org.apache.qpid.protocol
Class AMQConstant

java.lang.Object
  extended by org.apache.qpid.protocol.AMQConstant

public final class AMQConstant
extends Object

Defines constants for AMQP codes and also acts as a factory for creating such constants from the raw codes. Each constant also defines a short human readable description of the constant.

Todo:
Why would a constant be defined that is not in the map? Seems more natural that getConstant should raise an exception for an unknown constant. Or else provide an explanation of why this is so. Also, there is no way for callers to determine the unknown status of a code except by comparing its name to "unknown code", which would seem to render this scheme a little bit pointless?, Java has a nice enum construct for doing this sort of thing. Maybe this is done in the old style for Java 1.4 backward compatability? Now that is handled through retrotranslater it may be time to use enum.

CRC Card Responsibilities Collaborations Define the set of AMQP status codes. Provide a factory to lookup constants by their code.


Field Summary
static AMQConstant ACCESS_REFUSED
          The client attempted to work with a server entity to which it has no access due to security settings.
static AMQConstant ALREADY_EXISTS
          The client attempted to work with a server entity to which it has no access because another client is working with it.
static AMQConstant CHANNEL_ERROR
          The client attempted to work with a channel that had not been correctly opened.
static AMQConstant COMMAND_INVALID
          The client sent an invalid sequence of frames, attempting to perform an operation that was considered invalid by the server.
static AMQConstant CONTEXT_IN_USE
          An operator intervened to close the connection for some reason.
static AMQConstant FRAME_END
           
static AMQConstant FRAME_ERROR
          The client sent a malformed frame that the server could not decode.
static AMQConstant FRAME_MIN_SIZE
           
static AMQConstant IN_USE
          The client requested a method that was not allowed because some precondition failed.
static AMQConstant INTERNAL_ERROR
          The server could not complete the method because of an internal error.
static AMQConstant INVALID_ARGUMENT
           
static AMQConstant INVALID_PATH
          The client tried to work with an unknown virtual host or cluster.
static AMQConstant INVALID_ROUTING_KEY
           
static AMQConstant MESSAGE_TOO_LARGE
          The client attempted to transfer content larger than the server could accept at the present time.
static AMQConstant NO_CONSUMERS
          When the exchange cannot deliver to a consumer when the immediate flag is set.
static AMQConstant NO_ROUTE
          When the exchange cannot route the result of a .Publish, most likely due to an invalid routing key.
static AMQConstant NOT_ALLOWED
          The client tried to work with some entity in a manner that is prohibited by the server, due to security settings or by some other criteria.
static AMQConstant NOT_DELIVERED
          The client asked for a specific message that is no longer available.
static AMQConstant NOT_FOUND
          The client attempted to work with a server entity that does not exist.
static AMQConstant NOT_IMPLEMENTED
          The client tried to use functionality that is not implemented in the server.
static AMQConstant REPLY_SUCCESS
          Indicates that the method completed successfully.
static AMQConstant REQUEST_TIMEOUT
           
static AMQConstant RESOURCE_ERROR
          The server could not complete the method because it lacked sufficient resources.
static AMQConstant SYNTAX_ERROR
          The client sent a frame that contained illegal values for one or more fields.
static AMQConstant UNSUPPORTED_BROKER_PROTOCOL_ERROR
          The server does not support the protocol version
static AMQConstant UNSUPPORTED_CLIENT_PROTOCOL_ERROR
          The client imp does not support the protocol version
 
Method Summary
 int getCode()
          Gets the underlying AMQP status code.
static AMQConstant getConstant(int code)
          Creates a constant for a status code by looking up the code in the map of known codes.
 AMQShortString getName()
          Gets a short description of the status code.
 String toString()
          Renders the constant as a string, mainly for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REPLY_SUCCESS

public static final AMQConstant REPLY_SUCCESS
Indicates that the method completed successfully.


FRAME_END

public static final AMQConstant FRAME_END

NOT_DELIVERED

public static final AMQConstant NOT_DELIVERED
The client asked for a specific message that is no longer available. The message was delivered to another client, or was purged from the queue for some other reason.


MESSAGE_TOO_LARGE

public static final AMQConstant MESSAGE_TOO_LARGE
The client attempted to transfer content larger than the server could accept at the present time. The client may retry at a later time.


NO_ROUTE

public static final AMQConstant NO_ROUTE
When the exchange cannot route the result of a .Publish, most likely due to an invalid routing key. Only when the mandatory flag is set.


NO_CONSUMERS

public static final AMQConstant NO_CONSUMERS
When the exchange cannot deliver to a consumer when the immediate flag is set. As a result of pending data on the queue or the absence of any consumers of the queue.


CONTEXT_IN_USE

public static final AMQConstant CONTEXT_IN_USE
An operator intervened to close the connection for some reason. The client may retry at some later date.


INVALID_PATH

public static final AMQConstant INVALID_PATH
The client tried to work with an unknown virtual host or cluster.


ACCESS_REFUSED

public static final AMQConstant ACCESS_REFUSED
The client attempted to work with a server entity to which it has no access due to security settings.


NOT_FOUND

public static final AMQConstant NOT_FOUND
The client attempted to work with a server entity that does not exist.


ALREADY_EXISTS

public static final AMQConstant ALREADY_EXISTS
The client attempted to work with a server entity to which it has no access because another client is working with it.


IN_USE

public static final AMQConstant IN_USE
The client requested a method that was not allowed because some precondition failed.


INVALID_ROUTING_KEY

public static final AMQConstant INVALID_ROUTING_KEY

REQUEST_TIMEOUT

public static final AMQConstant REQUEST_TIMEOUT

INVALID_ARGUMENT

public static final AMQConstant INVALID_ARGUMENT

FRAME_ERROR

public static final AMQConstant FRAME_ERROR
The client sent a malformed frame that the server could not decode. This strongly implies a programming error in the client.


SYNTAX_ERROR

public static final AMQConstant SYNTAX_ERROR
The client sent a frame that contained illegal values for one or more fields. This strongly implies a programming error in the client.


COMMAND_INVALID

public static final AMQConstant COMMAND_INVALID
The client sent an invalid sequence of frames, attempting to perform an operation that was considered invalid by the server. This usually implies a programming error in the client.


CHANNEL_ERROR

public static final AMQConstant CHANNEL_ERROR
The client attempted to work with a channel that had not been correctly opened. This most likely indicates a fault in the client layer.


RESOURCE_ERROR

public static final AMQConstant RESOURCE_ERROR
The server could not complete the method because it lacked sufficient resources. This may be due to the client creating too many of some type of entity.


NOT_ALLOWED

public static final AMQConstant NOT_ALLOWED
The client tried to work with some entity in a manner that is prohibited by the server, due to security settings or by some other criteria.


NOT_IMPLEMENTED

public static final AMQConstant NOT_IMPLEMENTED
The client tried to use functionality that is not implemented in the server.


INTERNAL_ERROR

public static final AMQConstant INTERNAL_ERROR
The server could not complete the method because of an internal error. The server may require intervention by an operator in order to resume normal operations.


FRAME_MIN_SIZE

public static final AMQConstant FRAME_MIN_SIZE

UNSUPPORTED_BROKER_PROTOCOL_ERROR

public static final AMQConstant UNSUPPORTED_BROKER_PROTOCOL_ERROR
The server does not support the protocol version


UNSUPPORTED_CLIENT_PROTOCOL_ERROR

public static final AMQConstant UNSUPPORTED_CLIENT_PROTOCOL_ERROR
The client imp does not support the protocol version

Method Detail

getConstant

public static AMQConstant getConstant(int code)
Creates a constant for a status code by looking up the code in the map of known codes. If the code is not known a constant is still created for it, but it is marked as unknown.

Parameters:
code - The AMQP status code.
Returns:
The AMQP status code encapsulated as a constant.

getCode

public int getCode()
Gets the underlying AMQP status code.

Returns:
The AMQP status code.

getName

public AMQShortString getName()
Gets a short description of the status code.

Returns:
A short description of the status code.

toString

public String toString()
Renders the constant as a string, mainly for debugging purposes.

Overrides:
toString in class Object
Returns:
The status code and its description.


Licensed to the Apache Software Foundation