summaryrefslogtreecommitdiff
path: root/qpid/java/common/src
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2015-04-15 09:47:28 +0000
committerAlex Rudyy <orudyy@apache.org>2015-04-15 09:47:28 +0000
commit0a0baee45ebcff44635907d457c4ff6810b09c87 (patch)
tree8bfb0f9eddbc23cff88af69be80ab3ce7d47011c /qpid/java/common/src
parent54aa3d7070da16ce55c28ccad3f7d0871479e461 (diff)
downloadqpid-python-0a0baee45ebcff44635907d457c4ff6810b09c87.tar.gz
QPID-6481: Move java source tree to top level
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1673693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/common/src')
-rw-r--r--qpid/java/common/src/main/grammar/SelectorParser.jj612
-rwxr-xr-xqpid/java/common/src/main/java/common.bnd25
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQChannelException.java65
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java37
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java65
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java55
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQDisconnectedException.java32
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQException.java134
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQInternalException.java49
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQInvalidArgumentException.java40
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQInvalidRoutingKeyException.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQPInvalidClassException.java37
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQProtocolException.java39
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQSecurityException.java54
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQTimeoutException.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQUndeliveredException.java49
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java45
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/api/Message.java128
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java425
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java273
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/codec/MarkableDataInput.java41
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/codec/ServerDecoder.java244
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/common/AMQPFilterTypes.java64
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java147
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/common/ServerPropertyNames.java60
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/configuration/Accessor.java170
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java354
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/configuration/CommonProperties.java98
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/configuration/Configured.java44
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java38
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyUtils.java164
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/configuration/QpidProperty.java210
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/configuration/Validator.java31
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/dtx/XidImpl.java261
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/exchange/ExchangeDefaults.java63
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/ArithmeticExpression.java263
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/BinaryExpression.java90
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/BooleanExpression.java36
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java589
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/ConstantExpression.java207
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/Expression.java35
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/FilterableMessage.java41
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/LogicExpression.java114
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/PropertyExpression.java234
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/SelectorParsingException.java36
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java340
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/selector/ParseException.java208
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java1224
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParserConstants.java125
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParserTokenManager.java1066
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SimpleCharStream.java492
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/selector/Token.java152
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/filter/selector/TokenMgrError.java168
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQBody.java45
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlock.java51
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrame.java143
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java42
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBody.java74
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java212
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolClassException.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolHeaderException.java31
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolInstanceException.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolVersionException.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java797
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortStringTokenizer.java32
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQType.java844
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java52
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java322
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AccessRequestBody.java183
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/AccessRequestOkBody.java108
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicAckBody.java126
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicCancelBody.java127
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicCancelOkBody.java109
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicConsumeBody.java214
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicConsumeOkBody.java109
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java799
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicDeliverBody.java169
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetBody.java141
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetEmptyBody.java108
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetOkBody.java167
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicNackBody.java143
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicPublishBody.java170
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicQosBody.java139
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicQosOkBody.java87
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverBody.java115
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverSyncBody.java115
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverSyncOkBody.java87
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRejectBody.java126
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/BasicReturnBody.java150
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ByteArrayDataInput.java192
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelAlertBody.java137
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelCloseBody.java148
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelCloseOkBody.java85
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelFlowBody.java104
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelFlowOkBody.java106
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelMethodProcessor.java42
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelOpenBody.java95
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelOpenOkBody.java113
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ClientChannelMethodProcessor.java79
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ClientMethodDispatcher.java77
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ClientMethodProcessor.java39
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/CompositeAMQDataBlock.java92
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConfirmSelectBody.java105
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConfirmSelectOkBody.java77
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionCloseBody.java145
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionCloseOkBody.java82
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionOpenBody.java135
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionOpenOkBody.java108
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionRedirectBody.java120
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionSecureBody.java109
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionSecureOkBody.java107
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionStartBody.java153
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionStartOkBody.java142
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionTuneBody.java133
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionTuneOkBody.java133
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ContentBody.java184
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java198
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderPropertiesFactory.java58
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/EncodableAMQDataBlock.java35
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java1013
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeBoundBody.java138
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeBoundOkBody.java130
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeclareBody.java233
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeclareOkBody.java87
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeleteBody.java156
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeleteOkBody.java87
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ExtendedDataInput.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/FieldArray.java130
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java1181
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTableFactory.java43
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/FrameCreatingMethodProcessor.java629
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/HeartbeatBody.java103
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/MessagePublishInfo.java83
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/MethodDispatcher.java37
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/MethodProcessor.java40
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/MethodRegistry.java557
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolInitiation.java252
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolVersion.java188
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueueBindBody.java183
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueueBindOkBody.java87
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeclareBody.java213
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeclareOkBody.java134
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeleteBody.java170
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeleteOkBody.java107
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueuePurgeBody.java140
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueuePurgeOkBody.java107
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueueUnbindBody.java164
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/QueueUnbindOkBody.java87
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ServerChannelMethodProcessor.java93
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ServerMethodDispatcher.java73
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/ServerMethodProcessor.java39
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/TxCommitBody.java80
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/TxCommitOkBody.java78
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/TxRollbackBody.java78
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/TxRollbackOkBody.java79
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/TxSelectBody.java81
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/framing/TxSelectOkBody.java77
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/Address.java79
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/AddressParser.java422
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/JAddr.java97
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/LexError.java37
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Lexer.java82
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Lexicon.java103
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/LineInfo.java93
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/ParseError.java58
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Parser.java97
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/PyPrint.java149
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Token.java106
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java187
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactory.java50
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/properties/ConnectionStartProperties.java102
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQConstant.java227
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQMethodEvent.java90
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQMethodListener.java64
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java38
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQVersionAwareProtocolSession.java59
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolEngine.java62
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolEngineFactory.java31
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolVersionAware.java48
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java135
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/thread/DefaultThreadFactory.java45
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/thread/LoggingUncaughtExceptionHandler.java60
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/thread/QpidThreadExecutor.java40
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/thread/RealtimeThreadFactory.java72
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/thread/ThreadFactory.java28
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/thread/Threading.java51
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Acquired.java141
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Binary.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Binding.java36
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ByteBufferReceiver.java32
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ByteBufferSender.java32
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java228
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java881
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionClose.java196
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionCloseCode.java54
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionCloseOk.java111
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionDelegate.java113
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionException.java70
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionHeartbeat.java111
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionInvoker.java78
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionListener.java41
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionOpen.java235
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionOpenOk.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionRedirect.java196
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSecure.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSecureOk.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java431
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionStart.java238
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionStartOk.java280
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionTune.java272
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionTuneOk.java232
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Constant.java29
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DeliveryProperties.java593
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxCommit.java193
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxEnd.java232
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxForget.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxGetTimeout.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxPrepare.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxRecover.java111
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxRollback.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxSelect.java111
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxSetTimeout.java194
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxStart.java232
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/DtxXaStatus.java62
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBind.java280
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBound.java280
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBoundResult.java301
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeDeclare.java397
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeDelete.java193
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeQuery.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeQueryResult.java268
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeUnbind.java238
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionErrorCode.java72
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionException.java398
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionResult.java194
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionSync.java111
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Field.java83
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/FileReturnCode.java52
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/FragmentProperties.java224
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/FrameSizeObserver.java26
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Future.java37
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/GetTimeoutResult.java139
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Header.java143
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAccept.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcceptMode.java50
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcquire.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcquireMode.java50
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageCancel.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageCreditUnit.java50
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageDeliveryMode.java50
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageDeliveryPriority.java66
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlow.java236
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlowMode.java50
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlush.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageProperties.java475
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageReject.java238
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageRejectCode.java52
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageRelease.java193
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageResume.java196
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageResumeResult.java139
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageSetFlowMode.java196
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageStop.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageSubscribe.java443
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MessageTransfer.java302
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java236
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/MethodDelegate.java217
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkEventReceiver.java32
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkTransportConfiguration.java51
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Option.java60
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolDelegate.java40
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolError.java88
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEvent.java41
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEventReceiver.java30
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEventSender.java30
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java123
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolVersionException.java62
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/QueueDeclare.java394
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/QueueDelete.java232
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/QueuePurge.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/QueueQuery.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/QueueQueryResult.java429
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Range.java306
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSet.java58
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSetFactory.java38
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSetImpl.java240
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/RecoverResult.java141
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ReplyTo.java200
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SegmentType.java54
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SenderClosedException.java52
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SenderException.java52
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java214
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Session.java1215
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionAttach.java193
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionAttached.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionClosedException.java46
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCommandFragment.java138
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCommandPoint.java192
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCompleted.java193
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionConfirmed.java196
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDelegate.java246
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetach.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetachCode.java56
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetached.java196
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionException.java59
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionExpected.java196
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionFlush.java229
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionGap.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionHeader.java145
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionInvoker.java236
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionKnownCompleted.java154
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionListener.java42
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionRequestTimeout.java152
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/SessionTimeout.java152
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/StreamReturnCode.java52
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Struct.java156
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/StructFactory.java200
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Track.java50
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/TransportException.java51
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/TxCommit.java111
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/TxRollback.java111
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/TxSelect.java111
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Type.java148
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/XaResult.java141
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/Xid.java223
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java478
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractEncoder.java620
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java149
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java363
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java283
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java44
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java284
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/Assembler.java280
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/ConnectionBinding.java105
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java266
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/Frame.java146
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/IncomingNetworkTransport.java38
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java218
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkConnection.java55
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkDelegate.java42
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkEvent.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkTransport.java30
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/OutgoingNetworkTransport.java33
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/Ticker.java29
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/Transport.java138
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/TransportActivity.java33
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/TransportEncryption.java26
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/AbstractNetworkTransport.java342
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IdleTimeoutTicker.java87
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkConnection.java146
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java43
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoReceiver.java265
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoSender.java373
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SSLStatus.java49
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayer.java34
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java190
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLEncryptor.java87
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java85
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLSender.java114
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java106
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidMultipleTrustManager.java103
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidPeersOnlyTrustManager.java81
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLBufferingSender.java0
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLReceiver.java213
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLSender.java268
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java371
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java125
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/util/Logger.java130
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/util/Waiter.java63
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesCodes.java46
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesContentReader.java670
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesContentWriter.java366
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesFormatException.java29
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java246
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/url/BindingURL.java91
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java460
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/url/URLHelper.java173
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/url/URLSyntaxException.java97
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/ByteBufferInputStream.java100
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/BytesDataOutput.java178
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java680
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/DataUrlUtils.java32
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java396
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/GZIPUtils.java119
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/NameUUIDGen.java59
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/RandomUUIDGen.java39
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/Serial.java109
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/Strings.java406
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/SystemUtils.java127
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/UUIDGen.java36
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/UUIDs.java62
-rw-r--r--qpid/java/common/src/main/resources/qpidversion.properties23
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java120
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java205
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java185
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java349
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java194
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/FieldTableTest.java949
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java100
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java159
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java95
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java70
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/ssl/TrustManagerTest.java344
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java104
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java211
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java473
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java44
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java353
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/SessionTimeoutTest.java81
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/codec/BBEncoderTest.java47
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java166
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IdleTimeoutTickerTest.java250
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java122
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java90
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/network/security/ssl/SSLUtilTest.java1274
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java111
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java555
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java694
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/GZIPUtilsTest.java102
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java43
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java78
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/StringsTest.java48
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/default.properties21
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/mydefaults.properties21
424 files changed, 0 insertions, 72044 deletions
diff --git a/qpid/java/common/src/main/grammar/SelectorParser.jj b/qpid/java/common/src/main/grammar/SelectorParser.jj
deleted file mode 100644
index ec3a27142f..0000000000
--- a/qpid/java/common/src/main/grammar/SelectorParser.jj
+++ /dev/null
@@ -1,612 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
- //
- // Original File from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
- //
-
-// ----------------------------------------------------------------------------
-// OPTIONS
-// ----------------------------------------------------------------------------
-options {
- STATIC = false;
- UNICODE_INPUT = true;
-
- // some performance optimizations
- ERROR_REPORTING = false;
-}
-
-// ----------------------------------------------------------------------------
-// PARSER
-// ----------------------------------------------------------------------------
-
-PARSER_BEGIN(SelectorParser)
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.filter.selector;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-
-import org.apache.qpid.filter.ArithmeticExpression;
-import org.apache.qpid.filter.BooleanExpression;
-import org.apache.qpid.filter.ComparisonExpression;
-import org.apache.qpid.filter.ConstantExpression;
-import org.apache.qpid.filter.Expression;
-import org.apache.qpid.filter.LogicExpression;
-import org.apache.qpid.filter.PropertyExpression;
-import org.apache.qpid.filter.UnaryExpression;
-
-/**
- * JMS Selector Parser generated by JavaCC
- *
- * Do not edit this .java file directly - it is autogenerated from SelectorParser.jj
- */
-public class SelectorParser
-{
-
- public SelectorParser()
- {
- this(new StringReader(""));
- }
-
- public BooleanExpression parse(String sql) throws ParseException
- {
- this.ReInit(new StringReader(sql));
-
- return this.JmsSelector();
-
- }
-
- private BooleanExpression asBooleanExpression(Expression value) throws ParseException
- {
- if (value instanceof BooleanExpression)
- {
- return (BooleanExpression) value;
- }
- if (value instanceof PropertyExpression)
- {
- return UnaryExpression.createBooleanCast( value );
- }
- throw new ParseException("Expression will not result in a boolean value: " + value);
- }
-
-
-}
-
-PARSER_END(SelectorParser)
-
-// ----------------------------------------------------------------------------
-// Tokens
-// ----------------------------------------------------------------------------
-
-/* White Space */
-SPECIAL_TOKEN :
-{
- " " | "\t" | "\n" | "\r" | "\f"
-}
-
-/* Comments */
-SKIP:
-{
- <LINE_COMMENT: "--" (~["\n","\r"])* ("\n"|"\r"|"\r\n") >
-}
-
-SKIP:
-{
- <BLOCK_COMMENT: "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/">
-}
-
-/* Reserved Words */
-TOKEN [IGNORE_CASE] :
-{
- < NOT : "NOT">
- | < AND : "AND">
- | < OR : "OR">
- | < BETWEEN : "BETWEEN">
- | < LIKE : "LIKE">
- | < ESCAPE : "ESCAPE">
- | < IN : "IN">
- | < IS : "IS">
- | < TRUE : "TRUE" >
- | < FALSE : "FALSE" >
- | < NULL : "NULL" >
-}
-
-/* Literals */
-TOKEN [IGNORE_CASE] :
-{
-
- < DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* (["l","L"])? >
- | < HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
- | < OCTAL_LITERAL: "0" (["0"-"7"])* >
- | < FLOATING_POINT_LITERAL:
- (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? // matches: 5.5 or 5. or 5.5E10 or 5.E10
- | "." (["0"-"9"])+ (<EXPONENT>)? // matches: .5 or .5E10
- | (["0"-"9"])+ <EXPONENT> // matches: 5E10
- >
- | < #EXPONENT: "E" (["+","-"])? (["0"-"9"])+ >
- | < STRING_LITERAL: "'" ( ("''") | ~["'"] )* "'" >
-}
-
-TOKEN [IGNORE_CASE] :
-{
- < ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$"])* >
- | < QUOTED_ID : "\"" ( ("\"\"") | ~["\""] )* "\"" >
-}
-
-// ----------------------------------------------------------------------------
-// Grammer
-// ----------------------------------------------------------------------------
-BooleanExpression JmsSelector() :
-{
- Expression left=null;
-}
-{
- (
- left = orExpression()
- )
- {
- return asBooleanExpression(left);
- }
-
-}
-
-Expression orExpression() :
-{
- Expression left;
- Expression right;
-}
-{
- (
- left = andExpression()
- (
- <OR> right = andExpression()
- {
- left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
- }
- )*
- )
- {
- return left;
- }
-
-}
-
-
-Expression andExpression() :
-{
- Expression left;
- Expression right;
-}
-{
- (
- left = equalityExpression()
- (
- <AND> right = equalityExpression()
- {
- left = LogicExpression.createAND(asBooleanExpression(left), asBooleanExpression(right));
- }
- )*
- )
- {
- return left;
- }
-}
-
-Expression equalityExpression() :
-{
- Expression left;
- Expression right;
-}
-{
- (
- left = comparisonExpression()
- (
-
- "=" right = comparisonExpression()
- {
- left = ComparisonExpression.createEqual(left, right);
- }
- |
- "<>" right = comparisonExpression()
- {
- left = ComparisonExpression.createNotEqual(left, right);
- }
- |
- LOOKAHEAD(2)
- <IS> <NULL>
- {
- left = ComparisonExpression.createIsNull(left);
- }
- |
- <IS> <NOT> <NULL>
- {
- left = ComparisonExpression.createIsNotNull(left);
- }
- )*
- )
- {
- return left;
- }
-}
-
-Expression comparisonExpression() :
-{
- Expression left;
- Expression right;
- Expression low;
- Expression high;
- String t, u;
- boolean not;
- ArrayList list;
-}
-{
- (
- left = addExpression()
- (
-
- ">" right = addExpression()
- {
- left = ComparisonExpression.createGreaterThan(left, right);
- }
- |
- ">=" right = addExpression()
- {
- left = ComparisonExpression.createGreaterThanEqual(left, right);
- }
- |
- "<" right = addExpression()
- {
- left = ComparisonExpression.createLessThan(left, right);
- }
- |
- "<=" right = addExpression()
- {
- left = ComparisonExpression.createLessThanEqual(left, right);
- }
- |
- {
- u=null;
- }
- <LIKE> t = stringLiteral()
- [ <ESCAPE> u = stringLiteral() ]
- {
- left = ComparisonExpression.createLike(left, t, u);
- }
- |
- LOOKAHEAD(2)
- {
- u=null;
- }
- <NOT> <LIKE> t = stringLiteral() [ <ESCAPE> u = stringLiteral() ]
- {
- left = ComparisonExpression.createNotLike(left, t, u);
- }
- |
- <BETWEEN> low = addExpression() <AND> high = addExpression()
- {
- left = ComparisonExpression.createBetween(left, low, high);
- }
- |
- LOOKAHEAD(2)
- <NOT> <BETWEEN> low = addExpression() <AND> high = addExpression()
- {
- left = ComparisonExpression.createNotBetween(left, low, high);
- }
- |
- <IN>
- "("
- t = stringLiteral()
- {
- list = new ArrayList();
- list.add( t );
- }
- (
- ","
- t = stringLiteral()
- {
- list.add( t );
- }
-
- )*
- ")"
- {
- left = ComparisonExpression.createInFilter(left, list);
- }
- |
- LOOKAHEAD(2)
- <NOT> <IN>
- "("
- t = stringLiteral()
- {
- list = new ArrayList();
- list.add( t );
- }
- (
- ","
- t = stringLiteral()
- {
- list.add( t );
- }
-
- )*
- ")"
- {
- left = ComparisonExpression.createNotInFilter(left, list);
- }
-
- )*
- )
- {
- return left;
- }
-}
-
-Expression addExpression() :
-{
- Expression left;
- Expression right;
-}
-{
- left = multExpr()
- (
- LOOKAHEAD( ("+"|"-") multExpr())
- (
- "+" right = multExpr()
- {
- left = ArithmeticExpression.createPlus(left, right);
- }
- |
- "-" right = multExpr()
- {
- left = ArithmeticExpression.createMinus(left, right);
- }
- )
-
- )*
- {
- return left;
- }
-}
-
-Expression multExpr() :
-{
- Expression left;
- Expression right;
-}
-{
- left = unaryExpr()
- (
- "*" right = unaryExpr()
- {
- left = ArithmeticExpression.createMultiply(left, right);
- }
- |
- "/" right = unaryExpr()
- {
- left = ArithmeticExpression.createDivide(left, right);
- }
- |
- "%" right = unaryExpr()
- {
- left = ArithmeticExpression.createMod(left, right);
- }
-
- )*
- {
- return left;
- }
-}
-
-
-Expression unaryExpr() :
-{
- String s=null;
- Expression left=null;
-}
-{
- (
- LOOKAHEAD( "+" unaryExpr() )
- "+" left=unaryExpr()
- |
- "-" left=unaryExpr()
- {
- left = UnaryExpression.createNegate(left);
- }
- |
- <NOT> left=unaryExpr()
- {
- left = UnaryExpression.createNOT( asBooleanExpression(left) );
- }
- |
- left = primaryExpr()
- )
- {
- return left;
- }
-
-}
-
-Expression primaryExpr() :
-{
- Expression left=null;
-}
-{
- (
- left = literal()
- |
- left = variable()
- |
- "(" left = orExpression() ")"
- )
- {
- return left;
- }
-}
-
-
-
-ConstantExpression literal() :
-{
- Token t;
- String s;
- ConstantExpression left=null;
-}
-{
- (
- (
- s = stringLiteral()
- {
- left = new ConstantExpression(s);
- }
- )
- |
- (
- t = <DECIMAL_LITERAL>
- {
- left = ConstantExpression.createFromDecimal(t.image);
- }
- )
- |
- (
- t = <HEX_LITERAL>
- {
- left = ConstantExpression.createFromHex(t.image);
- }
- )
- |
- (
- t = <OCTAL_LITERAL>
- {
- left = ConstantExpression.createFromOctal(t.image);
- }
- )
- |
- (
- t = <FLOATING_POINT_LITERAL>
- {
- left = ConstantExpression.createFloat(t.image);
- }
- )
- |
- (
- <TRUE>
- {
- left = ConstantExpression.TRUE;
- }
- )
- |
- (
- <FALSE>
- {
- left = ConstantExpression.FALSE;
- }
- )
- |
- (
- <NULL>
- {
- left = ConstantExpression.NULL;
- }
- )
- )
- {
- return left;
- }
-}
-
-String stringLiteral() :
-{
- Token t;
- StringBuffer rc = new StringBuffer();
- boolean first=true;
-}
-{
- t = <STRING_LITERAL>
- {
- // Decode the sting value.
- String image = t.image;
- for( int i=1; i < image.length()-1; i++ ) {
- char c = image.charAt(i);
- if( c == (char) 0x27 )//single quote
- {
- i++;
- }
- rc.append(c);
- }
- return rc.toString();
- }
-}
-
-PropertyExpression variable() :
-{
- Token t;
- StringBuffer rc = new StringBuffer();
- PropertyExpression left=null;
-}
-{
- (
- t = <ID>
- {
- left = new PropertyExpression(t.image);
- }
- |
- t = <QUOTED_ID>
- {
- // Decode the sting value.
- String image = t.image;
- for( int i=1; i < image.length()-1; i++ ) {
- char c = image.charAt(i);
- if( c == '"' )
- {
- i++;
- }
- rc.append(c);
- }
- return new PropertyExpression(rc.toString());
- }
-
-
- )
- {
- return left;
- }
-}
diff --git a/qpid/java/common/src/main/java/common.bnd b/qpid/java/common/src/main/java/common.bnd
deleted file mode 100755
index cf06218370..0000000000
--- a/qpid/java/common/src/main/java/common.bnd
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-ver: 0.31.0
-
-Bundle-SymbolicName: qpid-common
-Bundle-Version: ${ver}
-Export-Package: *;version=${ver}
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java
deleted file mode 100644
index 73a906b81c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQChannelClosedException indicates that an operation cannot be performed becauase a channel has been closed.
- */
-public class AMQChannelClosedException extends AMQException
-{
- public AMQChannelClosedException(AMQConstant errorCode, String msg, Throwable cause)
- {
- super(errorCode, msg, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelException.java
deleted file mode 100644
index 7ab422eb4f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQChannelException indicates that an error that requires the channel to be closed has occurred.
- */
-public class AMQChannelException extends AMQException
-{
- private final int _classId;
- private final int _methodId;
- /* AMQP version for which exception ocurred */
- private final MethodRegistry _methodRegistry;
-
-
- public AMQChannelException(AMQConstant errorCode,
- String msg,
- int classId,
- int methodId,
- MethodRegistry methodRegistry)
- {
- super(errorCode, msg);
- _classId = classId;
- _methodId = methodId;
- _methodRegistry = methodRegistry;
-
- }
-
- public int getClassId()
- {
- return _classId;
- }
-
- public int getMethodId()
- {
- return _methodId;
- }
-
- public MethodRegistry getMethodRegistry()
- {
- return _methodRegistry;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java
deleted file mode 100644
index 4417c0a141..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQConnectionClosedException indicates that a connection has been closed.
- *
- * <p>This exception is really used as an event, in order that the method handler that raises it creates an event
- * which is propagated to the io handler, in order to notify it of the connection closure.
- */
-public class AMQConnectionClosedException extends AMQException
-{
- public AMQConnectionClosedException(AMQConstant errorCode, String msg, Throwable cause)
- {
- super(errorCode, msg, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java
deleted file mode 100644
index ca70d19420..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid;
-
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQConnectionException indicates that an error that requires the channel to be closed has occurred.
- */
-public class AMQConnectionException extends AMQException
-{
- private final int _classId;
- private final int _methodId;
-
- private final MethodRegistry _methodRegistry;
-
- public AMQConnectionException(AMQConstant errorCode, String msg, AMQMethodBody body, MethodRegistry methodRegistry)
- {
- this(errorCode, msg, body.getClazz(), body.getMethod(), methodRegistry, null);
- }
-
- public AMQConnectionException(AMQConstant errorCode, String msg, int classId, int methodId, MethodRegistry methodRegistry,
- Throwable cause)
- {
- super(errorCode, msg, cause);
- _classId = classId;
- _methodId = methodId;
- _methodRegistry = methodRegistry;
-
- }
-
- public AMQFrame getCloseFrame()
- {
- return new AMQFrame(0,
- _methodRegistry.createConnectionCloseBody(getErrorCode().getCode(),
- AMQShortString.validValueOf(getMessage()),
- _classId,
- _methodId));
-
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java
deleted file mode 100644
index efadaae611..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-import java.util.Collection;
-
-/**
- * AMQConnectionFailureException indicates that a connection to a broker could not be formed.
- */
-public class AMQConnectionFailureException extends AMQException
-{
- private Collection<Exception> _exceptions;
-
- public AMQConnectionFailureException(String message, Throwable cause)
- {
- super(cause instanceof AMQException ? ((AMQException) cause).getErrorCode() : null, message, cause);
- }
-
- public AMQConnectionFailureException(AMQConstant errorCode, String message, Throwable cause)
- {
- super(errorCode, message, cause);
- }
-
- public AMQConnectionFailureException(String message, Collection<Exception> exceptions)
- {
- // Blah, I hate ? but java won't let super() be anything other than the first thing, sorry...
- super (null, message, exceptions.isEmpty() ? null : exceptions.iterator().next());
- this._exceptions = exceptions;
- }
-
- public Collection<Exception> getLinkedExceptions()
- {
- return _exceptions;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQDisconnectedException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQDisconnectedException.java
deleted file mode 100644
index 38fbc8fc57..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQDisconnectedException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-/**
- * AMQDisconnectedException indicates that a broker disconnected without failover.
- */
-public class AMQDisconnectedException extends AMQException
-{
- public AMQDisconnectedException(String msg, Throwable cause)
- {
- super(null, msg, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java
deleted file mode 100644
index 7d2521a057..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQException forms the root exception of all exceptions relating to the AMQ protocol. It provides space to associate
- * a required AMQ error code with the exception, which is a numeric value, with a meaning defined by the protocol.
- */
-public class AMQException extends Exception
-{
- /** Holds the AMQ error code constant associated with this exception. */
- private AMQConstant _errorCode;
-
- private boolean _isHardError;
-
- /**
- * Creates an exception with an optional error code, optional message and optional underlying cause.
- *
- * @param errorCode The error code. May be null if not to be set.
- * @param msg The exception message. May be null if not to be set.
- * @param cause The underlying cause of the exception. May be null if not to be set.
- */
- public AMQException(AMQConstant errorCode, String msg, Throwable cause)
- {
- // isHardError is defaulted to true to avoid unnessacery modification to
- // existing code.
- this(errorCode,true,msg,cause);
- }
-
- /**
- * Creates an exception with an optional error code, optional message and optional underlying cause.
- *
- * @param errorCode The error code. May be null if not to be set.
- * @param isHardError Denotes if the underlying error is considered a hard error.
- * @param msg The exception message. May be null if not to be set.
- * @param cause The underlying cause of the exception. May be null if not to be set.
- */
- public AMQException(AMQConstant errorCode, boolean isHardError, String msg, Throwable cause)
- {
- super(((msg == null) ? "" : msg), cause);
- _errorCode = errorCode;
- _isHardError = isHardError;
- }
-
- /*
- * Deprecated constructors brought from M2.1
- */
- @Deprecated
- public AMQException(String msg)
- {
- this(null, (msg == null) ? "" : msg);
- }
-
- public AMQException(AMQConstant errorCode, String msg)
- {
- this(errorCode, (msg == null) ? "" : msg, null);
- }
-
- @Deprecated
- public AMQException(String msg, Throwable cause)
- {
- this(null, msg, cause);
- }
-
- @Override
- public String toString()
- {
- return getClass().getName() + ": " + getMessage() + (_errorCode == null ? "" : " [error code " + _errorCode + "]");
- }
-
- /**
- * Gets the AMQ protocol exception code associated with this exception.
- *
- * @return The AMQ protocol exception code associated with this exception.
- */
- public AMQConstant getErrorCode()
- {
- return _errorCode;
- }
-
- public boolean isHardError()
- {
- return _isHardError;
- }
-
- /**
- * Rethrown this exception as a new exception.
- *
- * Attempt to create a new exception of the same class if they have the default constructor of:
- * {AMQConstant.class, String.class, Throwable.class}.
- *
- * @return cloned exception
- */
- public AMQException cloneForCurrentThread()
- {
- Class amqeClass = this.getClass();
- Class<?>[] paramClasses = {AMQConstant.class, String.class, Throwable.class};
- Object[] params = {getErrorCode(), getMessage(), this};
-
- AMQException newAMQE;
-
- try
- {
- newAMQE = (AMQException) amqeClass.getConstructor(paramClasses).newInstance(params);
- }
- catch (Exception creationException)
- {
- newAMQE = new AMQException(getErrorCode(), getMessage(), this);
- }
-
- return newAMQE;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQInternalException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQInternalException.java
deleted file mode 100644
index 59dc800c0e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQInternalException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * InternalException encapsulates error code 541, or {@link AMQConstant#INTERNAL_ERROR} exceptions relating to the
- * AMQ protocol. It is used to report internal failures and errors that occur within the broker.
- */
-public class AMQInternalException extends AMQException
-{
- /** serialVersionUID */
- private static final long serialVersionUID = 2544449432843381112L;
-
- /**
- * Creates an exception with an optional message and optional underlying cause.
- *
- * @param msg The exception message. May be null if not to be set.
- * @param cause The underlying cause of the exception. May be null if not to be set.
- */
- public AMQInternalException(String msg, Throwable cause)
- {
- super(AMQConstant.INTERNAL_ERROR, ((msg == null) ? "Internal error" : msg), cause);
- }
-
- public AMQInternalException(String msg)
- {
- this(msg, null);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQInvalidArgumentException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQInvalidArgumentException.java
deleted file mode 100644
index 2592ab7662..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQInvalidArgumentException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQInvalidArgumentException indicates that an invalid argument has been passed to an AMQP method.
- */
-public class AMQInvalidArgumentException extends AMQException
-{
- public AMQInvalidArgumentException(String message, Throwable cause)
- {
- super(AMQConstant.ARGUMENT_INVALID, message, cause);
- }
-
- public boolean isHardError()
- {
- return false;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQInvalidRoutingKeyException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQInvalidRoutingKeyException.java
deleted file mode 100644
index d0a61cfeeb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQInvalidRoutingKeyException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQInvalidRoutingKeyException indicates an error with a routing key having an invalid format.
- */
-public class AMQInvalidRoutingKeyException extends AMQException
-{
- public AMQInvalidRoutingKeyException(String message, Throwable cause)
- {
- super(AMQConstant.INVALID_ROUTING_KEY, message, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQPInvalidClassException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQPInvalidClassException.java
deleted file mode 100644
index 533a704a80..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQPInvalidClassException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid;
-
-/**
- * AMQPInvalidClassException indicates an error when trying to store an illegally typed argument in a field table.
- *
- * <p>TODO Could just re-use an exising exception like IllegalArgumentException or ClassCastException.
- */
-public class AMQPInvalidClassException extends RuntimeException
-{
- /** Error message text when trying to store an unsupported class or null object */
- public static final String INVALID_OBJECT_MSG = "Only Primitive objects allowed. Object is: ";
-
- public AMQPInvalidClassException(String s)
- {
- super(s);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQProtocolException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQProtocolException.java
deleted file mode 100644
index 7744b128ce..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQProtocolException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-
-public class AMQProtocolException extends AMQException
-{
- /**
- * Constructor for a Protocol Exception
- * <p> This is the only provided constructor and the parameters have to be
- * set to null when they are unknown.
- *
- * @param msg A description of the reason of this exception .
- * @param errorCode A string specifyin the error code of this exception.
- * @param cause The linked Execption.
- */
- public AMQProtocolException(AMQConstant errorCode, String msg, Throwable cause)
- {
- super(errorCode, msg, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQSecurityException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQSecurityException.java
deleted file mode 100644
index d145d2c21d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQSecurityException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * SecurityException encapsulates error code 403, or {@link AMQConstant#ACCESS_REFUSED} exceptions relating to the
- * AMQ protocol. It is used to report authorisation failures and security errors.
- */
-public class AMQSecurityException extends AMQException
-{
- /** serialVersionUID */
- private static final long serialVersionUID = 8862069852716968394L;
-
- /**
- * Creates an exception with an optional message and optional underlying cause.
- *
- * @param msg The exception message. May be null if not to be set.
- * @param cause The underlying cause of the exception. May be null if not to be set.
- */
- public AMQSecurityException(String msg, Throwable cause)
- {
- super(AMQConstant.ACCESS_REFUSED, ((msg == null) ? "Permission denied" : msg), cause);
- }
-
- public AMQSecurityException(String msg)
- {
- this(msg, null);
- }
-
- public AMQSecurityException()
- {
- this(null);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQTimeoutException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQTimeoutException.java
deleted file mode 100644
index c36d2c5907..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQTimeoutException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQTimeoutException indicates that an expected response from a broker took too long.
- */
-public class AMQTimeoutException extends AMQException
-{
- public AMQTimeoutException(String message, Throwable cause)
- {
- super(AMQConstant.REQUEST_TIMEOUT, message, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQUndeliveredException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQUndeliveredException.java
deleted file mode 100644
index 68cbc57216..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQUndeliveredException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQUndeliveredException indicates that a message, marked immediate or mandatory, could not be delivered.
- */
-public class AMQUndeliveredException extends AMQException
-{
- private Object _bounced;
-
- public AMQUndeliveredException(AMQConstant errorCode, String msg, Object bounced, Throwable cause)
- {
- super(errorCode, msg, cause);
-
- _bounced = bounced;
- }
-
- public Object getUndeliveredMessage()
- {
- return _bounced;
- }
-
- public boolean isHardError()
- {
- return false;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java
deleted file mode 100644
index 902b12300f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-/**
- * AMQUnresolvedAddressException indicates failure to resolve a socket address.
- * <p>
- * TODO Not an AMQP exception as no status code.
- * <p>
- * TODO Why replace java.nio.UnresolvedAddressException with this? This is checked, which may explain why, but it
- * doesn't wrap the underlying exception.
- */
-public class AMQUnresolvedAddressException extends AMQException
-{
- private String _broker;
-
- public AMQUnresolvedAddressException(String message, String broker, Throwable cause)
- {
- super(null, message, cause);
- _broker = broker;
- }
-
- public String toString()
- {
- return super.toString() + " Broker, \"" + _broker + "\"";
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/api/Message.java b/qpid/java/common/src/main/java/org/apache/qpid/api/Message.java
deleted file mode 100644
index fff62424ca..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/api/Message.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpid.api;
-
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.MessageProperties;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public interface Message
-{
- public Header getHeader();
-
- public void setHeader(Header header);
-
- public MessageProperties getMessageProperties();
-
- public DeliveryProperties getDeliveryProperties();
-
- /**
- * This will abstract the underlying message data.
- * The Message implementation may not hold all message
- * data in memory (especially in the case of large messages)
- *
- * The appendData function might write data to
- * <ul>
- * <li> Memory (Ex: ByteBuffer)
- * <li> To Disk
- * <li> To Socket (Stream)
- * </ul>
- * @param src - the data to append
- * @throws IOException if there is an issue appending the data
- */
- public void appendData(byte[] src) throws IOException;
-
-
- /**
- * This will abstract the underlying message data.
- * The Message implementation may not hold all message
- * data in memory (especially in the case of large messages)
- *
- * The appendData function might write data to
- * <ul>
- * <li> Memory (Ex: ByteBuffer)
- * <li> To Disk
- * <li> To Socket (Stream)
- * </ul>
- * @param src - the data to append
- * @throws IOException if there is an issue appending the data
- */
- public void appendData(ByteBuffer src) throws IOException;
-
- /**
- * This will abstract the underlying message data.
- * The Message implementation may not hold all message
- * data in memory (especially in the case of large messages)
- *
- * The read function might copy data from
- * <ul>
- * <li> From memory (Ex: ByteBuffer)
- * <li> From Disk
- * <li> From Socket as and when it gets streamed
- * </ul>
- * @param target The target byte[] which the data gets copied to
- * @throws IOException if there is an issue reading the data
- */
- public void readData(byte[] target) throws IOException;
-
- /**
- * * This will abstract the underlying message data.
- * The Message implementation may not hold all message
- * data in memory (especially in the case of large messages)
- *
- * The read function might copy data from
- * <ul>
- * <li> From memory (Ex: ByteBuffer)
- * <li> From Disk
- * <li> From Socket as and when it gets streamed
- * </ul>
- *
- * @return A ByteBuffer containing data
- * @throws IOException if there is an issue reading the data
- */
- public ByteBuffer readData() throws IOException;
-
- /**
- * This should clear the body of the message.
- */
- public void clearData();
-
- /**
- * The provides access to the command Id assigned to the
- * message transfer.
- * This id is useful when you do
- * <ul>
- * <li>For message acquiring - If the transfer happend in no-acquire mode
- * you could use this id to accquire it.
- * <li>For releasing a message. You can use this id to release an acquired
- * message
- * <li>For Acknowledging a message - You need to pass this ID, in order to
- * acknowledge the message
- * <li>For Rejecting a message - You need to pass this ID, in order to reject
- * the message.
- * </ul>
- *
- * @return the message transfer id.
- */
- public int getMessageTransferId();
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java
deleted file mode 100644
index 9bafc30ebc..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.codec;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQDecoder delegates the decoding of AMQP either to a data block decoder, or in the case of new connections, to a
- * protocol initiation decoder. It is a cumulative decoder, which means that it can accumulate data to decode in the
- * buffer until there is enough data to decode.
- *
- * <p>One instance of this class is created per session, so any changes or configuration done at run time to the
- * decoder will only affect decoding of the protocol session data to which is it bound.
- *
- * <p>
- * TODO If protocol initiation decoder not needed, then don't create it. Probably not a big deal, but it adds to the
- * per-session overhead.
- */
-public abstract class AMQDecoder<T extends MethodProcessor>
-{
- private static final int MAX_BUFFERS_LIMIT = 10;
- private final T _methodProcessor;
-
- /** Holds the protocol initiation decoder. */
- private ProtocolInitiation.Decoder _piDecoder = new ProtocolInitiation.Decoder();
-
- /** Flag to indicate whether this decoder needs to handle protocol initiation. */
- private boolean _expectProtocolInitiation;
-
-
- private boolean _firstRead = true;
-
- private int _maxFrameSize = AMQConstant.FRAME_MIN_SIZE.getCode();
-
- private List<ByteArrayInputStream> _remainingBufs = new ArrayList<ByteArrayInputStream>();
-
- /**
- * Creates a new AMQP decoder.
- *
- * @param expectProtocolInitiation <tt>true</tt> if this decoder needs to handle protocol initiation.
- * @param methodProcessor method processor
- */
- protected AMQDecoder(boolean expectProtocolInitiation, T methodProcessor)
- {
- _expectProtocolInitiation = expectProtocolInitiation;
- _methodProcessor = methodProcessor;
- }
-
-
- /**
- * Sets the protocol initation flag, that determines whether decoding is handled by the data decoder of the protocol
- * initation decoder. This method is expected to be called with <tt>false</tt> once protocol initation completes.
- *
- * @param expectProtocolInitiation <tt>true</tt> to use the protocol initiation decoder, <tt>false</tt> to use the
- * data decoder.
- */
- public void setExpectProtocolInitiation(boolean expectProtocolInitiation)
- {
- _expectProtocolInitiation = expectProtocolInitiation;
- }
-
- public void setMaxFrameSize(final int frameMax)
- {
- _maxFrameSize = frameMax;
- }
-
- public T getMethodProcessor()
- {
- return _methodProcessor;
- }
-
- private class RemainingByteArrayInputStream extends InputStream
- {
- private int _currentListPos;
- private int _markPos;
-
-
- @Override
- public int read() throws IOException
- {
- ByteArrayInputStream currentStream = _remainingBufs.get(_currentListPos);
- if(currentStream.available() > 0)
- {
- return currentStream.read();
- }
- else if((_currentListPos == _remainingBufs.size())
- || (++_currentListPos == _remainingBufs.size()))
- {
- return -1;
- }
- else
- {
-
- ByteArrayInputStream stream = _remainingBufs.get(_currentListPos);
- stream.mark(0);
- return stream.read();
- }
- }
-
- @Override
- public int read(final byte[] b, final int off, final int len) throws IOException
- {
-
- if(_currentListPos == _remainingBufs.size())
- {
- return -1;
- }
- else
- {
- ByteArrayInputStream currentStream = _remainingBufs.get(_currentListPos);
- final int available = currentStream.available();
- int read = currentStream.read(b, off, len > available ? available : len);
- if(read < len)
- {
- if(_currentListPos++ != _remainingBufs.size())
- {
- _remainingBufs.get(_currentListPos).mark(0);
- }
- int correctRead = read == -1 ? 0 : read;
- int subRead = read(b, off+correctRead, len-correctRead);
- if(subRead == -1)
- {
- return read;
- }
- else
- {
- return correctRead+subRead;
- }
- }
- else
- {
- return len;
- }
- }
- }
-
- @Override
- public int available() throws IOException
- {
- int total = 0;
- for(int i = _currentListPos; i < _remainingBufs.size(); i++)
- {
- total += _remainingBufs.get(i).available();
- }
- return total;
- }
-
- @Override
- public void mark(final int readlimit)
- {
- _markPos = _currentListPos;
- final ByteArrayInputStream stream = _remainingBufs.get(_currentListPos);
- if(stream != null)
- {
- stream.mark(readlimit);
- }
- }
-
- @Override
- public void reset() throws IOException
- {
- _currentListPos = _markPos;
- final int size = _remainingBufs.size();
- if(_currentListPos < size)
- {
- _remainingBufs.get(_currentListPos).reset();
- }
- for(int i = _currentListPos+1; i<size; i++)
- {
- _remainingBufs.get(i).reset();
- }
- }
- }
-
- private static class SimpleDataInputStream extends DataInputStream implements MarkableDataInput
- {
- public SimpleDataInputStream(InputStream in)
- {
- super(in);
- }
-
- public AMQShortString readAMQShortString() throws IOException
- {
- return EncodingUtils.readAMQShortString(this);
- }
-
- }
-
-
- public void decodeBuffer(ByteBuffer buf) throws AMQFrameDecodingException, AMQProtocolVersionException, IOException
- {
-
- MarkableDataInput msg;
-
-
- // get prior remaining data from accumulator
- ByteArrayInputStream bais;
- DataInput di;
- if(!_remainingBufs.isEmpty())
- {
- bais = new ByteArrayInputStream(buf.array(),buf.arrayOffset()+buf.position(), buf.remaining());
- _remainingBufs.add(bais);
- msg = new SimpleDataInputStream(new RemainingByteArrayInputStream());
- }
- else
- {
- bais = null;
- msg = new ByteArrayDataInput(buf.array(),buf.arrayOffset()+buf.position(), buf.remaining());
- }
-
- // If this is the first read then we may be getting a protocol initiation back if we tried to negotiate
- // an unsupported version
- if(_firstRead && buf.hasRemaining())
- {
- _firstRead = false;
- if(!_expectProtocolInitiation && buf.get(buf.position()) > 8)
- {
- _expectProtocolInitiation = true;
- }
- }
-
- boolean enoughData = true;
- while (enoughData)
- {
- if(!_expectProtocolInitiation)
- {
- enoughData = decodable(msg);
- if (enoughData)
- {
- processInput(msg);
- }
- }
- else
- {
- enoughData = _piDecoder.decodable(msg);
- if (enoughData)
- {
- _methodProcessor.receiveProtocolHeader(new ProtocolInitiation(msg));
- }
-
- }
-
- if(!enoughData)
- {
- if(!_remainingBufs.isEmpty())
- {
- _remainingBufs.remove(_remainingBufs.size()-1);
- ListIterator<ByteArrayInputStream> iterator = _remainingBufs.listIterator();
- while(iterator.hasNext() && iterator.next().available() == 0)
- {
- iterator.remove();
- }
- }
-
- if(bais == null)
- {
- if(msg.available()!=0)
- {
- byte[] remaining = new byte[msg.available()];
- msg.read(remaining);
- _remainingBufs.add(new ByteArrayInputStream(remaining));
- }
- }
- else
- {
- if(bais.available()!=0)
- {
- byte[] remaining = new byte[bais.available()];
- bais.read(remaining);
- _remainingBufs.add(new ByteArrayInputStream(remaining));
- }
- }
-
- if(_remainingBufs.size() > MAX_BUFFERS_LIMIT)
- {
- int totalSize = 0;
- for(ByteArrayInputStream stream : _remainingBufs)
- {
- totalSize += stream.available();
- }
-
- byte[] completeBuffer = new byte[totalSize];
- int pos = 0;
- for(ByteArrayInputStream stream : _remainingBufs)
- {
- pos += stream.read(completeBuffer, pos, stream.available());
- }
-
- _remainingBufs.clear();
- _remainingBufs.add(new ByteArrayInputStream(completeBuffer));
- }
- }
- }
- }
-
- private boolean decodable(final MarkableDataInput in) throws AMQFrameDecodingException, IOException
- {
- final int remainingAfterAttributes = in.available() - (1 + 2 + 4 + 1);
- // type, channel, body length and end byte
- if (remainingAfterAttributes < 0)
- {
- return false;
- }
-
- in.mark(8);
- in.skip(1 + 2);
-
-
- // Get an unsigned int, lifted from MINA ByteBuffer getUnsignedInt()
- final long bodySize = in.readInt() & 0xffffffffL;
- if (bodySize > _maxFrameSize)
- {
- throw new AMQFrameDecodingException(AMQConstant.FRAME_ERROR,
- "Incoming frame size of "
- + bodySize
- + " is larger than negotiated maximum of "
- + _maxFrameSize);
- }
- in.reset();
-
- return (remainingAfterAttributes >= bodySize);
-
- }
-
- private void processInput(final MarkableDataInput in)
- throws AMQFrameDecodingException, AMQProtocolVersionException, IOException
- {
- final byte type = in.readByte();
-
- final int channel = in.readUnsignedShort();
- final long bodySize = EncodingUtils.readUnsignedInteger(in);
-
- // bodySize can be zero
- if ((channel < 0) || (bodySize < 0))
- {
- throw new AMQFrameDecodingException(AMQConstant.FRAME_ERROR,
- "Undecodable frame: type = " + type + " channel = " + channel
- + " bodySize = " + bodySize);
- }
-
- processFrame(channel, type, bodySize, in);
-
- byte marker = in.readByte();
- if ((marker & 0xFF) != 0xCE)
- {
- throw new AMQFrameDecodingException(AMQConstant.FRAME_ERROR,
- "End of frame marker not found. Read " + marker + " length=" + bodySize
- + " type=" + type);
- }
-
- }
-
- protected void processFrame(final int channel, final byte type, final long bodySize, final MarkableDataInput in)
- throws AMQFrameDecodingException, IOException
- {
- switch (type)
- {
- case 1:
- processMethod(channel, in);
- break;
- case 2:
- ContentHeaderBody.process(in, _methodProcessor.getChannelMethodProcessor(channel), bodySize);
- break;
- case 3:
- ContentBody.process(in, _methodProcessor.getChannelMethodProcessor(channel), bodySize);
- break;
- case 8:
- HeartbeatBody.process(channel, in, _methodProcessor, bodySize);
- break;
- default:
- throw new AMQFrameDecodingException(AMQConstant.FRAME_ERROR, "Unsupported frame type: " + type);
- }
- }
-
-
- abstract void processMethod(int channelId,
- MarkableDataInput in)
- throws AMQFrameDecodingException, IOException;
-
- AMQFrameDecodingException newUnknownMethodException(final int classId,
- final int methodId,
- ProtocolVersion protocolVersion)
- {
- return new AMQFrameDecodingException(AMQConstant.COMMAND_INVALID,
- "Method "
- + methodId
- + " unknown in AMQP version "
- + protocolVersion
- + " (while trying to decode class "
- + classId
- + " method "
- + methodId
- + ".");
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java
deleted file mode 100644
index 9bdc1dd889..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.codec;
-
-import java.io.IOException;
-
-import org.apache.qpid.framing.*;
-
-public class ClientDecoder extends AMQDecoder<ClientMethodProcessor<? extends ClientChannelMethodProcessor>>
-{
-
- /**
- * Creates a new AMQP decoder.
- *
- * @param methodProcessor method processor
- */
- public ClientDecoder(final ClientMethodProcessor<? extends ClientChannelMethodProcessor> methodProcessor)
- {
- super(false, methodProcessor);
- }
-
-
- void processMethod(int channelId,
- MarkableDataInput in)
- throws AMQFrameDecodingException, IOException
- {
- ClientMethodProcessor<? extends ClientChannelMethodProcessor> methodProcessor = getMethodProcessor();
- ClientChannelMethodProcessor channelMethodProcessor = methodProcessor.getChannelMethodProcessor(channelId);
- final int classAndMethod = in.readInt();
- int classId = classAndMethod >> 16;
- int methodId = classAndMethod & 0xFFFF;
- methodProcessor.setCurrentMethod(classId, methodId);
- try
- {
- switch (classAndMethod)
- {
- //CONNECTION_CLASS:
- case 0x000a000a:
- ConnectionStartBody.process(in, methodProcessor);
- break;
- case 0x000a0014:
- ConnectionSecureBody.process(in, methodProcessor);
- break;
- case 0x000a001e:
- ConnectionTuneBody.process(in, methodProcessor);
- break;
- case 0x000a0029:
- ConnectionOpenOkBody.process(in, methodProcessor);
- break;
- case 0x000a002a:
- ConnectionRedirectBody.process(in, methodProcessor);
- break;
- case 0x000a0032:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- ConnectionRedirectBody.process(in, methodProcessor);
- }
- else
- {
- ConnectionCloseBody.process(in, methodProcessor);
- }
- break;
- case 0x000a0033:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
- }
- else
- {
- methodProcessor.receiveConnectionCloseOk();
- }
- break;
- case 0x000a003c:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- ConnectionCloseBody.process(in, methodProcessor);
- }
- else
- {
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
- }
- break;
- case 0x000a003d:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- methodProcessor.receiveConnectionCloseOk();
- }
- else
- {
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
- }
- break;
-
- // CHANNEL_CLASS:
-
- case 0x0014000b:
- ChannelOpenOkBody.process(in, methodProcessor.getProtocolVersion(), channelMethodProcessor);
- break;
- case 0x00140014:
- ChannelFlowBody.process(in, channelMethodProcessor);
- break;
- case 0x00140015:
- ChannelFlowOkBody.process(in, channelMethodProcessor);
- break;
- case 0x0014001e:
- ChannelAlertBody.process(in, channelMethodProcessor);
- break;
- case 0x00140028:
- ChannelCloseBody.process(in, channelMethodProcessor);
- break;
- case 0x00140029:
- channelMethodProcessor.receiveChannelCloseOk();
- break;
-
- // ACCESS_CLASS:
-
- case 0x001e000b:
- AccessRequestOkBody.process(in, channelMethodProcessor);
- break;
-
- // EXCHANGE_CLASS:
-
- case 0x0028000b:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveExchangeDeclareOk();
- }
- break;
- case 0x00280015:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveExchangeDeleteOk();
- }
- break;
- case 0x00280017:
- ExchangeBoundOkBody.process(in, channelMethodProcessor);
- break;
-
-
- // QUEUE_CLASS:
-
- case 0x0032000b:
- QueueDeclareOkBody.process(in, channelMethodProcessor);
- break;
- case 0x00320015:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveQueueBindOk();
- }
- break;
- case 0x0032001f:
- QueuePurgeOkBody.process(in, channelMethodProcessor);
- break;
- case 0x00320029:
- QueueDeleteOkBody.process(in, channelMethodProcessor);
- break;
- case 0x00320033:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveQueueUnbindOk();
- }
- break;
-
-
- // BASIC_CLASS:
-
- case 0x003c000b:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveBasicQosOk();
- }
- break;
- case 0x003c0015:
- BasicConsumeOkBody.process(in, channelMethodProcessor);
- break;
- case 0x003c001f:
- BasicCancelOkBody.process(in, channelMethodProcessor);
- break;
- case 0x003c0032:
- BasicReturnBody.process(in, channelMethodProcessor);
- break;
- case 0x003c003c:
- BasicDeliverBody.process(in, channelMethodProcessor);
- break;
- case 0x003c0047:
- BasicGetOkBody.process(in, channelMethodProcessor);
- break;
- case 0x003c0048:
- BasicGetEmptyBody.process(in, channelMethodProcessor);
- break;
- case 0x003c0050:
- BasicAckBody.process(in, channelMethodProcessor);
- break;
- case 0x003c0065:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveBasicRecoverSyncOk();
- }
- break;
- case 0x003c006f:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveBasicRecoverSyncOk();
- }
- break;
- case 0x003c0078:
- BasicNackBody.process(in, channelMethodProcessor);
- break;
-
- // CONFIRM CLASS:
-
- case 0x0055000b:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveConfirmSelectOk();
- }
- break;
-
- // TX_CLASS:
-
- case 0x005a000b:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveTxSelectOk();
- }
- break;
- case 0x005a0015:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveTxCommitOk();
- }
- break;
- case 0x005a001f:
- if(!channelMethodProcessor.ignoreAllButCloseOk())
- {
- channelMethodProcessor.receiveTxRollbackOk();
- }
- break;
-
- default:
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
-
- }
- }
- finally
- {
- methodProcessor.setCurrentMethod(0, 0);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/codec/MarkableDataInput.java b/qpid/java/common/src/main/java/org/apache/qpid/codec/MarkableDataInput.java
deleted file mode 100644
index a1513135a3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/codec/MarkableDataInput.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.codec;
-
-import org.apache.qpid.framing.AMQShortString;
-
-import java.io.DataInput;
-import java.io.IOException;
-
-public interface MarkableDataInput extends DataInput
-{
- public void mark(int pos);
- public void reset() throws IOException;
-
- int available() throws IOException;
-
- long skip(long i) throws IOException;
-
- int read(byte[] b) throws IOException;
-
- public AMQShortString readAMQShortString() throws IOException;
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/codec/ServerDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/codec/ServerDecoder.java
deleted file mode 100644
index deed32346f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/codec/ServerDecoder.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.codec;
-
-import java.io.IOException;
-
-import org.apache.qpid.framing.*;
-
-public class ServerDecoder extends AMQDecoder<ServerMethodProcessor<? extends ServerChannelMethodProcessor>>
-{
-
- /**
- * Creates a new AMQP decoder.
- *
- * @param methodProcessor method processor
- */
- public ServerDecoder(final ServerMethodProcessor<? extends ServerChannelMethodProcessor> methodProcessor)
- {
- super(true, methodProcessor);
- }
-
- void processMethod(int channelId,
- MarkableDataInput in)
- throws AMQFrameDecodingException, IOException
- {
- ServerMethodProcessor<? extends ServerChannelMethodProcessor> methodProcessor = getMethodProcessor();
- final int classAndMethod = in.readInt();
- int classId = classAndMethod >> 16;
- int methodId = classAndMethod & 0xFFFF;
- methodProcessor.setCurrentMethod(classId, methodId);
- try
- {
- switch (classAndMethod)
- {
- //CONNECTION_CLASS:
- case 0x000a000b:
- ConnectionStartOkBody.process(in, methodProcessor);
- break;
- case 0x000a0015:
- ConnectionSecureOkBody.process(in, methodProcessor);
- break;
- case 0x000a001f:
- ConnectionTuneOkBody.process(in, methodProcessor);
- break;
- case 0x000a0028:
- ConnectionOpenBody.process(in, methodProcessor);
- break;
- case 0x000a0032:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
- }
- else
- {
- ConnectionCloseBody.process(in, methodProcessor);
- }
- break;
- case 0x000a0033:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
- }
- else
- {
- methodProcessor.receiveConnectionCloseOk();
- }
- break;
- case 0x000a003c:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- ConnectionCloseBody.process(in, methodProcessor);
- }
- else
- {
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
- }
- break;
- case 0x000a003d:
- if (methodProcessor.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- methodProcessor.receiveConnectionCloseOk();
- }
- else
- {
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
- }
- break;
-
- // CHANNEL_CLASS:
-
- case 0x0014000a:
- ChannelOpenBody.process(channelId, in, methodProcessor);
- break;
- case 0x00140014:
- ChannelFlowBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x00140015:
- ChannelFlowOkBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x00140028:
- ChannelCloseBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x00140029:
- methodProcessor.getChannelMethodProcessor(channelId).receiveChannelCloseOk();
- break;
-
- // ACCESS_CLASS:
-
- case 0x001e000a:
- AccessRequestBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
-
- // EXCHANGE_CLASS:
-
- case 0x0028000a:
- ExchangeDeclareBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x00280014:
- ExchangeDeleteBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x00280016:
- ExchangeBoundBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
-
-
- // QUEUE_CLASS:
-
- case 0x0032000a:
- QueueDeclareBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x00320014:
- QueueBindBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x0032001e:
- QueuePurgeBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x00320028:
- QueueDeleteBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x00320032:
- QueueUnbindBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
-
-
- // BASIC_CLASS:
-
- case 0x003c000a:
- BasicQosBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c0014:
- BasicConsumeBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c001e:
- BasicCancelBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c0028:
- BasicPublishBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c0046:
- BasicGetBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c0050:
- BasicAckBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c005a:
- BasicRejectBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c0064:
- BasicRecoverBody.process(in, methodProcessor.getProtocolVersion(),
- methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c0066:
- BasicRecoverSyncBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c006e:
- BasicRecoverSyncBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
- case 0x003c0078:
- BasicNackBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
-
- // CONFIRM CLASS:
-
- case 0x0055000a:
- ConfirmSelectBody.process(in, methodProcessor.getChannelMethodProcessor(channelId));
- break;
-
- // TX_CLASS:
-
- case 0x005a000a:
- if(!methodProcessor.getChannelMethodProcessor(channelId).ignoreAllButCloseOk())
- {
- methodProcessor.getChannelMethodProcessor(channelId).receiveTxSelect();
- }
- break;
- case 0x005a0014:
- if(!methodProcessor.getChannelMethodProcessor(channelId).ignoreAllButCloseOk())
- {
- methodProcessor.getChannelMethodProcessor(channelId).receiveTxCommit();
- }
- break;
- case 0x005a001e:
- if(!methodProcessor.getChannelMethodProcessor(channelId).ignoreAllButCloseOk())
- {
- methodProcessor.getChannelMethodProcessor(channelId).receiveTxRollback();
- }
- break;
-
-
- default:
- throw newUnknownMethodException(classId, methodId,
- methodProcessor.getProtocolVersion());
-
- }
- }
- finally
- {
- methodProcessor.setCurrentMethod(0, 0);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/common/AMQPFilterTypes.java b/qpid/java/common/src/main/java/org/apache/qpid/common/AMQPFilterTypes.java
deleted file mode 100644
index d033bf86c2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/common/AMQPFilterTypes.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid.common;
-
-import org.apache.qpid.framing.AMQShortString;
-
-/**
- * Specifies the different filter types for consumers that filter their messages.
- */
-public enum AMQPFilterTypes
-{
- JMS_SELECTOR("x-filter-jms-selector"),
- NO_CONSUME("x-filter-no-consume"),
- AUTO_CLOSE("x-filter-auto-close"),
- NO_LOCAL("x-qpid-no-local"),
- REPLAY_PERIOD("x-qpid-replay-period");
-
- /** The identifying string for the filter type. */
- private final AMQShortString _value;
-
- /**
- * Creates a new filter type from its identifying string.
- *
- * @param value The identifying string.
- */
- AMQPFilterTypes(String value)
- {
- _value = new AMQShortString(value);
- }
-
- /**
- * Gets the identifying string of the filter type.
- *
- * @return The identifying string of the filter type.
- */
- public AMQShortString getValue()
- {
- return _value;
- }
-
- @Override
- public String toString()
- {
- return _value.asString();
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java b/qpid/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java
deleted file mode 100644
index d077cc9717..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid.common;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * QpidProperties captures the project name, version number, and source code repository revision number from a properties
- * file which is generated as part of the build process. Normally, the name and version number are pulled from the module
- * name and version number of the Maven build POM, but could come from other sources if the build system is changed. The
- * idea behind this, is that every build has these values incorporated directly into its jar file, so that code in the
- * wild can be identified, should its origination be forgotten.
- *
- * <p>To get the build version of any Qpid code call the {@link #main} method. This version string is usually also
- * printed to the console on broker start up.
- */
-public class QpidProperties
-{
- /** The name of the version properties file to load from the class path. */
- public static final String VERSION_RESOURCE = "qpidversion.properties";
-
- /** Defines the name of the product property. */
- public static final String PRODUCT_NAME_PROPERTY = "qpid.name";
-
- /** Defines the name of the version property. */
- public static final String RELEASE_VERSION_PROPERTY = "qpid.version";
-
- /** Defines the name of the version suffix property. */
- public static final String RELEASE_VERSION_SUFFIX = "qpid.version.suffix";
-
- /** Defines the name of the source code revision property. */
- public static final String BUILD_VERSION_PROPERTY = "qpid.svnversion";
-
- /** Defines the default value for all properties that cannot be loaded. */
- private static final String DEFAULT = "unknown";
-
- /** Holds the product name. */
- private static final String productName;
-
- /** Holds the product version. */
- private static final String releaseVersion;
-
- /** Holds the source code revision. */
- private static final String buildVersion;
-
- private static final Properties properties = new Properties();
-
- // Loads the values from the version properties file.
- static
- {
-
- try(InputStream propertyStream = QpidProperties.class.getClassLoader().getResourceAsStream(VERSION_RESOURCE))
- {
- if (propertyStream != null)
- {
- properties.load(propertyStream);
- }
- }
- catch (IOException e)
- {
- // Ignore, most likely running within an IDE, values will have the DEFAULT text
- }
-
- String versionSuffix = properties.getProperty(RELEASE_VERSION_SUFFIX);
- String version = properties.getProperty(RELEASE_VERSION_PROPERTY, DEFAULT);
-
- productName = properties.getProperty(PRODUCT_NAME_PROPERTY, DEFAULT);
- releaseVersion = versionSuffix == null || "".equals(versionSuffix) ? version : version + ";" + versionSuffix;
- buildVersion = properties.getProperty(BUILD_VERSION_PROPERTY, DEFAULT);
- }
-
- public static Properties asProperties()
- {
- return new Properties(properties);
- }
-
- /**
- * Gets the product name.
- *
- * @return The product name.
- */
- public static String getProductName()
- {
- return productName;
- }
-
- /**
- * Gets the product version.
- *
- * @return The product version.
- */
- public static String getReleaseVersion()
- {
- return releaseVersion;
- }
-
- /**
- * Gets the source code revision.
- *
- * @return The source code revision.
- */
- public static String getBuildVersion()
- {
- return buildVersion;
- }
-
- /**
- * Extracts all of the version information as a printable string.
- *
- * @return All of the version information as a printable string.
- */
- public static String getVersionString()
- {
- return getProductName() + " - " + getReleaseVersion() + " build: " + getBuildVersion();
- }
-
- /**
- * Prints the versioning information to the console. This is extremely usefull for identifying Qpid code in the
- * wild, where the origination of the code has been forgotten.
- *
- * @param args Does not require any arguments.
- */
- public static void main(String[] args)
- {
- System.out.println(getVersionString());
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/common/ServerPropertyNames.java b/qpid/java/common/src/main/java/org/apache/qpid/common/ServerPropertyNames.java
deleted file mode 100644
index 3d792459a9..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/common/ServerPropertyNames.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.common;
-
-/**
- * Keys names used within the serverProperties argument of the ConnectionStart
- * method. Property names which start with "qpid." are Qpid specific.
- */
-public final class ServerPropertyNames
-{
- private ServerPropertyNames()
- {
- }
-
- /**
- * Server property: federation tag UUID
- */
- public static final String FEDERATION_TAG = "qpid.federation_tag";
-
- /**
- * Server property: array of features supported by the server.
- */
- public static final String QPID_FEATURES = "qpid.features";
-
- /**
- * Feature: Signifies that a server supports JMS selectors.
- */
- public static final String FEATURE_QPID_JMS_SELECTOR = "qpid.jms-selector";
-
- /**
- * Server property: 'name' attribute of the server instance.
- */
- public static final String QPID_INSTANCE_NAME = "qpid.instance_name";
-
- /**
- * Server property: build number.
- */
- public static final String QPID_BUILD = "qpid.build";
-
- public static final String PRODUCT = "product";
- public static final String VERSION = "version";
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/Accessor.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/Accessor.java
deleted file mode 100644
index b73f08f824..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/Accessor.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.configuration;
-
-import java.util.Map;
-
-public interface Accessor
-{
- public Boolean getBoolean(String name);
- public Integer getInt(String name);
- public Long getLong(String name);
- public String getString(String name);
- public Float getFloat(String name);
-
- static class SystemPropertyAccessor implements Accessor
- {
- public Boolean getBoolean(String name)
- {
- return System.getProperty(name) == null ? null : Boolean.getBoolean(name);
- }
-
- public Integer getInt(String name)
- {
- return Integer.getInteger(name);
- }
-
- public Long getLong(String name)
- {
- return Long.getLong(name);
- }
-
- public String getString(String name)
- {
- return System.getProperty(name);
- }
-
- public Float getFloat(String name)
- {
- return System.getProperty(name) == null ? null : Float.parseFloat(System.getProperty(name));
- }
- }
-
- static class MapAccessor implements Accessor
- {
- private Map<Object,Object> source;
-
- public MapAccessor(Map<Object,Object> map)
- {
- source = map;
- }
-
- protected void setSource(Map<Object, Object> source)
- {
- this.source = source;
- }
-
- public Boolean getBoolean(String name)
- {
- if (source != null && source.containsKey(name))
- {
- if (source.get(name) instanceof Boolean)
- {
- return (Boolean)source.get(name);
- }
- else
- {
- return Boolean.parseBoolean((String)source.get(name));
- }
- }
- else
- {
- return null;
- }
- }
-
- public Integer getInt(String name)
- {
- if (source != null && source.containsKey(name))
- {
- if (source.get(name) instanceof Integer)
- {
- return (Integer)source.get(name);
- }
- else
- {
- return Integer.parseInt((String)source.get(name));
- }
- }
- else
- {
- return null;
- }
- }
-
- public Long getLong(String name)
- {
- if (source != null && source.containsKey(name))
- {
- if (source.get(name) instanceof Long)
- {
- return (Long)source.get(name);
- }
- else
- {
- return Long.parseLong((String)source.get(name));
- }
- }
- else
- {
- return null;
- }
- }
-
- public String getString(String name)
- {
- if (source != null && source.containsKey(name))
- {
- if (source.get(name) instanceof String)
- {
- return (String)source.get(name);
- }
- else
- {
- return String.valueOf(source.get(name));
- }
- }
- else
- {
- return null;
- }
- }
-
- public Float getFloat(String name)
- {
- if (source != null && source.containsKey(name))
- {
- if (source.get(name) instanceof Float)
- {
- return (Float)source.get(name);
- }
- else
- {
- return Float.parseFloat((String)source.get(name));
- }
- }
- else
- {
- return null;
- }
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java
deleted file mode 100644
index 89e4c3ccdd..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.qpid.configuration;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class centralized the Qpid client properties.
- *
- * @see CommonProperties
- */
-public class ClientProperties
-{
- private static final Logger LOGGER = LoggerFactory.getLogger(ClientProperties.class);
-
- /**
- * Currently with Qpid it is not possible to change the client ID.
- * If one is not specified upon connection construction, an id is generated automatically.
- * Therefore an exception is always thrown unless this property is set to true.
- * type: boolean
- */
- public static final String IGNORE_SET_CLIENTID_PROP_NAME = "ignore_setclientID";
-
- /**
- * This property is currently used within the 0.10 code path only
- * The maximum number of pre-fetched messages per destination
- * This property is used for all the connection unless it is overwritten by the connectionURL
- * type: long
- */
- public static final String MAX_PREFETCH_PROP_NAME = "max_prefetch";
- public static final String MAX_PREFETCH_DEFAULT = "500";
-
- /**
- * When true a sync command is sent after every persistent messages.
- * type: boolean
- */
- public static final String SYNC_PERSISTENT_PROP_NAME = "sync_persistence";
-
- /**
- * When true a sync command is sent after sending a message ack.
- * type: boolean
- */
- public static final String SYNC_ACK_PROP_NAME = "sync_ack";
-
- /**
- * sync_publish property - {persistent|all}
- * If set to 'persistent',then persistent messages will be publish synchronously
- * If set to 'all', then all messages regardless of the delivery mode will be
- * published synchronously.
- */
- public static final String SYNC_PUBLISH_PROP_NAME = "sync_publish";
-
- /**
- * Frequency of heartbeat messages (in milliseconds)
- * @see #QPID_HEARTBEAT_INTERVAL
- */
- @Deprecated
- public static final String IDLE_TIMEOUT_PROP_NAME = "idle_timeout";
-
- /**
- * Frequency of heartbeat messages (in seconds)
- * @see #QPID_HEARTBEAT_INTERVAL
- */
- @Deprecated
- public static final String AMQJ_HEARTBEAT_DELAY = "amqj.heartbeat.delay";
-
- /**
- * Frequency of heartbeat messages (in seconds)
- */
- public static final String QPID_HEARTBEAT_INTERVAL = "qpid.heartbeat";
-
- /**
- * Default heartbeat interval (used by 0-10 protocol).
- */
- public static final int QPID_HEARTBEAT_INTERVAL_010_DEFAULT = 120;
-
- /**
- * @see #QPID_HEARTBEAT_TIMEOUT_FACTOR
- */
- @Deprecated
- public static final String AMQJ_HEARTBEAT_TIMEOUT_FACTOR = "amqj.heartbeat.timeoutFactor";
-
- /**
- * The factor applied to {@link #QPID_HEARTBEAT_INTERVAL} that determines the maximum
- * length of time that may elapse before the peer is deemed to have failed.
- *
- * @see #QPID_HEARTBEAT_TIMEOUT_FACTOR_DEFAULT
- */
- public static final String QPID_HEARTBEAT_TIMEOUT_FACTOR = "qpid.heartbeat_timeout_factor";
-
- /**
- * Default heartbeat timeout factor.
- */
- public static final float QPID_HEARTBEAT_TIMEOUT_FACTOR_DEFAULT = 2.0f;
-
- /**
- * This value will be used to determine the default destination syntax type.
- * Currently the two types are Binding URL (java only) and the Addressing format (used by
- * all clients).
- */
- public static final String DEST_SYNTAX = "qpid.dest_syntax";
-
- public static final String USE_LEGACY_MAP_MESSAGE_FORMAT = "qpid.use_legacy_map_message";
-
- public static final String USE_LEGACY_STREAM_MESSAGE_FORMAT = "qpid.use_legacy_stream_message";
-
- public static final String AMQP_VERSION = "qpid.amqp.version";
-
- public static final String QPID_VERIFY_CLIENT_ID = "qpid.verify_client_id";
-
- /**
- * System properties to change the default timeout used during
- * synchronous operations.
- */
- public static final String QPID_SYNC_OP_TIMEOUT = "qpid.sync_op_timeout";
- @Deprecated
- public static final String AMQJ_DEFAULT_SYNCWRITE_TIMEOUT = "amqj.default_syncwrite_timeout";
-
- /**
- * A default timeout value for synchronous operations
- */
- public static final int DEFAULT_SYNC_OPERATION_TIMEOUT = 60000;
-
- /**
- * System properties to change the default timeout used whilst closing connections
- * and underlying sessions.
- */
- public static final String QPID_CLOSE_TIMEOUT = "qpid.close_timeout";
-
- /**
- * A default timeout value for close operations
- */
- public static final int DEFAULT_CLOSE_TIMEOUT = 2000;
-
-
- /**
- * System properties to change the default value used for TCP_NODELAY
- */
- public static final String QPID_TCP_NODELAY_PROP_NAME = "qpid.tcp_nodelay";
- @Deprecated
- public static final String AMQJ_TCP_NODELAY_PROP_NAME = "amqj.tcp_nodelay";
-
- /**
- * System property to set the reject behaviour. default value will be 'normal' but can be
- * changed to 'server' in which case the server decides whether a message should be requeued
- * or dead lettered.
- * This can be overridden by the more specific settings at connection or binding URL level.
- */
- public static final String REJECT_BEHAVIOUR_PROP_NAME = "qpid.reject.behaviour";
-
- /**
- * System property used to set the key manager factory algorithm.
- *
- * Historically, Qpid referred to this as {@value #QPID_SSL_KEY_STORE_CERT_TYPE_PROP_NAME}.
- */
- public static final String QPID_SSL_KEY_MANAGER_FACTORY_ALGORITHM_PROP_NAME = "qpid.ssl.KeyManagerFactory.algorithm";
- @Deprecated
- public static final String QPID_SSL_KEY_STORE_CERT_TYPE_PROP_NAME = "qpid.ssl.keyStoreCertType";
-
- /**
- * System property used to set the trust manager factory algorithm.
- *
- * Historically, Qpid referred to this as {@value #QPID_SSL_TRUST_STORE_CERT_TYPE_PROP_NAME}.
- */
- public static final String QPID_SSL_TRUST_MANAGER_FACTORY_ALGORITHM_PROP_NAME = "qpid.ssl.TrustManagerFactory.algorithm";
- @Deprecated
- public static final String QPID_SSL_TRUST_STORE_CERT_TYPE_PROP_NAME = "qpid.ssl.trustStoreCertType";
-
- /**
- * System property to enable allow dispatcher thread to be run as a daemon thread
- */
- public static final String DAEMON_DISPATCHER = "qpid.jms.daemon.dispatcher";
-
- /**
- * Used to name the process utilising the Qpid client, to override the default
- * value is used in the ConnectionStartOk reply to the broker.
- */
- public static final String PROCESS_NAME = "qpid.client_process";
-
- /**
- * System property used to set the socket receive buffer size.
- *
- * Historically, Qpid referred to this as {@value #LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME}.
- */
- public static final String RECEIVE_BUFFER_SIZE_PROP_NAME = "qpid.receive_buffer_size";
- @Deprecated
- public static final String LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME = "amqj.receiveBufferSize";
-
- /**
- * System property used to set the socket send buffer size.
- *
- * Historically, Qpid referred to this as {@value #LEGACY_SEND_BUFFER_SIZE_PROP_NAME}.
- */
- public static final String SEND_BUFFER_SIZE_PROP_NAME = "qpid.send_buffer_size";
- @Deprecated
- public static final String LEGACY_SEND_BUFFER_SIZE_PROP_NAME = "amqj.sendBufferSize";
-
- /**
- * System property to set the time (in millis) to wait before failing when sending and
- * the client has been flow controlled by the broker.
- */
- public static final String QPID_FLOW_CONTROL_WAIT_FAILURE = "qpid.flow_control_wait_failure";
-
- /**
- * Default time (in millis) to wait before failing when sending and the client has been
- * flow controlled by the broker.
- */
- public static final long DEFAULT_FLOW_CONTROL_WAIT_FAILURE = 60000L;
-
- /**
- * System property to set the time (in millis) between log notifications that a
- * send is waiting because the client was flow controlled by the broker.
- */
- public static final String QPID_FLOW_CONTROL_WAIT_NOTIFY_PERIOD = "qpid.flow_control_wait_notify_period";
-
- /**
- * Default time (in millis) between log notifications that a send is
- * waiting because the client was flow controlled by the broker.
- */
- public static final long DEFAULT_FLOW_CONTROL_WAIT_NOTIFY_PERIOD = 5000L;
-
- /**
- * System property to control whether the client will declare queues during
- * consumer creation when using BindingURLs.
- */
- public static final String QPID_DECLARE_QUEUES_PROP_NAME = "qpid.declare_queues";
-
- /**
- * System property to control whether the client will declare exchanges during
- * producer/consumer creation when using BindingURLs.
- */
- public static final String QPID_DECLARE_EXCHANGES_PROP_NAME = "qpid.declare_exchanges";
- /**
- * System property to control whether the client will bind queues during
- * consumer creation when using BindingURLs.
- */
- public static final String QPID_BIND_QUEUES_PROP_NAME = "qpid.bind_queues";
-
- public static final String VERIFY_QUEUE_ON_SEND = "qpid.verify_queue_on_send";
-
- public static final String QPID_MAX_CACHED_ADDR_OPTION_STRINGS = "qpid.max_cached_address_option_strings";
- public static final int DEFAULT_MAX_CACHED_ADDR_OPTION_STRINGS = 10;
-
- /**
- * System property to control whether the 0-8/0-9/0-9-1 client will set the message
- * 'expiration' header using the computed expiration value (default, when false) or instead set
- * it to the raw TTL (when true). May be necessary for interop with other vendors.
- */
- public static final String SET_EXPIRATION_AS_TTL = "qpid.set_expiration_as_ttl";
-
- /**
- * System property to set a default value for a connection option 'ssl_verify_hostname'
- */
- public static final String CONNECTION_OPTION_SSL_VERIFY_HOST_NAME = "qpid.connection_ssl_verify_hostname";
- public static final boolean DEFAULT_CONNECTION_OPTION_SSL_VERIFY_HOST_NAME = true;
-
- /**
- * System property to set a default value for a connection option 'compress_messages'
- */
- public static final String CONNECTION_OPTION_COMPRESS_MESSAGES = "qpid.connection_compress_messages";
- public static final boolean DEFAULT_CONNECTION_OPTION_COMPRESS_MESSAGES = false;
-
-
- /**
- * System property to set a default value for a connection option 'message_compression_threshold_size'
- */
- public static final String CONNECTION_OPTION_MESSAGE_COMPRESSION_THRESHOLD_SIZE = "qpid.message_compression_threshold_size";
- public static final int DEFAULT_MESSAGE_COMPRESSION_THRESHOLD_SIZE = 102400;
-
- public static final String ADDR_SYNTAX_SUPPORTED_IN_0_8 = "qpid.addr_syntax_supported";
- public static final boolean DEFAULT_ADDR_SYNTAX_0_8_SUPPORT = true;
-
- /**
- * Before 0.30, when using AMQP 0-8..0-9-1 requesting queue depth (AMQSession#getQueueDepth) for a queue that
- * did not exist resulted in AMQChannelException. From 0.30 forward, 0 is returned in common with 0-10
- * behaviour.
- *
- * Setting this system property true restores the old behaviour. It also avoids the isBound with a null exchange
- * that causes an error in the Java Broker (0.28 and earlier).
- */
- public static final String QPID_USE_LEGACY_GETQUEUEDEPTH_BEHAVIOUR = "qpid.use_legacy_getqueuedepth_behavior";
-
- static
- {
- // force load of common properties
- Class<CommonProperties> commonPropertiesClass = CommonProperties.class;
-
- Properties props = new Properties();
- String initialProperties = System.getProperty("qpid.client_properties_file");
- URL initialPropertiesLocation = null;
- try
- {
- if (initialProperties == null)
- {
- initialPropertiesLocation = ClientProperties.class.getClassLoader().getResource("qpid-client.properties");
- }
- else
- {
- initialPropertiesLocation = (new File(initialProperties)).toURI().toURL();
- }
-
- if (initialPropertiesLocation != null)
- {
- props.load(initialPropertiesLocation.openStream());
- }
- }
- catch (MalformedURLException e)
- {
- LOGGER.warn("Could not open client properties file '"+initialProperties+"'.", e);
- }
- catch (IOException e)
- {
- LOGGER.warn("Could not open client properties file '" + initialPropertiesLocation + "'.", e);
- }
-
- Set<String> propertyNames = new HashSet<>(props.stringPropertyNames());
- propertyNames.removeAll(System.getProperties().stringPropertyNames());
- for (String propName : propertyNames)
- {
- System.setProperty(propName, props.getProperty(propName));
- }
-
- }
-
- private ClientProperties()
- {
- //No instances
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/CommonProperties.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/CommonProperties.java
deleted file mode 100644
index a052a02748..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/CommonProperties.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.configuration;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.common.QpidProperties;
-
-/**
- * Centralised record of Qpid common properties.
- *
- * @see ClientProperties
- */
-public class CommonProperties
-{
- private static final Logger LOGGER = LoggerFactory.getLogger(CommonProperties.class);
-
- /**
- * The timeout used by the IO layer for timeouts such as send timeout in IoSender, and the close timeout for IoSender and IoReceiver
- */
- public static final String IO_NETWORK_TRANSPORT_TIMEOUT_PROP_NAME = "qpid.io_network_transport_timeout";
- public static final int IO_NETWORK_TRANSPORT_TIMEOUT_DEFAULT = 60000;
-
- public static final String HANDSHAKE_TIMEOUT_PROP_NAME = "qpid.handshake_timeout";
- public static final int HANDSHAKE_TIMEOUT_DEFAULT = 2;
-
- static
- {
-
- Properties props = new Properties(QpidProperties.asProperties());
- String initialProperties = System.getProperty("qpid.common_properties_file");
- URL initialPropertiesLocation = null;
- try
- {
- if (initialProperties == null)
- {
- initialPropertiesLocation = CommonProperties.class.getClassLoader().getResource("qpid-common.properties");
- }
- else
- {
- initialPropertiesLocation = (new File(initialProperties)).toURI().toURL();
- }
-
- if (initialPropertiesLocation != null)
- {
- props.load(initialPropertiesLocation.openStream());
- }
- }
- catch (MalformedURLException e)
- {
- LOGGER.warn("Could not open common properties file '"+initialProperties+"'.", e);
- }
- catch (IOException e)
- {
- LOGGER.warn("Could not open common properties file '" + initialPropertiesLocation + "'.", e);
- }
-
- Set<String> propertyNames = new HashSet<>(props.stringPropertyNames());
- propertyNames.removeAll(System.getProperties().stringPropertyNames());
- for (String propName : propertyNames)
- {
- System.setProperty(propName, props.getProperty(propName));
- }
-
- }
-
- private CommonProperties()
- {
- //no instances
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/Configured.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/Configured.java
deleted file mode 100644
index 22903888fe..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/Configured.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.configuration;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marks a field as having a "configured" value injected into it by a configurator.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Configured
-{
- /**
- * The Commons Configuration path to the configuration element
- */
- String path();
-
- /**
- * The default value to use should the path not be found in the configuration source
- */
- String defaultValue();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java
deleted file mode 100644
index cf08dafb49..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.configuration;
-
-import org.apache.qpid.AMQException;
-
-/**
- * Indicates a failure to parse a property expansion. See {@link PropertyUtils} for the code that does property
- * expansions.
- *
- * <p>
- * TODO Not an AMQP exception as no status code.
- */
-public class PropertyException extends AMQException
-{
- public PropertyException(String message, Throwable cause)
- {
- super(null, message, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyUtils.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyUtils.java
deleted file mode 100644
index da366ffd0f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyUtils.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.configuration;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * PropertyUtils provides helper methods for dealing with Java properties.
- *
- * <p>
- * TODO Make the lookup method generic by passing in the properties to use for the expansion, rather than hard coding
- * as system properties. The expansion code has greater potential for re-use that way.
- * <p>
- * TODO Some more property related code could be added to this utils class, which might more appropriately reside under
- * org.apache.qpid.util. For example standardised code to load properties from a resource name, currently found in
- * QpidProperties and possibly other places could be moved here.
- */
-public class PropertyUtils
-{
- private PropertyUtils()
- {
- }
-
- /**
- * Given a string that contains substrings of the form <code>${xxx}</code>, looks up the valuea of 'xxx' as a
- * system properties and substitutes tham back into the original string, to provide a property value expanded
- * string.
- *
- * @param value The string to be scanned for property references. May be <code>null</code>, in which case this
- * method returns immediately with no effect.
- *
- * @return The original string with the properties replaced, or <code>null</code> if the original string is
- * <code>null</code>.
- *
- * @throws PropertyException If the string contains an opening <code>${</code> without a balancing <code>}</code>,
- * or if the property to expand does not exist as a system property.
- */
- public static String replaceProperties(String value) throws PropertyException
- {
- if (value == null)
- {
- return null;
- }
-
- ArrayList<String> fragments = new ArrayList<String>();
- ArrayList<String> propertyRefs = new ArrayList<String>();
- parsePropertyString(value, fragments, propertyRefs);
-
- StringBuffer sb = new StringBuffer();
- Iterator<String> j = propertyRefs.iterator();
-
- for (String fragment : fragments)
- {
- if (fragment == null)
- {
- String propertyName = j.next();
-
- // try to get it from the project or keys
- // Backward compatibility
- String replacement = System.getProperty(propertyName);
-
- if (replacement == null)
- {
- throw new PropertyException("Property ${" + propertyName + "} has not been set", null);
- }
-
- fragment = replacement;
- }
-
- sb.append(fragment);
- }
-
- return sb.toString();
- }
-
- /**
- * Parses the supplied value for properties which are specified using ${foo} syntax. $X is left as is, and $$
- * specifies a single $.
- *
- * @param value The property string to parse.
- * @param fragments Is populated with the string fragments. A null means "insert a property value here. The number
- * of nulls in the list when populated is equal to the size of the propertyRefs list.
- * @param propertyRefs Populated with the property names to be added into the final string.
- */
- private static void parsePropertyString(String value, ArrayList<String> fragments, ArrayList<String> propertyRefs)
- throws PropertyException
- {
- int prev = 0;
- int pos;
- // search for the next instance of $ from the 'prev' position
- while ((pos = value.indexOf("$", prev)) >= 0)
- {
-
- // if there was any text before this, add it as a fragment
- if (pos > 0)
- {
- fragments.add(value.substring(prev, pos));
- }
- // if we are at the end of the string, we tack on a $
- // then move past it
- if (pos == (value.length() - 1))
- {
- fragments.add("$");
- prev = pos + 1;
- }
- else if (value.charAt(pos + 1) != '{')
- {
- // peek ahead to see if the next char is a property or not
- // not a property: insert the char as a literal
- if (value.charAt(pos + 1) == '$')
- {
- // two $ map to one $
- fragments.add("$");
- prev = pos + 2;
- }
- else
- {
- // $X maps to $X for all values of X!='$'
- fragments.add(value.substring(pos, pos + 2));
- prev = pos + 2;
- }
- }
- else
- {
- // property found, extract its name or bail on a typo
- int endName = value.indexOf('}', pos);
- if (endName < 0)
- {
- throw new PropertyException("Syntax error in property: " + value, null);
- }
-
- String propertyName = value.substring(pos + 2, endName);
- fragments.add(null);
- propertyRefs.add(propertyName);
- prev = endName + 1;
- }
- }
- // no more $ signs found
- // if there is any tail to the file, append it
- if (prev < value.length())
- {
- fragments.add(value.substring(prev));
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/QpidProperty.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/QpidProperty.java
deleted file mode 100644
index 3ed32a604a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/QpidProperty.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.qpid.configuration;
-
-import org.apache.qpid.configuration.Accessor.SystemPropertyAccessor;
-
-public abstract class QpidProperty<T>
-{
- private T defValue;
- private String[] names;
- private Accessor accessor;
-
- QpidProperty(T defValue, String... names)
- {
- this(new SystemPropertyAccessor(),defValue,names);
- }
-
- QpidProperty(Accessor accessor,T defValue, String... names)
- {
- this.accessor = accessor;
- this.defValue = defValue;
- this.names = names;
- }
-
- public T get()
- {
- for (String name : names)
- {
- T obj = getByName(name);
- if (obj != null)
- {
- return obj;
- }
- }
-
- return defValue;
- }
-
- protected abstract T getByName(String name);
-
- public static QpidProperty<Boolean> booleanProperty(Boolean defaultValue,
- String... names)
- {
- return new QpidBooleanProperty(defaultValue, names);
- }
-
- public static QpidProperty<Boolean> booleanProperty(Accessor accessor,
- Boolean defaultValue,String... names)
- {
- return new QpidBooleanProperty(accessor,defaultValue, names);
- }
-
- public static QpidProperty<Integer> intProperty(Integer defaultValue,
- String... names)
- {
- return new QpidIntProperty(defaultValue, names);
- }
-
- public static QpidProperty<Integer> intProperty(Accessor accessor,
- Integer defaultValue, String... names)
- {
- return new QpidIntProperty(accessor,defaultValue, names);
- }
-
- public static QpidProperty<Long> longProperty(Long defaultValue,
- String... names)
- {
- return new QpidLongProperty(defaultValue, names);
- }
-
- public static QpidProperty<Long> longProperty(Accessor accessor,
- Long defaultValue, String... names)
- {
- return new QpidLongProperty(accessor,defaultValue, names);
- }
-
- public static QpidProperty<String> stringProperty(String defaultValue,
- String... names)
- {
- return new QpidStringProperty(defaultValue, names);
- }
-
- public static QpidProperty<String> stringProperty(Accessor accessor,
- String defaultValue,String... names)
- {
- return new QpidStringProperty(accessor,defaultValue, names);
- }
-
- public static QpidProperty<Float> floatProperty(Float defaultValue, String... names)
- {
- return new QpidFloatProperty(defaultValue, names);
- }
-
- protected Accessor getAccessor()
- {
- return accessor;
- }
-
- static class QpidBooleanProperty extends QpidProperty<Boolean>
- {
- QpidBooleanProperty(Boolean defValue, String... names)
- {
- super(defValue, names);
- }
-
- QpidBooleanProperty(Accessor accessor,Boolean defValue, String... names)
- {
- super(accessor,defValue, names);
- }
-
- @Override
- protected Boolean getByName(String name)
- {
- return getAccessor().getBoolean(name);
- }
- }
-
- static class QpidIntProperty extends QpidProperty<Integer>
- {
- QpidIntProperty(Integer defValue, String... names)
- {
- super(defValue, names);
- }
-
- QpidIntProperty(Accessor accessor,Integer defValue, String... names)
- {
- super(accessor,defValue, names);
- }
-
- @Override
- protected Integer getByName(String name)
- {
- return getAccessor().getInt(name);
- }
- }
-
- static class QpidLongProperty extends QpidProperty<Long>
- {
- QpidLongProperty(Long defValue, String... names)
- {
- super(defValue, names);
- }
-
- QpidLongProperty(Accessor accessor,Long defValue, String... names)
- {
- super(accessor,defValue, names);
- }
-
- @Override
- protected Long getByName(String name)
- {
- return getAccessor().getLong(name);
- }
- }
-
- static class QpidStringProperty extends QpidProperty<String>
- {
- QpidStringProperty(String defValue, String... names)
- {
- super(defValue, names);
- }
-
- QpidStringProperty(Accessor accessor,String defValue, String... names)
- {
- super(accessor,defValue, names);
- }
-
- @Override
- protected String getByName(String name)
- {
- return getAccessor().getString(name);
- }
- }
-
- static class QpidFloatProperty extends QpidProperty<Float>
- {
- QpidFloatProperty(Float defValue, String... names)
- {
- super(defValue, names);
- }
-
- QpidFloatProperty(Accessor accessor,Float defValue, String... names)
- {
- super(accessor,defValue, names);
- }
-
- @Override
- protected Float getByName(String name)
- {
- return getAccessor().getFloat(name);
- }
- }
-
-} \ No newline at end of file
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/Validator.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/Validator.java
deleted file mode 100644
index e65bddf10b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/Validator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.configuration;
-
-
-public interface Validator
-{
- public void validate(Integer value);
-
- public void validate(Long value);
-
- public void validate(String value);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/dtx/XidImpl.java b/qpid/java/common/src/main/java/org/apache/qpid/dtx/XidImpl.java
deleted file mode 100644
index 2d017b1cd4..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/dtx/XidImpl.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpid.dtx;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.AMQInvalidArgumentException;
-
-import javax.transaction.xa.Xid;
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * Implements javax.transaction.dtx.Xid
- */
-public class XidImpl implements Xid
-{
- /**
- * this session's logger
- */
- private static final Logger _logger = LoggerFactory.getLogger(XidImpl.class);
-
- /**
- * the transaction branch identifier part of XID as an array of bytes
- */
- private byte[] _branchQualifier;
-
- /**
- * the format identifier part of the XID.
- */
- private int _formatID;
-
- /**
- * the global transaction identifier part of XID as an array of bytes.
- */
- private byte[] _globalTransactionID;
-
- //--- Constructors
-
- /**
- * Create new Xid.
- * this is an empty constructor.
- */
- public XidImpl()
- {
-
- }
-
- /**
- * Create a new XidImpl from an existing Xid.
- * <p> Usefull for casting external Xids
- *
- * @param xid Foreign Xid.
- */
- public XidImpl(Xid xid)
- {
- _branchQualifier = xid.getBranchQualifier();
- _formatID = xid.getFormatId();
- _globalTransactionID = xid.getGlobalTransactionId();
- }
-
- /**
- * Create a new Xid.
- *
- * @param branchQualifier The transaction branch identifier part of XID as an array of bytes.
- * @param format The format identifier part of the XID.
- * @param globalTransactionID The global transaction identifier part of XID as an array of bytes.
- */
- public XidImpl(byte[] branchQualifier, int format, byte[] globalTransactionID)
- {
- _branchQualifier = branchQualifier;
- _formatID = format;
- _globalTransactionID = globalTransactionID;
- }
-
- /**
- * Create a new Xid form its String form
- * 4 1 1 g b
- * +---+---+---+---+---+---+---+- -+---+---+- -+---+
- * | format_id | g | b | txn-id | br-id |
- * +---+---+---+---+---+---+---+- -+---+---+- -+---+
- * 0 4 5 6 6+g 6+g+b
- * format_id: an implementation specific format identifier
- * <p>
- * gtrid_length: how many bytes of this form the transaction id
- * <p>
- * bqual_length: how many bytes of this form the branch id
- * <p>
- * data: a sequence of octets of at most 128 bytes containing the txn id and the
- * branch id
- * <p>
- * Note - The sum of the two lengths must equal the length of the data field.
- *
- * @param xid an XID STring Form
- * @throws AMQInvalidArgumentException If the string does not represent a valid Xid
- */
- public XidImpl(String xid) throws AMQInvalidArgumentException
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("converting string " + xid + " into XidImpl");
- }
- try
- {
- DataInputStream input = new DataInputStream(new ByteArrayInputStream(xid.getBytes()));
- _formatID = (int) input.readLong();
- int g = input.readByte();
- int b = input.readByte();
- _globalTransactionID = new byte[g];
- _branchQualifier = new byte[b];
- if (input.read(_globalTransactionID, 0, g) != g)
- {
- throw new AMQInvalidArgumentException("Cannot convert the string " + xid + " into an Xid", null);
- }
- if (input.read(_branchQualifier, 0, b) != b)
- {
- throw new AMQInvalidArgumentException("Cannot convert the string " + xid + " into an Xid", null);
- }
- }
- catch (IOException e)
- {
- throw new AMQInvalidArgumentException("cannot convert the string " + xid + " into an Xid", e);
- }
- }
-
- //--- Xid interface implementation
-
- /**
- * Format identifier. O means the OSI CCR format.
- *
- * @return Global transaction identifier.
- */
- public byte[] getGlobalTransactionId()
- {
- return _globalTransactionID;
- }
-
- /**
- * Obtain the transaction branch identifier part of XID as an array of bytes.
- *
- * @return Branch identifier part of XID.
- */
- public byte[] getBranchQualifier()
- {
- return _branchQualifier;
- }
-
- /**
- * Obtain the format identifier part of the XID.
- *
- * @return Format identifier. O means the OSI CCR format.
- */
- public int getFormatId()
- {
- return _formatID;
- }
-
- //--- Object operations
-
- /**
- * Indicates whether some other Xid is "equal to" this one.
- * <p> Two Xids are equal if and only if their three elementary parts are equal
- *
- * @param o the object to compare this <code>XidImpl</code> against.
- * @return true if the <code>XidImpl</code> are equal, false otherwise.
- */
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o instanceof XidImpl)
- {
- XidImpl other = (XidImpl) o;
- if (_formatID == other.getFormatId())
- {
- if (_branchQualifier.length == other.getBranchQualifier().length)
- {
- for (int i = 0; i < _branchQualifier.length; i++)
- {
- if (_branchQualifier[i] != other.getBranchQualifier()[i])
- {
- return false;
- }
- }
- if (_globalTransactionID.length == other.getGlobalTransactionId().length)
- {
- for (int i = 0; i < _globalTransactionID.length; i++)
- {
- if (_globalTransactionID[i] != other.getGlobalTransactionId()[i])
- {
- return false;
- }
- }
- // everithing is equal
- return true;
- }
- }
- }
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- int result = _branchQualifier != null ? Arrays.hashCode(_branchQualifier) : 0;
- result = 31 * result + _formatID;
- result = 31 * result + (_globalTransactionID != null ? Arrays.hashCode(_globalTransactionID) : 0);
- return result;
- }
-
- //-- Static helper method
- /**
- * Convert an Xid into the AMQP String format.
- *
- * 4 1 1 g b
- * +---+---+---+---+---+---+---+- -+---+---+- -+---+
- * | format_id | g | b | txn-id | br-id |
- * +---+---+---+---+---+---+---+- -+---+---+- -+---+
- * 0 4 5 6 6+g 6+g+b
- * format_id: an implementation specific format identifier
- * <p>
- * gtrid_length: how many bytes of this form the transaction id
- * <p>
- * bqual_length: how many bytes of this form the branch id
- * <p>
- * data: a sequence of octets of at most 128 bytes containing the txn id and the
- * branch id
- * <p>
- * Note - The sum of the two lengths must equal the length of the data field.
- *
- * @param xid an Xid to convert.
- * @return The String representation of this Xid
- */
- public static org.apache.qpid.transport.Xid convert(Xid xid)
- {
- return new org.apache.qpid.transport.Xid(xid.getFormatId(),
- xid.getGlobalTransactionId(),
- xid.getBranchQualifier());
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/exchange/ExchangeDefaults.java b/qpid/java/common/src/main/java/org/apache/qpid/exchange/ExchangeDefaults.java
deleted file mode 100644
index 9384002a72..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/exchange/ExchangeDefaults.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.exchange;
-
-/**
- * Defines the names of the standard AMQP exchanges that every AMQP broker should provide. These exchange names
- * and type are given in the specification.
- *
- * <p>
- * TODO A type safe enum, might be more appropriate for the exchange types.
- */
-public class ExchangeDefaults
-{
- private ExchangeDefaults()
- {
- }
-
- /** The default direct exchange, which is a special internal exchange that cannot be explicitly bound to. */
- public static final String DEFAULT_EXCHANGE_NAME = "";
-
- /** The pre-defined topic exchange, the broker SHOULD provide this. */
- public static final String TOPIC_EXCHANGE_NAME = "amq.topic";
-
- /** Defines the identifying type name of topic exchanges. */
- public static final String TOPIC_EXCHANGE_CLASS = "topic";
-
- /** The pre-defined direct exchange, the broker MUST provide this. */
- public static final String DIRECT_EXCHANGE_NAME = "amq.direct";
-
- /** Defines the identifying type name of direct exchanges. */
- public static final String DIRECT_EXCHANGE_CLASS = "direct";
-
- /** The pre-defined headers exchange, the specification does not say this needs to be provided. */
- public static final String HEADERS_EXCHANGE_NAME = "amq.match";
-
- /** Defines the identifying type name of headers exchanges. */
- public static final String HEADERS_EXCHANGE_CLASS = "headers";
-
- /** The pre-defined fanout exchange, the boker MUST provide this. */
- public static final String FANOUT_EXCHANGE_NAME = "amq.fanout";
-
- /** Defines the identifying type name of fanout exchanges. */
- public static final String FANOUT_EXCHANGE_CLASS = "fanout";
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/ArithmeticExpression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/ArithmeticExpression.java
deleted file mode 100644
index 35a7c93043..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/ArithmeticExpression.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-/**
- * An expression which performs an operation on two expression values
- */
-public abstract class ArithmeticExpression extends BinaryExpression
-{
-
- protected static final int INTEGER = 1;
- protected static final int LONG = 2;
- protected static final int DOUBLE = 3;
-
- public ArithmeticExpression(Expression left, Expression right)
- {
- super(left, right);
- }
-
- public static Expression createPlus(Expression left, Expression right)
- {
- return new ArithmeticExpression(left, right)
- {
- protected Object evaluate(Object lvalue, Object rvalue)
- {
- if (lvalue instanceof String)
- {
- String text = (String) lvalue;
- String answer = text + rvalue;
-
- return answer;
- }
- else if (lvalue instanceof Number)
- {
- return plus((Number) lvalue, asNumber(rvalue));
- }
-
- throw new SelectorParsingException("Cannot call plus operation on: " + lvalue + " and: " + rvalue);
- }
-
- public String getExpressionSymbol()
- {
- return "+";
- }
- };
- }
-
- public static Expression createMinus(Expression left, Expression right)
- {
- return new ArithmeticExpression(left, right)
- {
- protected Object evaluate(Object lvalue, Object rvalue)
- {
- if (lvalue instanceof Number)
- {
- return minus((Number) lvalue, asNumber(rvalue));
- }
-
- throw new SelectorParsingException("Cannot call minus operation on: " + lvalue + " and: " + rvalue);
- }
-
- public String getExpressionSymbol()
- {
- return "-";
- }
- };
- }
-
- public static Expression createMultiply(Expression left, Expression right)
- {
- return new ArithmeticExpression(left, right)
- {
-
- protected Object evaluate(Object lvalue, Object rvalue)
- {
- if (lvalue instanceof Number)
- {
- return multiply((Number) lvalue, asNumber(rvalue));
- }
-
- throw new SelectorParsingException("Cannot call multiply operation on: " + lvalue + " and: " + rvalue);
- }
-
- public String getExpressionSymbol()
- {
- return "*";
- }
- };
- }
-
- public static Expression createDivide(Expression left, Expression right)
- {
- return new ArithmeticExpression(left, right)
- {
-
- protected Object evaluate(Object lvalue, Object rvalue)
- {
- if (lvalue instanceof Number)
- {
- return divide((Number) lvalue, asNumber(rvalue));
- }
-
- throw new SelectorParsingException("Cannot call divide operation on: " + lvalue + " and: " + rvalue);
- }
-
- public String getExpressionSymbol()
- {
- return "/";
- }
- };
- }
-
- public static Expression createMod(Expression left, Expression right)
- {
- return new ArithmeticExpression(left, right)
- {
-
- protected Object evaluate(Object lvalue, Object rvalue)
- {
- if (lvalue instanceof Number)
- {
- return mod((Number) lvalue, asNumber(rvalue));
- }
-
- throw new SelectorParsingException("Cannot call mod operation on: " + lvalue + " and: " + rvalue);
- }
-
- public String getExpressionSymbol()
- {
- return "%";
- }
- };
- }
-
- protected Number plus(Number left, Number right)
- {
- switch (numberType(left, right))
- {
-
- case INTEGER:
- return Integer.valueOf(left.intValue() + right.intValue());
-
- case LONG:
- return Long.valueOf(left.longValue() + right.longValue());
-
- default:
- return Double.valueOf(left.doubleValue() + right.doubleValue());
- }
- }
-
- protected Number minus(Number left, Number right)
- {
- switch (numberType(left, right))
- {
-
- case INTEGER:
- return Integer.valueOf(left.intValue() - right.intValue());
-
- case LONG:
- return Long.valueOf(left.longValue() - right.longValue());
-
- default:
- return Double.valueOf(left.doubleValue() - right.doubleValue());
- }
- }
-
- protected Number multiply(Number left, Number right)
- {
- switch (numberType(left, right))
- {
-
- case INTEGER:
- return Integer.valueOf(left.intValue() * right.intValue());
-
- case LONG:
- return Long.valueOf(left.longValue() * right.longValue());
-
- default:
- return Double.valueOf(left.doubleValue() * right.doubleValue());
- }
- }
-
- protected Number divide(Number left, Number right)
- {
- return Double.valueOf(left.doubleValue() / right.doubleValue());
- }
-
- protected Number mod(Number left, Number right)
- {
- return Double.valueOf(left.doubleValue() % right.doubleValue());
- }
-
- private int numberType(Number left, Number right)
- {
- if (isDouble(left) || isDouble(right))
- {
- return DOUBLE;
- }
- else if ((left instanceof Long) || (right instanceof Long))
- {
- return LONG;
- }
- else
- {
- return INTEGER;
- }
- }
-
- private boolean isDouble(Number n)
- {
- return (n instanceof Float) || (n instanceof Double);
- }
-
- protected Number asNumber(Object value)
- {
- if (value instanceof Number)
- {
- return (Number) value;
- }
- else
- {
- throw new SelectorParsingException("Cannot convert value: " + value + " into a number");
- }
- }
-
- public Object evaluate(FilterableMessage message)
- {
- Object lvalue = getLeft().evaluate(message);
- if (lvalue == null)
- {
- return null;
- }
-
- Object rvalue = getRight().evaluate(message);
- if (rvalue == null)
- {
- return null;
- }
-
- return evaluate(lvalue, rvalue);
- }
-
- protected abstract Object evaluate(Object lvalue, Object rvalue);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/BinaryExpression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/BinaryExpression.java
deleted file mode 100644
index 47f97ea908..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/BinaryExpression.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-/**
- * An expression which performs an operation on two expression values.
- */
-public abstract class BinaryExpression implements Expression
-{
- private final Expression left;
- private final Expression right;
-
- public BinaryExpression(Expression left, Expression right)
- {
- this.left = left;
- this.right = right;
- }
-
- public Expression getLeft()
- {
- return left;
- }
-
- public Expression getRight()
- {
- return right;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- return "(" + left.toString() + " " + getExpressionSymbol() + " " + right.toString() + ")";
- }
-
- /**
- * TODO: more efficient hashCode()
- *
- * @see java.lang.Object#hashCode()
- */
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- /**
- * TODO: more efficient hashCode()
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o)
- {
-
- if ((o == null) || !this.getClass().equals(o.getClass()))
- {
- return false;
- }
-
- return toString().equals(o.toString());
-
- }
-
- /**
- * Returns the symbol that represents this binary expression. For example, addition is
- * represented by "+"
- *
- * @return the expression symbol
- */
- public abstract String getExpressionSymbol();
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/BooleanExpression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/BooleanExpression.java
deleted file mode 100644
index 5b1cf54680..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/BooleanExpression.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-/**
- * A BooleanExpression is an expression that always
- * produces a Boolean result.
- */
-public interface BooleanExpression extends Expression
-{
-
- /**
- * @param message message to match
- * @return true if the expression evaluates to Boolean.TRUE.
- */
- public boolean matches(FilterableMessage message);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java
deleted file mode 100644
index 76f743000b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.regex.Pattern;
-
-/**
- * A filter performing a comparison of two objects
- */
-public abstract class ComparisonExpression extends BinaryExpression implements BooleanExpression
-{
-
- public static BooleanExpression createBetween(Expression value, Expression left, Expression right)
- {
- return LogicExpression.createAND(createGreaterThanEqual(value, left), createLessThanEqual(value, right));
- }
-
- public static BooleanExpression createNotBetween(Expression value, Expression left, Expression right)
- {
- return LogicExpression.createOR(createLessThan(value, left), createGreaterThan(value, right));
- }
-
- private static final HashSet<Character> REGEXP_CONTROL_CHARS = new HashSet<Character>();
-
- static
- {
- REGEXP_CONTROL_CHARS.add('.');
- REGEXP_CONTROL_CHARS.add('\\');
- REGEXP_CONTROL_CHARS.add('[');
- REGEXP_CONTROL_CHARS.add(']');
- REGEXP_CONTROL_CHARS.add('^');
- REGEXP_CONTROL_CHARS.add('$');
- REGEXP_CONTROL_CHARS.add('?');
- REGEXP_CONTROL_CHARS.add('*');
- REGEXP_CONTROL_CHARS.add('+');
- REGEXP_CONTROL_CHARS.add('{');
- REGEXP_CONTROL_CHARS.add('}');
- REGEXP_CONTROL_CHARS.add('|');
- REGEXP_CONTROL_CHARS.add('(');
- REGEXP_CONTROL_CHARS.add(')');
- REGEXP_CONTROL_CHARS.add(':');
- REGEXP_CONTROL_CHARS.add('&');
- REGEXP_CONTROL_CHARS.add('<');
- REGEXP_CONTROL_CHARS.add('>');
- REGEXP_CONTROL_CHARS.add('=');
- REGEXP_CONTROL_CHARS.add('!');
- }
-
- static class LikeExpression extends UnaryExpression implements BooleanExpression
- {
-
- private Pattern likePattern;
-
- public LikeExpression(Expression right, String like, int escape)
- {
- super(right);
-
- StringBuffer regexp = new StringBuffer(like.length() * 2);
- regexp.append("\\A"); // The beginning of the input
- for (int i = 0; i < like.length(); i++)
- {
- char c = like.charAt(i);
- if (escape == (0xFFFF & c))
- {
- i++;
- if (i >= like.length())
- {
- // nothing left to escape...
- break;
- }
-
- char t = like.charAt(i);
- regexp.append("\\x");
- regexp.append(Integer.toHexString(0xFFFF & t));
- }
- else if (c == '%')
- {
- regexp.append(".*?"); // Do a non-greedy match
- }
- else if (c == '_')
- {
- regexp.append("."); // match one
- }
- else if (REGEXP_CONTROL_CHARS.contains(c))
- {
- regexp.append("\\x");
- regexp.append(Integer.toHexString(0xFFFF & c));
- }
- else
- {
- regexp.append(c);
- }
- }
-
- regexp.append("\\z"); // The end of the input
-
- likePattern = Pattern.compile(regexp.toString(), Pattern.DOTALL);
- }
-
- /**
- * org.apache.activemq.filter.UnaryExpression#getExpressionSymbol()
- */
- public String getExpressionSymbol()
- {
- return "LIKE";
- }
-
- /**
- * org.apache.activemq.filter.Expression#evaluate(MessageEvaluationContext)
- */
- public Object evaluate(FilterableMessage message)
- {
-
- Object rv = this.getRight().evaluate(message);
-
- if (rv == null)
- {
- return null;
- }
-
- if (!(rv instanceof String))
- {
- return
- Boolean.FALSE;
- }
-
- return likePattern.matcher((String) rv).matches() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public boolean matches(FilterableMessage message)
- {
- Object object = evaluate(message);
-
- return (object != null) && (object == Boolean.TRUE);
- }
- }
-
- public static BooleanExpression createLike(Expression left, String right, String escape)
- {
- if ((escape != null) && (escape.length() != 1))
- {
- throw new SelectorParsingException(
- "The ESCAPE string literal is invalid. It can only be one character. Litteral used: " + escape);
- }
-
- int c = -1;
- if (escape != null)
- {
- c = 0xFFFF & escape.charAt(0);
- }
-
- return new LikeExpression(left, right, c);
- }
-
- public static BooleanExpression createNotLike(Expression left, String right, String escape)
- {
- return UnaryExpression.createNOT(createLike(left, right, escape));
- }
-
- public static BooleanExpression createInFilter(Expression left, List elements)
- {
-
- if (!(left instanceof PropertyExpression))
- {
- throw new SelectorParsingException("Expected a property for In expression, got: " + left);
- }
-
- return UnaryExpression.createInExpression((PropertyExpression) left, elements, false);
-
- }
-
- public static BooleanExpression createNotInFilter(Expression left, List elements)
- {
-
- if (!(left instanceof PropertyExpression))
- {
- throw new SelectorParsingException("Expected a property for In expression, got: " + left);
- }
-
- return UnaryExpression.createInExpression((PropertyExpression) left, elements, true);
-
- }
-
- public static BooleanExpression createIsNull(Expression left)
- {
- return doCreateEqual(left, ConstantExpression.NULL);
- }
-
- public static BooleanExpression createIsNotNull(Expression left)
- {
- return UnaryExpression.createNOT(doCreateEqual(left, ConstantExpression.NULL));
- }
-
- public static BooleanExpression createNotEqual(Expression left, Expression right)
- {
- return UnaryExpression.createNOT(createEqual(left, right));
- }
-
- public static BooleanExpression createEqual(Expression left, Expression right)
- {
- checkEqualOperand(left);
- checkEqualOperand(right);
- checkEqualOperandCompatability(left, right);
-
- return doCreateEqual(left, right);
- }
-
- private static BooleanExpression doCreateEqual(Expression left, Expression right)
- {
- return new EqualExpression(left, right);
- }
-
- public static BooleanExpression createGreaterThan(final Expression left, final Expression right)
- {
- checkLessThanOperand(left);
- checkLessThanOperand(right);
-
- return new ComparisonExpression(left, right)
- {
- protected boolean asBoolean(int answer)
- {
- return answer > 0;
- }
-
- public String getExpressionSymbol()
- {
- return ">";
- }
- };
- }
-
- public static BooleanExpression createGreaterThanEqual(final Expression left, final Expression right)
- {
- checkLessThanOperand(left);
- checkLessThanOperand(right);
-
- return new ComparisonExpression(left, right)
- {
- protected boolean asBoolean(int answer)
- {
- return answer >= 0;
- }
-
- public String getExpressionSymbol()
- {
- return ">=";
- }
- };
- }
-
- public static BooleanExpression createLessThan(final Expression left, final Expression right)
- {
- checkLessThanOperand(left);
- checkLessThanOperand(right);
-
- return new ComparisonExpression(left, right)
- {
-
- protected boolean asBoolean(int answer)
- {
- return answer < 0;
- }
-
- public String getExpressionSymbol()
- {
- return "<";
- }
-
- };
- }
-
- public static BooleanExpression createLessThanEqual(final Expression left, final Expression right)
- {
- checkLessThanOperand(left);
- checkLessThanOperand(right);
-
- return new ComparisonExpression(left, right)
- {
-
- protected boolean asBoolean(int answer)
- {
- return answer <= 0;
- }
-
- public String getExpressionSymbol()
- {
- return "<=";
- }
- };
- }
-
- /**
- * Only Numeric expressions can be used in {@literal >, >=, < or <=} expressions.
- *
- * @param expr expression to check
- */
- public static void checkLessThanOperand(Expression expr)
- {
- if (expr instanceof ConstantExpression)
- {
- Object value = ((ConstantExpression) expr).getValue();
- if (value instanceof Number)
- {
- return;
- }
-
- // Else it's boolean or a String..
- throw new SelectorParsingException("Value '" + expr + "' cannot be compared.");
- }
-
- if (expr instanceof BooleanExpression)
- {
- throw new SelectorParsingException("Value '" + expr + "' cannot be compared.");
- }
- }
-
- /**
- * Validates that the expression can be used in {@literal == or <>} expression.
- * Cannot not be NULL TRUE or FALSE literals.
- *
- * @param expr expression to check
- */
- public static void checkEqualOperand(Expression expr)
- {
- if (expr instanceof ConstantExpression)
- {
- Object value = ((ConstantExpression) expr).getValue();
- if (value == null)
- {
- throw new SelectorParsingException("'" + expr + "' cannot be compared.");
- }
- }
- }
-
- /**
- *
- * @param left
- * @param right
- */
- private static void checkEqualOperandCompatability(Expression left, Expression right)
- {
- if ((left instanceof ConstantExpression) && (right instanceof ConstantExpression))
- {
- if ((left instanceof BooleanExpression) && !(right instanceof BooleanExpression))
- {
- throw new SelectorParsingException("'" + left + "' cannot be compared with '" + right + "'");
- }
- }
- }
-
- public ComparisonExpression(Expression left, Expression right)
- {
- super(left, right);
- }
-
- public Object evaluate(FilterableMessage message)
- {
- Comparable lv = (Comparable) getLeft().evaluate(message);
- if (lv == null)
- {
- return null;
- }
-
- Comparable rv = (Comparable) getRight().evaluate(message);
- if (rv == null)
- {
- return null;
- }
-
- return compare(lv, rv);
- }
-
- protected Boolean compare(Comparable lv, Comparable rv)
- {
- Class lc = lv.getClass();
- Class rc = rv.getClass();
- // If the the objects are not of the same type,
- // try to convert up to allow the comparison.
- if (lc != rc)
- {
- if (lc == Byte.class)
- {
- if (rc == Short.class)
- {
- lv = ((Number) lv).shortValue();
- }
- else if (rc == Integer.class)
- {
- lv = ((Number) lv).intValue();
- }
- else if (rc == Long.class)
- {
- lv = ((Number) lv).longValue();
- }
- else if (rc == Float.class)
- {
- lv = ((Number) lv).floatValue();
- }
- else if (rc == Double.class)
- {
- lv = ((Number) lv).doubleValue();
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Short.class)
- {
- if (rc == Integer.class)
- {
- lv = ((Number) lv).intValue();
- }
- else if (rc == Long.class)
- {
- lv = ((Number) lv).longValue();
- }
- else if (rc == Float.class)
- {
- lv = ((Number) lv).floatValue();
- }
- else if (rc == Double.class)
- {
- lv = ((Number) lv).doubleValue();
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Integer.class)
- {
- if (rc == Long.class)
- {
- lv = ((Number) lv).longValue();
- }
- else if (rc == Float.class)
- {
- lv = ((Number) lv).floatValue();
- }
- else if (rc == Double.class)
- {
- lv = ((Number) lv).doubleValue();
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Long.class)
- {
- if (rc == Integer.class)
- {
- rv = ((Number) rv).longValue();
- }
- else if (rc == Float.class)
- {
- lv = ((Number) lv).floatValue();
- }
- else if (rc == Double.class)
- {
- lv = ((Number) lv).doubleValue();
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Float.class)
- {
- if (rc == Integer.class)
- {
- rv = ((Number) rv).floatValue();
- }
- else if (rc == Long.class)
- {
- rv = ((Number) rv).floatValue();
- }
- else if (rc == Double.class)
- {
- lv = ((Number) lv).doubleValue();
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Double.class)
- {
- if (rc == Integer.class)
- {
- rv = ((Number) rv).doubleValue();
- }
- else if (rc == Long.class)
- {
- rv = ((Number) rv).doubleValue();
- }
- else if (rc == Float.class)
- {
- rv = ((Number) rv).doubleValue();
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else
- {
- return Boolean.FALSE;
- }
- }
-
- return asBoolean(lv.compareTo(rv)) ? Boolean.TRUE : Boolean.FALSE;
- }
-
- protected abstract boolean asBoolean(int answer);
-
- public boolean matches(FilterableMessage message)
- {
- Object object = evaluate(message);
-
- return (object != null) && (object == Boolean.TRUE);
- }
-
- private static class EqualExpression extends ComparisonExpression
- {
- public EqualExpression(final Expression left, final Expression right)
- {
- super(left, right);
- }
-
- public Object evaluate(FilterableMessage message)
- {
- Object lv = getLeft().evaluate(message);
- Object rv = getRight().evaluate(message);
-
- // Iff one of the values is null
- if ((lv == null) ^ (rv == null))
- {
- return Boolean.FALSE;
- }
-
- if ((lv == rv) || lv.equals(rv))
- {
- return Boolean.TRUE;
- }
-
- if ((lv instanceof Comparable) && (rv instanceof Comparable))
- {
- return compare((Comparable) lv, (Comparable) rv);
- }
-
- return Boolean.FALSE;
- }
-
- protected boolean asBoolean(int answer)
- {
- return answer == 0;
- }
-
- public String getExpressionSymbol()
- {
- return "=";
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/ConstantExpression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/ConstantExpression.java
deleted file mode 100644
index 9d8509b303..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/ConstantExpression.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import java.math.BigDecimal;
-
-/**
- * Represents a constant expression
- */
-public class ConstantExpression implements Expression
-{
-
- static class BooleanConstantExpression extends ConstantExpression implements BooleanExpression
- {
- public BooleanConstantExpression(Object value)
- {
- super(value);
- }
-
- public boolean matches(FilterableMessage message)
- {
- Object object = evaluate(message);
-
- return (object != null) && (object == Boolean.TRUE);
- }
- }
-
- public static final BooleanConstantExpression NULL = new BooleanConstantExpression(null);
- public static final BooleanConstantExpression TRUE = new BooleanConstantExpression(Boolean.TRUE);
- public static final BooleanConstantExpression FALSE = new BooleanConstantExpression(Boolean.FALSE);
-
- private Object _value;
-
- public static ConstantExpression createFromDecimal(String text)
- {
-
- // Strip off the 'l' or 'L' if needed.
- if (text.endsWith("l") || text.endsWith("L"))
- {
- text = text.substring(0, text.length() - 1);
- }
-
- Number value;
- try
- {
- value = Long.valueOf(text);
- }
- catch (NumberFormatException e)
- {
- // The number may be too big to fit in a long.
- value = new BigDecimal(text);
- }
-
- long l = value.longValue();
- if ((Integer.MIN_VALUE <= l) && (l <= Integer.MAX_VALUE))
- {
- value = value.intValue();
- }
-
- return new ConstantExpression(value);
- }
-
- public static ConstantExpression createFromHex(String text)
- {
- Number value = Long.parseLong(text.substring(2), 16);
- long l = value.longValue();
- if ((Integer.MIN_VALUE <= l) && (l <= Integer.MAX_VALUE))
- {
- value = value.intValue();
- }
-
- return new ConstantExpression(value);
- }
-
- public static ConstantExpression createFromOctal(String text)
- {
- Number value = Long.parseLong(text, 8);
- long l = value.longValue();
- if ((Integer.MIN_VALUE <= l) && (l <= Integer.MAX_VALUE))
- {
- value = value.intValue();
- }
-
- return new ConstantExpression(value);
- }
-
- public static ConstantExpression createFloat(String text)
- {
- Number value = new Double(text);
-
- return new ConstantExpression(value);
- }
-
- public ConstantExpression(Object value)
- {
- this._value = value;
- }
-
- public Object evaluate(FilterableMessage message)
- {
- return _value;
- }
-
- public Object getValue()
- {
- return _value;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- if (_value == null)
- {
- return "NULL";
- }
-
- if (_value instanceof Boolean)
- {
- return ((Boolean) _value) ? "TRUE" : "FALSE";
- }
-
- if (_value instanceof String)
- {
- return encodeString((String) _value);
- }
-
- return _value.toString();
- }
-
- /**
- * TODO: more efficient hashCode()
- *
- * @see java.lang.Object#hashCode()
- */
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- /**
- * TODO: more efficient hashCode()
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o)
- {
-
- if ((o == null) || !this.getClass().equals(o.getClass()))
- {
- return false;
- }
-
- return toString().equals(o.toString());
-
- }
-
- /**
- * Encodes the value of string so that it looks like it would look like
- * when it was provided in a selector.
- *
- * @param s string to encode
- * @return encoded string
- */
- public static String encodeString(String s)
- {
- StringBuilder b = new StringBuilder();
- b.append('\'');
- for (int i = 0; i < s.length(); i++)
- {
- char c = s.charAt(i);
- if (c == '\'')
- {
- b.append(c);
- }
-
- b.append(c);
- }
-
- b.append('\'');
-
- return b.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/Expression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/Expression.java
deleted file mode 100644
index 64630c142e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/Expression.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-/**
- * Represents an expression
- */
-public interface Expression
-{
-
- /**
- * @param message message to evaluate
- * @return the value of this expression
- */
- public Object evaluate(FilterableMessage message);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/FilterableMessage.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/FilterableMessage.java
deleted file mode 100644
index 98c34bafd2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/FilterableMessage.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.qpid.filter;
-
-public interface FilterableMessage
-{
-
- boolean isPersistent();
-
- boolean isRedelivered();
-
- Object getHeader(String name);
-
- String getReplyTo();
-
- String getType();
-
- byte getPriority();
-
- String getMessageId();
-
- long getTimestamp();
-
- String getCorrelationId();
-
- long getExpiration();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/LogicExpression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/LogicExpression.java
deleted file mode 100644
index 6de3a03ee0..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/LogicExpression.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-/**
- * A filter performing a comparison of two objects
- */
-public abstract class LogicExpression extends BinaryExpression implements BooleanExpression
-{
-
- public static BooleanExpression createOR(BooleanExpression lvalue, BooleanExpression rvalue)
- {
- return new OrExpression(lvalue, rvalue);
- }
-
- public static BooleanExpression createAND(BooleanExpression lvalue, BooleanExpression rvalue)
- {
- return new AndExpression(lvalue, rvalue);
- }
-
- public LogicExpression(BooleanExpression left, BooleanExpression right)
- {
- super(left, right);
- }
-
- public abstract Object evaluate(FilterableMessage message);
-
- public boolean matches(FilterableMessage message)
- {
- Object object = evaluate(message);
-
- return (object != null) && (object == Boolean.TRUE);
- }
-
- private static class OrExpression extends LogicExpression
- {
- public OrExpression(final BooleanExpression lvalue, final BooleanExpression rvalue)
- {
- super(lvalue, rvalue);
- }
-
- public Object evaluate(FilterableMessage message)
- {
-
- Boolean lv = (Boolean) getLeft().evaluate(message);
- // Can we do an OR shortcut??
- if ((lv != null) && lv.booleanValue())
- {
- return Boolean.TRUE;
- }
-
- Boolean rv = (Boolean) getRight().evaluate(message);
-
- return (rv == null) ? null : rv;
- }
-
- public String getExpressionSymbol()
- {
- return "OR";
- }
- }
-
- private static class AndExpression extends LogicExpression
- {
- public AndExpression(final BooleanExpression lvalue, final BooleanExpression rvalue)
- {
- super(lvalue, rvalue);
- }
-
- public Object evaluate(FilterableMessage message)
- {
-
- Boolean lv = (Boolean) getLeft().evaluate(message);
-
- // Can we do an AND shortcut??
- if (lv == null)
- {
- return null;
- }
-
- if (!lv.booleanValue())
- {
- return Boolean.FALSE;
- }
-
- Boolean rv = (Boolean) getRight().evaluate(message);
-
- return (rv == null) ? null : rv;
- }
-
- public String getExpressionSymbol()
- {
- return "AND";
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/PropertyExpression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/PropertyExpression.java
deleted file mode 100644
index 4fb9c0e62f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/PropertyExpression.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-
-/**
- * Represents a property expression
- */
-public class PropertyExpression implements Expression
-{
- // Constants - defined the same as JMS
- private static enum JMSDeliveryMode { NON_PERSISTENT, PERSISTENT }
-
- private static final int DEFAULT_PRIORITY = 4;
-
- private static final Logger _logger = LoggerFactory.getLogger(PropertyExpression.class);
-
- private static final HashMap<String, Expression> JMS_PROPERTY_EXPRESSIONS = new HashMap<String, Expression>();
-
- {
- JMS_PROPERTY_EXPRESSIONS.put("JMSDestination", new Expression()
- {
- public Object evaluate(FilterableMessage message)
- {
- //TODO
- return null;
- }
- });
- JMS_PROPERTY_EXPRESSIONS.put("JMSReplyTo", new ReplyToExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSType", new TypeExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSDeliveryMode", new DeliveryModeExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSPriority", new PriorityExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSMessageID", new MessageIDExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("AMQMessageID", new MessageIDExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSTimestamp", new TimestampExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSCorrelationID", new CorrelationIdExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSExpiration", new ExpirationExpression());
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSRedelivered", new Expression()
- {
- public Object evaluate(FilterableMessage message)
- {
- return message.isRedelivered();
- }
- });
- }
-
- private final String name;
- private final Expression jmsPropertyExpression;
-
- public boolean outerTest()
- {
- return false;
- }
-
- public PropertyExpression(String name)
- {
- this.name = name;
-
-
-
- jmsPropertyExpression = JMS_PROPERTY_EXPRESSIONS.get(name);
- }
-
- public Object evaluate(FilterableMessage message)
- {
-
- if (jmsPropertyExpression != null)
- {
- return jmsPropertyExpression.evaluate(message);
- }
- else
- {
- return message.getHeader(name);
- }
- }
-
- public String getName()
- {
- return name;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- return name;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode()
- {
- return name.hashCode();
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o)
- {
-
- if ((o == null) || !this.getClass().equals(o.getClass()))
- {
- return false;
- }
-
- return name.equals(((PropertyExpression) o).name);
-
- }
-
- private static class ReplyToExpression implements Expression
- {
- public Object evaluate(FilterableMessage message)
- {
- String replyTo = message.getReplyTo();
- return replyTo;
- }
-
- }
-
- private static class TypeExpression implements Expression
- {
- public Object evaluate(FilterableMessage message)
- {
-
- String type = message.getType();
- return type;
-
- }
- }
-
- private static class DeliveryModeExpression implements Expression
- {
- public Object evaluate(FilterableMessage message)
- {
- JMSDeliveryMode mode = message.isPersistent() ? JMSDeliveryMode.PERSISTENT :
- JMSDeliveryMode.NON_PERSISTENT;
- if (_logger.isDebugEnabled())
- {
- _logger.debug("JMSDeliveryMode is :" + mode);
- }
-
- return mode.toString();
- }
- }
-
- private static class PriorityExpression implements Expression
- {
- public Object evaluate(FilterableMessage message)
- {
- byte priority = message.getPriority();
- return (int) priority;
- }
- }
-
- private static class MessageIDExpression implements Expression
- {
- public Object evaluate(FilterableMessage message)
- {
-
- String messageId = message.getMessageId();
-
- return messageId;
-
- }
- }
-
- private static class TimestampExpression implements Expression
- {
- public Object evaluate(FilterableMessage message)
- {
- long timestamp = message.getTimestamp();
- return timestamp;
- }
- }
-
- private static class CorrelationIdExpression implements Expression
- {
- public Object evaluate(FilterableMessage message)
- {
-
- String correlationId = message.getCorrelationId();
-
- return correlationId;
- }
- }
-
- private static class ExpirationExpression implements Expression
- {
- public Object evaluate(FilterableMessage message)
- {
- long expiration = message.getExpiration();
- return expiration;
-
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/SelectorParsingException.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/SelectorParsingException.java
deleted file mode 100644
index 53909a0009..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/SelectorParsingException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.qpid.filter;
-
-public class SelectorParsingException extends RuntimeException
-{
- public SelectorParsingException(String s)
- {
- super(s);
- }
-
- public SelectorParsingException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public SelectorParsingException(Throwable cause)
- {
- super(cause);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java
deleted file mode 100644
index b80b89840c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * An expression which performs an operation on two expression values
- */
-public abstract class UnaryExpression implements Expression
-{
-
- private static final BigDecimal BD_LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE);
- private Expression right;
-
- public static Expression createNegate(Expression left)
- {
- return new NegativeExpression(left);
- }
-
- public static BooleanExpression createInExpression(PropertyExpression right, List elements, final boolean not)
- {
-
- // Use a HashSet if there are many elements.
- Collection t;
- if (elements.size() == 0)
- {
- t = null;
- }
- else if (elements.size() < 5)
- {
- t = elements;
- }
- else
- {
- t = new HashSet(elements);
- }
-
- final Collection inList = t;
-
- return new InExpression(right, inList, not);
- }
-
- abstract static class BooleanUnaryExpression extends UnaryExpression implements BooleanExpression
- {
- public BooleanUnaryExpression(Expression left)
- {
- super(left);
- }
-
- public boolean matches(FilterableMessage message)
- {
- Object object = evaluate(message);
-
- return (object != null) && (object == Boolean.TRUE);
- }
- }
-
- public static BooleanExpression createNOT(BooleanExpression left)
- {
- return new NotExpression(left);
- }
-
- public static BooleanExpression createBooleanCast(Expression left)
- {
- return new BooleanCastExpression(left);
- }
-
- private static Number negate(Number left)
- {
- Class clazz = left.getClass();
- if (clazz == Integer.class)
- {
- return -left.intValue();
- }
- else if (clazz == Long.class)
- {
- return -left.longValue();
- }
- else if (clazz == Float.class)
- {
- return -left.floatValue();
- }
- else if (clazz == Double.class)
- {
- return -left.doubleValue();
- }
- else if (clazz == BigDecimal.class)
- {
- // We ussually get a big deciamal when we have Long.MIN_VALUE constant in the
- // Selector. Long.MIN_VALUE is too big to store in a Long as a positive so we store it
- // as a Big decimal. But it gets Negated right away.. to here we try to covert it back
- // to a Long.
- BigDecimal bd = (BigDecimal) left;
- bd = bd.negate();
-
- if (BD_LONG_MIN_VALUE.compareTo(bd) == 0)
- {
- return Long.MIN_VALUE;
- }
-
- return bd;
- }
- else
- {
- throw new SelectorParsingException("Don't know how to negate: " + left);
- }
- }
-
- public UnaryExpression(Expression left)
- {
- this.right = left;
- }
-
- public Expression getRight()
- {
- return right;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- return "(" + getExpressionSymbol() + " " + right.toString() + ")";
- }
-
- /**
- * TODO: more efficient hashCode()
- *
- * @see java.lang.Object#hashCode()
- */
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- /**
- * TODO: more efficient hashCode()
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o)
- {
- return ((o != null) && this.getClass().equals(o.getClass())) && toString().equals(o.toString());
- }
-
- /**
- * Returns the symbol that represents this binary expression. For example, addition is
- * represented by "+"
- *
- * @return symbol
- */
- public abstract String getExpressionSymbol();
-
- private static class NegativeExpression extends UnaryExpression
- {
- public NegativeExpression(final Expression left)
- {
- super(left);
- }
-
- public Object evaluate(FilterableMessage message)
- {
- Object rvalue = getRight().evaluate(message);
- if (rvalue == null)
- {
- return null;
- }
-
- if (rvalue instanceof Number)
- {
- return negate((Number) rvalue);
- }
-
- return null;
- }
-
- public String getExpressionSymbol()
- {
- return "-";
- }
- }
-
- private static class InExpression extends BooleanUnaryExpression
- {
- private final Collection _inList;
- private final boolean _not;
-
- public InExpression(final PropertyExpression right, final Collection inList, final boolean not)
- {
- super(right);
- _inList = inList;
- _not = not;
- }
-
- public Object evaluate(FilterableMessage message)
- {
-
- Object rvalue = getRight().evaluate(message);
- if (rvalue == null)
- {
- return null;
- }
-
- if (rvalue.getClass() != String.class)
- {
- return null;
- }
-
- if (((_inList != null) && _inList.contains(rvalue)) ^ _not)
- {
- return Boolean.TRUE;
- }
- else
- {
- return Boolean.FALSE;
- }
-
- }
-
- public String toString()
- {
- StringBuilder answer = new StringBuilder(String.valueOf(getRight()));
- answer.append(" ");
- answer.append(getExpressionSymbol());
- answer.append(" ( ");
-
- int count = 0;
- for (Object o : _inList)
- {
- if (count != 0)
- {
- answer.append(", ");
- }
-
- answer.append(o);
- count++;
- }
-
- answer.append(" )");
-
- return answer.toString();
- }
-
- public String getExpressionSymbol()
- {
- if (_not)
- {
- return "NOT IN";
- }
- else
- {
- return "IN";
- }
- }
- }
-
- private static class NotExpression extends BooleanUnaryExpression
- {
- public NotExpression(final BooleanExpression left)
- {
- super(left);
- }
-
- public Object evaluate(FilterableMessage message)
- {
- Boolean lvalue = (Boolean) getRight().evaluate(message);
- if (lvalue == null)
- {
- return null;
- }
-
- return lvalue ? Boolean.FALSE : Boolean.TRUE;
- }
-
- public String getExpressionSymbol()
- {
- return "NOT";
- }
- }
-
- private static class BooleanCastExpression extends BooleanUnaryExpression
- {
- public BooleanCastExpression(final Expression left)
- {
- super(left);
- }
-
- public Object evaluate(FilterableMessage message)
- {
- Object rvalue = getRight().evaluate(message);
- if (rvalue == null)
- {
- return null;
- }
-
- if (!rvalue.getClass().equals(Boolean.class))
- {
- return Boolean.FALSE;
- }
-
- return ((Boolean) rvalue) ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public String toString()
- {
- return getRight().toString();
- }
-
- public String getExpressionSymbol()
- {
- return "";
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/ParseException.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/ParseException.java
deleted file mode 100644
index bf28ada12b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/ParseException.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
-/* JavaCCOptions:KEEP_LINE_COL=null */
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.filter.selector;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-public class ParseException extends Exception {
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * This constructor is used by the method "generateParseException"
- * in the generated parser. Calling this constructor generates
- * a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set.
- */
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal,
- String[] tokenImageVal
- )
- {
- super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /**
- * The following constructors are for use by you for whatever
- * purpose you can think of. Constructing the exception in this
- * manner makes the exception behave in the normal way - i.e., as
- * documented in the class "Throwable". The fields "errorToken",
- * "expectedTokenSequences", and "tokenImage" do not contain
- * relevant information. The JavaCC generated code does not use
- * these constructors.
- */
-
- public ParseException() {
- super();
- }
-
- /** Constructor with message. */
- public ParseException(String message) {
- super(message);
- }
-
-
- /**
- * This is the last token that has been consumed successfully. If
- * this object has been created due to a parse error, the token
- * followng this token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array
- * of integers represents a sequence of tokens (by their ordinal
- * values) that is expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated
- * parser within which the parse error occurred. This array is
- * defined in the generated ...Constants interface.
- */
- public String[] tokenImage;
-
- /**
- * It uses "currentToken" and "expectedTokenSequences" to generate a parse
- * error message and returns it. If this object has been created
- * due to a parse error, and you do not catch it (it gets thrown
- * from the parser) the correct error message
- * gets displayed.
- */
- private static String initialise(Token currentToken,
- int[][] expectedTokenSequences,
- String[] tokenImage) {
- String eol = System.getProperty("line.separator", "\n");
- StringBuffer expected = new StringBuffer();
- int maxSize = 0;
- for (int i = 0; i < expectedTokenSequences.length; i++) {
- if (maxSize < expectedTokenSequences[i].length) {
- maxSize = expectedTokenSequences[i].length;
- }
- for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
- }
- if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
- expected.append("...");
- }
- expected.append(eol).append(" ");
- }
- String retval = "Encountered \"";
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++) {
- if (i != 0) retval += " ";
- if (tok.kind == 0) {
- retval += tokenImage[0];
- break;
- }
- retval += " " + tokenImage[tok.kind];
- retval += " \"";
- retval += add_escapes(tok.image);
- retval += " \"";
- tok = tok.next;
- }
- retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
- retval += "." + eol;
- if (expectedTokenSequences.length == 1) {
- retval += "Was expecting:" + eol + " ";
- } else {
- retval += "Was expecting one of:" + eol + " ";
- }
- retval += expected.toString();
- return retval;
- }
-
- /**
- * The end of line string for this machine.
- */
- protected String eol = System.getProperty("line.separator", "\n");
-
- /**
- * Used to convert raw characters to their escaped version
- * when these raw version cannot be used as part of an ASCII
- * string literal.
- */
- static String add_escapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
-}
-/* JavaCC - OriginalChecksum=d315306e736475f86f69c53861799960 (do not edit this line) */
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java
deleted file mode 100644
index ed85de9d8e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java
+++ /dev/null
@@ -1,1224 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. SelectorParser.java */
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.filter.selector;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-
-import org.apache.qpid.filter.ArithmeticExpression;
-import org.apache.qpid.filter.BooleanExpression;
-import org.apache.qpid.filter.ComparisonExpression;
-import org.apache.qpid.filter.ConstantExpression;
-import org.apache.qpid.filter.Expression;
-import org.apache.qpid.filter.LogicExpression;
-import org.apache.qpid.filter.PropertyExpression;
-import org.apache.qpid.filter.UnaryExpression;
-
-/**
- * JMS Selector Parser generated by JavaCC
- *
- * Do not edit this .java file directly - it is autogenerated from SelectorParser.jj
- */
-public class SelectorParser implements SelectorParserConstants {
-
- public SelectorParser()
- {
- this(new StringReader(""));
- }
-
- public BooleanExpression parse(String sql) throws ParseException
- {
- this.ReInit(new StringReader(sql));
-
- return this.JmsSelector();
-
- }
-
- private BooleanExpression asBooleanExpression(Expression value) throws ParseException
- {
- if (value instanceof BooleanExpression)
- {
- return (BooleanExpression) value;
- }
- if (value instanceof PropertyExpression)
- {
- return UnaryExpression.createBooleanCast( value );
- }
- throw new ParseException("Expression will not result in a boolean value: " + value);
- }
-
-// ----------------------------------------------------------------------------
-// Grammer
-// ----------------------------------------------------------------------------
- final public BooleanExpression JmsSelector() throws ParseException {
- Expression left=null;
- left = orExpression();
- {if (true) return asBooleanExpression(left);}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression orExpression() throws ParseException {
- Expression left;
- Expression right;
- left = andExpression();
- label_1:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case OR:
- ;
- break;
- default:
- break label_1;
- }
- jj_consume_token(OR);
- right = andExpression();
- left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression andExpression() throws ParseException {
- Expression left;
- Expression right;
- left = equalityExpression();
- label_2:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AND:
- ;
- break;
- default:
- break label_2;
- }
- jj_consume_token(AND);
- right = equalityExpression();
- left = LogicExpression.createAND(asBooleanExpression(left), asBooleanExpression(right));
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression equalityExpression() throws ParseException {
- Expression left;
- Expression right;
- left = comparisonExpression();
- label_3:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IS:
- case 27:
- case 28:
- ;
- break;
- default:
- break label_3;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case 27:
- jj_consume_token(27);
- right = comparisonExpression();
- left = ComparisonExpression.createEqual(left, right);
- break;
- case 28:
- jj_consume_token(28);
- right = comparisonExpression();
- left = ComparisonExpression.createNotEqual(left, right);
- break;
- default:
- if (jj_2_1(2)) {
- jj_consume_token(IS);
- jj_consume_token(NULL);
- left = ComparisonExpression.createIsNull(left);
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IS:
- jj_consume_token(IS);
- jj_consume_token(NOT);
- jj_consume_token(NULL);
- left = ComparisonExpression.createIsNotNull(left);
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression comparisonExpression() throws ParseException {
- Expression left;
- Expression right;
- Expression low;
- Expression high;
- String t, u;
- boolean not;
- ArrayList list;
- left = addExpression();
- label_4:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case NOT:
- case BETWEEN:
- case LIKE:
- case IN:
- case 29:
- case 30:
- case 31:
- case 32:
- ;
- break;
- default:
- break label_4;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case 29:
- jj_consume_token(29);
- right = addExpression();
- left = ComparisonExpression.createGreaterThan(left, right);
- break;
- case 30:
- jj_consume_token(30);
- right = addExpression();
- left = ComparisonExpression.createGreaterThanEqual(left, right);
- break;
- case 31:
- jj_consume_token(31);
- right = addExpression();
- left = ComparisonExpression.createLessThan(left, right);
- break;
- case 32:
- jj_consume_token(32);
- right = addExpression();
- left = ComparisonExpression.createLessThanEqual(left, right);
- break;
- case LIKE:
- u=null;
- jj_consume_token(LIKE);
- t = stringLiteral();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ESCAPE:
- jj_consume_token(ESCAPE);
- u = stringLiteral();
- break;
- default:
- ;
- }
- left = ComparisonExpression.createLike(left, t, u);
- break;
- default:
- if (jj_2_2(2)) {
- u=null;
- jj_consume_token(NOT);
- jj_consume_token(LIKE);
- t = stringLiteral();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ESCAPE:
- jj_consume_token(ESCAPE);
- u = stringLiteral();
- break;
- default:
- ;
- }
- left = ComparisonExpression.createNotLike(left, t, u);
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case BETWEEN:
- jj_consume_token(BETWEEN);
- low = addExpression();
- jj_consume_token(AND);
- high = addExpression();
- left = ComparisonExpression.createBetween(left, low, high);
- break;
- default:
- if (jj_2_3(2)) {
- jj_consume_token(NOT);
- jj_consume_token(BETWEEN);
- low = addExpression();
- jj_consume_token(AND);
- high = addExpression();
- left = ComparisonExpression.createNotBetween(left, low, high);
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IN:
- jj_consume_token(IN);
- jj_consume_token(33);
- t = stringLiteral();
- list = new ArrayList();
- list.add( t );
- label_5:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case 34:
- ;
- break;
- default:
- break label_5;
- }
- jj_consume_token(34);
- t = stringLiteral();
- list.add( t );
- }
- jj_consume_token(35);
- left = ComparisonExpression.createInFilter(left, list);
- break;
- default:
- if (jj_2_4(2)) {
- jj_consume_token(NOT);
- jj_consume_token(IN);
- jj_consume_token(33);
- t = stringLiteral();
- list = new ArrayList();
- list.add( t );
- label_6:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case 34:
- ;
- break;
- default:
- break label_6;
- }
- jj_consume_token(34);
- t = stringLiteral();
- list.add( t );
- }
- jj_consume_token(35);
- left = ComparisonExpression.createNotInFilter(left, list);
- } else {
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- }
- }
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression addExpression() throws ParseException {
- Expression left;
- Expression right;
- left = multExpr();
- label_7:
- while (true) {
- if (jj_2_5(2147483647)) {
- ;
- } else {
- break label_7;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case 36:
- jj_consume_token(36);
- right = multExpr();
- left = ArithmeticExpression.createPlus(left, right);
- break;
- case 37:
- jj_consume_token(37);
- right = multExpr();
- left = ArithmeticExpression.createMinus(left, right);
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression multExpr() throws ParseException {
- Expression left;
- Expression right;
- left = unaryExpr();
- label_8:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case 38:
- case 39:
- case 40:
- ;
- break;
- default:
- break label_8;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case 38:
- jj_consume_token(38);
- right = unaryExpr();
- left = ArithmeticExpression.createMultiply(left, right);
- break;
- case 39:
- jj_consume_token(39);
- right = unaryExpr();
- left = ArithmeticExpression.createDivide(left, right);
- break;
- case 40:
- jj_consume_token(40);
- right = unaryExpr();
- left = ArithmeticExpression.createMod(left, right);
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression unaryExpr() throws ParseException {
- String s=null;
- Expression left=null;
- if (jj_2_6(2147483647)) {
- jj_consume_token(36);
- left = unaryExpr();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case 37:
- jj_consume_token(37);
- left = unaryExpr();
- left = UnaryExpression.createNegate(left);
- break;
- case NOT:
- jj_consume_token(NOT);
- left = unaryExpr();
- left = UnaryExpression.createNOT( asBooleanExpression(left) );
- break;
- case TRUE:
- case FALSE:
- case NULL:
- case DECIMAL_LITERAL:
- case HEX_LITERAL:
- case OCTAL_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case ID:
- case QUOTED_ID:
- case 33:
- left = primaryExpr();
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression primaryExpr() throws ParseException {
- Expression left=null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case TRUE:
- case FALSE:
- case NULL:
- case DECIMAL_LITERAL:
- case HEX_LITERAL:
- case OCTAL_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- left = literal();
- break;
- case ID:
- case QUOTED_ID:
- left = variable();
- break;
- case 33:
- jj_consume_token(33);
- left = orExpression();
- jj_consume_token(35);
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public ConstantExpression literal() throws ParseException {
- Token t;
- String s;
- ConstantExpression left=null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING_LITERAL:
- s = stringLiteral();
- left = new ConstantExpression(s);
- break;
- case DECIMAL_LITERAL:
- t = jj_consume_token(DECIMAL_LITERAL);
- left = ConstantExpression.createFromDecimal(t.image);
- break;
- case HEX_LITERAL:
- t = jj_consume_token(HEX_LITERAL);
- left = ConstantExpression.createFromHex(t.image);
- break;
- case OCTAL_LITERAL:
- t = jj_consume_token(OCTAL_LITERAL);
- left = ConstantExpression.createFromOctal(t.image);
- break;
- case FLOATING_POINT_LITERAL:
- t = jj_consume_token(FLOATING_POINT_LITERAL);
- left = ConstantExpression.createFloat(t.image);
- break;
- case TRUE:
- jj_consume_token(TRUE);
- left = ConstantExpression.TRUE;
- break;
- case FALSE:
- jj_consume_token(FALSE);
- left = ConstantExpression.FALSE;
- break;
- case NULL:
- jj_consume_token(NULL);
- left = ConstantExpression.NULL;
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- final public String stringLiteral() throws ParseException {
- Token t;
- StringBuffer rc = new StringBuffer();
- boolean first=true;
- t = jj_consume_token(STRING_LITERAL);
- // Decode the sting value.
- String image = t.image;
- for( int i=1; i < image.length()-1; i++ ) {
- char c = image.charAt(i);
- if( c == (char) 0x27 )//single quote
- {
- i++;
- }
- rc.append(c);
- }
- {if (true) return rc.toString();}
- throw new Error("Missing return statement in function");
- }
-
- final public PropertyExpression variable() throws ParseException {
- Token t;
- StringBuffer rc = new StringBuffer();
- PropertyExpression left=null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ID:
- t = jj_consume_token(ID);
- left = new PropertyExpression(t.image);
- break;
- case QUOTED_ID:
- t = jj_consume_token(QUOTED_ID);
- // Decode the sting value.
- String image = t.image;
- for( int i=1; i < image.length()-1; i++ ) {
- char c = image.charAt(i);
- if( c == '"' )
- {
- i++;
- }
- rc.append(c);
- }
- {if (true) return new PropertyExpression(rc.toString());}
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return left;}
- throw new Error("Missing return statement in function");
- }
-
- private boolean jj_2_1(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_1(); }
- catch(LookaheadSuccess ls) { return true; }
- }
-
- private boolean jj_2_2(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_2(); }
- catch(LookaheadSuccess ls) { return true; }
- }
-
- private boolean jj_2_3(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_3(); }
- catch(LookaheadSuccess ls) { return true; }
- }
-
- private boolean jj_2_4(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_4(); }
- catch(LookaheadSuccess ls) { return true; }
- }
-
- private boolean jj_2_5(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_5(); }
- catch(LookaheadSuccess ls) { return true; }
- }
-
- private boolean jj_2_6(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_6(); }
- catch(LookaheadSuccess ls) { return true; }
- }
-
- private boolean jj_3R_59() {
- if (jj_scan_token(ESCAPE)) return true;
- if (jj_3R_38()) return true;
- return false;
- }
-
- private boolean jj_3R_38() {
- if (jj_scan_token(STRING_LITERAL)) return true;
- return false;
- }
-
- private boolean jj_3R_15() {
- if (jj_3R_19()) return true;
- return false;
- }
-
- private boolean jj_3R_14() {
- if (jj_scan_token(NOT)) return true;
- if (jj_3R_10()) return true;
- return false;
- }
-
- private boolean jj_3R_12() {
- if (jj_scan_token(36)) return true;
- if (jj_3R_10()) return true;
- return false;
- }
-
- private boolean jj_3R_55() {
- if (jj_scan_token(IN)) return true;
- if (jj_scan_token(33)) return true;
- if (jj_3R_38()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_60()) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(35)) return true;
- return false;
- }
-
- private boolean jj_3R_47() {
- if (jj_scan_token(IS)) return true;
- if (jj_scan_token(NOT)) return true;
- if (jj_scan_token(NULL)) return true;
- return false;
- }
-
- private boolean jj_3R_13() {
- if (jj_scan_token(37)) return true;
- if (jj_3R_10()) return true;
- return false;
- }
-
- private boolean jj_3R_33() {
- if (jj_scan_token(NULL)) return true;
- return false;
- }
-
- private boolean jj_3_1() {
- if (jj_scan_token(IS)) return true;
- if (jj_scan_token(NULL)) return true;
- return false;
- }
-
- private boolean jj_3R_10() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_12()) {
- jj_scanpos = xsp;
- if (jj_3R_13()) {
- jj_scanpos = xsp;
- if (jj_3R_14()) {
- jj_scanpos = xsp;
- if (jj_3R_15()) return true;
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_46() {
- if (jj_scan_token(28)) return true;
- if (jj_3R_41()) return true;
- return false;
- }
-
- private boolean jj_3R_32() {
- if (jj_scan_token(FALSE)) return true;
- return false;
- }
-
- private boolean jj_3_3() {
- if (jj_scan_token(NOT)) return true;
- if (jj_scan_token(BETWEEN)) return true;
- if (jj_3R_43()) return true;
- if (jj_scan_token(AND)) return true;
- if (jj_3R_43()) return true;
- return false;
- }
-
- private boolean jj_3R_45() {
- if (jj_scan_token(27)) return true;
- if (jj_3R_41()) return true;
- return false;
- }
-
- private boolean jj_3R_42() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_45()) {
- jj_scanpos = xsp;
- if (jj_3R_46()) {
- jj_scanpos = xsp;
- if (jj_3_1()) {
- jj_scanpos = xsp;
- if (jj_3R_47()) return true;
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_54() {
- if (jj_scan_token(BETWEEN)) return true;
- if (jj_3R_43()) return true;
- if (jj_scan_token(AND)) return true;
- if (jj_3R_43()) return true;
- return false;
- }
-
- private boolean jj_3R_31() {
- if (jj_scan_token(TRUE)) return true;
- return false;
- }
-
- private boolean jj_3R_58() {
- if (jj_scan_token(ESCAPE)) return true;
- if (jj_3R_38()) return true;
- return false;
- }
-
- private boolean jj_3R_18() {
- if (jj_scan_token(40)) return true;
- if (jj_3R_10()) return true;
- return false;
- }
-
- private boolean jj_3R_30() {
- if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
- return false;
- }
-
- private boolean jj_3R_39() {
- if (jj_3R_41()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_42()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3_2() {
- if (jj_scan_token(NOT)) return true;
- if (jj_scan_token(LIKE)) return true;
- if (jj_3R_38()) return true;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_59()) jj_scanpos = xsp;
- return false;
- }
-
- private boolean jj_3R_53() {
- if (jj_scan_token(LIKE)) return true;
- if (jj_3R_38()) return true;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_58()) jj_scanpos = xsp;
- return false;
- }
-
- private boolean jj_3R_17() {
- if (jj_scan_token(39)) return true;
- if (jj_3R_10()) return true;
- return false;
- }
-
- private boolean jj_3R_29() {
- if (jj_scan_token(OCTAL_LITERAL)) return true;
- return false;
- }
-
- private boolean jj_3R_16() {
- if (jj_scan_token(38)) return true;
- if (jj_3R_10()) return true;
- return false;
- }
-
- private boolean jj_3R_11() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_16()) {
- jj_scanpos = xsp;
- if (jj_3R_17()) {
- jj_scanpos = xsp;
- if (jj_3R_18()) return true;
- }
- }
- return false;
- }
-
- private boolean jj_3R_40() {
- if (jj_scan_token(AND)) return true;
- if (jj_3R_39()) return true;
- return false;
- }
-
- private boolean jj_3R_28() {
- if (jj_scan_token(HEX_LITERAL)) return true;
- return false;
- }
-
- private boolean jj_3R_9() {
- if (jj_3R_10()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_11()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_27() {
- if (jj_scan_token(DECIMAL_LITERAL)) return true;
- return false;
- }
-
- private boolean jj_3R_57() {
- if (jj_scan_token(37)) return true;
- if (jj_3R_9()) return true;
- return false;
- }
-
- private boolean jj_3R_36() {
- if (jj_3R_39()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_40()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3_5() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_scan_token(36)) {
- jj_scanpos = xsp;
- if (jj_scan_token(37)) return true;
- }
- if (jj_3R_9()) return true;
- return false;
- }
-
- private boolean jj_3R_52() {
- if (jj_scan_token(32)) return true;
- if (jj_3R_43()) return true;
- return false;
- }
-
- private boolean jj_3R_35() {
- if (jj_scan_token(QUOTED_ID)) return true;
- return false;
- }
-
- private boolean jj_3R_56() {
- if (jj_scan_token(36)) return true;
- if (jj_3R_9()) return true;
- return false;
- }
-
- private boolean jj_3R_26() {
- if (jj_3R_38()) return true;
- return false;
- }
-
- private boolean jj_3R_51() {
- if (jj_scan_token(31)) return true;
- if (jj_3R_43()) return true;
- return false;
- }
-
- private boolean jj_3R_34() {
- if (jj_scan_token(ID)) return true;
- return false;
- }
-
- private boolean jj_3R_61() {
- if (jj_scan_token(34)) return true;
- if (jj_3R_38()) return true;
- return false;
- }
-
- private boolean jj_3R_48() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_56()) {
- jj_scanpos = xsp;
- if (jj_3R_57()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_37() {
- if (jj_scan_token(OR)) return true;
- if (jj_3R_36()) return true;
- return false;
- }
-
- private boolean jj_3R_23() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_26()) {
- jj_scanpos = xsp;
- if (jj_3R_27()) {
- jj_scanpos = xsp;
- if (jj_3R_28()) {
- jj_scanpos = xsp;
- if (jj_3R_29()) {
- jj_scanpos = xsp;
- if (jj_3R_30()) {
- jj_scanpos = xsp;
- if (jj_3R_31()) {
- jj_scanpos = xsp;
- if (jj_3R_32()) {
- jj_scanpos = xsp;
- if (jj_3R_33()) return true;
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_50() {
- if (jj_scan_token(30)) return true;
- if (jj_3R_43()) return true;
- return false;
- }
-
- private boolean jj_3R_24() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_34()) {
- jj_scanpos = xsp;
- if (jj_3R_35()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_49() {
- if (jj_scan_token(29)) return true;
- if (jj_3R_43()) return true;
- return false;
- }
-
- private boolean jj_3R_44() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_49()) {
- jj_scanpos = xsp;
- if (jj_3R_50()) {
- jj_scanpos = xsp;
- if (jj_3R_51()) {
- jj_scanpos = xsp;
- if (jj_3R_52()) {
- jj_scanpos = xsp;
- if (jj_3R_53()) {
- jj_scanpos = xsp;
- if (jj_3_2()) {
- jj_scanpos = xsp;
- if (jj_3R_54()) {
- jj_scanpos = xsp;
- if (jj_3_3()) {
- jj_scanpos = xsp;
- if (jj_3R_55()) {
- jj_scanpos = xsp;
- if (jj_3_4()) return true;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_43() {
- if (jj_3R_9()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_48()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_25() {
- if (jj_3R_36()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_37()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_22() {
- if (jj_scan_token(33)) return true;
- if (jj_3R_25()) return true;
- if (jj_scan_token(35)) return true;
- return false;
- }
-
- private boolean jj_3R_21() {
- if (jj_3R_24()) return true;
- return false;
- }
-
- private boolean jj_3R_20() {
- if (jj_3R_23()) return true;
- return false;
- }
-
- private boolean jj_3R_60() {
- if (jj_scan_token(34)) return true;
- if (jj_3R_38()) return true;
- return false;
- }
-
- private boolean jj_3R_19() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_20()) {
- jj_scanpos = xsp;
- if (jj_3R_21()) {
- jj_scanpos = xsp;
- if (jj_3R_22()) return true;
- }
- }
- return false;
- }
-
- private boolean jj_3R_41() {
- if (jj_3R_43()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_44()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3_4() {
- if (jj_scan_token(NOT)) return true;
- if (jj_scan_token(IN)) return true;
- if (jj_scan_token(33)) return true;
- if (jj_3R_38()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_61()) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(35)) return true;
- return false;
- }
-
- private boolean jj_3_6() {
- if (jj_scan_token(36)) return true;
- if (jj_3R_10()) return true;
- return false;
- }
-
- /** Generated Token Manager. */
- public SelectorParserTokenManager token_source;
- SimpleCharStream jj_input_stream;
- /** Current token. */
- public Token token;
- /** Next token. */
- public Token jj_nt;
- private int jj_ntk;
- private Token jj_scanpos, jj_lastpos;
- private int jj_la;
-
- /** Constructor with InputStream. */
- public SelectorParser(java.io.InputStream stream) {
- this(stream, null);
- }
- /** Constructor with InputStream and supplied encoding */
- public SelectorParser(java.io.InputStream stream, String encoding) {
- try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
- token_source = new SelectorParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream stream) {
- ReInit(stream, null);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream stream, String encoding) {
- try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- }
-
- /** Constructor. */
- public SelectorParser(java.io.Reader stream) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new SelectorParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- }
-
- /** Constructor with generated Token Manager. */
- public SelectorParser(SelectorParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(SelectorParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- }
-
- private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- return token;
- }
- token = oldToken;
- throw generateParseException();
- }
-
- static private final class LookaheadSuccess extends java.lang.Error { }
- final private LookaheadSuccess jj_ls = new LookaheadSuccess();
- private boolean jj_scan_token(int kind) {
- if (jj_scanpos == jj_lastpos) {
- jj_la--;
- if (jj_scanpos.next == null) {
- jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
- } else {
- jj_lastpos = jj_scanpos = jj_scanpos.next;
- }
- } else {
- jj_scanpos = jj_scanpos.next;
- }
- if (jj_scanpos.kind != kind) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
- return false;
- }
-
-
-/** Get the next Token. */
- final public Token getNextToken() {
- if (token.next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- return token;
- }
-
-/** Get the specific Token. */
- final public Token getToken(int index) {
- Token t = token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- private int jj_ntk() {
- if ((jj_nt=token.next) == null)
- return (jj_ntk = (token.next=token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- /** Generate ParseException. */
- public ParseException generateParseException() {
- Token errortok = token.next;
- int line = errortok.beginLine, column = errortok.beginColumn;
- String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image;
- return new ParseException("Parse error at line " + line + ", column " + column + ". Encountered: " + mess);
- }
-
- /** Enable tracing. */
- final public void enable_tracing() {
- }
-
- /** Disable tracing. */
- final public void disable_tracing() {
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParserConstants.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParserConstants.java
deleted file mode 100644
index 2ffdcddc6c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParserConstants.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. SelectorParserConstants.java */
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.filter.selector;
-
-
-/**
- * Token literal values and constants.
- * Generated by org.javacc.parser.OtherFilesGen#start()
- */
-public interface SelectorParserConstants {
-
- /** End of File. */
- int EOF = 0;
- /** RegularExpression Id. */
- int LINE_COMMENT = 6;
- /** RegularExpression Id. */
- int BLOCK_COMMENT = 7;
- /** RegularExpression Id. */
- int NOT = 8;
- /** RegularExpression Id. */
- int AND = 9;
- /** RegularExpression Id. */
- int OR = 10;
- /** RegularExpression Id. */
- int BETWEEN = 11;
- /** RegularExpression Id. */
- int LIKE = 12;
- /** RegularExpression Id. */
- int ESCAPE = 13;
- /** RegularExpression Id. */
- int IN = 14;
- /** RegularExpression Id. */
- int IS = 15;
- /** RegularExpression Id. */
- int TRUE = 16;
- /** RegularExpression Id. */
- int FALSE = 17;
- /** RegularExpression Id. */
- int NULL = 18;
- /** RegularExpression Id. */
- int DECIMAL_LITERAL = 19;
- /** RegularExpression Id. */
- int HEX_LITERAL = 20;
- /** RegularExpression Id. */
- int OCTAL_LITERAL = 21;
- /** RegularExpression Id. */
- int FLOATING_POINT_LITERAL = 22;
- /** RegularExpression Id. */
- int EXPONENT = 23;
- /** RegularExpression Id. */
- int STRING_LITERAL = 24;
- /** RegularExpression Id. */
- int ID = 25;
- /** RegularExpression Id. */
- int QUOTED_ID = 26;
-
- /** Lexical state. */
- int DEFAULT = 0;
-
- /** Literal token values. */
- String[] tokenImage = {
- "<EOF>",
- "\" \"",
- "\"\\t\"",
- "\"\\n\"",
- "\"\\r\"",
- "\"\\f\"",
- "<LINE_COMMENT>",
- "<BLOCK_COMMENT>",
- "\"NOT\"",
- "\"AND\"",
- "\"OR\"",
- "\"BETWEEN\"",
- "\"LIKE\"",
- "\"ESCAPE\"",
- "\"IN\"",
- "\"IS\"",
- "\"TRUE\"",
- "\"FALSE\"",
- "\"NULL\"",
- "<DECIMAL_LITERAL>",
- "<HEX_LITERAL>",
- "<OCTAL_LITERAL>",
- "<FLOATING_POINT_LITERAL>",
- "<EXPONENT>",
- "<STRING_LITERAL>",
- "<ID>",
- "<QUOTED_ID>",
- "\"=\"",
- "\"<>\"",
- "\">\"",
- "\">=\"",
- "\"<\"",
- "\"<=\"",
- "\"(\"",
- "\",\"",
- "\")\"",
- "\"+\"",
- "\"-\"",
- "\"*\"",
- "\"/\"",
- "\"%\"",
- };
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParserTokenManager.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParserTokenManager.java
deleted file mode 100644
index 96781acf84..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SelectorParserTokenManager.java
+++ /dev/null
@@ -1,1066 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. SelectorParserTokenManager.java */
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.filter.selector;
-import java.io.StringReader;
-import java.util.ArrayList;
-import org.apache.qpid.filter.ArithmeticExpression;
-import org.apache.qpid.filter.BooleanExpression;
-import org.apache.qpid.filter.ComparisonExpression;
-import org.apache.qpid.filter.ConstantExpression;
-import org.apache.qpid.filter.Expression;
-import org.apache.qpid.filter.LogicExpression;
-import org.apache.qpid.filter.PropertyExpression;
-import org.apache.qpid.filter.UnaryExpression;
-
-/** Token Manager. */
-public class SelectorParserTokenManager implements SelectorParserConstants
-{
-
- /** Debug output. */
- public java.io.PrintStream debugStream = System.out;
- /** Set debug output. */
- public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private int jjStopAtPos(int pos, int kind)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- return pos + 1;
-}
-private int jjMoveStringLiteralDfa0_0()
-{
- switch(curChar)
- {
- case 9:
- jjmatchedKind = 2;
- return jjMoveNfa_0(5, 0);
- case 10:
- jjmatchedKind = 3;
- return jjMoveNfa_0(5, 0);
- case 12:
- jjmatchedKind = 5;
- return jjMoveNfa_0(5, 0);
- case 13:
- jjmatchedKind = 4;
- return jjMoveNfa_0(5, 0);
- case 32:
- jjmatchedKind = 1;
- return jjMoveNfa_0(5, 0);
- case 37:
- jjmatchedKind = 40;
- return jjMoveNfa_0(5, 0);
- case 40:
- jjmatchedKind = 33;
- return jjMoveNfa_0(5, 0);
- case 41:
- jjmatchedKind = 35;
- return jjMoveNfa_0(5, 0);
- case 42:
- jjmatchedKind = 38;
- return jjMoveNfa_0(5, 0);
- case 43:
- jjmatchedKind = 36;
- return jjMoveNfa_0(5, 0);
- case 44:
- jjmatchedKind = 34;
- return jjMoveNfa_0(5, 0);
- case 45:
- jjmatchedKind = 37;
- return jjMoveNfa_0(5, 0);
- case 47:
- jjmatchedKind = 39;
- return jjMoveNfa_0(5, 0);
- case 60:
- jjmatchedKind = 31;
- return jjMoveStringLiteralDfa1_0(0x110000000L);
- case 61:
- jjmatchedKind = 27;
- return jjMoveNfa_0(5, 0);
- case 62:
- jjmatchedKind = 29;
- return jjMoveStringLiteralDfa1_0(0x40000000L);
- case 65:
- return jjMoveStringLiteralDfa1_0(0x200L);
- case 66:
- return jjMoveStringLiteralDfa1_0(0x800L);
- case 69:
- return jjMoveStringLiteralDfa1_0(0x2000L);
- case 70:
- return jjMoveStringLiteralDfa1_0(0x20000L);
- case 73:
- return jjMoveStringLiteralDfa1_0(0xc000L);
- case 76:
- return jjMoveStringLiteralDfa1_0(0x1000L);
- case 78:
- return jjMoveStringLiteralDfa1_0(0x40100L);
- case 79:
- return jjMoveStringLiteralDfa1_0(0x400L);
- case 84:
- return jjMoveStringLiteralDfa1_0(0x10000L);
- case 97:
- return jjMoveStringLiteralDfa1_0(0x200L);
- case 98:
- return jjMoveStringLiteralDfa1_0(0x800L);
- case 101:
- return jjMoveStringLiteralDfa1_0(0x2000L);
- case 102:
- return jjMoveStringLiteralDfa1_0(0x20000L);
- case 105:
- return jjMoveStringLiteralDfa1_0(0xc000L);
- case 108:
- return jjMoveStringLiteralDfa1_0(0x1000L);
- case 110:
- return jjMoveStringLiteralDfa1_0(0x40100L);
- case 111:
- return jjMoveStringLiteralDfa1_0(0x400L);
- case 116:
- return jjMoveStringLiteralDfa1_0(0x10000L);
- default :
- return jjMoveNfa_0(5, 0);
- }
-}
-private int jjMoveStringLiteralDfa1_0(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return jjMoveNfa_0(5, 0);
- }
- switch(curChar)
- {
- case 61:
- if ((active0 & 0x40000000L) != 0L)
- {
- jjmatchedKind = 30;
- jjmatchedPos = 1;
- }
- else if ((active0 & 0x100000000L) != 0L)
- {
- jjmatchedKind = 32;
- jjmatchedPos = 1;
- }
- break;
- case 62:
- if ((active0 & 0x10000000L) != 0L)
- {
- jjmatchedKind = 28;
- jjmatchedPos = 1;
- }
- break;
- case 65:
- return jjMoveStringLiteralDfa2_0(active0, 0x20000L);
- case 69:
- return jjMoveStringLiteralDfa2_0(active0, 0x800L);
- case 73:
- return jjMoveStringLiteralDfa2_0(active0, 0x1000L);
- case 78:
- if ((active0 & 0x4000L) != 0L)
- {
- jjmatchedKind = 14;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_0(active0, 0x200L);
- case 79:
- return jjMoveStringLiteralDfa2_0(active0, 0x100L);
- case 82:
- if ((active0 & 0x400L) != 0L)
- {
- jjmatchedKind = 10;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
- case 83:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 15;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_0(active0, 0x2000L);
- case 85:
- return jjMoveStringLiteralDfa2_0(active0, 0x40000L);
- case 97:
- return jjMoveStringLiteralDfa2_0(active0, 0x20000L);
- case 101:
- return jjMoveStringLiteralDfa2_0(active0, 0x800L);
- case 105:
- return jjMoveStringLiteralDfa2_0(active0, 0x1000L);
- case 110:
- if ((active0 & 0x4000L) != 0L)
- {
- jjmatchedKind = 14;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_0(active0, 0x200L);
- case 111:
- return jjMoveStringLiteralDfa2_0(active0, 0x100L);
- case 114:
- if ((active0 & 0x400L) != 0L)
- {
- jjmatchedKind = 10;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
- case 115:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 15;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_0(active0, 0x2000L);
- case 117:
- return jjMoveStringLiteralDfa2_0(active0, 0x40000L);
- default :
- break;
- }
- return jjMoveNfa_0(5, 1);
-}
-private int jjMoveStringLiteralDfa2_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjMoveNfa_0(5, 1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return jjMoveNfa_0(5, 1);
- }
- switch(curChar)
- {
- case 67:
- return jjMoveStringLiteralDfa3_0(active0, 0x2000L);
- case 68:
- if ((active0 & 0x200L) != 0L)
- {
- jjmatchedKind = 9;
- jjmatchedPos = 2;
- }
- break;
- case 75:
- return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
- case 76:
- return jjMoveStringLiteralDfa3_0(active0, 0x60000L);
- case 84:
- if ((active0 & 0x100L) != 0L)
- {
- jjmatchedKind = 8;
- jjmatchedPos = 2;
- }
- return jjMoveStringLiteralDfa3_0(active0, 0x800L);
- case 85:
- return jjMoveStringLiteralDfa3_0(active0, 0x10000L);
- case 99:
- return jjMoveStringLiteralDfa3_0(active0, 0x2000L);
- case 100:
- if ((active0 & 0x200L) != 0L)
- {
- jjmatchedKind = 9;
- jjmatchedPos = 2;
- }
- break;
- case 107:
- return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
- case 108:
- return jjMoveStringLiteralDfa3_0(active0, 0x60000L);
- case 116:
- if ((active0 & 0x100L) != 0L)
- {
- jjmatchedKind = 8;
- jjmatchedPos = 2;
- }
- return jjMoveStringLiteralDfa3_0(active0, 0x800L);
- case 117:
- return jjMoveStringLiteralDfa3_0(active0, 0x10000L);
- default :
- break;
- }
- return jjMoveNfa_0(5, 2);
-}
-private int jjMoveStringLiteralDfa3_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjMoveNfa_0(5, 2);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return jjMoveNfa_0(5, 2);
- }
- switch(curChar)
- {
- case 65:
- return jjMoveStringLiteralDfa4_0(active0, 0x2000L);
- case 69:
- if ((active0 & 0x1000L) != 0L)
- {
- jjmatchedKind = 12;
- jjmatchedPos = 3;
- }
- else if ((active0 & 0x10000L) != 0L)
- {
- jjmatchedKind = 16;
- jjmatchedPos = 3;
- }
- break;
- case 76:
- if ((active0 & 0x40000L) != 0L)
- {
- jjmatchedKind = 18;
- jjmatchedPos = 3;
- }
- break;
- case 83:
- return jjMoveStringLiteralDfa4_0(active0, 0x20000L);
- case 87:
- return jjMoveStringLiteralDfa4_0(active0, 0x800L);
- case 97:
- return jjMoveStringLiteralDfa4_0(active0, 0x2000L);
- case 101:
- if ((active0 & 0x1000L) != 0L)
- {
- jjmatchedKind = 12;
- jjmatchedPos = 3;
- }
- else if ((active0 & 0x10000L) != 0L)
- {
- jjmatchedKind = 16;
- jjmatchedPos = 3;
- }
- break;
- case 108:
- if ((active0 & 0x40000L) != 0L)
- {
- jjmatchedKind = 18;
- jjmatchedPos = 3;
- }
- break;
- case 115:
- return jjMoveStringLiteralDfa4_0(active0, 0x20000L);
- case 119:
- return jjMoveStringLiteralDfa4_0(active0, 0x800L);
- default :
- break;
- }
- return jjMoveNfa_0(5, 3);
-}
-private int jjMoveStringLiteralDfa4_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjMoveNfa_0(5, 3);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return jjMoveNfa_0(5, 3);
- }
- switch(curChar)
- {
- case 69:
- if ((active0 & 0x20000L) != 0L)
- {
- jjmatchedKind = 17;
- jjmatchedPos = 4;
- }
- return jjMoveStringLiteralDfa5_0(active0, 0x800L);
- case 80:
- return jjMoveStringLiteralDfa5_0(active0, 0x2000L);
- case 101:
- if ((active0 & 0x20000L) != 0L)
- {
- jjmatchedKind = 17;
- jjmatchedPos = 4;
- }
- return jjMoveStringLiteralDfa5_0(active0, 0x800L);
- case 112:
- return jjMoveStringLiteralDfa5_0(active0, 0x2000L);
- default :
- break;
- }
- return jjMoveNfa_0(5, 4);
-}
-private int jjMoveStringLiteralDfa5_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjMoveNfa_0(5, 4);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return jjMoveNfa_0(5, 4);
- }
- switch(curChar)
- {
- case 69:
- if ((active0 & 0x2000L) != 0L)
- {
- jjmatchedKind = 13;
- jjmatchedPos = 5;
- }
- return jjMoveStringLiteralDfa6_0(active0, 0x800L);
- case 101:
- if ((active0 & 0x2000L) != 0L)
- {
- jjmatchedKind = 13;
- jjmatchedPos = 5;
- }
- return jjMoveStringLiteralDfa6_0(active0, 0x800L);
- default :
- break;
- }
- return jjMoveNfa_0(5, 5);
-}
-private int jjMoveStringLiteralDfa6_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjMoveNfa_0(5, 5);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return jjMoveNfa_0(5, 5);
- }
- switch(curChar)
- {
- case 78:
- if ((active0 & 0x800L) != 0L)
- {
- jjmatchedKind = 11;
- jjmatchedPos = 6;
- }
- break;
- case 110:
- if ((active0 & 0x800L) != 0L)
- {
- jjmatchedKind = 11;
- jjmatchedPos = 6;
- }
- break;
- default :
- break;
- }
- return jjMoveNfa_0(5, 6);
-}
-static final long[] jjbitVec0 = {
- 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-static final long[] jjbitVec2 = {
- 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-private int jjMoveNfa_0(int startState, int curPos)
-{
- int strKind = jjmatchedKind;
- int strPos = jjmatchedPos;
- int seenUpto;
- input_stream.backup(seenUpto = curPos + 1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { throw new Error("Internal Error"); }
- curPos = 0;
- int startsAt = 0;
- jjnewStateCnt = 48;
- int i = 1;
- jjstateSet[0] = startState;
- int kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- do
- {
- switch(jjstateSet[--i])
- {
- case 5:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(0, 3);
- else if (curChar == 34)
- jjCheckNAddStates(4, 6);
- else if (curChar == 36)
- {
- if (kind > 25)
- kind = 25;
- jjCheckNAdd(27);
- }
- else if (curChar == 39)
- jjCheckNAddStates(7, 9);
- else if (curChar == 46)
- jjCheckNAdd(17);
- else if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 6;
- else if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 0;
- if ((0x3fe000000000000L & l) != 0L)
- {
- if (kind > 19)
- kind = 19;
- jjCheckNAddTwoStates(14, 15);
- }
- else if (curChar == 48)
- {
- if (kind > 21)
- kind = 21;
- jjCheckNAddTwoStates(45, 47);
- }
- break;
- case 0:
- if (curChar == 45)
- jjCheckNAddStates(10, 12);
- break;
- case 1:
- if ((0xffffffffffffdbffL & l) != 0L)
- jjCheckNAddStates(10, 12);
- break;
- case 2:
- if ((0x2400L & l) != 0L && kind > 6)
- kind = 6;
- break;
- case 3:
- if (curChar == 10 && kind > 6)
- kind = 6;
- break;
- case 4:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 3;
- break;
- case 6:
- if (curChar == 42)
- jjCheckNAddTwoStates(7, 8);
- break;
- case 7:
- if ((0xfffffbffffffffffL & l) != 0L)
- jjCheckNAddTwoStates(7, 8);
- break;
- case 8:
- if (curChar == 42)
- jjCheckNAddStates(13, 15);
- break;
- case 9:
- if ((0xffff7bffffffffffL & l) != 0L)
- jjCheckNAddTwoStates(10, 8);
- break;
- case 10:
- if ((0xfffffbffffffffffL & l) != 0L)
- jjCheckNAddTwoStates(10, 8);
- break;
- case 11:
- if (curChar == 47 && kind > 7)
- kind = 7;
- break;
- case 12:
- if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 6;
- break;
- case 13:
- if ((0x3fe000000000000L & l) == 0L)
- break;
- if (kind > 19)
- kind = 19;
- jjCheckNAddTwoStates(14, 15);
- break;
- case 14:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 19)
- kind = 19;
- jjCheckNAddTwoStates(14, 15);
- break;
- case 16:
- if (curChar == 46)
- jjCheckNAdd(17);
- break;
- case 17:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(17, 18);
- break;
- case 19:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(20);
- break;
- case 20:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAdd(20);
- break;
- case 21:
- case 22:
- if (curChar == 39)
- jjCheckNAddStates(7, 9);
- break;
- case 23:
- if (curChar == 39)
- jjstateSet[jjnewStateCnt++] = 22;
- break;
- case 24:
- if ((0xffffff7fffffffffL & l) != 0L)
- jjCheckNAddStates(7, 9);
- break;
- case 25:
- if (curChar == 39 && kind > 24)
- kind = 24;
- break;
- case 26:
- if (curChar != 36)
- break;
- if (kind > 25)
- kind = 25;
- jjCheckNAdd(27);
- break;
- case 27:
- if ((0x3ff001000000000L & l) == 0L)
- break;
- if (kind > 25)
- kind = 25;
- jjCheckNAdd(27);
- break;
- case 28:
- case 29:
- if (curChar == 34)
- jjCheckNAddStates(4, 6);
- break;
- case 30:
- if (curChar == 34)
- jjstateSet[jjnewStateCnt++] = 29;
- break;
- case 31:
- if ((0xfffffffbffffffffL & l) != 0L)
- jjCheckNAddStates(4, 6);
- break;
- case 32:
- if (curChar == 34 && kind > 26)
- kind = 26;
- break;
- case 33:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(0, 3);
- break;
- case 34:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(34, 35);
- break;
- case 35:
- if (curChar != 46)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(36, 37);
- break;
- case 36:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(36, 37);
- break;
- case 38:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(39);
- break;
- case 39:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAdd(39);
- break;
- case 40:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(40, 41);
- break;
- case 42:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(43);
- break;
- case 43:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAdd(43);
- break;
- case 44:
- if (curChar != 48)
- break;
- if (kind > 21)
- kind = 21;
- jjCheckNAddTwoStates(45, 47);
- break;
- case 46:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 20)
- kind = 20;
- jjstateSet[jjnewStateCnt++] = 46;
- break;
- case 47:
- if ((0xff000000000000L & l) == 0L)
- break;
- if (kind > 21)
- kind = 21;
- jjCheckNAdd(47);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- do
- {
- switch(jjstateSet[--i])
- {
- case 5:
- case 27:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 25)
- kind = 25;
- jjCheckNAdd(27);
- break;
- case 1:
- jjAddStates(10, 12);
- break;
- case 7:
- jjCheckNAddTwoStates(7, 8);
- break;
- case 9:
- case 10:
- jjCheckNAddTwoStates(10, 8);
- break;
- case 15:
- if ((0x100000001000L & l) != 0L && kind > 19)
- kind = 19;
- break;
- case 18:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(16, 17);
- break;
- case 24:
- jjAddStates(7, 9);
- break;
- case 31:
- jjAddStates(4, 6);
- break;
- case 37:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(18, 19);
- break;
- case 41:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(20, 21);
- break;
- case 45:
- if ((0x100000001000000L & l) != 0L)
- jjCheckNAdd(46);
- break;
- case 46:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 20)
- kind = 20;
- jjCheckNAdd(46);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int hiByte = (int)(curChar >> 8);
- int i1 = hiByte >> 6;
- long l1 = 1L << (hiByte & 077);
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- do
- {
- switch(jjstateSet[--i])
- {
- case 1:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjAddStates(10, 12);
- break;
- case 7:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjCheckNAddTwoStates(7, 8);
- break;
- case 9:
- case 10:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjCheckNAddTwoStates(10, 8);
- break;
- case 24:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjAddStates(7, 9);
- break;
- case 31:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjAddStates(4, 6);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 48 - (jjnewStateCnt = startsAt)))
- break;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { break; }
- }
- if (jjmatchedPos > strPos)
- return curPos;
-
- int toRet = Math.max(curPos, seenUpto);
-
- if (curPos < toRet)
- for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; )
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { throw new Error("Internal Error : Please send a bug report."); }
-
- if (jjmatchedPos < strPos)
- {
- jjmatchedKind = strKind;
- jjmatchedPos = strPos;
- }
- else if (jjmatchedPos == strPos && jjmatchedKind > strKind)
- jjmatchedKind = strKind;
-
- return toRet;
-}
-static final int[] jjnextStates = {
- 34, 35, 40, 41, 30, 31, 32, 23, 24, 25, 1, 2, 4, 8, 9, 11,
- 19, 20, 38, 39, 42, 43,
-};
-private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
-{
- switch(hiByte)
- {
- case 0:
- return ((jjbitVec2[i2] & l2) != 0L);
- default :
- if ((jjbitVec0[i1] & l1) != 0L)
- return true;
- return false;
- }
-}
-
-/** Token literal values. */
-public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-"\75", "\74\76", "\76", "\76\75", "\74", "\74\75", "\50", "\54", "\51", "\53", "\55",
-"\52", "\57", "\45", };
-
-/** Lexer state names. */
-public static final String[] lexStateNames = {
- "DEFAULT",
-};
-static final long[] jjtoToken = {
- 0x1ffff7fff01L,
-};
-static final long[] jjtoSkip = {
- 0xfeL,
-};
-static final long[] jjtoSpecial = {
- 0x3eL,
-};
-protected SimpleCharStream input_stream;
-private final int[] jjrounds = new int[48];
-private final int[] jjstateSet = new int[96];
-protected char curChar;
-/** Constructor. */
-public SelectorParserTokenManager(SimpleCharStream stream){
- if (SimpleCharStream.staticFlag)
- throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
- input_stream = stream;
-}
-
-/** Constructor. */
-public SelectorParserTokenManager(SimpleCharStream stream, int lexState){
- this(stream);
- SwitchTo(lexState);
-}
-
-/** Reinitialise parser. */
-public void ReInit(SimpleCharStream stream)
-{
- jjmatchedPos = jjnewStateCnt = 0;
- curLexState = defaultLexState;
- input_stream = stream;
- ReInitRounds();
-}
-private void ReInitRounds()
-{
- int i;
- jjround = 0x80000001;
- for (i = 48; i-- > 0;)
- jjrounds[i] = 0x80000000;
-}
-
-/** Reinitialise parser. */
-public void ReInit(SimpleCharStream stream, int lexState)
-{
- ReInit(stream);
- SwitchTo(lexState);
-}
-
-/** Switch to specified lex state. */
-public void SwitchTo(int lexState)
-{
- if (lexState >= 1 || lexState < 0)
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
- else
- curLexState = lexState;
-}
-
-protected Token jjFillToken()
-{
- final Token t;
- final String curTokenImage;
- final int beginLine;
- final int endLine;
- final int beginColumn;
- final int endColumn;
- String im = jjstrLiteralImages[jjmatchedKind];
- curTokenImage = (im == null) ? input_stream.GetImage() : im;
- beginLine = input_stream.getBeginLine();
- beginColumn = input_stream.getBeginColumn();
- endLine = input_stream.getEndLine();
- endColumn = input_stream.getEndColumn();
- t = Token.newToken(jjmatchedKind, curTokenImage);
-
- t.beginLine = beginLine;
- t.endLine = endLine;
- t.beginColumn = beginColumn;
- t.endColumn = endColumn;
-
- return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-/** Get the next Token. */
-public Token getNextToken()
-{
- Token specialToken = null;
- Token matchedToken;
- int curPos = 0;
-
- EOFLoop :
- for (;;)
- {
- try
- {
- curChar = input_stream.BeginToken();
- }
- catch(java.io.IOException e)
- {
- jjmatchedKind = 0;
- matchedToken = jjFillToken();
- matchedToken.specialToken = specialToken;
- return matchedToken;
- }
-
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_0();
- if (jjmatchedKind != 0x7fffffff)
- {
- if (jjmatchedPos + 1 < curPos)
- input_stream.backup(curPos - jjmatchedPos - 1);
- if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- matchedToken.specialToken = specialToken;
- return matchedToken;
- }
- else
- {
- if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- if (specialToken == null)
- specialToken = matchedToken;
- else
- {
- matchedToken.specialToken = specialToken;
- specialToken = (specialToken.next = matchedToken);
- }
- }
- continue EOFLoop;
- }
- }
- int error_line = input_stream.getEndLine();
- int error_column = input_stream.getEndColumn();
- String error_after = null;
- boolean EOFSeen = false;
- try { input_stream.readChar(); input_stream.backup(1); }
- catch (java.io.IOException e1) {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- if (curChar == '\n' || curChar == '\r') {
- error_line++;
- error_column = 0;
- }
- else
- error_column++;
- }
- if (!EOFSeen) {
- input_stream.backup(1);
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- }
- throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
- }
-}
-
-private void jjCheckNAdd(int state)
-{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
-}
-private void jjAddStates(int start, int end)
-{
- do {
- jjstateSet[jjnewStateCnt++] = jjnextStates[start];
- } while (start++ != end);
-}
-private void jjCheckNAddTwoStates(int state1, int state2)
-{
- jjCheckNAdd(state1);
- jjCheckNAdd(state2);
-}
-
-private void jjCheckNAddStates(int start, int end)
-{
- do {
- jjCheckNAdd(jjnextStates[start]);
- } while (start++ != end);
-}
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SimpleCharStream.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SimpleCharStream.java
deleted file mode 100644
index c492e5cc23..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/SimpleCharStream.java
+++ /dev/null
@@ -1,492 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */
-/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.filter.selector;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (without unicode processing).
- */
-
-public class SimpleCharStream
-{
-/** Whether parser is static. */
- public static final boolean staticFlag = false;
- int bufsize;
- int available;
- int tokenBegin;
-/** Position in buffer. */
- public int bufpos = -1;
- protected int bufline[];
- protected int bufcolumn[];
-
- protected int column = 0;
- protected int line = 1;
-
- protected boolean prevCharIsCR = false;
- protected boolean prevCharIsLF = false;
-
- protected java.io.Reader inputStream;
-
- protected char[] buffer;
- protected int maxNextCharInd = 0;
- protected int inBuf = 0;
- protected int tabSize = 8;
-
- protected void setTabSize(int i) { tabSize = i; }
- protected int getTabSize(int i) { return tabSize; }
-
-
- protected void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
-
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
- }
-
- protected void FillBuff() throws java.io.IOException
- {
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0)
- bufpos = maxNextCharInd = 0;
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
- available = tokenBegin;
- }
-
- int i;
- try {
- if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- --bufpos;
- backup(0);
- if (tokenBegin == -1)
- tokenBegin = bufpos;
- throw e;
- }
- }
-
-/** Start. */
- public char BeginToken() throws java.io.IOException
- {
- tokenBegin = -1;
- char c = readChar();
- tokenBegin = bufpos;
-
- return c;
- }
-
- protected void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
-
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (tabSize - (column % tabSize));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
-/** Read a character. */
- public char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
-
- if (++bufpos == bufsize)
- bufpos = 0;
-
- return buffer[bufpos];
- }
-
- if (++bufpos >= maxNextCharInd)
- FillBuff();
-
- char c = buffer[bufpos];
-
- UpdateLineColumn(c);
- return c;
- }
-
- @Deprecated
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public int getColumn() {
- return bufcolumn[bufpos];
- }
-
- @Deprecated
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public int getLine() {
- return bufline[bufpos];
- }
-
- /** Get token end column number. */
- public int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- /** Get token end line number. */
- public int getEndLine() {
- return bufline[bufpos];
- }
-
- /** Get token beginning column number. */
- public int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- /** Get token beginning line number. */
- public int getBeginLine() {
- return bufline[tokenBegin];
- }
-
-/** Backup a number of characters. */
- public void backup(int amount) {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
- {
- this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn) throws java.io.UnsupportedEncodingException
- {
- this(dstream, encoding, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
- {
- this(dstream, encoding, 1, 1, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
- {
- ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
- {
- ReInit(dstream, encoding, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn) throws java.io.UnsupportedEncodingException
- {
- ReInit(dstream, encoding, startline, startcolumn, 4096);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- /** Get token literal value. */
- public String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
-
- /** Get the suffix. */
- public char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- /** Reset buffer when finished. */
- public void Done()
- {
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
-
-}
-/* JavaCC - OriginalChecksum=dcf3510e97e4ee9a841bdafac162a129 (do not edit this line) */
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/Token.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/Token.java
deleted file mode 100644
index aebd21dacc..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/Token.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
-/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.filter.selector;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token implements java.io.Serializable {
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /** The line number of the first character of this Token. */
- public int beginLine;
- /** The column number of the first character of this Token. */
- public int beginColumn;
- /** The line number of the last character of this Token. */
- public int endLine;
- /** The column number of the last character of this Token. */
- public int endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * An optional attribute value of the Token.
- * Tokens which are not used as syntactic sugar will often contain
- * meaningful values that will be used later on by the compiler or
- * interpreter. This attribute value is often different from the image.
- * Any subclass of Token that actually wants to return a non-null value can
- * override this method as appropriate.
- */
- public Object getValue() {
- return null;
- }
-
- /**
- * No-argument constructor
- */
- public Token() {}
-
- /**
- * Constructs a new token for the specified Image.
- */
- public Token(int kind)
- {
- this(kind, null);
- }
-
- /**
- * Constructs a new token for the specified Image and Kind.
- */
- public Token(int kind, String image)
- {
- this.kind = kind;
- this.image = image;
- }
-
- /**
- * Returns the image.
- */
- public String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simply add something like :
- *
- * case MyParserConstants.ID : return new IDToken(ofKind, image);
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use sit in your lexical actions.
- */
- public static Token newToken(int ofKind, String image)
- {
- switch(ofKind)
- {
- default : return new Token(ofKind, image);
- }
- }
-
- public static Token newToken(int ofKind)
- {
- return newToken(ofKind, null);
- }
-
-}
-/* JavaCC - OriginalChecksum=dfd1857bf2f000661cadfe9ef672245e (do not edit this line) */
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/TokenMgrError.java b/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/TokenMgrError.java
deleted file mode 100644
index 835339dc53..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/filter/selector/TokenMgrError.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
-/* JavaCCOptions: */
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.filter.selector;
-
-/** Token Manager Error. */
-public class TokenMgrError extends Error
-{
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their escaped (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexical error
- * curLexState : lexical state in which this error occurred
- * errorLine : line number when the error occurred
- * errorColumn : column number when the error occurred
- * errorAfter : prefix that was seen before this error occurred
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** Constructor with message and reason. */
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- /** Full Constructor. */
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
-/* JavaCC - OriginalChecksum=795daaee93a15e0081e60f73df35399f (do not edit this line) */
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQBody.java
deleted file mode 100644
index 6860b46546..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQBody.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
-import org.apache.qpid.transport.ByteBufferSender;
-
-public interface AMQBody
-{
- public byte getFrameType();
-
- /**
- * Get the size of the body
- * @return unsigned short
- */
- public abstract int getSize();
-
- public void writePayload(DataOutput buffer) throws IOException;
-
- void handle(final int channelId, final AMQVersionAwareProtocolSession amqProtocolSession) throws AMQException;
-
- long writePayload(ByteBufferSender sender) throws IOException;
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlock.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlock.java
deleted file mode 100644
index 8f804bf2d6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlock.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.transport.ByteBufferSender;
-
-
-/**
- * A data block represents something that has a size in bytes and the ability to write itself to a byte
- * buffer (similar to a byte array).
- */
-public abstract class AMQDataBlock implements EncodableAMQDataBlock
-{
- /**
- * Get the size of buffer needed to store the byte representation of this
- * frame.
- * @return unsigned integer
- */
- public abstract long getSize();
-
- /**
- * Writes the datablock to the specified buffer.
- * @param buffer the buffer to write to
- * @throws IOException if there is a problem writing the output
- */
- public abstract void writePayload(DataOutput buffer) throws IOException;
-
- public abstract long writePayload(ByteBufferSender sender) throws IOException;
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrame.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrame.java
deleted file mode 100644
index 5fcdfb901a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrame.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.util.BytesDataOutput;
-
-public class AMQFrame extends AMQDataBlock implements EncodableAMQDataBlock
-{
- private final int _channel;
-
- private final AMQBody _bodyFrame;
- public static final byte FRAME_END_BYTE = (byte) 0xCE;
-
-
- public AMQFrame(final int channel, final AMQBody bodyFrame)
- {
- _channel = channel;
- _bodyFrame = bodyFrame;
- }
-
- public long getSize()
- {
- return 1 + 2 + 4 + _bodyFrame.getSize() + 1;
- }
-
- public static final int getFrameOverhead()
- {
- return 1 + 2 + 4 + 1;
- }
-
-
- public void writePayload(DataOutput buffer) throws IOException
- {
- buffer.writeByte(_bodyFrame.getFrameType());
- EncodingUtils.writeUnsignedShort(buffer, _channel);
- EncodingUtils.writeUnsignedInteger(buffer, _bodyFrame.getSize());
- _bodyFrame.writePayload(buffer);
- buffer.writeByte(FRAME_END_BYTE);
- }
-
- private static final byte[] FRAME_END_BYTE_ARRAY = new byte[] { FRAME_END_BYTE };
-
- @Override
- public long writePayload(final ByteBufferSender sender) throws IOException
- {
- byte[] frameHeader = new byte[7];
- BytesDataOutput buffer = new BytesDataOutput(frameHeader);
-
- buffer.writeByte(_bodyFrame.getFrameType());
- EncodingUtils.writeUnsignedShort(buffer, _channel);
- EncodingUtils.writeUnsignedInteger(buffer, _bodyFrame.getSize());
- sender.send(ByteBuffer.wrap(frameHeader));
-
- long size = 8 + _bodyFrame.writePayload(sender);
-
- sender.send(ByteBuffer.wrap(FRAME_END_BYTE_ARRAY));
- return size;
- }
-
- public final int getChannel()
- {
- return _channel;
- }
-
- public final AMQBody getBodyFrame()
- {
- return _bodyFrame;
- }
-
- public String toString()
- {
- return "Frame channelId: " + _channel + ", bodyFrame: " + String.valueOf(_bodyFrame);
- }
-
- public static void writeFrame(DataOutput buffer, final int channel, AMQBody body) throws IOException
- {
- buffer.writeByte(body.getFrameType());
- EncodingUtils.writeUnsignedShort(buffer, channel);
- EncodingUtils.writeUnsignedInteger(buffer, body.getSize());
- body.writePayload(buffer);
- buffer.writeByte(FRAME_END_BYTE);
-
- }
-
- public static void writeFrames(DataOutput buffer, final int channel, AMQBody body1, AMQBody body2) throws IOException
- {
- buffer.writeByte(body1.getFrameType());
- EncodingUtils.writeUnsignedShort(buffer, channel);
- EncodingUtils.writeUnsignedInteger(buffer, body1.getSize());
- body1.writePayload(buffer);
- buffer.writeByte(FRAME_END_BYTE);
- buffer.writeByte(body2.getFrameType());
- EncodingUtils.writeUnsignedShort(buffer, channel);
- EncodingUtils.writeUnsignedInteger(buffer, body2.getSize());
- body2.writePayload(buffer);
- buffer.writeByte(FRAME_END_BYTE);
-
- }
-
- public static void writeFrames(DataOutput buffer, final int channel, AMQBody body1, AMQBody body2, AMQBody body3) throws IOException
- {
- buffer.writeByte(body1.getFrameType());
- EncodingUtils.writeUnsignedShort(buffer, channel);
- EncodingUtils.writeUnsignedInteger(buffer, body1.getSize());
- body1.writePayload(buffer);
- buffer.writeByte(FRAME_END_BYTE);
- buffer.writeByte(body2.getFrameType());
- EncodingUtils.writeUnsignedShort(buffer, channel);
- EncodingUtils.writeUnsignedInteger(buffer, body2.getSize());
- body2.writePayload(buffer);
- buffer.writeByte(FRAME_END_BYTE);
- buffer.writeByte(body3.getFrameType());
- EncodingUtils.writeUnsignedShort(buffer, channel);
- EncodingUtils.writeUnsignedInteger(buffer, body3.getSize());
- body3.writePayload(buffer);
- buffer.writeByte(FRAME_END_BYTE);
-
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java
deleted file mode 100644
index 34e9211d1c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * AMQFrameDecodingException indicates that an AMQP frame cannot be decoded because it does not have the correct
- * format as defined by the protocol.
- */
-public class AMQFrameDecodingException extends AMQException
-{
- public AMQFrameDecodingException(AMQConstant errorCode, String message, Throwable cause)
- {
- super(errorCode, message, cause);
- }
-
- public AMQFrameDecodingException(AMQConstant errorCode, String message)
- {
- super(errorCode, message, null);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBody.java
deleted file mode 100644
index 23315d4787..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBody.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQChannelException;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-
-public interface AMQMethodBody extends AMQBody
-{
- public static final byte TYPE = 1;
-
- /** @return unsigned short */
- public int getClazz();
-
- /** @return unsigned short */
- public int getMethod();
-
- public void writeMethodPayload(DataOutput buffer) throws IOException;
-
-
- public int getSize();
-
- public void writePayload(DataOutput buffer) throws IOException;
-
- public AMQFrame generateFrame(int channelId);
-
- public String toString();
-
-
-
- /**
- * Convenience Method to create a channel not found exception
- *
- * @param channelId The channel id that is not found
- *
- * @param methodRegistry
- * @return new AMQChannelException
- */
- public AMQChannelException getChannelNotFoundException(int channelId, final MethodRegistry methodRegistry);
-
- public AMQChannelException getChannelException(AMQConstant code,
- String message,
- final MethodRegistry methodRegistry);
-
- public AMQConnectionException getConnectionException(AMQConstant code,
- String message,
- final MethodRegistry methodRegistry);
-
-
- public boolean execute(MethodDispatcher methodDispatcher, int channelId) throws AMQException;
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java
deleted file mode 100644
index 01deed67ed..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.apache.qpid.AMQChannelException;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.util.BytesDataOutput;
-
-public abstract class AMQMethodBodyImpl implements AMQMethodBody
-{
- public static final byte TYPE = 1;
-
- public AMQMethodBodyImpl()
- {
- }
-
- public byte getFrameType()
- {
- return TYPE;
- }
-
-
- /** unsigned short
- *
- * @return body size*/
- abstract protected int getBodySize();
-
-
- public AMQFrame generateFrame(int channelId)
- {
- return new AMQFrame(channelId, this);
- }
-
- /**
- * Creates an AMQChannelException for the corresponding body type (a channel exception should include the class and
- * method ids of the body it resulted from).
- */
-
- /**
- * Convenience Method to create a channel not found exception
- *
- * @param channelId The channel id that is not found
- *
- * @param methodRegistry
- * @return new AMQChannelException
- */
- public AMQChannelException getChannelNotFoundException(int channelId, final MethodRegistry methodRegistry)
- {
- return getChannelException(AMQConstant.NOT_FOUND, "Channel not found for id:" + channelId, methodRegistry);
- }
-
- public AMQChannelException getChannelException(AMQConstant code,
- String message,
- final MethodRegistry methodRegistry)
- {
- return new AMQChannelException(code, message, getClazz(), getMethod(), methodRegistry);
- }
-
- public AMQConnectionException getConnectionException(AMQConstant code,
- String message,
- final MethodRegistry methodRegistry)
- {
- return new AMQConnectionException(code, message, this, methodRegistry);
- }
-
- public void handle(final int channelId, final AMQVersionAwareProtocolSession session) throws AMQException
- {
- session.methodFrameReceived(channelId, this);
- }
-
- public int getSize()
- {
- return 2 + 2 + getBodySize();
- }
-
- public void writePayload(DataOutput buffer) throws IOException
- {
- EncodingUtils.writeUnsignedShort(buffer, getClazz());
- EncodingUtils.writeUnsignedShort(buffer, getMethod());
- writeMethodPayload(buffer);
- }
-
- @Override
- public long writePayload(final ByteBufferSender sender) throws IOException
- {
- final int size = getSize();
- byte[] bytes = new byte[size];
- BytesDataOutput buffer = new BytesDataOutput(bytes);
- writePayload(buffer);
- sender.send(ByteBuffer.wrap(bytes));
- return size;
- }
-
- protected int getSizeOf(AMQShortString string)
- {
- return EncodingUtils.encodedShortStringLength(string);
- }
-
- protected void writeByte(DataOutput buffer, byte b) throws IOException
- {
- buffer.writeByte(b);
- }
-
- protected void writeAMQShortString(DataOutput buffer, AMQShortString string) throws IOException
- {
- EncodingUtils.writeShortStringBytes(buffer, string);
- }
-
- protected int readInt(DataInput buffer) throws IOException
- {
- return buffer.readInt();
- }
-
- protected void writeInt(DataOutput buffer, int i) throws IOException
- {
- buffer.writeInt(i);
- }
-
- protected int getSizeOf(FieldTable table)
- {
- return EncodingUtils.encodedFieldTableLength(table); //To change body of created methods use File | Settings | File Templates.
- }
-
- protected void writeFieldTable(DataOutput buffer, FieldTable table) throws IOException
- {
- EncodingUtils.writeFieldTableBytes(buffer, table);
- }
-
- protected void writeLong(DataOutput buffer, long l) throws IOException
- {
- buffer.writeLong(l);
- }
-
- protected int getSizeOf(byte[] response)
- {
- return (response == null) ? 4 : response.length + 4;
- }
-
- protected void writeBytes(DataOutput buffer, byte[] data) throws IOException
- {
- EncodingUtils.writeBytes(buffer,data);
- }
-
- protected short readShort(DataInput buffer) throws IOException
- {
- return EncodingUtils.readShort(buffer);
- }
-
- protected void writeShort(DataOutput buffer, short s) throws IOException
- {
- EncodingUtils.writeShort(buffer, s);
- }
-
- protected void writeBitfield(DataOutput buffer, byte bitfield0) throws IOException
- {
- buffer.writeByte(bitfield0);
- }
-
- protected void writeUnsignedShort(DataOutput buffer, int s) throws IOException
- {
- EncodingUtils.writeUnsignedShort(buffer, s);
- }
-
- protected void writeUnsignedInteger(DataOutput buffer, long i) throws IOException
- {
- EncodingUtils.writeUnsignedInteger(buffer, i);
- }
-
-
- protected void writeUnsignedByte(DataOutput buffer, short unsignedByte) throws IOException
- {
- EncodingUtils.writeUnsignedByte(buffer, unsignedByte);
- }
-
- protected long readTimestamp(DataInput buffer) throws IOException
- {
- return EncodingUtils.readTimestamp(buffer);
- }
-
- protected void writeTimestamp(DataOutput buffer, long t) throws IOException
- {
- EncodingUtils.writeTimestamp(buffer, t);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolClassException.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolClassException.java
deleted file mode 100644
index 0586a11619..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolClassException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-/**
- * AMQProtocolInstanceException indicates that the protocol class is incorrect in a header.
- * <p>
- * TODO Not an AMQP exception as no status code.
- */
-public class AMQProtocolClassException extends AMQProtocolHeaderException
-{
- public AMQProtocolClassException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolHeaderException.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolHeaderException.java
deleted file mode 100644
index b55a48067d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolHeaderException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import org.apache.qpid.transport.TransportException;
-
-public class AMQProtocolHeaderException extends TransportException
-{
- public AMQProtocolHeaderException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolInstanceException.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolInstanceException.java
deleted file mode 100644
index cbc9e724de..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolInstanceException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-/**
- * AMQProtocolInstanceException indicates that the protocol instance is incorrect in a header.
- * <p>
- * TODO Not an AMQP exception as no status code.
- */
-public class AMQProtocolInstanceException extends AMQProtocolHeaderException
-{
- public AMQProtocolInstanceException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolVersionException.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolVersionException.java
deleted file mode 100644
index 37c384bfc9..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolVersionException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-/**
- * AMQProtocolInstanceException indicates that the client and server differ on expected protocol version in a header.
- * <p>
- * TODO Not an AMQP exception as no status code.
- */
-public class AMQProtocolVersionException extends AMQProtocolHeaderException
-{
- public AMQProtocolVersionException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java
deleted file mode 100644
index 765d742789..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java
+++ /dev/null
@@ -1,797 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A short string is a representation of an AMQ Short String
- * Short strings differ from the Java String class by being limited to on ASCII characters (0-127)
- * and thus can be held more effectively in a byte buffer.
- *
- */
-public final class AMQShortString implements CharSequence, Comparable<AMQShortString>
-{
- /**
- * The maximum number of octets in AMQ short string as defined in AMQP specification
- */
- public static final int MAX_LENGTH = 255;
- private static final byte MINUS = (byte)'-';
- private static final byte ZERO = (byte) '0';
-
- private final class TokenizerImpl implements AMQShortStringTokenizer
- {
- private final byte _delim;
- private int _count = -1;
- private int _pos = 0;
-
- public TokenizerImpl(final byte delim)
- {
- _delim = delim;
- }
-
- public int countTokens()
- {
- if(_count == -1)
- {
- _count = 1 + AMQShortString.this.occurrences(_delim);
- }
- return _count;
- }
-
- public AMQShortString nextToken()
- {
- if(_pos <= AMQShortString.this.length())
- {
- int nextDelim = AMQShortString.this.indexOf(_delim, _pos);
- if(nextDelim == -1)
- {
- nextDelim = AMQShortString.this.length();
- }
-
- AMQShortString nextToken = AMQShortString.this.substring(_pos, nextDelim++);
- _pos = nextDelim;
- return nextToken;
- }
- else
- {
- return null;
- }
- }
-
- public boolean hasMoreTokens()
- {
- return _pos <= AMQShortString.this.length();
- }
- }
-
- private AMQShortString substring(final int from, final int to)
- {
- return new AMQShortString(_data, from+_offset, to-from);
- }
-
- private static final ConcurrentMap<AMQShortString, AMQShortString> _globalInternMap =
- new ConcurrentHashMap<AMQShortString, AMQShortString>();
-
- private static final Logger _logger = LoggerFactory.getLogger(AMQShortString.class);
-
- private final byte[] _data;
- private final int _offset;
- private int _hashCode;
- private String _asString = null;
-
- private final int _length;
- private static final char[] EMPTY_CHAR_ARRAY = new char[0];
-
- public static final AMQShortString EMPTY_STRING = new AMQShortString((String)null);
-
- public AMQShortString(byte[] data)
- {
- if (data == null)
- {
- throw new NullPointerException("Cannot create AMQShortString with null data[]");
- }
- if (data.length > MAX_LENGTH)
- {
- throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
- }
- _data = data.clone();
- _length = data.length;
- _offset = 0;
- }
-
- public AMQShortString(String data)
- {
- this((data == null) ? EMPTY_CHAR_ARRAY : data.toCharArray());
- _asString = data;
- }
-
- public AMQShortString(char[] data)
- {
- if (data == null)
- {
- throw new NullPointerException("Cannot create AMQShortString with null char[]");
- }
- // the current implementation of 0.8/0.9.x short string encoding
- // supports only ASCII characters
- if (data.length> MAX_LENGTH)
- {
- throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
- }
- final int length = data.length;
- final byte[] stringBytes = new byte[length];
- int hash = 0;
- for (int i = 0; i < length; i++)
- {
- stringBytes[i] = (byte) (0xFF & data[i]);
- hash = (31 * hash) + stringBytes[i];
- }
- _hashCode = hash;
- _data = stringBytes;
-
- _length = length;
- _offset = 0;
-
- }
-
- public AMQShortString(CharSequence charSequence)
- {
- if (charSequence == null)
- {
- // it should be possible to create short string for null data
- charSequence = "";
- }
- // the current implementation of 0.8/0.9.x short string encoding
- // supports only ASCII characters
- if (charSequence.length() > MAX_LENGTH)
- {
- throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
- }
- final int length = charSequence.length();
- final byte[] stringBytes = new byte[length];
- int hash = 0;
- for (int i = 0; i < length; i++)
- {
- stringBytes[i] = ((byte) (0xFF & charSequence.charAt(i)));
- hash = (31 * hash) + stringBytes[i];
-
- }
-
- _data = stringBytes;
- _hashCode = hash;
- _length = length;
- _offset = 0;
-
- }
-
- private AMQShortString(DataInput data, final int length) throws IOException
- {
- if (length > MAX_LENGTH)
- {
- throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
- }
- byte[] dataBytes = new byte[length];
- data.readFully(dataBytes);
- _data = dataBytes;
- _offset = 0;
- _length = length;
-
- }
-
- public AMQShortString(byte[] data, final int offset, final int length)
- {
- if (length > MAX_LENGTH)
- {
- throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
- }
- if (data == null)
- {
- throw new NullPointerException("Cannot create AMQShortString with null data[]");
- }
-
- _offset = offset;
- _length = length;
- _data = data;
- }
-
- public AMQShortString shrink()
- {
- if(_data.length != _length)
- {
- return copy();
- }
- else
- {
- return this;
- }
- }
-
- /**
- * Get the length of the short string
- * @return length of the underlying byte array
- */
- public int length()
- {
- return _length;
- }
-
- public char charAt(int index)
- {
-
- return (char) _data[_offset + index];
-
- }
-
- public CharSequence subSequence(int start, int end)
- {
- return new CharSubSequence(start, end);
- }
-
- public static AMQShortString readFromBuffer(DataInput buffer) throws IOException
- {
- final int length = buffer.readUnsignedByte();
- if (length == 0)
- {
- return null;
- }
- else
- {
-
- return new AMQShortString(buffer, length);
- }
- }
-
- public byte[] getBytes()
- {
- if(_offset == 0 && _length == _data.length)
- {
- return _data.clone();
- }
- else
- {
- byte[] data = new byte[_length];
- System.arraycopy(_data,_offset,data,0,_length);
- return data;
- }
- }
-
- public void writeToBuffer(DataOutput buffer) throws IOException
- {
-
- final int size = length();
- buffer.writeByte(size);
- buffer.write(_data, _offset, size);
-
- }
-
- public boolean endsWith(String s)
- {
- return endsWith(new AMQShortString(s));
- }
-
-
- public boolean endsWith(AMQShortString otherString)
- {
-
- if (otherString.length() > length())
- {
- return false;
- }
-
-
- int thisLength = length();
- int otherLength = otherString.length();
-
- for (int i = 1; i <= otherLength; i++)
- {
- if (charAt(thisLength - i) != otherString.charAt(otherLength - i))
- {
- return false;
- }
- }
- return true;
- }
-
- public boolean startsWith(String s)
- {
- return startsWith(new AMQShortString(s));
- }
-
- public boolean startsWith(AMQShortString otherString)
- {
-
- if (otherString.length() > length())
- {
- return false;
- }
-
- for (int i = 0; i < otherString.length(); i++)
- {
- if (charAt(i) != otherString.charAt(i))
- {
- return false;
- }
- }
-
- return true;
-
- }
-
- public boolean startsWith(CharSequence otherString)
- {
- if (otherString.length() > length())
- {
- return false;
- }
-
- for (int i = 0; i < otherString.length(); i++)
- {
- if (charAt(i) != otherString.charAt(i))
- {
- return false;
- }
- }
-
- return true;
- }
-
-
- private final class CharSubSequence implements CharSequence
- {
- private final int _sequenceOffset;
- private final int _end;
-
- public CharSubSequence(final int offset, final int end)
- {
- _sequenceOffset = offset;
- _end = end;
- }
-
- public int length()
- {
- return _end - _sequenceOffset;
- }
-
- public char charAt(int index)
- {
- return AMQShortString.this.charAt(index + _sequenceOffset);
- }
-
- public CharSequence subSequence(int start, int end)
- {
- return new CharSubSequence(start + _sequenceOffset, end + _sequenceOffset);
- }
-
- @Override
- public String toString()
- {
- char[] chars = new char[length()];
- for(int i = 0; i < length(); i++)
- {
- chars[i] = charAt(i);
- }
- return new String(chars);
- }
- }
-
- public char[] asChars()
- {
- final int size = length();
- final char[] chars = new char[size];
-
- for (int i = 0; i < size; i++)
- {
- chars[i] = (char) _data[i + _offset];
- }
-
- return chars;
- }
-
-
- public String asString()
- {
- if (_asString == null)
- {
- AMQShortString intern = intern(false);
-
- if(intern == this)
- {
- _asString = new String(asChars());
- }
- else
- {
- _asString = intern.asString();
- }
-
- }
- return _asString;
- }
-
- public boolean equals(Object o)
- {
-
- if (o == this)
- {
- return true;
- }
-
- if(o instanceof AMQShortString)
- {
- return equals((AMQShortString) o);
- }
-
- return false;
-
- }
-
- public boolean equals(final AMQShortString otherString)
- {
- if (otherString == this)
- {
- return true;
- }
-
- if (otherString == null)
- {
- return false;
- }
-
- final int hashCode = _hashCode;
-
- final int otherHashCode = otherString._hashCode;
-
- if ((hashCode != 0) && (otherHashCode != 0) && (hashCode != otherHashCode))
- {
- return false;
- }
-
- final int length = _length;
-
- if(length != otherString._length)
- {
- return false;
- }
-
-
- final byte[] data = _data;
-
- final byte[] otherData = otherString._data;
-
- final int offset = _offset;
-
- final int otherOffset = otherString._offset;
-
- if(offset == 0 && otherOffset == 0 && length == data.length && length == otherData.length)
- {
- return Arrays.equals(data, otherData);
- }
- else
- {
- int thisIdx = offset;
- int otherIdx = otherOffset;
- for(int i = length; i-- != 0; )
- {
- if(!(data[thisIdx++] == otherData[otherIdx++]))
- {
- return false;
- }
- }
- }
-
- return true;
-
- }
-
- public boolean equalsCharSequence(CharSequence s)
- {
- if(s instanceof AMQShortString)
- {
- return equals((AMQShortString) s);
- }
-
- if (s == null)
- {
- return false;
- }
-
- if (s.length() != length())
- {
- return false;
- }
-
- for (int i = 0; i < length(); i++)
- {
- if (charAt(i) != s.charAt(i))
- {
- return false;
- }
- }
-
- return true;
- }
-
- public int hashCode()
- {
- int hash = _hashCode;
- if (hash == 0)
- {
- final int size = length();
-
- for (int i = 0; i < size; i++)
- {
- hash = (31 * hash) + _data[i+_offset];
- }
-
- _hashCode = hash;
- }
-
- return hash;
- }
-
- public void setDirty()
- {
- _hashCode = 0;
- }
-
- public String toString()
- {
- return asString();
- }
-
- public int compareTo(AMQShortString name)
- {
- if(name == this)
- {
- return 0;
- }
- else if (name == null)
- {
- return 1;
- }
- else
- {
-
- if (name.length() < length())
- {
- return -name.compareTo(this);
- }
-
- for (int i = 0; i < length(); i++)
- {
- final byte d = _data[i+_offset];
- final byte n = name._data[i+name._offset];
- if (d < n)
- {
- return -1;
- }
-
- if (d > n)
- {
- return 1;
- }
- }
-
- return (length() == name.length()) ? 0 : -1;
- }
- }
-
-
- public AMQShortStringTokenizer tokenize(byte delim)
- {
- return new TokenizerImpl(delim);
- }
-
-
- public AMQShortString intern()
- {
- return intern(true);
- }
-
- public AMQShortString intern(boolean keep)
- {
-
- AMQShortString internString = keep ? _globalInternMap.putIfAbsent(this,this) : _globalInternMap.get(this);
-
- return internString == null ? this : internString;
-
- }
-
- private AMQShortString copy()
- {
- byte[] dataBytes = new byte[_length];
- System.arraycopy(_data,_offset,dataBytes,0,_length);
- return new AMQShortString(dataBytes,0,_length);
- }
-
- private int occurrences(final byte delim)
- {
- int count = 0;
- final int end = _offset + _length;
- for(int i = _offset ; i < end ; i++ )
- {
- if(_data[i] == delim)
- {
- count++;
- }
- }
- return count;
- }
-
- private int indexOf(final byte val, final int pos)
- {
-
- for(int i = pos; i < length(); i++)
- {
- if(_data[_offset+i] == val)
- {
- return i;
- }
- }
- return -1;
- }
-
-
- public static AMQShortString join(final Collection<AMQShortString> terms,
- final AMQShortString delim)
- {
- if(terms.size() == 0)
- {
- return EMPTY_STRING;
- }
-
- int size = delim.length() * (terms.size() - 1);
- for(AMQShortString term : terms)
- {
- size += term.length();
- }
-
- if (size > MAX_LENGTH)
- {
- throw new IllegalArgumentException("Cannot create AMQShortString with number of octets over 255!");
- }
- byte[] data = new byte[size];
- int pos = 0;
- final byte[] delimData = delim._data;
- final int delimOffset = delim._offset;
- final int delimLength = delim._length;
-
-
- for(AMQShortString term : terms)
- {
-
- if(pos!=0)
- {
- System.arraycopy(delimData, delimOffset,data,pos, delimLength);
- pos+=delimLength;
- }
- System.arraycopy(term._data,term._offset,data,pos,term._length);
- pos+=term._length;
- }
-
-
-
- return new AMQShortString(data,0,size);
- }
-
- public int toIntValue()
- {
- int pos = _offset;
- int val = 0;
-
-
- boolean isNegative = (_data[pos] == MINUS);
- if(isNegative)
- {
- pos++;
- }
-
- final int end = _length + _offset;
-
- while(pos < end)
- {
- int digit = (int) (_data[pos++] - ZERO);
- if((digit < 0) || (digit > 9))
- {
- throw new NumberFormatException("\""+toString()+"\" is not a valid number");
- }
- val = val * 10;
- val += digit;
- }
- if(isNegative)
- {
- val = val * -1;
- }
- return val;
- }
-
- public boolean contains(final byte b)
- {
- final int end = _length + _offset;
- for(int i = _offset; i < end; i++)
- {
- if(_data[i] == b)
- {
- return true;
- }
- }
- return false; //To change body of created methods use File | Settings | File Templates.
- }
-
- public static AMQShortString validValueOf(Object obj)
- {
- return valueOf(obj,true,true);
- }
-
- static AMQShortString valueOf(Object obj, boolean truncate, boolean nullAsEmptyString)
- {
- if (obj == null)
- {
- if (nullAsEmptyString)
- {
- return EMPTY_STRING;
- }
- return null;
- }
- else
- {
- String value = String.valueOf(obj);
- if (truncate && value.length() > AMQShortString.MAX_LENGTH)
- {
- value = value.substring(0, AMQShortString.MAX_LENGTH - 3) + "...";
- }
- return valueOf(value);
- }
- }
-
- public static AMQShortString valueOf(Object obj)
- {
- return valueOf(obj, false, false);
- }
-
- public static AMQShortString valueOf(String obj)
- {
- if(obj == null)
- {
- return null;
- }
- else
- {
- return new AMQShortString(obj);
- }
-
- }
-
- public static String toString(AMQShortString amqShortString)
- {
- return amqShortString == null ? null : amqShortString.asString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortStringTokenizer.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortStringTokenizer.java
deleted file mode 100644
index 25ab60327a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortStringTokenizer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-package org.apache.qpid.framing;
-
-
-public interface AMQShortStringTokenizer
-{
-
- public int countTokens();
-
- public AMQShortString nextToken();
-
- boolean hasMoreTokens();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQType.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQType.java
deleted file mode 100644
index 71b5c5a623..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQType.java
+++ /dev/null
@@ -1,844 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.Collection;
-
-/**
- * AMQType is a type that represents the different possible AMQP field table types. It provides operations for each
- * of the types to perform tasks such as calculating the size of an instance of the type, converting types between AMQP
- * and Java native types, and reading and writing instances of AMQP types in binary formats to and from byte buffers.
- */
-public enum AMQType
-{
- LONG_STRING('S')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedLongStringLength((String) value);
- }
-
- public String toNativeValue(Object value)
- {
- if (value != null)
- {
- return value.toString();
- }
- else
- {
- throw new NullPointerException("Cannot convert: null to String.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeLongStringBytes(buffer, (String) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readLongString(buffer);
- }
- },
-
- INTEGER('i')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.unsignedIntegerLength();
- }
-
- public Long toNativeValue(Object value)
- {
- if (value instanceof Long)
- {
- return (Long) value;
- }
- else if (value instanceof Integer)
- {
- return ((Integer) value).longValue();
- }
- else if (value instanceof Short)
- {
- return ((Short) value).longValue();
- }
- else if (value instanceof Byte)
- {
- return ((Byte) value).longValue();
- }
- else if ((value instanceof String) || (value == null))
- {
- return Long.valueOf((String) value);
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName() + ") to int.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeUnsignedInteger(buffer, (Long) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readUnsignedInteger(buffer);
- }
- },
-
- DECIMAL('D')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedByteLength() + EncodingUtils.encodedIntegerLength();
- }
-
- public Object toNativeValue(Object value)
- {
- if (value instanceof BigDecimal)
- {
- return (BigDecimal) value;
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to BigDecimal.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- BigDecimal bd = (BigDecimal) value;
-
- byte places = new Integer(bd.scale()).byteValue();
-
- int unscaled = bd.intValue();
-
- EncodingUtils.writeByte(buffer, places);
-
- EncodingUtils.writeInteger(buffer, unscaled);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- byte places = EncodingUtils.readByte(buffer);
-
- int unscaled = EncodingUtils.readInteger(buffer);
-
- BigDecimal bd = new BigDecimal(unscaled);
-
- return bd.setScale(places);
- }
- },
-
- TIMESTAMP('T')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedLongLength();
- }
-
- public Object toNativeValue(Object value)
- {
- if (value instanceof Long)
- {
- return (Long) value;
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to timestamp.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeLong(buffer, (Long) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readLong(buffer);
- }
- },
-
- /**
- * Implements the field table type. The native value of a field table type will be an instance of
- * {@link FieldTable}, which itself may contain name/value pairs encoded as {@link AMQTypedValue}s.
- */
- FIELD_TABLE('F')
- {
- /**
- * Calculates the size of an instance of the type in bytes.
- *
- * @param value An instance of the type.
- *
- * @return The size of the instance of the type in bytes.
- */
- public int getEncodingSize(Object value)
- {
- // Ensure that the value is a FieldTable.
- if (!(value instanceof FieldTable))
- {
- throw new IllegalArgumentException("Value is not a FieldTable.");
- }
-
- FieldTable ftValue = (FieldTable) value;
-
- // Loop over all name/value pairs adding up size of each. FieldTable itself keeps track of its encoded
- // size as entries are added, so no need to loop over all explicitly.
- // EncodingUtils calculation of the encoded field table lenth, will include 4 bytes for its 'size' field.
- return EncodingUtils.encodedFieldTableLength(ftValue);
- }
-
- /**
- * Converts an instance of the type to an equivalent Java native representation.
- *
- * @param value An instance of the type.
- *
- * @return An equivalent Java native representation.
- */
- public Object toNativeValue(Object value)
- {
- // Ensure that the value is a FieldTable.
- if (!(value instanceof FieldTable))
- {
- throw new IllegalArgumentException("Value is not a FieldTable.");
- }
-
- return (FieldTable) value;
- }
-
- /**
- * Writes an instance of the type to a specified byte buffer.
- *
- * @param value An instance of the type.
- * @param buffer The byte buffer to write it to.
- */
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- // Ensure that the value is a FieldTable.
- if (!(value instanceof FieldTable))
- {
- throw new IllegalArgumentException("Value is not a FieldTable.");
- }
-
- FieldTable ftValue = (FieldTable) value;
-
- // Loop over all name/values writing out into buffer.
- ftValue.writeToBuffer(buffer);
- }
-
- /**
- * Reads an instance of the type from a specified byte buffer.
- *
- * @param buffer The byte buffer to write it to.
- *
- * @return An instance of the type.
- */
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- try
- {
- // Read size of field table then all name/value pairs.
- return EncodingUtils.readFieldTable(buffer);
- }
- catch (AMQFrameDecodingException e)
- {
- throw new IllegalArgumentException("Unable to read field table from buffer.", e);
- }
- }
- },
- /**
- * Implements the field table type. The native value of a field table type will be an instance of
- * {@link FieldTable}, which itself may contain name/value pairs encoded as {@link AMQTypedValue}s.
- */
- FIELD_ARRAY('A')
- {
- public int getEncodingSize(Object value)
- {
- if (!(value instanceof Collection))
- {
- throw new IllegalArgumentException("Value is not a Collection.");
- }
-
- FieldArray fieldArrayValue = FieldArray.asFieldArray((Collection)value);
-
- return 4 + fieldArrayValue.getEncodingSize();
- }
-
- public Object toNativeValue(Object value)
- {
- // Ensure that the value is a FieldTable.
- if (!(value instanceof Collection))
- {
- throw new IllegalArgumentException("Value cannot be converted to a FieldArray.");
- }
-
- return FieldArray.asFieldArray((Collection)value);
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
-
- if (!(value instanceof FieldArray))
- {
- throw new IllegalArgumentException("Value is not a FieldArray.");
- }
-
- FieldArray fieldArrayValue = (FieldArray) value;
-
- // Loop over all name/values writing out into buffer.
- fieldArrayValue.writeToBuffer(buffer);
- }
-
- /**
- * Reads an instance of the type from a specified byte buffer.
- *
- * @param buffer The byte buffer to write it to.
- *
- * @return An instance of the type.
- */
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- // Read size of field table then all name/value pairs.
- return FieldArray.readFromBuffer(buffer);
-
- }
- },
- VOID('V')
- {
- public int getEncodingSize(Object value)
- {
- return 0;
- }
-
- public Object toNativeValue(Object value)
- {
- if (value == null)
- {
- return null;
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to null String.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer)
- { }
-
- public Object readValueFromBuffer(DataInput buffer)
- {
- return null;
- }
- },
-
- BINARY('x')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedLongstrLength((byte[]) value);
- }
-
- public Object toNativeValue(Object value)
- {
- if ((value instanceof byte[]) || (value == null))
- {
- return value;
- }
- else
- {
- throw new IllegalArgumentException("Value: " + value + " (" + value.getClass().getName()
- + ") cannot be converted to byte[]");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeLongstr(buffer, (byte[]) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readLongstr(buffer);
- }
- },
-
- ASCII_STRING('c')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedLongStringLength((String) value);
- }
-
- public String toNativeValue(Object value)
- {
- if (value != null)
- {
- return value.toString();
- }
- else
- {
- throw new NullPointerException("Cannot convert: null to String.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeLongStringBytes(buffer, (String) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readLongString(buffer);
- }
- },
-
- WIDE_STRING('C')
- {
- public int getEncodingSize(Object value)
- {
- // FIXME: use proper charset encoder
- return EncodingUtils.encodedLongStringLength((String) value);
- }
-
- public String toNativeValue(Object value)
- {
- if (value != null)
- {
- return value.toString();
- }
- else
- {
- throw new NullPointerException("Cannot convert: null to String.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeLongStringBytes(buffer, (String) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readLongString(buffer);
- }
- },
-
- BOOLEAN('t')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedBooleanLength();
- }
-
- public Object toNativeValue(Object value)
- {
- if (value instanceof Boolean)
- {
- return (Boolean) value;
- }
- else if ((value instanceof String) || (value == null))
- {
- return Boolean.valueOf((String) value);
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to boolean.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeBoolean(buffer, (Boolean) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readBoolean(buffer);
- }
- },
-
- ASCII_CHARACTER('k')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedCharLength();
- }
-
- public Character toNativeValue(Object value)
- {
- if (value instanceof Character)
- {
- return (Character) value;
- }
- else if (value == null)
- {
- throw new NullPointerException("Cannot convert null into char");
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to char.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeChar(buffer, (Character) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readChar(buffer);
- }
- },
-
- BYTE('b')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedByteLength();
- }
-
- public Byte toNativeValue(Object value)
- {
- if (value instanceof Byte)
- {
- return (Byte) value;
- }
- else if ((value instanceof String) || (value == null))
- {
- return Byte.valueOf((String) value);
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to byte.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeByte(buffer, (Byte) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readByte(buffer);
- }
- },
-
- SHORT('s')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedShortLength();
- }
-
- public Short toNativeValue(Object value)
- {
- if (value instanceof Short)
- {
- return (Short) value;
- }
- else if (value instanceof Byte)
- {
- return ((Byte) value).shortValue();
- }
- else if ((value instanceof String) || (value == null))
- {
- return Short.valueOf((String) value);
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to short.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeShort(buffer, (Short) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readShort(buffer);
- }
- },
-
- INT('I')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedIntegerLength();
- }
-
- public Integer toNativeValue(Object value)
- {
- if (value instanceof Integer)
- {
- return (Integer) value;
- }
- else if (value instanceof Short)
- {
- return ((Short) value).intValue();
- }
- else if (value instanceof Byte)
- {
- return ((Byte) value).intValue();
- }
- else if ((value instanceof String) || (value == null))
- {
- return Integer.valueOf((String) value);
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName() + ") to int.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeInteger(buffer, (Integer) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readInteger(buffer);
- }
- },
-
- LONG('l')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedLongLength();
- }
-
- public Object toNativeValue(Object value)
- {
- if (value instanceof Long)
- {
- return (Long) value;
- }
- else if (value instanceof Integer)
- {
- return ((Integer) value).longValue();
- }
- else if (value instanceof Short)
- {
- return ((Short) value).longValue();
- }
- else if (value instanceof Byte)
- {
- return ((Byte) value).longValue();
- }
- else if ((value instanceof String) || (value == null))
- {
- return Long.valueOf((String) value);
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to long.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeLong(buffer, (Long) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readLong(buffer);
- }
- },
-
- FLOAT('f')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedFloatLength();
- }
-
- public Float toNativeValue(Object value)
- {
- if (value instanceof Float)
- {
- return (Float) value;
- }
- else if ((value instanceof String) || (value == null))
- {
- return Float.valueOf((String) value);
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to float.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeFloat(buffer, (Float) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readFloat(buffer);
- }
- },
-
- DOUBLE('d')
- {
- public int getEncodingSize(Object value)
- {
- return EncodingUtils.encodedDoubleLength();
- }
-
- public Double toNativeValue(Object value)
- {
- if (value instanceof Double)
- {
- return (Double) value;
- }
- else if (value instanceof Float)
- {
- return ((Float) value).doubleValue();
- }
- else if ((value instanceof String) || (value == null))
- {
- return Double.valueOf((String) value);
- }
- else
- {
- throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName()
- + ") to double.");
- }
- }
-
- public void writeValueImpl(Object value, DataOutput buffer) throws IOException
- {
- EncodingUtils.writeDouble(buffer, (Double) value);
- }
-
- public Object readValueFromBuffer(DataInput buffer) throws IOException
- {
- return EncodingUtils.readDouble(buffer);
- }
- };
-
- /** Holds the defined one byte identifier for the type. */
- private final byte _identifier;
-
- /**
- * Creates an instance of an AMQP type from its defined one byte identifier.
- *
- * @param identifier The one byte identifier for the type.
- */
- AMQType(char identifier)
- {
- _identifier = (byte) identifier;
- }
-
- /**
- * Extracts the byte identifier for the typ.
- *
- * @return The byte identifier for the typ.
- */
- public final byte identifier()
- {
- return _identifier;
- }
-
- /**
- * Calculates the size of an instance of the type in bytes.
- *
- * @param value An instance of the type.
- *
- * @return The size of the instance of the type in bytes.
- */
- public abstract int getEncodingSize(Object value);
-
- /**
- * Converts an instance of the type to an equivalent Java native representation.
- *
- * @param value An instance of the type.
- *
- * @return An equivalent Java native representation.
- */
- public abstract Object toNativeValue(Object value);
-
- /**
- * Converts an instance of the type to an equivalent Java native representation, packaged as an
- * {@link AMQTypedValue} tagged with its AMQP type.
- *
- * @param value An instance of the type.
- *
- * @return An equivalent Java native representation, tagged with its AMQP type.
- */
- public AMQTypedValue asTypedValue(Object value)
- {
- return AMQTypedValue.createAMQTypedValue(this, toNativeValue(value));
- }
-
- /**
- * Writes an instance of the type to a specified byte buffer, preceded by its one byte identifier. As the type and
- * value are both written, this provides a fully encoded description of a parameters type and value.
- *
- * @param value An instance of the type.
- * @param buffer The byte buffer to write it to.
- * @throws IOException if there is a problem writing to the buffer
- */
- public void writeToBuffer(Object value, DataOutput buffer) throws IOException
- {
- buffer.writeByte(identifier());
- writeValueImpl(value, buffer);
- }
-
- /**
- * Writes an instance of the type to a specified byte buffer.
- *
- * @param value An instance of the type.
- * @param buffer The byte buffer to write it to.
- */
- abstract void writeValueImpl(Object value, DataOutput buffer) throws IOException;
-
- /**
- * Reads an instance of the type from a specified byte buffer.
- *
- * @param buffer The byte buffer to write it to.
- *
- * @return An instance of the type.
- */
- abstract Object readValueFromBuffer(DataInput buffer) throws IOException;
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java
deleted file mode 100644
index 94a7d127b3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class AMQTypeMap
-{
- public static final Map<Byte, AMQType> _reverseTypeMap = new HashMap<Byte, AMQType>();
-
- private AMQTypeMap()
- {
- }
-
- static
- {
- for(AMQType type : AMQType.values())
- {
- _reverseTypeMap.put(type.identifier(), type);
- }
- }
-
- public static AMQType getType(Byte identifier)
- {
- AMQType result = _reverseTypeMap.get(identifier);
- if (result == null) {
- throw new IllegalArgumentException
- ("no such type code: " + Integer.toHexString(identifier.intValue()));
- }
- return result;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java
deleted file mode 100644
index e60ead7ad1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-
-/**
- * AMQTypedValue combines together a native Java Object value, and an {@link AMQType}, as a fully typed AMQP parameter
- * value. It provides the ability to read and write fully typed parameters to and from byte buffers. It also provides
- * the ability to create such parameters from Java native value and a type tag or to extract the native value and type
- * from one.
- */
-public abstract class AMQTypedValue
-{
-
- public abstract AMQType getType();
-
- public abstract Object getValue();
-
- public abstract void writeToBuffer(DataOutput buffer) throws IOException;
-
- public abstract int getEncodingSize();
-
-
- private static final class GenericTypedValue extends AMQTypedValue
- {
- /** The type of the value. */
- private final AMQType _type;
-
- /** The Java native representation of the AMQP typed value. */
- private final Object _value;
-
- private GenericTypedValue(AMQType type, Object value)
- {
- if (type == null)
- {
- throw new NullPointerException("Cannot create a typed value with null type");
- }
-
- _type = type;
- _value = type.toNativeValue(value);
- }
-
- private GenericTypedValue(AMQType type, DataInput buffer) throws IOException
- {
- _type = type;
- _value = type.readValueFromBuffer(buffer);
- }
-
-
- public AMQType getType()
- {
- return _type;
- }
-
- public Object getValue()
- {
- return _value;
- }
-
- public void writeToBuffer(DataOutput buffer) throws IOException
- {
- _type.writeToBuffer(_value, buffer);
- }
-
- public int getEncodingSize()
- {
- return _type.getEncodingSize(_value);
- }
-
-
- public String toString()
- {
- return "[" + getType() + ": " + getValue() + "]";
- }
-
-
- public boolean equals(Object o)
- {
- if(o instanceof GenericTypedValue)
- {
- GenericTypedValue other = (GenericTypedValue) o;
- return _type == other._type && (_value == null ? other._value == null : _value.equals(other._value));
- }
- else
- {
- return false;
- }
- }
-
- public int hashCode()
- {
- return _type.hashCode() ^ (_value == null ? 0 : _value.hashCode());
- }
-
- }
-
- private static final class LongTypedValue extends AMQTypedValue
- {
-
- private final long _value;
-
- private LongTypedValue(long value)
- {
- _value = value;
- }
-
- public LongTypedValue(DataInput buffer) throws IOException
- {
- _value = EncodingUtils.readLong(buffer);
- }
-
- public AMQType getType()
- {
- return AMQType.LONG;
- }
-
-
- public Object getValue()
- {
- return _value;
- }
-
- public void writeToBuffer(DataOutput buffer) throws IOException
- {
- EncodingUtils.writeByte(buffer,AMQType.LONG.identifier());
- EncodingUtils.writeLong(buffer,_value);
- }
-
-
- public int getEncodingSize()
- {
- return EncodingUtils.encodedLongLength();
- }
- }
-
- private static final class IntTypedValue extends AMQTypedValue
- {
- @Override
- public String toString()
- {
- return "[INT: " + String.valueOf(_value) + "]";
- }
-
- private final int _value;
-
- public IntTypedValue(int value)
- {
- _value = value;
- }
-
- public AMQType getType()
- {
- return AMQType.INT;
- }
-
-
- public Object getValue()
- {
- return _value;
- }
-
- public void writeToBuffer(DataOutput buffer) throws IOException
- {
- EncodingUtils.writeByte(buffer,AMQType.INT.identifier());
- EncodingUtils.writeInteger(buffer, _value);
- }
-
-
- public int getEncodingSize()
- {
- return EncodingUtils.encodedIntegerLength();
- }
- }
-
-
- public static AMQTypedValue readFromBuffer(DataInput buffer) throws IOException
- {
- AMQType type = AMQTypeMap.getType(buffer.readByte());
-
- switch(type)
- {
- case LONG:
- return new LongTypedValue(buffer);
-
- case INT:
- int value = EncodingUtils.readInteger(buffer);
- return createAMQTypedValue(value);
-
- default:
- return new GenericTypedValue(type, buffer);
- }
-
- }
-
- private static final AMQTypedValue[] INT_VALUES = new AMQTypedValue[16];
- static
- {
- for(int i = 0 ; i < 16; i ++)
- {
- INT_VALUES[i] = new IntTypedValue(i);
- }
- }
-
- public static AMQTypedValue createAMQTypedValue(int i)
- {
- return (i & 0x0f) == i ? INT_VALUES[i] : new IntTypedValue(i);
- }
-
-
- public static AMQTypedValue createAMQTypedValue(long value)
- {
- return new LongTypedValue(value);
- }
-
- public static AMQTypedValue createAMQTypedValue(AMQType type, Object value)
- {
- switch(type)
- {
- case LONG:
- return new LongTypedValue((Long) AMQType.LONG.toNativeValue(value));
- case INT:
- return new IntTypedValue((Integer) AMQType.INT.toNativeValue(value));
-
- default:
- return new GenericTypedValue(type, value);
- }
- }
-
-
-
- public static AMQTypedValue toTypedValue(Object val)
- {
- if(val == null)
- {
- return AMQType.VOID.asTypedValue(null);
- }
-
- Class klass = val.getClass();
- if(klass == String.class)
- {
- return AMQType.LONG_STRING.asTypedValue(val);
- }
- else if(klass == Character.class)
- {
- return AMQType.ASCII_CHARACTER.asTypedValue(val);
- }
- else if(klass == Integer.class)
- {
- return AMQType.INT.asTypedValue(val);
- }
- else if(klass == Long.class)
- {
- return AMQType.LONG.asTypedValue(val);
- }
- else if(klass == Float.class)
- {
- return AMQType.FLOAT.asTypedValue(val);
- }
- else if(klass == Double.class)
- {
- return AMQType.DOUBLE.asTypedValue(val);
- }
- else if(klass == Date.class)
- {
- return AMQType.TIMESTAMP.asTypedValue(val);
- }
- else if(klass == Byte.class)
- {
- return AMQType.BYTE.asTypedValue(val);
- }
- else if(klass == Boolean.class)
- {
- return AMQType.BOOLEAN.asTypedValue(val);
- }
- else if(klass == byte[].class)
- {
- return AMQType.BINARY.asTypedValue(val);
- }
- else if(klass == BigDecimal.class)
- {
- return AMQType.DECIMAL.asTypedValue(val);
- }
- else if(val instanceof Map)
- {
- return AMQType.FIELD_TABLE.asTypedValue(FieldTable.convertToFieldTable((Map)val));
- }
- else if(klass == FieldTable.class)
- {
- return AMQType.FIELD_TABLE.asTypedValue(val);
- }
- else if(val instanceof Collection)
- {
- return AMQType.FIELD_ARRAY.asTypedValue(val);
- }
- throw new IllegalArgumentException("Cannot convert an object of class " + val.getClass().getName() + " to an AMQP typed value");
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AccessRequestBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AccessRequestBody.java
deleted file mode 100644
index 8dec50c400..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AccessRequestBody.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class AccessRequestBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 30;
- public static final int METHOD_ID = 10;
-
- // Fields declared in specification
- private final AMQShortString _realm; // [realm]
- private final byte _bitfield0; // [exclusive, passive, active, write, read]
-
- // Constructor
- public AccessRequestBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _realm = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- }
-
- public AccessRequestBody(
- AMQShortString realm,
- boolean exclusive,
- boolean passive,
- boolean active,
- boolean write,
- boolean read
- )
- {
- _realm = realm;
- byte bitfield0 = (byte)0;
- if( exclusive )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- if( passive )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 1));
- }
-
- if( active )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 2));
- }
-
- if( write )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 3));
- }
-
- if( read )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 4));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getRealm()
- {
- return _realm;
- }
- public final boolean getExclusive()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final boolean getPassive()
- {
- return (((int)(_bitfield0)) & ( 1 << 1)) != 0;
- }
- public final boolean getActive()
- {
- return (((int)(_bitfield0)) & ( 1 << 2)) != 0;
- }
- public final boolean getWrite()
- {
- return (((int)(_bitfield0)) & ( 1 << 3)) != 0;
- }
- public final boolean getRead()
- {
- return (((int)(_bitfield0)) & ( 1 << 4)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 1;
- size += getSizeOf( _realm );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _realm );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchAccessRequest(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[AccessRequestBodyImpl: ");
- buf.append( "realm=" );
- buf.append( getRealm() );
- buf.append( ", " );
- buf.append( "exclusive=" );
- buf.append( getExclusive() );
- buf.append( ", " );
- buf.append( "passive=" );
- buf.append( getPassive() );
- buf.append( ", " );
- buf.append( "active=" );
- buf.append( getActive() );
- buf.append( ", " );
- buf.append( "write=" );
- buf.append( getWrite() );
- buf.append( ", " );
- buf.append( "read=" );
- buf.append( getRead() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
- AMQShortString realm = buffer.readAMQShortString();
- byte bitfield = buffer.readByte();
- boolean exclusive = (bitfield & 0x01) == 0x1 ;
- boolean passive = (bitfield & 0x02) == 0x2 ;
- boolean active = (bitfield & 0x04) == 0x4 ;
- boolean write = (bitfield & 0x08) == 0x8 ;
- boolean read = (bitfield & 0x10) == 0x10 ;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveAccessRequest(realm, exclusive, passive, active, write, read);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AccessRequestOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AccessRequestOkBody.java
deleted file mode 100644
index 7ed0b3602b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AccessRequestOkBody.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class AccessRequestOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 30;
- public static final int METHOD_ID = 11;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
-
- // Constructor
- public AccessRequestOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- }
-
- public AccessRequestOkBody(
- int ticket
- )
- {
- _ticket = ticket;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
-
- protected int getBodySize()
- {
- int size = 2;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchAccessRequestOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[AccessRequestOkBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher)
- throws IOException
- {
- int ticket = buffer.readUnsignedShort();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveAccessRequestOk(ticket);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicAckBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicAckBody.java
deleted file mode 100644
index 01ca6f95f1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicAckBody.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicAckBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 80;
-
- // Fields declared in specification
- private final long _deliveryTag; // [deliveryTag]
- private final byte _bitfield0; // [multiple]
-
- // Constructor
- public BasicAckBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _deliveryTag = buffer.readLong();
- _bitfield0 = buffer.readByte();
- }
-
- public BasicAckBody(
- long deliveryTag,
- boolean multiple
- )
- {
- _deliveryTag = deliveryTag;
- byte bitfield0 = (byte)0;
- if( multiple )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final long getDeliveryTag()
- {
- return _deliveryTag;
- }
- public final boolean getMultiple()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 9;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeLong( buffer, _deliveryTag );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicAck(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicAckBodyImpl: ");
- buf.append( "deliveryTag=" );
- buf.append( getDeliveryTag() );
- buf.append( ", " );
- buf.append( "multiple=" );
- buf.append( getMultiple() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ChannelMethodProcessor dispatcher) throws IOException
- {
-
- long deliveryTag = buffer.readLong();
- boolean multiple = (buffer.readByte() & 0x01) != 0;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicAck(deliveryTag, multiple);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicCancelBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicCancelBody.java
deleted file mode 100644
index c9a870e2a5..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicCancelBody.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicCancelBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 30;
-
- // Fields declared in specification
- private final AMQShortString _consumerTag; // [consumerTag]
- private final byte _bitfield0; // [nowait]
-
- // Constructor
- public BasicCancelBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _consumerTag = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- }
-
- public BasicCancelBody(
- AMQShortString consumerTag,
- boolean nowait
- )
- {
- _consumerTag = consumerTag;
- byte bitfield0 = (byte)0;
- if( nowait )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getConsumerTag()
- {
- return _consumerTag;
- }
- public final boolean getNowait()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 1;
- size += getSizeOf( _consumerTag );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _consumerTag );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicCancel(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicCancelBodyImpl: ");
- buf.append( "consumerTag=" );
- buf.append( getConsumerTag() );
- buf.append( ", " );
- buf.append( "nowait=" );
- buf.append( getNowait() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
-
- AMQShortString consumerTag = buffer.readAMQShortString();
- boolean noWait = (buffer.readByte() & 0x01) == 0x01;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicCancel(consumerTag, noWait);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicCancelOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicCancelOkBody.java
deleted file mode 100644
index 8d16aa44ec..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicCancelOkBody.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicCancelOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 31;
-
- // Fields declared in specification
- private final AMQShortString _consumerTag; // [consumerTag]
-
- // Constructor
- public BasicCancelOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _consumerTag = buffer.readAMQShortString();
- }
-
- public BasicCancelOkBody(
- AMQShortString consumerTag
- )
- {
- _consumerTag = consumerTag;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getConsumerTag()
- {
- return _consumerTag;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _consumerTag );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _consumerTag );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicCancelOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicCancelOkBodyImpl: ");
- buf.append( "consumerTag=" );
- buf.append( getConsumerTag() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput in,
- final ClientChannelMethodProcessor dispatcher)
- throws IOException
- {
- AMQShortString consumerTag = in.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicCancelOk(consumerTag);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicConsumeBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicConsumeBody.java
deleted file mode 100644
index 502fa07e78..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicConsumeBody.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicConsumeBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 20;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _queue; // [queue]
- private final AMQShortString _consumerTag; // [consumerTag]
- private final byte _bitfield0; // [noLocal, noAck, exclusive, nowait]
- private final FieldTable _arguments; // [arguments]
-
- // Constructor
- public BasicConsumeBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _queue = buffer.readAMQShortString();
- _consumerTag = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- _arguments = EncodingUtils.readFieldTable(buffer);
- }
-
- public BasicConsumeBody(
- int ticket,
- AMQShortString queue,
- AMQShortString consumerTag,
- boolean noLocal,
- boolean noAck,
- boolean exclusive,
- boolean nowait,
- FieldTable arguments
- )
- {
- _ticket = ticket;
- _queue = queue;
- _consumerTag = consumerTag;
- byte bitfield0 = (byte)0;
- if( noLocal )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- if( noAck )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 1));
- }
-
- if( exclusive )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 2));
- }
-
- if( nowait )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 3));
- }
-
- _bitfield0 = bitfield0;
- _arguments = arguments;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getQueue()
- {
- return _queue;
- }
- public final AMQShortString getConsumerTag()
- {
- return _consumerTag;
- }
- public final boolean getNoLocal()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final boolean getNoAck()
- {
- return (((int)(_bitfield0)) & ( 1 << 1)) != 0;
- }
- public final boolean getExclusive()
- {
- return (((int)(_bitfield0)) & ( 1 << 2)) != 0;
- }
- public final boolean getNowait()
- {
- return (((int)(_bitfield0)) & ( 1 << 3)) != 0;
- }
- public final FieldTable getArguments()
- {
- return _arguments;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _queue );
- size += getSizeOf( _consumerTag );
- size += getSizeOf( _arguments );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _queue );
- writeAMQShortString( buffer, _consumerTag );
- writeBitfield( buffer, _bitfield0 );
- writeFieldTable( buffer, _arguments );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicConsume(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicConsumeBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append( ", " );
- buf.append( "consumerTag=" );
- buf.append( getConsumerTag() );
- buf.append( ", " );
- buf.append( "noLocal=" );
- buf.append( getNoLocal() );
- buf.append( ", " );
- buf.append( "noAck=" );
- buf.append( getNoAck() );
- buf.append( ", " );
- buf.append( "exclusive=" );
- buf.append( getExclusive() );
- buf.append( ", " );
- buf.append( "nowait=" );
- buf.append( getNowait() );
- buf.append( ", " );
- buf.append( "arguments=" );
- buf.append( getArguments() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher)
- throws IOException, AMQFrameDecodingException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString queue = buffer.readAMQShortString();
- AMQShortString consumerTag = buffer.readAMQShortString();
- byte bitfield = buffer.readByte();
-
- boolean noLocal = (bitfield & 0x01) == 0x01;
- boolean noAck = (bitfield & 0x02) == 0x02;
- boolean exclusive = (bitfield & 0x04) == 0x04;
- boolean nowait = (bitfield & 0x08) == 0x08;
- FieldTable arguments = EncodingUtils.readFieldTable(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicConsume(queue, consumerTag, noLocal, noAck, exclusive, nowait, arguments);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicConsumeOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicConsumeOkBody.java
deleted file mode 100644
index d3df7f222a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicConsumeOkBody.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicConsumeOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 21;
-
- // Fields declared in specification
- private final AMQShortString _consumerTag; // [consumerTag]
-
- // Constructor
- public BasicConsumeOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _consumerTag = buffer.readAMQShortString();
- }
-
- public BasicConsumeOkBody(
- AMQShortString consumerTag
- )
- {
- _consumerTag = consumerTag;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getConsumerTag()
- {
- return _consumerTag;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _consumerTag );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _consumerTag );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicConsumeOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicConsumeOkBodyImpl: ");
- buf.append( "consumerTag=" );
- buf.append( getConsumerTag() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher)
- throws IOException
- {
- AMQShortString consumerTag = buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicConsumeOk(consumerTag);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
deleted file mode 100644
index 6481c6ebdb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
+++ /dev/null
@@ -1,799 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.util.BytesDataOutput;
-
-public class BasicContentHeaderProperties
-{
- //persistent & non-persistent constants, values as per JMS DeliveryMode
- public static final byte NON_PERSISTENT = 1;
- public static final byte PERSISTENT = 2;
-
- private static final Logger _logger = LoggerFactory.getLogger(BasicContentHeaderProperties.class);
-
- private static final AMQShortString ZERO_STRING = null;
-
- private AMQShortString _contentType;
-
- private AMQShortString _encoding;
-
- private FieldTable _headers;
-
- private byte _deliveryMode;
-
- private byte _priority;
-
- private AMQShortString _correlationId;
-
- private AMQShortString _replyTo;
-
- private long _expiration;
-
- private AMQShortString _messageId;
-
- private long _timestamp;
-
- private AMQShortString _type;
-
- private AMQShortString _userId;
-
- private AMQShortString _appId;
-
- private AMQShortString _clusterId;
-
- private int _propertyFlags = 0;
- private static final int CONTENT_TYPE_MASK = 1 << 15;
- private static final int ENCODING_MASK = 1 << 14;
- private static final int HEADERS_MASK = 1 << 13;
- private static final int DELIVERY_MODE_MASK = 1 << 12;
- private static final int PRIORITY_MASK = 1 << 11;
- private static final int CORRELATION_ID_MASK = 1 << 10;
- private static final int REPLY_TO_MASK = 1 << 9;
- private static final int EXPIRATION_MASK = 1 << 8;
- private static final int MESSAGE_ID_MASK = 1 << 7;
- private static final int TIMESTAMP_MASK = 1 << 6;
- private static final int TYPE_MASK = 1 << 5;
- private static final int USER_ID_MASK = 1 << 4;
- private static final int APPLICATION_ID_MASK = 1 << 3;
- private static final int CLUSTER_ID_MASK = 1 << 2;
- private byte[] _encodedForm;
-
-
- public BasicContentHeaderProperties(BasicContentHeaderProperties other)
- {
- if(other._headers != null)
- {
- byte[] encodedHeaders = other._headers.getDataAsBytes();
-
- _headers = new FieldTable(encodedHeaders,0,encodedHeaders.length);
-
- }
-
- _contentType = other._contentType;
-
- _encoding = other._encoding;
-
- _deliveryMode = other._deliveryMode;
-
- _priority = other._priority;
-
- _correlationId = other._correlationId;
-
- _replyTo = other._replyTo;
-
- _expiration = other._expiration;
-
- _messageId = other._messageId;
-
- _timestamp = other._timestamp;
-
- _type = other._type;
-
- _userId = other._userId;
-
- _appId = other._appId;
-
- _clusterId = other._clusterId;
-
- _propertyFlags = other._propertyFlags;
- }
-
- public BasicContentHeaderProperties()
- {
- }
-
- public int getPropertyListSize()
- {
- if(useEncodedForm())
- {
- return _encodedForm.length;
- }
- else
- {
- int size = 0;
-
- if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_contentType);
- }
-
- if ((_propertyFlags & ENCODING_MASK) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_encoding);
- }
-
- if ((_propertyFlags & HEADERS_MASK) != 0)
- {
- size += EncodingUtils.encodedFieldTableLength(_headers);
- }
-
- if ((_propertyFlags & DELIVERY_MODE_MASK) != 0)
- {
- size += 1;
- }
-
- if ((_propertyFlags & PRIORITY_MASK) != 0)
- {
- size += 1;
- }
-
- if ((_propertyFlags & CORRELATION_ID_MASK) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_correlationId);
- }
-
- if ((_propertyFlags & REPLY_TO_MASK) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_replyTo);
- }
-
- if ((_propertyFlags & EXPIRATION_MASK) != 0)
- {
- if (_expiration == 0L)
- {
- size += EncodingUtils.encodedShortStringLength(ZERO_STRING);
- }
- else
- {
- size += EncodingUtils.encodedShortStringLength(_expiration);
- }
- }
-
- if ((_propertyFlags & MESSAGE_ID_MASK) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_messageId);
- }
-
- if ((_propertyFlags & TIMESTAMP_MASK) != 0)
- {
- size += 8;
- }
-
- if ((_propertyFlags & TYPE_MASK) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_type);
- }
-
- if ((_propertyFlags & USER_ID_MASK) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_userId);
- }
-
- if ((_propertyFlags & APPLICATION_ID_MASK) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_appId);
- }
-
- if ((_propertyFlags & CLUSTER_ID_MASK) != 0)
- {
- size += EncodingUtils.encodedShortStringLength(_clusterId);
- }
-
- return size;
- }
- }
-
- public void setPropertyFlags(int propertyFlags)
- {
- _propertyFlags = propertyFlags;
- }
-
- public int getPropertyFlags()
- {
- return _propertyFlags;
- }
-
- public void writePropertyListPayload(DataOutput buffer) throws IOException
- {
- if(useEncodedForm())
- {
- buffer.write(_encodedForm);
- }
- else
- {
- if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _contentType);
- }
-
- if ((_propertyFlags & ENCODING_MASK) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _encoding);
- }
-
- if ((_propertyFlags & HEADERS_MASK) != 0)
- {
- EncodingUtils.writeFieldTableBytes(buffer, _headers);
- }
-
- if ((_propertyFlags & DELIVERY_MODE_MASK) != 0)
- {
- buffer.writeByte(_deliveryMode);
- }
-
- if ((_propertyFlags & PRIORITY_MASK) != 0)
- {
- buffer.writeByte(_priority);
- }
-
- if ((_propertyFlags & CORRELATION_ID_MASK) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _correlationId);
- }
-
- if ((_propertyFlags & REPLY_TO_MASK) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _replyTo);
- }
-
- if ((_propertyFlags & EXPIRATION_MASK) != 0)
- {
- if (_expiration == 0L)
- {
- EncodingUtils.writeShortStringBytes(buffer, ZERO_STRING);
- }
- else
- {
- EncodingUtils.writeShortStringBytes(buffer, String.valueOf(_expiration));
- }
- }
-
- if ((_propertyFlags & MESSAGE_ID_MASK) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _messageId);
- }
-
- if ((_propertyFlags & TIMESTAMP_MASK) != 0)
- {
- EncodingUtils.writeTimestamp(buffer, _timestamp);
- }
-
- if ((_propertyFlags & TYPE_MASK) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _type);
- }
-
- if ((_propertyFlags & USER_ID_MASK) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _userId);
- }
-
- if ((_propertyFlags & APPLICATION_ID_MASK) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _appId);
- }
-
- if ((_propertyFlags & CLUSTER_ID_MASK) != 0)
- {
- EncodingUtils.writeShortStringBytes(buffer, _clusterId);
- }
- }
- }
-
-
- public long writePropertyListPayload(final ByteBufferSender sender) throws IOException
- {
- if(useEncodedForm())
- {
- sender.send(ByteBuffer.wrap(_encodedForm));
- return _encodedForm.length;
- }
- else
- {
- int propertyListSize = getPropertyListSize();
- byte[] data = new byte[propertyListSize];
- BytesDataOutput out = new BytesDataOutput(data);
- writePropertyListPayload(out);
- sender.send(ByteBuffer.wrap(data));
- return propertyListSize;
- }
-
- }
-
- public void populatePropertiesFromBuffer(DataInput buffer, int propertyFlags, int size) throws AMQFrameDecodingException, IOException
- {
- _propertyFlags = propertyFlags;
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Property flags: " + _propertyFlags);
- }
-
- _encodedForm = new byte[size];
- buffer.readFully(_encodedForm);
-
- ByteArrayDataInput input = new ByteArrayDataInput(_encodedForm);
-
- decode(input);
-
- }
-
- private void decode(ByteArrayDataInput buffer) throws IOException, AMQFrameDecodingException
- {
- int headersOffset = 0;
-
- if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
- {
- _contentType = buffer.readAMQShortString();
- headersOffset += EncodingUtils.encodedShortStringLength(_contentType);
- }
-
- if ((_propertyFlags & ENCODING_MASK) != 0)
- {
- _encoding = buffer.readAMQShortString();
- headersOffset += EncodingUtils.encodedShortStringLength(_encoding);
- }
-
- if ((_propertyFlags & HEADERS_MASK) != 0)
- {
- long length = EncodingUtils.readUnsignedInteger(buffer);
-
- _headers = new FieldTable(_encodedForm, headersOffset+4, (int)length);
-
- buffer.skipBytes((int)length);
- }
-
- if ((_propertyFlags & DELIVERY_MODE_MASK) != 0)
- {
- _deliveryMode = buffer.readByte();
- }
-
- if ((_propertyFlags & PRIORITY_MASK) != 0)
- {
- _priority = buffer.readByte();
- }
-
- if ((_propertyFlags & CORRELATION_ID_MASK) != 0)
- {
- _correlationId = buffer.readAMQShortString();
- }
-
- if ((_propertyFlags & REPLY_TO_MASK) != 0)
- {
- _replyTo = buffer.readAMQShortString();
- }
-
- if ((_propertyFlags & EXPIRATION_MASK) != 0)
- {
- _expiration = EncodingUtils.readLongAsShortString(buffer);
- }
-
- if ((_propertyFlags & MESSAGE_ID_MASK) != 0)
- {
- _messageId = buffer.readAMQShortString();
- }
-
- if ((_propertyFlags & TIMESTAMP_MASK) != 0)
- {
- _timestamp = EncodingUtils.readTimestamp(buffer);
- }
-
- if ((_propertyFlags & TYPE_MASK) != 0)
- {
- _type = buffer.readAMQShortString();
- }
-
- if ((_propertyFlags & USER_ID_MASK) != 0)
- {
- _userId = buffer.readAMQShortString();
- }
-
- if ((_propertyFlags & APPLICATION_ID_MASK) != 0)
- {
- _appId = buffer.readAMQShortString();
- }
-
- if ((_propertyFlags & CLUSTER_ID_MASK) != 0)
- {
- _clusterId = buffer.readAMQShortString();
- }
-
-
- }
-
-
- public AMQShortString getContentType()
- {
- return _contentType;
- }
-
- public String getContentTypeAsString()
- {
- return (_contentType == null) ? null : _contentType.toString();
- }
-
- public void setContentType(AMQShortString contentType)
- {
-
- if(contentType == null)
- {
- _propertyFlags &= (~CONTENT_TYPE_MASK);
- }
- else
- {
- _propertyFlags |= CONTENT_TYPE_MASK;
- }
- _contentType = contentType;
- _encodedForm = null;
- }
-
- public void setContentType(String contentType)
- {
- setContentType((contentType == null) ? null : AMQShortString.valueOf(contentType));
- }
-
- public String getEncodingAsString()
- {
-
- return (getEncoding() == null) ? null : getEncoding().toString();
- }
-
- public AMQShortString getEncoding()
- {
- return _encoding;
- }
-
- public void setEncoding(String encoding)
- {
- setEncoding(encoding == null ? null : AMQShortString.valueOf(encoding));
- }
-
- public void setEncoding(AMQShortString encoding)
- {
- if(encoding == null)
- {
- _propertyFlags &= (~ENCODING_MASK);
- }
- else
- {
- _propertyFlags |= ENCODING_MASK;
- }
- _encoding = encoding;
- _encodedForm = null;
- }
-
- public FieldTable getHeaders()
- {
- if (_headers == null)
- {
- setHeaders(FieldTableFactory.newFieldTable());
- }
-
- return _headers;
- }
-
- public void setHeaders(FieldTable headers)
- {
- if(headers == null)
- {
- _propertyFlags &= (~HEADERS_MASK);
- }
- else
- {
- _propertyFlags |= HEADERS_MASK;
- }
- _headers = headers;
- _encodedForm = null;
- }
-
- public byte getDeliveryMode()
- {
- return _deliveryMode;
- }
-
- public void setDeliveryMode(byte deliveryMode)
- {
- _propertyFlags |= DELIVERY_MODE_MASK;
- _deliveryMode = deliveryMode;
- _encodedForm = null;
- }
-
- public byte getPriority()
- {
- return _priority;
- }
-
- public void setPriority(byte priority)
- {
- _propertyFlags |= PRIORITY_MASK;
- _priority = priority;
- _encodedForm = null;
- }
-
- public AMQShortString getCorrelationId()
- {
- return _correlationId;
- }
-
- public String getCorrelationIdAsString()
- {
- return (_correlationId == null) ? null : _correlationId.toString();
- }
-
- public void setCorrelationId(String correlationId)
- {
- setCorrelationId((correlationId == null) ? null : AMQShortString.valueOf(correlationId));
- }
-
- public void setCorrelationId(AMQShortString correlationId)
- {
- if(correlationId == null)
- {
- _propertyFlags &= (~CORRELATION_ID_MASK);
- }
- else
- {
- _propertyFlags |= CORRELATION_ID_MASK;
- }
- _correlationId = correlationId;
- _encodedForm = null;
- }
-
- public String getReplyToAsString()
- {
- return (_replyTo == null) ? null : _replyTo.toString();
- }
-
- public AMQShortString getReplyTo()
- {
- return _replyTo;
- }
-
- public void setReplyTo(String replyTo)
- {
- setReplyTo((replyTo == null) ? null : AMQShortString.valueOf(replyTo));
- }
-
- public void setReplyTo(AMQShortString replyTo)
- {
- if(replyTo == null)
- {
- _propertyFlags &= (~REPLY_TO_MASK);
- }
- else
- {
- _propertyFlags |= REPLY_TO_MASK;
- }
- _replyTo = replyTo;
- _encodedForm = null;
- }
-
- public long getExpiration()
- {
- return _expiration;
- }
-
- public void setExpiration(long expiration)
- {
- if(expiration == 0l)
- {
- _propertyFlags &= (~EXPIRATION_MASK);
- }
- else
- {
- _propertyFlags |= EXPIRATION_MASK;
- }
- _expiration = expiration;
- _encodedForm = null;
- }
-
- public AMQShortString getMessageId()
- {
- return _messageId;
- }
-
- public String getMessageIdAsString()
- {
- return (_messageId == null) ? null : _messageId.toString();
- }
-
- public void setMessageId(String messageId)
- {
- setMessageId(messageId == null ? null : new AMQShortString(messageId));
- }
-
- public void setMessageId(AMQShortString messageId)
- {
- if(messageId == null)
- {
- _propertyFlags &= (~MESSAGE_ID_MASK);
- }
- else
- {
- _propertyFlags |= MESSAGE_ID_MASK;
- }
- _messageId = messageId;
- _encodedForm = null;
- }
-
- public long getTimestamp()
- {
- return _timestamp;
- }
-
- public void setTimestamp(long timestamp)
- {
- _propertyFlags |= TIMESTAMP_MASK;
- _timestamp = timestamp;
- _encodedForm = null;
- }
-
- public String getTypeAsString()
- {
- return (_type == null) ? null : _type.toString();
- }
-
- public AMQShortString getType()
- {
- return _type;
- }
-
- public void setType(String type)
- {
- setType((type == null) ? null : AMQShortString.valueOf(type));
- }
-
- public void setType(AMQShortString type)
- {
- if(type == null)
- {
- _propertyFlags &= (~TYPE_MASK);
- }
- else
- {
- _propertyFlags |= TYPE_MASK;
- }
- _type = type;
- _encodedForm = null;
- }
-
- public String getUserIdAsString()
- {
- return (_userId == null) ? null : _userId.toString();
- }
-
- public AMQShortString getUserId()
- {
- return _userId;
- }
-
- public void setUserId(String userId)
- {
- setUserId((userId == null) ? null : AMQShortString.valueOf(userId));
- }
-
- public void setUserId(AMQShortString userId)
- {
- if(userId == null)
- {
- _propertyFlags &= (~USER_ID_MASK);
- }
- else
- {
- _propertyFlags |= USER_ID_MASK;
- }
- _userId = userId;
- _encodedForm = null;
- }
-
- public String getAppIdAsString()
- {
- return (_appId == null) ? null : _appId.toString();
- }
-
- public AMQShortString getAppId()
- {
- return _appId;
- }
-
- public void setAppId(String appId)
- {
- setAppId((appId == null) ? null : AMQShortString.valueOf(appId));
- }
-
- public void setAppId(AMQShortString appId)
- {
- if(appId == null)
- {
- _propertyFlags &= (~APPLICATION_ID_MASK);
- }
- else
- {
- _propertyFlags |= APPLICATION_ID_MASK;
- }
- _appId = appId;
- _encodedForm = null;
- }
-
- public String getClusterIdAsString()
- {
- return (_clusterId == null) ? null : _clusterId.toString();
- }
-
- public AMQShortString getClusterId()
- {
- return _clusterId;
- }
-
- public void setClusterId(String clusterId)
- {
- setClusterId((clusterId == null) ? null : AMQShortString.valueOf(clusterId));
- }
-
- public void setClusterId(AMQShortString clusterId)
- {
- if(clusterId == null)
- {
- _propertyFlags &= (~CLUSTER_ID_MASK);
- }
- else
- {
- _propertyFlags |= CLUSTER_ID_MASK;
- }
- _clusterId = clusterId;
- _encodedForm = null;
- }
-
- public String toString()
- {
- return "reply-to = " + _replyTo + ",propertyFlags = " + _propertyFlags + ",ApplicationID = " + _appId
- + ",ClusterID = " + _clusterId + ",UserId = " + _userId + ",JMSMessageID = " + _messageId
- + ",JMSCorrelationID = " + _correlationId + ",JMSDeliveryMode = " + _deliveryMode + ",JMSExpiration = "
- + _expiration + ",JMSPriority = " + _priority + ",JMSTimestamp = " + _timestamp + ",JMSType = " + _type;
- }
-
- private boolean useEncodedForm()
- {
- return _encodedForm != null && (_headers == null || _headers.isClean());
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicDeliverBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicDeliverBody.java
deleted file mode 100644
index f61ee2d55b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicDeliverBody.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicDeliverBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 60;
-
- // Fields declared in specification
- private final AMQShortString _consumerTag; // [consumerTag]
- private final long _deliveryTag; // [deliveryTag]
- private final byte _bitfield0; // [redelivered]
- private final AMQShortString _exchange; // [exchange]
- private final AMQShortString _routingKey; // [routingKey]
-
- // Constructor
- public BasicDeliverBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _consumerTag = buffer.readAMQShortString();
- _deliveryTag = buffer.readLong();
- _bitfield0 = buffer.readByte();
- _exchange = buffer.readAMQShortString();
- _routingKey = buffer.readAMQShortString();
- }
-
- public BasicDeliverBody(
- AMQShortString consumerTag,
- long deliveryTag,
- boolean redelivered,
- AMQShortString exchange,
- AMQShortString routingKey
- )
- {
- _consumerTag = consumerTag;
- _deliveryTag = deliveryTag;
- byte bitfield0 = (byte)0;
- if( redelivered )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- _bitfield0 = bitfield0;
- _exchange = exchange;
- _routingKey = routingKey;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getConsumerTag()
- {
- return _consumerTag;
- }
- public final long getDeliveryTag()
- {
- return _deliveryTag;
- }
- public final boolean getRedelivered()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
-
- protected int getBodySize()
- {
- int size = 9;
- size += getSizeOf( _consumerTag );
- size += getSizeOf( _exchange );
- size += getSizeOf( _routingKey );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _consumerTag );
- writeLong( buffer, _deliveryTag );
- writeBitfield( buffer, _bitfield0 );
- writeAMQShortString( buffer, _exchange );
- writeAMQShortString( buffer, _routingKey );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicDeliver(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicDeliverBodyImpl: ");
- buf.append( "consumerTag=" );
- buf.append( getConsumerTag() );
- buf.append( ", " );
- buf.append( "deliveryTag=" );
- buf.append( getDeliveryTag() );
- buf.append( ", " );
- buf.append( "redelivered=" );
- buf.append( getRedelivered() );
- buf.append( ", " );
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "routingKey=" );
- buf.append( getRoutingKey() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher) throws IOException
- {
-
- AMQShortString consumerTag = buffer.readAMQShortString();
- long deliveryTag = buffer.readLong();
- boolean redelivered = (buffer.readByte() & 0x01) != 0;
- AMQShortString exchange = buffer.readAMQShortString();
- AMQShortString routingKey = buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicDeliver(consumerTag, deliveryTag, redelivered, exchange, routingKey);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetBody.java
deleted file mode 100644
index 68a6f2980b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetBody.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicGetBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 70;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _queue; // [queue]
- private final byte _bitfield0; // [noAck]
-
- // Constructor
- public BasicGetBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _queue = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- }
-
- public BasicGetBody(
- int ticket,
- AMQShortString queue,
- boolean noAck
- )
- {
- _ticket = ticket;
- _queue = queue;
- byte bitfield0 = (byte)0;
- if( noAck )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getQueue()
- {
- return _queue;
- }
- public final boolean getNoAck()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _queue );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _queue );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicGet(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicGetBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append( ", " );
- buf.append( "noAck=" );
- buf.append( getNoAck() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher)
- throws IOException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString queue = buffer.readAMQShortString();
- boolean noAck = (buffer.readByte() & 0x01) != 0;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicGet(queue, noAck);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetEmptyBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetEmptyBody.java
deleted file mode 100644
index f37fb632db..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetEmptyBody.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicGetEmptyBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 72;
-
- // Fields declared in specification
- private final AMQShortString _clusterId; // [clusterId]
-
- // Constructor
- public BasicGetEmptyBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _clusterId = buffer.readAMQShortString();
- }
-
- public BasicGetEmptyBody(
- AMQShortString clusterId
- )
- {
- _clusterId = clusterId;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getClusterId()
- {
- return _clusterId;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _clusterId );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _clusterId );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicGetEmpty(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicGetEmptyBody: ");
- buf.append( "clusterId=" );
- buf.append( getClusterId() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher) throws IOException
- {
- AMQShortString clusterId = buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicGetEmpty();
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetOkBody.java
deleted file mode 100644
index 37e9bdae5a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicGetOkBody.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicGetOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 71;
-
- // Fields declared in specification
- private final long _deliveryTag; // [deliveryTag]
- private final byte _bitfield0; // [redelivered]
- private final AMQShortString _exchange; // [exchange]
- private final AMQShortString _routingKey; // [routingKey]
- private final long _messageCount; // [messageCount]
-
- // Constructor
- public BasicGetOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _deliveryTag = buffer.readLong();
- _bitfield0 = buffer.readByte();
- _exchange = buffer.readAMQShortString();
- _routingKey = buffer.readAMQShortString();
- _messageCount = EncodingUtils.readUnsignedInteger(buffer);
- }
-
- public BasicGetOkBody(
- long deliveryTag,
- boolean redelivered,
- AMQShortString exchange,
- AMQShortString routingKey,
- long messageCount
- )
- {
- _deliveryTag = deliveryTag;
- byte bitfield0 = (byte)0;
- if( redelivered )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- _bitfield0 = bitfield0;
- _exchange = exchange;
- _routingKey = routingKey;
- _messageCount = messageCount;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final long getDeliveryTag()
- {
- return _deliveryTag;
- }
- public final boolean getRedelivered()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
- public final long getMessageCount()
- {
- return _messageCount;
- }
-
- protected int getBodySize()
- {
- int size = 13;
- size += getSizeOf( _exchange );
- size += getSizeOf( _routingKey );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeLong( buffer, _deliveryTag );
- writeBitfield( buffer, _bitfield0 );
- writeAMQShortString( buffer, _exchange );
- writeAMQShortString( buffer, _routingKey );
- writeUnsignedInteger( buffer, _messageCount );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicGetOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicGetOkBodyImpl: ");
- buf.append( "deliveryTag=" );
- buf.append( getDeliveryTag() );
- buf.append( ", " );
- buf.append( "redelivered=" );
- buf.append( getRedelivered() );
- buf.append( ", " );
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "routingKey=" );
- buf.append( getRoutingKey() );
- buf.append( ", " );
- buf.append( "messageCount=" );
- buf.append( getMessageCount() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher) throws IOException
- {
- long deliveryTag = buffer.readLong();
- boolean redelivered = (buffer.readByte() & 0x01) != 0;
- AMQShortString exchange = buffer.readAMQShortString();
- AMQShortString routingKey = buffer.readAMQShortString();
- long messageCount = EncodingUtils.readUnsignedInteger(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicGetOk(deliveryTag, redelivered, exchange, routingKey, messageCount);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicNackBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicNackBody.java
deleted file mode 100644
index 33ccb10f39..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicNackBody.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicNackBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 120;
-
- // Fields declared in specification
- private final long _deliveryTag; // [deliveryTag]
- private final byte _bitfield0; // [multiple]
-
- // Constructor
- public BasicNackBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _deliveryTag = buffer.readLong();
- _bitfield0 = buffer.readByte();
- }
-
- public BasicNackBody(
- long deliveryTag,
- boolean multiple,
- boolean requeue
- )
- {
- _deliveryTag = deliveryTag;
- byte bitfield0 = (byte)0;
- if( multiple )
- {
- bitfield0 = (byte) (((int) bitfield0) | 1);
-
- }
- if( requeue )
- {
- bitfield0 = (byte) (((int) bitfield0) | 2);
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final long getDeliveryTag()
- {
- return _deliveryTag;
- }
-
- public final boolean getMultiple()
- {
- return (((int)(_bitfield0)) & 1) != 0;
- }
-
- public final boolean getRequeue()
- {
- return (((int)(_bitfield0)) & 2 ) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 9;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeLong( buffer, _deliveryTag );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicNack(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicNackBodyImpl: ");
- buf.append( "deliveryTag=" );
- buf.append( getDeliveryTag() );
- buf.append( ", " );
- buf.append( "multiple=" );
- buf.append( getMultiple() );
- buf.append( ", " );
- buf.append( "requeue=" );
- buf.append( getRequeue() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ChannelMethodProcessor dispatcher) throws IOException
- {
-
- long deliveryTag = buffer.readLong();
- byte bitfield = buffer.readByte();
- boolean multiple = (bitfield & 0x01) != 0;
- boolean requeue = (bitfield & 0x02) != 0;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicNack(deliveryTag, multiple, requeue);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicPublishBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicPublishBody.java
deleted file mode 100644
index 8e5d71a804..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicPublishBody.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicPublishBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 40;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _exchange; // [exchange]
- private final AMQShortString _routingKey; // [routingKey]
- private final byte _bitfield0; // [mandatory, immediate]
-
- // Constructor
- public BasicPublishBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _exchange = buffer.readAMQShortString();
- _routingKey = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- }
-
- public BasicPublishBody(
- int ticket,
- AMQShortString exchange,
- AMQShortString routingKey,
- boolean mandatory,
- boolean immediate
- )
- {
- _ticket = ticket;
- _exchange = exchange;
- _routingKey = routingKey;
- byte bitfield0 = (byte)0;
- if( mandatory )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- if( immediate )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 1));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
- public final boolean getMandatory()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final boolean getImmediate()
- {
- return (((int)(_bitfield0)) & ( 1 << 1)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _exchange );
- size += getSizeOf( _routingKey );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _exchange );
- writeAMQShortString( buffer, _routingKey );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicPublish(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicPublishBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "routingKey=" );
- buf.append( getRoutingKey() );
- buf.append( ", " );
- buf.append( "mandatory=" );
- buf.append( getMandatory() );
- buf.append( ", " );
- buf.append( "immediate=" );
- buf.append( getImmediate() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString exchange = buffer.readAMQShortString();
- AMQShortString routingKey = buffer.readAMQShortString();
- byte bitfield = buffer.readByte();
-
- boolean mandatory = (bitfield & 0x01) != 0;
- boolean immediate = (bitfield & 0x02) != 0;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicPublish(exchange, routingKey, mandatory, immediate);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicQosBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicQosBody.java
deleted file mode 100644
index 6b7e90f41f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicQosBody.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicQosBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 10;
-
- // Fields declared in specification
- private final long _prefetchSize; // [prefetchSize]
- private final int _prefetchCount; // [prefetchCount]
- private final byte _bitfield0; // [global]
-
- // Constructor
- public BasicQosBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _prefetchSize = EncodingUtils.readUnsignedInteger(buffer);
- _prefetchCount = buffer.readUnsignedShort();
- _bitfield0 = buffer.readByte();
- }
-
- public BasicQosBody(
- long prefetchSize,
- int prefetchCount,
- boolean global
- )
- {
- _prefetchSize = prefetchSize;
- _prefetchCount = prefetchCount;
- byte bitfield0 = (byte)0;
- if( global )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final long getPrefetchSize()
- {
- return _prefetchSize;
- }
- public final int getPrefetchCount()
- {
- return _prefetchCount;
- }
- public final boolean getGlobal()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 7;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedInteger( buffer, _prefetchSize );
- writeUnsignedShort( buffer, _prefetchCount );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicQos(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicQosBodyImpl: ");
- buf.append( "prefetchSize=" );
- buf.append( getPrefetchSize() );
- buf.append( ", " );
- buf.append( "prefetchCount=" );
- buf.append( getPrefetchCount() );
- buf.append( ", " );
- buf.append( "global=" );
- buf.append( getGlobal() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
-
- long prefetchSize = EncodingUtils.readUnsignedInteger(buffer);
- int prefetchCount = buffer.readUnsignedShort();
- boolean global = (buffer.readByte() & 0x01) == 0x01;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicQos(prefetchSize, prefetchCount, global);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicQosOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicQosOkBody.java
deleted file mode 100644
index 4be10906c2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicQosOkBody.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicQosOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 11;
-
- // Fields declared in specification
-
- // Constructor
- public BasicQosOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- }
-
- public BasicQosOkBody(
- )
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- int size = 0;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicQosOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicQosOkBodyImpl: ");
- buf.append("]");
- return buf.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverBody.java
deleted file mode 100644
index e5490c4827..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverBody.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicRecoverBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 100;
-
- // Fields declared in specification
- private final byte _bitfield0; // [requeue]
-
- // Constructor
- public BasicRecoverBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _bitfield0 = buffer.readByte();
- }
-
- public BasicRecoverBody(
- boolean requeue
- )
- {
- byte bitfield0 = (byte)0;
- if( requeue )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final boolean getRequeue()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 1;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicRecover(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicRecoverBodyImpl: ");
- buf.append( "requeue=" );
- buf.append( getRequeue() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput in,
- final ProtocolVersion protocolVersion,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
- boolean requeue = (in.readByte() & 0x01) == 0x01;
- boolean sync = (ProtocolVersion.v8_0.equals(protocolVersion));
-
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicRecover(requeue, sync);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverSyncBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverSyncBody.java
deleted file mode 100644
index f82ee78862..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverSyncBody.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-91
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicRecoverSyncBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
- private int _methodId;
-
- public static final int CLASS_ID = 60;
-
- // Fields declared in specification
- private final byte _bitfield0; // [requeue]
-
- // Constructor
- public BasicRecoverSyncBody(MarkableDataInput buffer, ProtocolVersion protocolVersion) throws AMQFrameDecodingException, IOException
- {
- _methodId = ProtocolVersion.v0_9.equals(protocolVersion) ? 102 : 110;
- _bitfield0 = buffer.readByte();
- }
-
- public BasicRecoverSyncBody(ProtocolVersion protocolVersion,
- boolean requeue
- )
- {
- _methodId = ProtocolVersion.v0_9.equals(protocolVersion) ? 102 : 110;
-
- byte bitfield0 = (byte)0;
- if( requeue )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return _methodId;
- }
-
- public final boolean getRequeue()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 1;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicRecoverSync(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicRecoverSyncBodyImpl: ");
- buf.append( "requeue=" );
- buf.append( getRequeue() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput in,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
- boolean requeue = (in.readByte() & 0x01) == 0x01;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicRecover(requeue, true);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverSyncOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverSyncOkBody.java
deleted file mode 100644
index dc60d53952..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRecoverSyncOkBody.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-91
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-
-public class BasicRecoverSyncOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public final int _ownMethodId;
-
- // Fields declared in specification
-
- // Constructor
- public BasicRecoverSyncOkBody(ProtocolVersion protocolVersion)
- {
- if(ProtocolVersion.v0_91.equals(protocolVersion))
- {
- _ownMethodId = 111;
- }
- else
- {
- _ownMethodId = 101;
- }
- }
-
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return _ownMethodId;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicRecoverSyncOk(this, channelId);
- }
-
- public String toString()
- {
- return "[BasicRecoverSyncOkBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRejectBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRejectBody.java
deleted file mode 100644
index 8c8757f1d2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicRejectBody.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicRejectBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 90;
-
- // Fields declared in specification
- private final long _deliveryTag; // [deliveryTag]
- private final byte _bitfield0; // [requeue]
-
- // Constructor
- public BasicRejectBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _deliveryTag = buffer.readLong();
- _bitfield0 = buffer.readByte();
- }
-
- public BasicRejectBody(
- long deliveryTag,
- boolean requeue
- )
- {
- _deliveryTag = deliveryTag;
- byte bitfield0 = (byte)0;
- if( requeue )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final long getDeliveryTag()
- {
- return _deliveryTag;
- }
- public final boolean getRequeue()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 9;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeLong( buffer, _deliveryTag );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicReject(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicRejectBodyImpl: ");
- buf.append( "deliveryTag=" );
- buf.append( getDeliveryTag() );
- buf.append( ", " );
- buf.append( "requeue=" );
- buf.append( getRequeue() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
-
- long deliveryTag = buffer.readLong();
- boolean requeue = (buffer.readByte() & 0x01) != 0;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicReject(deliveryTag, requeue);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicReturnBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicReturnBody.java
deleted file mode 100644
index afdb343c9f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicReturnBody.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class BasicReturnBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 60;
- public static final int METHOD_ID = 50;
-
- // Fields declared in specification
- private final int _replyCode; // [replyCode]
- private final AMQShortString _replyText; // [replyText]
- private final AMQShortString _exchange; // [exchange]
- private final AMQShortString _routingKey; // [routingKey]
-
- // Constructor
- public BasicReturnBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _replyCode = buffer.readUnsignedShort();
- _replyText = buffer.readAMQShortString();
- _exchange = buffer.readAMQShortString();
- _routingKey = buffer.readAMQShortString();
- }
-
- public BasicReturnBody(
- int replyCode,
- AMQShortString replyText,
- AMQShortString exchange,
- AMQShortString routingKey
- )
- {
- _replyCode = replyCode;
- _replyText = replyText;
- _exchange = exchange;
- _routingKey = routingKey;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getReplyCode()
- {
- return _replyCode;
- }
- public final AMQShortString getReplyText()
- {
- return _replyText;
- }
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
-
- protected int getBodySize()
- {
- int size = 2;
- size += getSizeOf( _replyText );
- size += getSizeOf( _exchange );
- size += getSizeOf( _routingKey );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _replyCode );
- writeAMQShortString( buffer, _replyText );
- writeAMQShortString( buffer, _exchange );
- writeAMQShortString( buffer, _routingKey );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchBasicReturn(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[BasicReturnBodyImpl: ");
- buf.append( "replyCode=" );
- buf.append( getReplyCode() );
- buf.append( ", " );
- buf.append( "replyText=" );
- buf.append( getReplyText() );
- buf.append( ", " );
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "routingKey=" );
- buf.append( getRoutingKey() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher) throws IOException
- {
-
- int replyCode = buffer.readUnsignedShort();
- AMQShortString replyText = buffer.readAMQShortString();
- AMQShortString exchange = buffer.readAMQShortString();
- AMQShortString routingKey = buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveBasicReturn(replyCode, replyText, exchange, routingKey);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ByteArrayDataInput.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ByteArrayDataInput.java
deleted file mode 100644
index 854f77e135..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ByteArrayDataInput.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ByteArrayDataInput implements ExtendedDataInput, MarkableDataInput
-{
- private byte[] _data;
- private int _offset;
- private int _length;
- private int _origin;
- private int _mark;
-
- public ByteArrayDataInput(byte[] data)
- {
- this(data,0, data.length);
- }
-
- public ByteArrayDataInput(byte[] data, int offset, int length)
- {
- _data = data;
- _offset = offset;
- _length = length;
- _origin = offset;
- _mark = 0;
- }
-
- public void readFully(byte[] b)
- {
- System.arraycopy(_data,_offset,b,0,b.length);
- _offset+=b.length;
- }
-
- public void readFully(byte[] b, int off, int len)
- {
- System.arraycopy(_data,_offset,b,off,len);
- _offset+=len;
- }
-
- public int skipBytes(int n)
- {
- return _offset+=n;
- }
-
- public boolean readBoolean()
- {
- return _data[_offset++] != 0;
- }
-
- public byte readByte()
- {
- return _data[_offset++];
- }
-
- public int readUnsignedByte()
- {
- return ((int)_data[_offset++]) & 0xFF;
- }
-
- public short readShort()
- {
- return (short) (((((int)_data[_offset++]) << 8) & 0xFF00) | (((int)_data[_offset++]) & 0xFF));
- }
-
- public int readUnsignedShort()
- {
- return (((((int)_data[_offset++]) << 8) & 0xFF00) | (((int)_data[_offset++]) & 0xFF));
- }
-
- public char readChar()
- {
- return (char) (((((int)_data[_offset++]) << 8) & 0xFF00) | (((int)_data[_offset++]) & 0xFF));
- }
-
- public int readInt()
- {
- return ((((int)_data[_offset++]) << 24) & 0xFF000000)
- | ((((int)_data[_offset++]) << 16) & 0xFF0000)
- | ((((int)_data[_offset++]) << 8) & 0xFF00)
- | (((int)_data[_offset++]) & 0xFF);
- }
-
- public long readLong()
- {
- return ((((long)_data[_offset++]) << 56) & 0xFF00000000000000L)
- | ((((long)_data[_offset++]) << 48) & 0xFF000000000000L)
- | ((((long)_data[_offset++]) << 40) & 0xFF0000000000L)
- | ((((long)_data[_offset++]) << 32) & 0xFF00000000L)
- | ((((long)_data[_offset++]) << 24) & 0xFF000000L)
- | ((((long)_data[_offset++]) << 16) & 0xFF0000L)
- | ((((long)_data[_offset++]) << 8) & 0xFF00L)
- | (((long)_data[_offset++]) & 0xFFL);
- }
-
- public float readFloat()
- {
- return Float.intBitsToFloat(readInt());
- }
-
- public double readDouble()
- {
- return Double.longBitsToDouble(readLong());
- }
-
- public AMQShortString readAMQShortString()
- {
- int length = _data[_offset++] & 0xff;
- if(length == 0)
- {
- return null;
- }
- else
- {
- final AMQShortString amqShortString = new AMQShortString(_data, _offset, length);
- _offset+=length;
- return amqShortString;
- }
- }
-
- public String readLine()
- {
- throw new UnsupportedOperationException();
- }
-
- public String readUTF()
- {
- throw new UnsupportedOperationException();
- }
-
- public int available()
- {
- return (_origin+_length)-_offset;
- }
-
-
- public long skip(long i)
- {
- _offset+=i;
- return i;
- }
-
- public int read(byte[] b)
- {
- readFully(b);
- return b.length;
- }
-
- public int position()
- {
- return _offset - _origin;
- }
-
- public void position(int position)
- {
- _offset = position + _origin;
- }
-
- public int length()
- {
- return _length;
- }
-
-
- public void mark(int readAhead)
- {
- _mark = _offset-_origin;
- }
-
- public void reset()
- {
- _offset = _origin + _mark;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelAlertBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelAlertBody.java
deleted file mode 100644
index 289cf2cc10..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelAlertBody.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ChannelAlertBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 20;
- public static final int METHOD_ID = 30;
-
- // Fields declared in specification
- private final int _replyCode; // [replyCode]
- private final AMQShortString _replyText; // [replyText]
- private final FieldTable _details; // [details]
-
- // Constructor
- public ChannelAlertBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _replyCode = buffer.readUnsignedShort();
- _replyText = buffer.readAMQShortString();
- _details = EncodingUtils.readFieldTable(buffer);
- }
-
- public ChannelAlertBody(
- int replyCode,
- AMQShortString replyText,
- FieldTable details
- )
- {
- _replyCode = replyCode;
- _replyText = replyText;
- _details = details;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getReplyCode()
- {
- return _replyCode;
- }
- public final AMQShortString getReplyText()
- {
- return _replyText;
- }
- public final FieldTable getDetails()
- {
- return _details;
- }
-
- protected int getBodySize()
- {
- int size = 2;
- size += getSizeOf( _replyText );
- size += getSizeOf( _details );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _replyCode );
- writeAMQShortString( buffer, _replyText );
- writeFieldTable( buffer, _details );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchChannelAlert(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ChannelAlertBodyImpl: ");
- buf.append( "replyCode=" );
- buf.append( getReplyCode() );
- buf.append( ", " );
- buf.append( "replyText=" );
- buf.append( getReplyText() );
- buf.append( ", " );
- buf.append( "details=" );
- buf.append( getDetails() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher)
- throws IOException, AMQFrameDecodingException
- {
-
- int replyCode = buffer.readUnsignedShort();
- AMQShortString replyText = buffer.readAMQShortString();
- FieldTable details = EncodingUtils.readFieldTable(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveChannelAlert(replyCode, replyText, details);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelCloseBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelCloseBody.java
deleted file mode 100644
index a3b92a1fad..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelCloseBody.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ChannelCloseBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 20;
- public static final int METHOD_ID = 40;
-
- // Fields declared in specification
- private final int _replyCode; // [replyCode]
- private final AMQShortString _replyText; // [replyText]
- private final int _classId; // [classId]
- private final int _methodId; // [methodId]
-
- // Constructor
- public ChannelCloseBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _replyCode = buffer.readUnsignedShort();
- _replyText = buffer.readAMQShortString();
- _classId = buffer.readUnsignedShort();
- _methodId = buffer.readUnsignedShort();
- }
-
- public ChannelCloseBody(
- int replyCode,
- AMQShortString replyText,
- int classId,
- int methodId
- )
- {
- _replyCode = replyCode;
- _replyText = replyText;
- _classId = classId;
- _methodId = methodId;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getReplyCode()
- {
- return _replyCode;
- }
- public final AMQShortString getReplyText()
- {
- return _replyText;
- }
- public final int getClassId()
- {
- return _classId;
- }
- public final int getMethodId()
- {
- return _methodId;
- }
-
- protected int getBodySize()
- {
- int size = 6;
- size += getSizeOf( _replyText );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _replyCode );
- writeAMQShortString( buffer, _replyText );
- writeUnsignedShort( buffer, _classId );
- writeUnsignedShort( buffer, _methodId );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchChannelClose(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ChannelCloseBodyImpl: ");
- buf.append( "replyCode=" );
- buf.append( getReplyCode() );
- buf.append( ", " );
- buf.append( "replyText=" );
- buf.append( getReplyText() );
- buf.append( ", " );
- buf.append( "classId=" );
- buf.append( getClassId() );
- buf.append( ", " );
- buf.append( "methodId=" );
- buf.append( getMethodId() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ChannelMethodProcessor dispatcher) throws IOException
- {
-
- int replyCode = buffer.readUnsignedShort();
- AMQShortString replyText = buffer.readAMQShortString();
- int classId = buffer.readUnsignedShort();
- int methodId = buffer.readUnsignedShort();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveChannelClose(replyCode, replyText, classId, methodId);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelCloseOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelCloseOkBody.java
deleted file mode 100644
index e9b1572eef..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelCloseOkBody.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ChannelCloseOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
- public static final ChannelCloseOkBody INSTANCE = new ChannelCloseOkBody();
-
- public static final int CLASS_ID = 20;
- public static final int METHOD_ID = 41;
-
- // Fields declared in specification
-
- // Constructor
- public ChannelCloseOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- }
-
- private ChannelCloseOkBody()
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchChannelCloseOk(this, channelId);
- }
-
- public String toString()
- {
- return "[ChannelCloseOkBody]";
-
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelFlowBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelFlowBody.java
deleted file mode 100644
index 1c3cc47d4e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelFlowBody.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ChannelFlowBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 20;
- public static final int METHOD_ID = 20;
-
- // Fields declared in specification
- private final boolean _active; // [active]
-
- // Constructor
- public ChannelFlowBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _active = (buffer.readByte() & 0x01) == 0x01;
- }
-
- public ChannelFlowBody(boolean active)
- {
- _active = active;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final boolean getActive()
- {
- return _active;
- }
-
- protected int getBodySize()
- {
- return 1;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeBitfield( buffer, _active ? (byte)1 : (byte)0);
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchChannelFlow(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ChannelFlowBodyImpl: ");
- buf.append( "active=" );
- buf.append( getActive() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ChannelMethodProcessor dispatcher) throws IOException
- {
- boolean active = (buffer.readByte() & 0x01) == 0x01;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveChannelFlow(active);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelFlowOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelFlowOkBody.java
deleted file mode 100644
index 9d4a2b09a1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelFlowOkBody.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ChannelFlowOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 20;
- public static final int METHOD_ID = 21;
-
- // Fields declared in specification
- private final boolean _active; // [active]
-
- // Constructor
- public ChannelFlowOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _active = (buffer.readByte() & 0x01) == 0x01;
- }
-
- public ChannelFlowOkBody(boolean active)
- {
- _active = active;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final boolean getActive()
- {
- return _active;
- }
-
- protected int getBodySize()
- {
- int size = 1;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeBitfield( buffer, _active ? (byte)1 : (byte)0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchChannelFlowOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ChannelFlowOkBodyImpl: ");
- buf.append( "active=" );
- buf.append( getActive() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ChannelMethodProcessor dispatcher)
- throws IOException
- {
- boolean active = (buffer.readByte() & 0x01) == 0x01;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveChannelFlowOk(active);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelMethodProcessor.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelMethodProcessor.java
deleted file mode 100644
index 75fbb15629..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelMethodProcessor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-public interface ChannelMethodProcessor
-{
- void receiveChannelFlow(boolean active);
-
- void receiveChannelFlowOk(boolean active);
-
- void receiveChannelClose(int replyCode, AMQShortString replyText, int classId, int methodId);
-
- void receiveChannelCloseOk();
-
- void receiveMessageContent(byte[] data);
-
- void receiveMessageHeader(BasicContentHeaderProperties properties, long bodySize);
-
- boolean ignoreAllButCloseOk();
-
- void receiveBasicNack(long deliveryTag, boolean multiple, boolean requeue);
-
- void receiveBasicAck(long deliveryTag, boolean multiple);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelOpenBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelOpenBody.java
deleted file mode 100644
index af583f5fda..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelOpenBody.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ChannelOpenBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 20;
- public static final int METHOD_ID = 10;
-
-
- // Constructor
- public ChannelOpenBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- // ignore unused OOB string
- buffer.readAMQShortString();
- }
-
- public ChannelOpenBody()
- {
-
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- protected int getBodySize()
- {
- return 1;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, null );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchChannelOpen(this, channelId);
- }
-
- public String toString()
- {
- return "[ChannelOpenBody] ";
- }
-
- public static void process(final int channelId,
- final MarkableDataInput buffer,
- final ServerMethodProcessor dispatcher) throws IOException
- {
- buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveChannelOpen(channelId);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelOpenOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelOpenOkBody.java
deleted file mode 100644
index e3b4f38a8c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ChannelOpenOkBody.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ChannelOpenOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 20;
- public static final int METHOD_ID = 11;
-
- public static final ChannelOpenOkBody INSTANCE_0_8 = new ChannelOpenOkBody(true);
- public static final ChannelOpenOkBody INSTANCE_0_9 = new ChannelOpenOkBody(false);
-
- public static ChannelOpenOkBody getInstance(ProtocolVersion protocolVersion, MarkableDataInput input)
- throws IOException
- {
- final boolean isAMQP08 = ProtocolVersion.v8_0.equals(protocolVersion);
- ChannelOpenOkBody instance = isAMQP08 ? INSTANCE_0_8 : INSTANCE_0_9;
- if(!isAMQP08)
- {
- EncodingUtils.readBytes(input);
- }
- return instance;
- }
- // Fields declared in specification
- private final boolean _isAMQP08;
- // Constructor
-
- private ChannelOpenOkBody(boolean isAMQP08)
- {
- _isAMQP08 = isAMQP08;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return _isAMQP08 ? 0 : 4;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- if(!_isAMQP08)
- {
- buffer.writeInt(0);
- }
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchChannelOpenOk(this, channelId);
- }
-
- public String toString()
- {
- return "[ChannelOpenOkBody]";
- }
-
- public static void process(final MarkableDataInput in,
- final ProtocolVersion protocolVersion,
- final ClientChannelMethodProcessor dispatcher) throws IOException
- {
- if(!ProtocolVersion.v8_0.equals(protocolVersion))
- {
- EncodingUtils.readBytes(in);
- }
-
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveChannelOpenOk();
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientChannelMethodProcessor.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientChannelMethodProcessor.java
deleted file mode 100644
index 289a284d6b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientChannelMethodProcessor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-public interface ClientChannelMethodProcessor extends ChannelMethodProcessor
-{
- void receiveChannelOpenOk();
-
- void receiveChannelAlert(int replyCode, final AMQShortString replyText, FieldTable details);
-
- void receiveAccessRequestOk(int ticket);
-
- void receiveExchangeDeclareOk();
-
- void receiveExchangeDeleteOk();
-
- void receiveExchangeBoundOk(int replyCode, AMQShortString replyText);
-
- void receiveQueueBindOk();
-
- void receiveQueueUnbindOk();
-
- void receiveQueueDeclareOk(final AMQShortString queue, long messageCount, long consumerCount);
-
- void receiveQueuePurgeOk(long messageCount);
-
- void receiveQueueDeleteOk(long messageCount);
-
- void receiveBasicRecoverSyncOk();
-
- void receiveBasicQosOk();
-
- void receiveBasicConsumeOk(AMQShortString consumerTag);
-
- void receiveBasicCancelOk(AMQShortString consumerTag);
-
- void receiveBasicReturn(int replyCode,
- AMQShortString replyText,
- AMQShortString exchange,
- AMQShortString routingKey);
-
- void receiveBasicDeliver(AMQShortString consumerTag,
- long deliveryTag,
- boolean redelivered,
- AMQShortString exchange, AMQShortString routingKey);
-
- void receiveBasicGetOk(long deliveryTag,
- boolean redelivered,
- AMQShortString exchange,
- AMQShortString routingKey, long messageCount);
-
- void receiveBasicGetEmpty();
-
- void receiveTxSelectOk();
-
- void receiveTxCommitOk();
-
- void receiveTxRollbackOk();
-
- void receiveConfirmSelectOk();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientMethodDispatcher.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientMethodDispatcher.java
deleted file mode 100644
index 4f1b6b917e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientMethodDispatcher.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-9
- * 0-91
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import org.apache.qpid.AMQException;
-
-public interface ClientMethodDispatcher
-{
-
- public boolean dispatchBasicCancelOk(BasicCancelOkBody body, int channelId) throws AMQException;
- public boolean dispatchBasicConsumeOk(BasicConsumeOkBody body, int channelId) throws AMQException;
- public boolean dispatchBasicDeliver(BasicDeliverBody body, int channelId) throws AMQException;
- public boolean dispatchBasicGetEmpty(BasicGetEmptyBody body, int channelId) throws AMQException;
- public boolean dispatchBasicGetOk(BasicGetOkBody body, int channelId) throws AMQException;
- public boolean dispatchBasicQosOk(BasicQosOkBody body, int channelId) throws AMQException;
- public boolean dispatchBasicReturn(BasicReturnBody body, int channelId) throws AMQException;
- public boolean dispatchChannelClose(ChannelCloseBody body, int channelId) throws AMQException;
- public boolean dispatchChannelCloseOk(ChannelCloseOkBody body, int channelId) throws AMQException;
- public boolean dispatchChannelFlow(ChannelFlowBody body, int channelId) throws AMQException;
- public boolean dispatchChannelFlowOk(ChannelFlowOkBody body, int channelId) throws AMQException;
- public boolean dispatchChannelOpenOk(ChannelOpenOkBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionClose(ConnectionCloseBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionCloseOk(ConnectionCloseOkBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionOpenOk(ConnectionOpenOkBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionSecure(ConnectionSecureBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionStart(ConnectionStartBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionTune(ConnectionTuneBody body, int channelId) throws AMQException;
- public boolean dispatchExchangeBoundOk(ExchangeBoundOkBody body, int channelId) throws AMQException;
- public boolean dispatchExchangeDeclareOk(ExchangeDeclareOkBody body, int channelId) throws AMQException;
- public boolean dispatchExchangeDeleteOk(ExchangeDeleteOkBody body, int channelId) throws AMQException;
- public boolean dispatchQueueBindOk(QueueBindOkBody body, int channelId) throws AMQException;
- public boolean dispatchQueueDeclareOk(QueueDeclareOkBody body, int channelId) throws AMQException;
- public boolean dispatchQueueDeleteOk(QueueDeleteOkBody body, int channelId) throws AMQException;
- public boolean dispatchQueuePurgeOk(QueuePurgeOkBody body, int channelId) throws AMQException;
- public boolean dispatchTxCommitOk(TxCommitOkBody body, int channelId) throws AMQException;
- public boolean dispatchTxRollbackOk(TxRollbackOkBody body, int channelId) throws AMQException;
- public boolean dispatchTxSelectOk(TxSelectOkBody body, int channelId) throws AMQException;
-
- boolean dispatchConnectionRedirect(ConnectionRedirectBody connectionRedirectBody, int channelId) throws AMQException;
- boolean dispatchAccessRequestOk(AccessRequestOkBody accessRequestOkBody, int channelId) throws AMQException;
-
- boolean dispatchQueueUnbindOk(QueueUnbindOkBody queueUnbindOkBody, int channelId) throws AMQException;
-
- boolean dispatchBasicRecoverSyncOk(BasicRecoverSyncOkBody basicRecoverSyncOkBody, int channelId)
- throws AMQException;
-
- boolean dispatchChannelAlert(ChannelAlertBody channelAlertBody, int channelId) throws AMQException;
-
- boolean dispatchConfirmSelectOk(ConfirmSelectOkBody confirmSelectOkBody, int channelId) throws AMQException;
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientMethodProcessor.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientMethodProcessor.java
deleted file mode 100644
index 0b599ee40a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ClientMethodProcessor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-public interface ClientMethodProcessor<T extends ClientChannelMethodProcessor> extends MethodProcessor<T>
-{
- void receiveConnectionStart(short versionMajor,
- short versionMinor,
- FieldTable serverProperties,
- byte[] mechanisms,
- byte[] locales);
-
- void receiveConnectionSecure(byte[] challenge);
-
- void receiveConnectionRedirect(AMQShortString host, AMQShortString knownHosts);
-
- void receiveConnectionTune(int channelMax, long frameMax, int heartbeat);
-
- void receiveConnectionOpenOk(AMQShortString knownHosts);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/CompositeAMQDataBlock.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/CompositeAMQDataBlock.java
deleted file mode 100644
index 819446021e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/CompositeAMQDataBlock.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.transport.ByteBufferSender;
-
-public class CompositeAMQDataBlock extends AMQDataBlock implements EncodableAMQDataBlock
-{
-
- private AMQDataBlock[] _blocks;
-
- public CompositeAMQDataBlock(AMQDataBlock[] blocks)
- {
- _blocks = blocks;
- }
-
-
- public AMQDataBlock[] getBlocks()
- {
- return _blocks;
- }
-
-
- public long getSize()
- {
- long frameSize = 0;
- for (int i = 0; i < _blocks.length; i++)
- {
- frameSize += _blocks[i].getSize();
- }
- return frameSize;
- }
-
- public void writePayload(DataOutput buffer) throws IOException
- {
- for (int i = 0; i < _blocks.length; i++)
- {
- _blocks[i].writePayload(buffer);
- }
- }
-
- @Override
- public long writePayload(final ByteBufferSender sender) throws IOException
- {
- long size = 0l;
- for (int i = 0; i < _blocks.length; i++)
- {
- size += _blocks[i].writePayload(sender);
- }
- return size;
- }
-
- public String toString()
- {
- if (_blocks == null)
- {
- return "No blocks contained in composite frame";
- }
- else
- {
- StringBuilder buf = new StringBuilder(this.getClass().getName());
- buf.append("{");
- for (int i = 0 ; i < _blocks.length; i++)
- {
- buf.append(" ").append(i).append("=[").append(_blocks[i].toString()).append("]");
- }
- buf.append("}");
- return buf.toString();
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConfirmSelectBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConfirmSelectBody.java
deleted file mode 100644
index 7f9e56caa6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConfirmSelectBody.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConfirmSelectBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 85;
- public static final int METHOD_ID = 10;
-
- // Fields declared in specification
- private final boolean _nowait; // [active]
-
- // Constructor
- public ConfirmSelectBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _nowait = (buffer.readByte() & 0x01) == 0x01;
- }
-
- public ConfirmSelectBody(boolean nowait)
- {
- _nowait = nowait;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final boolean getNowait()
- {
- return _nowait;
- }
-
- protected int getBodySize()
- {
- return 1;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeBitfield( buffer, _nowait ? (byte)1 : (byte)0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConfirmSelect(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConfirmSelectBody: ");
- buf.append( "active=" );
- buf.append( getNowait() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher)
- throws IOException
- {
- boolean nowait = (buffer.readByte() & 0x01) == 0x01;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConfirmSelect(nowait);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConfirmSelectOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConfirmSelectOkBody.java
deleted file mode 100644
index d0e3bd093d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConfirmSelectOkBody.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-
-public class ConfirmSelectOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 85;
- public static final int METHOD_ID = 11;
-
- public static final ConfirmSelectOkBody INSTANCE = new ConfirmSelectOkBody();
-
- private ConfirmSelectOkBody()
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConfirmSelectOk(this, channelId);
- }
-
- public String toString()
- {
- return "[ConfirmSelectOkBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionCloseBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionCloseBody.java
deleted file mode 100644
index 546cf5fa0a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionCloseBody.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-91
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionCloseBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
-
- private final int _ownMethodId;
- // Fields declared in specification
- private final int _replyCode; // [replyCode]
- private final AMQShortString _replyText; // [replyText]
- private final int _classId; // [classId]
- private final int _methodId; // [methodId]
-
- // Constructor
- public ConnectionCloseBody(MarkableDataInput buffer, ProtocolVersion protocolVersion) throws AMQFrameDecodingException, IOException
- {
- _ownMethodId = ProtocolVersion.v8_0.equals(protocolVersion) ? 60 : 50;
- _replyCode = buffer.readUnsignedShort();
- _replyText = buffer.readAMQShortString();
- _classId = buffer.readUnsignedShort();
- _methodId = buffer.readUnsignedShort();
- }
-
- public ConnectionCloseBody(ProtocolVersion protocolVersion,
- int replyCode,
- AMQShortString replyText,
- int classId,
- int methodId
- )
- {
- _ownMethodId = ProtocolVersion.v8_0.equals(protocolVersion) ? 60 : 50;
- _replyCode = replyCode;
- _replyText = replyText;
- _classId = classId;
- _methodId = methodId;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return _ownMethodId;
- }
-
- public final int getReplyCode()
- {
- return _replyCode;
- }
- public final AMQShortString getReplyText()
- {
- return _replyText;
- }
- public final int getClassId()
- {
- return _classId;
- }
- public final int getMethodId()
- {
- return _methodId;
- }
-
- protected int getBodySize()
- {
- int size = 6;
- size += getSizeOf( _replyText );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _replyCode );
- writeAMQShortString( buffer, _replyText );
- writeUnsignedShort( buffer, _classId );
- writeUnsignedShort( buffer, _methodId );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionClose(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionCloseBodyImpl: ");
- buf.append( "replyCode=" );
- buf.append( getReplyCode() );
- buf.append( ", " );
- buf.append( "replyText=" );
- buf.append( getReplyText() );
- buf.append( ", " );
- buf.append( "classId=" );
- buf.append( getClassId() );
- buf.append( ", " );
- buf.append( "methodId=" );
- buf.append( getMethodId() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer, final MethodProcessor dispatcher) throws IOException
- {
- int replyCode = buffer.readUnsignedShort();
- AMQShortString replyText = buffer.readAMQShortString();
- int classId = buffer.readUnsignedShort();
- int methodId = buffer.readUnsignedShort();
- dispatcher.receiveConnectionClose(replyCode, replyText, classId, methodId);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionCloseOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionCloseOkBody.java
deleted file mode 100644
index 30e9f90b9a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionCloseOkBody.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-91
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionCloseOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
- private final int _ownMethodId;
-
- public static final int CLASS_ID = 10;
-
- public static final ConnectionCloseOkBody CONNECTION_CLOSE_OK_0_8 = new ConnectionCloseOkBody(61);
- public static final ConnectionCloseOkBody CONNECTION_CLOSE_OK_0_9 = new ConnectionCloseOkBody(51);
-
- // Constructor
- private ConnectionCloseOkBody(int methodId)
- {
- _ownMethodId = methodId;
- }
-
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return _ownMethodId;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionCloseOk(this, channelId);
- }
-
- public String toString()
- {
- return "[ConnectionCloseOkBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionOpenBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionOpenBody.java
deleted file mode 100644
index 7fb815ae40..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionOpenBody.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionOpenBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
- public static final int METHOD_ID = 40;
-
- // Fields declared in specification
- private final AMQShortString _virtualHost; // [virtualHost]
- private final AMQShortString _capabilities; // [capabilities]
- private final boolean _insist; // [insist]
-
- // Constructor
- public ConnectionOpenBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _virtualHost = buffer.readAMQShortString();
- _capabilities = buffer.readAMQShortString();
- _insist = (buffer.readByte() & 0x01) == 0x01;
- }
-
- public ConnectionOpenBody(
- AMQShortString virtualHost,
- AMQShortString capabilities,
- boolean insist
- )
- {
- _virtualHost = virtualHost;
- _capabilities = capabilities;
- _insist = insist;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getVirtualHost()
- {
- return _virtualHost;
- }
- public final AMQShortString getCapabilities()
- {
- return _capabilities;
- }
- public final boolean getInsist()
- {
- return _insist;
- }
-
- protected int getBodySize()
- {
- int size = 1;
- size += getSizeOf( _virtualHost );
- size += getSizeOf( _capabilities );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _virtualHost );
- writeAMQShortString( buffer, _capabilities );
- writeBitfield( buffer, _insist ? (byte)1 : (byte)0);
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionOpen(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionOpenBodyImpl: ");
- buf.append( "virtualHost=" );
- buf.append( getVirtualHost() );
- buf.append( ", " );
- buf.append( "capabilities=" );
- buf.append( getCapabilities() );
- buf.append( ", " );
- buf.append( "insist=" );
- buf.append( getInsist() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer, final ServerMethodProcessor dispatcher) throws IOException
- {
-
- AMQShortString virtualHost = buffer.readAMQShortString();
- AMQShortString capabilities = buffer.readAMQShortString();
- boolean insist = (buffer.readByte() & 0x01) == 0x01;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionOpen(virtualHost, capabilities, insist);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionOpenOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionOpenOkBody.java
deleted file mode 100644
index 95c48873f3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionOpenOkBody.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionOpenOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
- public static final int METHOD_ID = 41;
-
- // Fields declared in specification
- private final AMQShortString _knownHosts; // [knownHosts]
-
- // Constructor
- public ConnectionOpenOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _knownHosts = buffer.readAMQShortString();
- }
-
- public ConnectionOpenOkBody(
- AMQShortString knownHosts
- )
- {
- _knownHosts = knownHosts;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getKnownHosts()
- {
- return _knownHosts;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _knownHosts );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _knownHosts );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionOpenOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionOpenOkBodyImpl: ");
- buf.append( "knownHosts=" );
- buf.append( getKnownHosts() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer, final ClientMethodProcessor dispatcher) throws IOException
- {
- AMQShortString knownHosts = buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionOpenOk(knownHosts);
- }
-
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionRedirectBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionRedirectBody.java
deleted file mode 100644
index 491cc25125..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionRedirectBody.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionRedirectBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
- private final int _ownMethodId;
-
- public static final int CLASS_ID = 10;
-
- // Fields declared in specification
- private final AMQShortString _host; // [host]
- private final AMQShortString _knownHosts; // [knownHosts]
-
- // Constructor
- public ConnectionRedirectBody(MarkableDataInput buffer, ProtocolVersion protocolVersion) throws AMQFrameDecodingException, IOException
- {
- _ownMethodId = ProtocolVersion.v8_0.equals(protocolVersion) ? 50 : 42;
- _host = buffer.readAMQShortString();
- _knownHosts = buffer.readAMQShortString();
- }
-
- public ConnectionRedirectBody(ProtocolVersion protocolVersion, AMQShortString host, AMQShortString knownHosts)
- {
- _ownMethodId = ProtocolVersion.v8_0.equals(protocolVersion) ? 50 : 42;
- _host = host;
- _knownHosts = knownHosts;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return _ownMethodId;
- }
-
- public final AMQShortString getHost()
- {
- return _host;
- }
- public final AMQShortString getKnownHosts()
- {
- return _knownHosts;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _host );
- size += getSizeOf( _knownHosts );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _host );
- writeAMQShortString( buffer, _knownHosts );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionRedirect(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionRedirectBodyImpl: ");
- buf.append( "host=" );
- buf.append( getHost() );
- buf.append( ", " );
- buf.append( "knownHosts=" );
- buf.append( getKnownHosts() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer, final ClientMethodProcessor dispatcher) throws IOException
- {
- AMQShortString host = buffer.readAMQShortString();
- AMQShortString knownHosts = buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionRedirect(host, knownHosts);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionSecureBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionSecureBody.java
deleted file mode 100644
index e10af3b4c1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionSecureBody.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionSecureBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
- public static final int METHOD_ID = 20;
-
- // Fields declared in specification
- private final byte[] _challenge; // [challenge]
-
- // Constructor
- public ConnectionSecureBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _challenge = EncodingUtils.readBytes(buffer);
- }
-
- public ConnectionSecureBody(
- byte[] challenge
- )
- {
- _challenge = challenge;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final byte[] getChallenge()
- {
- return _challenge;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _challenge );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeBytes( buffer, _challenge );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionSecure(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionSecureBodyImpl: ");
- buf.append( "challenge=" );
- buf.append( getChallenge() == null ? "null" : java.util.Arrays.toString( getChallenge() ) );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput in, final ClientMethodProcessor dispatcher)
- throws IOException, AMQFrameDecodingException
-
- {
- byte[] challenge = EncodingUtils.readBytes(in);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionSecure(challenge);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionSecureOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionSecureOkBody.java
deleted file mode 100644
index 4c4a249bb6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionSecureOkBody.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionSecureOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
- public static final int METHOD_ID = 21;
-
- // Fields declared in specification
- private final byte[] _response; // [response]
-
- // Constructor
- public ConnectionSecureOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _response = EncodingUtils.readBytes(buffer);
- }
-
- public ConnectionSecureOkBody(
- byte[] response
- )
- {
- _response = response;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final byte[] getResponse()
- {
- return _response;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _response );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeBytes( buffer, _response );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionSecureOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionSecureOkBodyImpl: ");
- buf.append( "response=" );
- buf.append( getResponse() == null ? "null" : java.util.Arrays.toString( getResponse() ) );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput in, final ServerMethodProcessor dispatcher) throws IOException
- {
- byte[] response = EncodingUtils.readBytes(in);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionSecureOk(response);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionStartBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionStartBody.java
deleted file mode 100644
index 3b94919d4e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionStartBody.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionStartBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
- public static final int METHOD_ID = 10;
-
- // Fields declared in specification
- private final short _versionMajor; // [versionMajor]
- private final short _versionMinor; // [versionMinor]
- private final FieldTable _serverProperties; // [serverProperties]
- private final byte[] _mechanisms; // [mechanisms]
- private final byte[] _locales; // [locales]
-
- public ConnectionStartBody(
- short versionMajor,
- short versionMinor,
- FieldTable serverProperties,
- byte[] mechanisms,
- byte[] locales
- )
- {
- _versionMajor = versionMajor;
- _versionMinor = versionMinor;
- _serverProperties = serverProperties;
- _mechanisms = mechanisms;
- _locales = locales;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final short getVersionMajor()
- {
- return _versionMajor;
- }
- public final short getVersionMinor()
- {
- return _versionMinor;
- }
- public final FieldTable getServerProperties()
- {
- return _serverProperties;
- }
- public final byte[] getMechanisms()
- {
- return _mechanisms;
- }
- public final byte[] getLocales()
- {
- return _locales;
- }
-
- protected int getBodySize()
- {
- int size = 2;
- size += getSizeOf( _serverProperties );
- size += getSizeOf( _mechanisms );
- size += getSizeOf( _locales );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedByte( buffer, _versionMajor );
- writeUnsignedByte( buffer, _versionMinor );
- writeFieldTable( buffer, _serverProperties );
- writeBytes( buffer, _mechanisms );
- writeBytes( buffer, _locales );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionStart(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionStartBodyImpl: ");
- buf.append( "versionMajor=" );
- buf.append( getVersionMajor() );
- buf.append( ", " );
- buf.append( "versionMinor=" );
- buf.append( getVersionMinor() );
- buf.append( ", " );
- buf.append( "serverProperties=" );
- buf.append( getServerProperties() );
- buf.append( ", " );
- buf.append( "mechanisms=" );
- buf.append( getMechanisms() == null ? "null" : java.util.Arrays.toString( getMechanisms() ) );
- buf.append( ", " );
- buf.append( "locales=" );
- buf.append( getLocales() == null ? "null" : java.util.Arrays.toString( getLocales() ) );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput in, final ClientMethodProcessor dispatcher)
- throws IOException, AMQFrameDecodingException
- {
- short versionMajor = (short) in.readUnsignedByte();
- short versionMinor = (short) in.readUnsignedByte();
- FieldTable serverProperties = EncodingUtils.readFieldTable(in);
- byte[] mechanisms = EncodingUtils.readBytes(in);
- byte[] locales = EncodingUtils.readBytes(in);
-
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionStart(versionMajor, versionMinor, serverProperties, mechanisms, locales);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionStartOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionStartOkBody.java
deleted file mode 100644
index 5b6a8e3ef7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionStartOkBody.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionStartOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
- public static final int METHOD_ID = 11;
-
- // Fields declared in specification
- private final FieldTable _clientProperties; // [clientProperties]
- private final AMQShortString _mechanism; // [mechanism]
- private final byte[] _response; // [response]
- private final AMQShortString _locale; // [locale]
-
- public ConnectionStartOkBody(
- FieldTable clientProperties,
- AMQShortString mechanism,
- byte[] response,
- AMQShortString locale
- )
- {
- _clientProperties = clientProperties;
- _mechanism = mechanism;
- _response = response;
- _locale = locale;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final FieldTable getClientProperties()
- {
- return _clientProperties;
- }
- public final AMQShortString getMechanism()
- {
- return _mechanism;
- }
- public final byte[] getResponse()
- {
- return _response;
- }
- public final AMQShortString getLocale()
- {
- return _locale;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _clientProperties );
- size += getSizeOf( _mechanism );
- size += getSizeOf( _response );
- size += getSizeOf( _locale );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeFieldTable( buffer, _clientProperties );
- writeAMQShortString( buffer, _mechanism );
- writeBytes( buffer, _response );
- writeAMQShortString( buffer, _locale );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionStartOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionStartOkBodyImpl: ");
- buf.append( "clientProperties=" );
- buf.append( getClientProperties() );
- buf.append( ", " );
- buf.append( "mechanism=" );
- buf.append( getMechanism() );
- buf.append( ", " );
- buf.append( "response=" );
- buf.append( getResponse() == null ? "null" : java.util.Arrays.toString( getResponse() ) );
- buf.append( ", " );
- buf.append( "locale=" );
- buf.append( getLocale() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput in, final ServerMethodProcessor dispatcher)
- throws IOException, AMQFrameDecodingException
- {
-
- FieldTable clientProperties = EncodingUtils.readFieldTable(in);
- AMQShortString mechanism = in.readAMQShortString();
- byte[] response = EncodingUtils.readBytes(in);
- AMQShortString locale = in.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionStartOk(clientProperties, mechanism, response, locale);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionTuneBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionTuneBody.java
deleted file mode 100644
index 04def21d44..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionTuneBody.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionTuneBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
- public static final int METHOD_ID = 30;
-
- // Fields declared in specification
- private final int _channelMax; // [channelMax]
- private final long _frameMax; // [frameMax]
- private final int _heartbeat; // [heartbeat]
-
- // Constructor
- public ConnectionTuneBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _channelMax = buffer.readUnsignedShort();
- _frameMax = EncodingUtils.readUnsignedInteger(buffer);
- _heartbeat = buffer.readUnsignedShort();
- }
-
- public ConnectionTuneBody(
- int channelMax,
- long frameMax,
- int heartbeat
- )
- {
- _channelMax = channelMax;
- _frameMax = frameMax;
- _heartbeat = heartbeat;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getChannelMax()
- {
- return _channelMax;
- }
- public final long getFrameMax()
- {
- return _frameMax;
- }
- public final int getHeartbeat()
- {
- return _heartbeat;
- }
-
- protected int getBodySize()
- {
- int size = 8;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _channelMax );
- writeUnsignedInteger( buffer, _frameMax );
- writeUnsignedShort( buffer, _heartbeat );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionTune(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionTuneBodyImpl: ");
- buf.append( "channelMax=" );
- buf.append( getChannelMax() );
- buf.append( ", " );
- buf.append( "frameMax=" );
- buf.append( getFrameMax() );
- buf.append( ", " );
- buf.append( "heartbeat=" );
- buf.append( getHeartbeat() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer, final ClientMethodProcessor dispatcher) throws IOException
- {
-
- int channelMax = buffer.readUnsignedShort();
- long frameMax = EncodingUtils.readUnsignedInteger(buffer);
- int heartbeat = buffer.readUnsignedShort();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionTune(channelMax, frameMax, heartbeat);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionTuneOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionTuneOkBody.java
deleted file mode 100644
index 3141a85766..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ConnectionTuneOkBody.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ConnectionTuneOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 10;
- public static final int METHOD_ID = 31;
-
- // Fields declared in specification
- private final int _channelMax; // [channelMax]
- private final long _frameMax; // [frameMax]
- private final int _heartbeat; // [heartbeat]
-
- // Constructor
- public ConnectionTuneOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _channelMax = buffer.readUnsignedShort();
- _frameMax = EncodingUtils.readUnsignedInteger(buffer);
- _heartbeat = buffer.readUnsignedShort();
- }
-
- public ConnectionTuneOkBody(
- int channelMax,
- long frameMax,
- int heartbeat
- )
- {
- _channelMax = channelMax;
- _frameMax = frameMax;
- _heartbeat = heartbeat;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getChannelMax()
- {
- return _channelMax;
- }
- public final long getFrameMax()
- {
- return _frameMax;
- }
- public final int getHeartbeat()
- {
- return _heartbeat;
- }
-
- protected int getBodySize()
- {
- int size = 8;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _channelMax );
- writeUnsignedInteger( buffer, _frameMax );
- writeUnsignedShort( buffer, _heartbeat );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchConnectionTuneOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ConnectionTuneOkBodyImpl: ");
- buf.append( "channelMax=" );
- buf.append( getChannelMax() );
- buf.append( ", " );
- buf.append( "frameMax=" );
- buf.append( getFrameMax() );
- buf.append( ", " );
- buf.append( "heartbeat=" );
- buf.append( getHeartbeat() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer, final ServerMethodProcessor dispatcher) throws IOException
- {
-
- int channelMax = buffer.readUnsignedShort();
- long frameMax = EncodingUtils.readUnsignedInteger(buffer);
- int heartbeat = buffer.readUnsignedShort();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveConnectionTuneOk(channelMax, frameMax, heartbeat);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentBody.java
deleted file mode 100644
index 0f4ba5209b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentBody.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
-import org.apache.qpid.transport.ByteBufferSender;
-
-public class ContentBody implements AMQBody
-{
- public static final byte TYPE = 3;
-
- private byte[] _payload;
-
- public ContentBody()
- {
- }
-
- public ContentBody(DataInput buffer, long size) throws AMQFrameDecodingException, IOException
- {
- _payload = new byte[(int)size];
- buffer.readFully(getPayload());
- }
-
-
- public ContentBody(byte[] payload)
- {
- _payload = payload;
- }
-
- public byte getFrameType()
- {
- return TYPE;
- }
-
- public int getSize()
- {
- return getPayload() == null ? 0 : getPayload().length;
- }
-
- public void writePayload(DataOutput buffer) throws IOException
- {
- buffer.write(getPayload());
- }
-
- public void handle(final int channelId, final AMQVersionAwareProtocolSession session)
- throws AMQException
- {
- session.contentBodyReceived(channelId, this);
- }
-
- @Override
- public long writePayload(final ByteBufferSender sender) throws IOException
- {
- if(_payload != null)
- {
- sender.send(ByteBuffer.wrap(_payload));
- return _payload.length;
- }
- else
- {
- return 0l;
- }
- }
-
- public byte[] getPayload()
- {
- return _payload;
- }
-
- public static void process(final MarkableDataInput in,
- final ChannelMethodProcessor methodProcessor, final long bodySize)
- throws IOException
- {
-
- byte[] payload = new byte[(int)bodySize];
- in.readFully(payload);
-
- if(!methodProcessor.ignoreAllButCloseOk())
- {
- methodProcessor.receiveMessageContent(payload);
- }
- }
-
- private static class BufferContentBody implements AMQBody
- {
- private final int _length;
- private final int _offset;
- private final ByteBuffer _buf;
-
- private BufferContentBody( ByteBuffer buf, int offset, int length)
- {
- _length = length;
- _offset = offset;
- _buf = buf;
- }
-
- public byte getFrameType()
- {
- return TYPE;
- }
-
-
- public int getSize()
- {
- return _length;
- }
-
- public void writePayload(DataOutput buffer) throws IOException
- {
- if(_buf.hasArray())
- {
- buffer.write(_buf.array(), _buf.arrayOffset() + _offset, _length);
- }
- else
- {
- byte[] data = new byte[_length];
- ByteBuffer buf = _buf.duplicate();
-
- buf.position(_offset);
- buf.limit(_offset+_length);
- buf.get(data);
- buffer.write(data);
- }
- }
-
- @Override
- public long writePayload(final ByteBufferSender sender) throws IOException
- {
- if(_buf.hasArray())
- {
- sender.send(ByteBuffer.wrap(_buf.array(), _buf.arrayOffset() + _offset, _length));
- }
- else
- {
- ByteBuffer buf = _buf.duplicate();
-
- buf.position(_offset);
- buf.limit(_offset+_length);
- sender.send(buf);
- }
- return _length;
- }
-
- public void handle(int channelId, AMQVersionAwareProtocolSession amqProtocolSession) throws AMQException
- {
- throw new RuntimeException("Buffered Body only to be used for outgoing data");
- }
- }
-
- public static AMQFrame createAMQFrame(int channelId, ByteBuffer buf, int offset, int length)
- {
- return new AMQFrame(channelId, new BufferContentBody(buf, offset, length));
- }
-
- public static AMQFrame createAMQFrame(int channelId, ContentBody body)
- {
- return new AMQFrame(channelId, body);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java
deleted file mode 100644
index 21b8e6c8b6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.util.BytesDataOutput;
-
-public class ContentHeaderBody implements AMQBody
-{
- public static final byte TYPE = 2;
- public static final int CLASS_ID = 60;
-
- private long _bodySize;
-
- /** must never be null */
- private BasicContentHeaderProperties _properties;
-
- public ContentHeaderBody(DataInput buffer, long size) throws AMQFrameDecodingException, IOException
- {
- buffer.readUnsignedShort();
- buffer.readUnsignedShort();
- _bodySize = buffer.readLong();
- int propertyFlags = buffer.readUnsignedShort();
- ContentHeaderPropertiesFactory factory = ContentHeaderPropertiesFactory.getInstance();
- _properties = factory.createContentHeaderProperties(CLASS_ID, propertyFlags, buffer, (int)size - 14);
-
- }
-
- public ContentHeaderBody(BasicContentHeaderProperties props)
- {
- _properties = props;
- }
-
- public ContentHeaderBody(BasicContentHeaderProperties props, long bodySize)
- {
- _properties = props;
- _bodySize = bodySize;
- }
-
- public byte getFrameType()
- {
- return TYPE;
- }
-
- /**
- * Helper method that is used currently by the persistence layer.
- * @param buffer buffer to decode
- * @param size size of the body
- *
- * @return the decoded header body
- * @throws AMQFrameDecodingException if there is a decoding issue
- * @throws AMQProtocolVersionException if there is a version issue
- * @throws IOException if there is an IO issue
- */
- public static ContentHeaderBody createFromBuffer(DataInputStream buffer, long size)
- throws AMQFrameDecodingException, AMQProtocolVersionException, IOException
- {
- ContentHeaderBody body = new ContentHeaderBody(buffer, size);
-
- return body;
- }
-
- public int getSize()
- {
- return 2 + 2 + 8 + 2 + _properties.getPropertyListSize();
- }
-
- public void writePayload(DataOutput buffer) throws IOException
- {
- EncodingUtils.writeUnsignedShort(buffer, CLASS_ID);
- EncodingUtils.writeUnsignedShort(buffer, 0);
- buffer.writeLong(_bodySize);
- EncodingUtils.writeUnsignedShort(buffer, _properties.getPropertyFlags());
- _properties.writePropertyListPayload(buffer);
- }
-
- @Override
- public long writePayload(final ByteBufferSender sender) throws IOException
- {
- byte[] data = new byte[14];
- BytesDataOutput buffer = new BytesDataOutput(data);
- EncodingUtils.writeUnsignedShort(buffer, CLASS_ID);
- EncodingUtils.writeUnsignedShort(buffer, 0);
- buffer.writeLong(_bodySize);
- EncodingUtils.writeUnsignedShort(buffer, _properties.getPropertyFlags());
- sender.send(ByteBuffer.wrap(data));
- return 14 + _properties.writePropertyListPayload(sender);
- }
-
- public void handle(final int channelId, final AMQVersionAwareProtocolSession session)
- throws AMQException
- {
- session.contentHeaderReceived(channelId, this);
- }
-
- public static AMQFrame createAMQFrame(int channelId,
- BasicContentHeaderProperties properties,
- long bodySize)
- {
- return new AMQFrame(channelId, new ContentHeaderBody(properties, bodySize));
- }
-
- public BasicContentHeaderProperties getProperties()
- {
- return _properties;
- }
-
- public void setProperties(BasicContentHeaderProperties props)
- {
- _properties = props;
- }
-
- @Override
- public String toString()
- {
- return "ContentHeaderBody{" +
- "classId=" + CLASS_ID +
- ", weight=" + 0 +
- ", bodySize=" + _bodySize +
- ", properties=" + _properties +
- '}';
- }
-
- public int getClassId()
- {
- return CLASS_ID;
- }
-
- public int getWeight()
- {
- return 0;
- }
-
- /** unsigned long but java can't handle that anyway when allocating byte array
- *
- * @return the body size */
- public long getBodySize()
- {
- return _bodySize;
- }
-
- public void setBodySize(long bodySize)
- {
- _bodySize = bodySize;
- }
-
- public static void process(final MarkableDataInput buffer,
- final ChannelMethodProcessor methodProcessor, final long size)
- throws IOException, AMQFrameDecodingException
- {
-
- int classId = buffer.readUnsignedShort();
- buffer.readUnsignedShort();
- long bodySize = buffer.readLong();
- int propertyFlags = buffer.readUnsignedShort();
-
- BasicContentHeaderProperties properties;
-
- if (classId != CLASS_ID)
- {
- throw new AMQFrameDecodingException(null, "Unsupported content header class id: " + classId, null);
- }
- properties = new BasicContentHeaderProperties();
- properties.populatePropertiesFromBuffer(buffer, propertyFlags, (int)(size-14));
-
- if(!methodProcessor.ignoreAllButCloseOk())
- {
- methodProcessor.receiveMessageHeader(properties, bodySize);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderPropertiesFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderPropertiesFactory.java
deleted file mode 100644
index e8eb471284..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderPropertiesFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.IOException;
-
-public class ContentHeaderPropertiesFactory
-{
- private static final ContentHeaderPropertiesFactory _instance = new ContentHeaderPropertiesFactory();
-
- public static ContentHeaderPropertiesFactory getInstance()
- {
- return _instance;
- }
-
- private ContentHeaderPropertiesFactory()
- {
- }
-
- public BasicContentHeaderProperties createContentHeaderProperties(int classId, int propertyFlags,
- DataInput buffer, int size)
- throws AMQFrameDecodingException, IOException
- {
- BasicContentHeaderProperties properties;
- // AMQP version change: "Hardwired" version to major=8, minor=0
- // TODO: Change so that the actual version is obtained from
- // the ProtocolInitiation object for this session.
- if (classId == BasicConsumeBody.CLASS_ID)
- {
- properties = new BasicContentHeaderProperties();
- }
- else
- {
- throw new AMQFrameDecodingException(null, "Unsupport content header class id: " + classId, null);
- }
- properties.populatePropertiesFromBuffer(buffer, propertyFlags, size);
- return properties;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodableAMQDataBlock.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodableAMQDataBlock.java
deleted file mode 100644
index 9cf96e698c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodableAMQDataBlock.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-/**
- * Marker interface to indicate to MINA that a data block should be encoded with the
- * single encoder/decoder that we have defined.
- *
- * Note that due to a bug in MINA all classes must directly implement this interface, even if
- * a superclass implements it.
- * TODO: fix MINA so that this is not necessary
- *
- */
-public interface EncodableAMQDataBlock
-{
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
deleted file mode 100644
index a7fe4b01f3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
+++ /dev/null
@@ -1,1013 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EncodingUtils
-{
- private static final Logger _logger = LoggerFactory.getLogger(EncodingUtils.class);
-
- private static final String STRING_ENCODING = "iso8859-15";
-
- private static final Charset _charset = Charset.forName("iso8859-15");
-
- public static final int SIZEOF_UNSIGNED_SHORT = 2;
- public static final int SIZEOF_UNSIGNED_INT = 4;
- private static final boolean[] ALL_FALSE_ARRAY = new boolean[8];
-
- private EncodingUtils()
- {
- }
-
- public static int encodedShortStringLength(String s)
- {
- if (s == null)
- {
- return 1;
- }
- else
- {
- return (short) (1 + s.length());
- }
- }
-
- public static int encodedShortStringLength(short s)
- {
- if (s == 0)
- {
- return 1 + 1;
- }
-
- int len = 0;
- if (s < 0)
- {
- len = 1;
- // sloppy - doesn't work of Integer.MIN_VALUE
- s = (short) -s;
- }
-
- if (s > 9999)
- {
- return 1 + 5;
- }
- else if (s > 999)
- {
- return 1 + 4;
- }
- else if (s > 99)
- {
- return 1 + 3;
- }
- else if (s > 9)
- {
- return 1 + 2;
- }
- else
- {
- return 1 + 1;
- }
-
- }
-
- public static int encodedShortStringLength(int i)
- {
- if (i == 0)
- {
- return 1 + 1;
- }
-
- int len = 0;
- if (i < 0)
- {
- len = 1;
- // sloppy - doesn't work of Integer.MIN_VALUE
- i = -i;
- }
-
- // range is now 1 - 2147483647
- if (i < Short.MAX_VALUE)
- {
- return len + encodedShortStringLength((short) i);
- }
- else if (i > 999999)
- {
- return len + 6 + encodedShortStringLength((short) (i / 1000000));
- }
- else // if i > 99999
- {
- return len + 5 + encodedShortStringLength((short) (i / 100000));
- }
-
- }
-
- public static int encodedShortStringLength(long l)
- {
- if (l == 0)
- {
- return 1 + 1;
- }
-
- int len = 0;
- if (l < 0)
- {
- len = 1;
- // sloppy - doesn't work of Long.MIN_VALUE
- l = -l;
- }
-
- if (l < Integer.MAX_VALUE)
- {
- return len + encodedShortStringLength((int) l);
- }
- else if (l > 9999999999L)
- {
- return len + 10 + encodedShortStringLength((int) (l / 10000000000L));
- }
- else
- {
- return len + 1 + encodedShortStringLength((int) (l / 10L));
- }
-
- }
-
- public static int encodedShortStringLength(AMQShortString s)
- {
- if (s == null)
- {
- return 1;
- }
- else
- {
- return (1 + s.length());
- }
- }
-
- public static int encodedLongStringLength(String s)
- {
- if (s == null)
- {
- return 4;
- }
- else
- {
- return 4 + s.length();
- }
- }
-
- public static int encodedLongStringLength(char[] s)
- {
- if (s == null)
- {
- return 4;
- }
- else
- {
- return 4 + s.length;
- }
- }
-
- public static int encodedLongstrLength(byte[] bytes)
- {
- if (bytes == null)
- {
- return 4;
- }
- else
- {
- return 4 + bytes.length;
- }
- }
-
- public static int encodedFieldTableLength(FieldTable table)
- {
- if (table == null)
- {
- // length is encoded as 4 octets
- return 4;
- }
- else
- {
- // length of the table plus 4 octets for the length
- return (int) table.getEncodedSize() + 4;
- }
- }
-
- public static void writeShortStringBytes(DataOutput buffer, String s) throws IOException
- {
- if (s != null)
- {
- byte[] encodedString = new byte[s.length()];
- char[] cha = s.toCharArray();
- for (int i = 0; i < cha.length; i++)
- {
- encodedString[i] = (byte) cha[i];
- }
-
- // TODO: check length fits in an unsigned byte
- writeUnsignedByte(buffer, (short)encodedString.length);
- buffer.write(encodedString);
-
-
- }
- else
- {
- // really writing out unsigned byte
- buffer.write((byte) 0);
- }
- }
-
- public static void writeShortStringBytes(DataOutput buffer, AMQShortString s) throws IOException
- {
- if (s != null)
- {
-
- s.writeToBuffer(buffer);
- }
- else
- {
- // really writing out unsigned byte
- buffer.write((byte) 0);
- }
- }
-
- public static void writeLongStringBytes(DataOutput buffer, String s) throws IOException
- {
- if (s != null)
- {
- int len = s.length();
- writeUnsignedInteger(buffer, s.length());
- byte[] encodedString = new byte[len];
- char[] cha = s.toCharArray();
- for (int i = 0; i < cha.length; i++)
- {
- encodedString[i] = (byte) cha[i];
- }
-
- buffer.write(encodedString);
- }
- else
- {
- writeUnsignedInteger(buffer, 0);
- }
- }
-
- public static void writeLongStringBytes(DataOutput buffer, char[] s) throws IOException
- {
- if (s != null)
- {
- int len = s.length;
- writeUnsignedInteger(buffer, s.length);
- byte[] encodedString = new byte[len];
- for (int i = 0; i < s.length; i++)
- {
- encodedString[i] = (byte) s[i];
- }
-
- buffer.write(encodedString);
- }
- else
- {
- writeUnsignedInteger(buffer, 0);
- }
- }
-
- public static void writeLongStringBytes(DataOutput buffer, byte[] bytes) throws IOException
- {
- if (bytes != null)
- {
- writeUnsignedInteger(buffer, bytes.length);
- buffer.write(bytes);
- }
- else
- {
- writeUnsignedInteger(buffer, 0);
- }
- }
-
- public static void writeUnsignedByte(DataOutput buffer, short b) throws IOException
- {
- byte bv = (byte) b;
- buffer.write(bv);
- }
-
- public static void writeUnsignedShort(DataOutput buffer, int s) throws IOException
- {
- // TODO: Is this comparison safe? Do I need to cast RHS to long?
- if (s < Short.MAX_VALUE)
- {
- buffer.writeShort(s);
- }
- else
- {
- short sv = (short) s;
- buffer.write((byte) (0xFF & (sv >> 8)));
- buffer.write((byte) (0xFF & sv));
- }
- }
-
- public static int unsignedIntegerLength()
- {
- return 4;
- }
-
- public static void writeUnsignedInteger(DataOutput buffer, long l) throws IOException
- {
- // TODO: Is this comparison safe? Do I need to cast RHS to long?
- if (l < Integer.MAX_VALUE)
- {
- buffer.writeInt((int) l);
- }
- else
- {
- int iv = (int) l;
-
- // FIXME: This *may* go faster if we build this into a local 4-byte array and then
- // put the array in a single call.
- buffer.write((byte) (0xFF & (iv >> 24)));
- buffer.write((byte) (0xFF & (iv >> 16)));
- buffer.write((byte) (0xFF & (iv >> 8)));
- buffer.write((byte) (0xFF & iv));
- }
- }
-
- public static void writeFieldTableBytes(DataOutput buffer, FieldTable table) throws IOException
- {
- if (table != null)
- {
- table.writeToBuffer(buffer);
- }
- else
- {
- EncodingUtils.writeUnsignedInteger(buffer, 0);
- }
- }
-
- public static void writeBooleans(DataOutput buffer, boolean[] values) throws IOException
- {
- byte packedValue = 0;
- for (int i = 0; i < values.length; i++)
- {
- if (values[i])
- {
- packedValue = (byte) (packedValue | (1 << i));
- }
- }
-
- buffer.write(packedValue);
- }
-
- public static void writeBooleans(DataOutput buffer, boolean value) throws IOException
- {
-
- buffer.write(value ? (byte) 1 : (byte) 0);
- }
-
- public static void writeBooleans(DataOutput buffer, boolean value0, boolean value1) throws IOException
- {
- byte packedValue = value0 ? (byte) 1 : (byte) 0;
-
- if (value1)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 1));
- }
-
- buffer.write(packedValue);
- }
-
- public static void writeBooleans(DataOutput buffer, boolean value0, boolean value1, boolean value2) throws IOException
- {
- byte packedValue = value0 ? (byte) 1 : (byte) 0;
-
- if (value1)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 1));
- }
-
- if (value2)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 2));
- }
-
- buffer.write(packedValue);
- }
-
- public static void writeBooleans(DataOutput buffer, boolean value0, boolean value1, boolean value2, boolean value3) throws IOException
- {
- byte packedValue = value0 ? (byte) 1 : (byte) 0;
-
- if (value1)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 1));
- }
-
- if (value2)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 2));
- }
-
- if (value3)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 3));
- }
-
- buffer.write(packedValue);
- }
-
- public static void writeBooleans(DataOutput buffer, boolean value0, boolean value1, boolean value2, boolean value3,
- boolean value4) throws IOException
- {
- byte packedValue = value0 ? (byte) 1 : (byte) 0;
-
- if (value1)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 1));
- }
-
- if (value2)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 2));
- }
-
- if (value3)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 3));
- }
-
- if (value4)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 4));
- }
-
- buffer.write(packedValue);
- }
-
- public static void writeBooleans(DataOutput buffer, boolean value0, boolean value1, boolean value2, boolean value3,
- boolean value4, boolean value5) throws IOException
- {
- byte packedValue = value0 ? (byte) 1 : (byte) 0;
-
- if (value1)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 1));
- }
-
- if (value2)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 2));
- }
-
- if (value3)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 3));
- }
-
- if (value4)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 4));
- }
-
- if (value5)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 5));
- }
-
- buffer.write(packedValue);
- }
-
- public static void writeBooleans(DataOutput buffer, boolean value0, boolean value1, boolean value2, boolean value3,
- boolean value4, boolean value5, boolean value6) throws IOException
- {
- byte packedValue = value0 ? (byte) 1 : (byte) 0;
-
- if (value1)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 1));
- }
-
- if (value2)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 2));
- }
-
- if (value3)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 3));
- }
-
- if (value4)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 4));
- }
-
- if (value5)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 5));
- }
-
- if (value6)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 6));
- }
-
- buffer.write(packedValue);
- }
-
- public static void writeBooleans(DataOutput buffer, boolean value0, boolean value1, boolean value2, boolean value3,
- boolean value4, boolean value5, boolean value6, boolean value7) throws IOException
- {
- byte packedValue = value0 ? (byte) 1 : (byte) 0;
-
- if (value1)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 1));
- }
-
- if (value2)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 2));
- }
-
- if (value3)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 3));
- }
-
- if (value4)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 4));
- }
-
- if (value5)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 5));
- }
-
- if (value6)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 6));
- }
-
- if (value7)
- {
- packedValue = (byte) (packedValue | (byte) (1 << 7));
- }
-
- buffer.write(packedValue);
- }
-
- /**
- * This is used for writing longstrs.
- * @param buffer buffer to write to
- * @param data data to write
- * @throws IOException if there is an issue writing the output
- */
- public static void writeLongstr(DataOutput buffer, byte[] data) throws IOException
- {
- if (data != null)
- {
- writeUnsignedInteger(buffer, data.length);
- buffer.write(data);
- }
- else
- {
- writeUnsignedInteger(buffer, 0);
- }
- }
-
- public static void writeTimestamp(DataOutput buffer, long timestamp) throws IOException
- {
- writeLong(buffer, timestamp);
- }
-
- public static boolean[] readBooleans(DataInput buffer) throws IOException
- {
- final byte packedValue = buffer.readByte();
- if (packedValue == 0)
- {
- return ALL_FALSE_ARRAY;
- }
-
- final boolean[] result = new boolean[8];
-
- result[0] = ((packedValue & 1) != 0);
- result[1] = ((packedValue & (1 << 1)) != 0);
- result[2] = ((packedValue & (1 << 2)) != 0);
- result[3] = ((packedValue & (1 << 3)) != 0);
- if ((packedValue & 0xF0) == 0)
- {
- result[0] = ((packedValue & 1) != 0);
- }
-
- result[4] = ((packedValue & (1 << 4)) != 0);
- result[5] = ((packedValue & (1 << 5)) != 0);
- result[6] = ((packedValue & (1 << 6)) != 0);
- result[7] = ((packedValue & (1 << 7)) != 0);
-
- return result;
- }
-
- public static FieldTable readFieldTable(DataInput buffer) throws AMQFrameDecodingException, IOException
- {
- long length = ((long)(buffer.readInt())) & 0xFFFFFFFFL;
- if (length == 0)
- {
- return null;
- }
- else
- {
- return FieldTableFactory.newFieldTable(buffer, length);
- }
- }
-
- public static AMQShortString readAMQShortString(DataInput buffer) throws IOException
- {
- return AMQShortString.readFromBuffer(buffer);
-
- }
-
- public static String readShortString(DataInput buffer) throws IOException
- {
- short length = (short) (((short)buffer.readByte()) & 0xFF);
- if (length == 0)
- {
- return null;
- }
- else
- {
- // this may seem rather odd to declare two array but testing has shown
- // that constructing a string from a byte array is 5 (five) times slower
- // than constructing one from a char array.
- // this approach here is valid since we know that all the chars are
- // ASCII (0-127)
- byte[] stringBytes = new byte[length];
- buffer.readFully(stringBytes, 0, length);
- char[] stringChars = new char[length];
- for (int i = 0; i < stringChars.length; i++)
- {
- stringChars[i] = (char) stringBytes[i];
- }
-
- return new String(stringChars);
- }
- }
-
- public static String readLongString(DataInput buffer) throws IOException
- {
- long length = ((long)(buffer.readInt())) & 0xFFFFFFFFL;
- if (length == 0)
- {
- return "";
- }
- else
- {
- // this may seem rather odd to declare two array but testing has shown
- // that constructing a string from a byte array is 5 (five) times slower
- // than constructing one from a char array.
- // this approach here is valid since we know that all the chars are
- // ASCII (0-127)
- byte[] stringBytes = new byte[(int) length];
- buffer.readFully(stringBytes, 0, (int) length);
- char[] stringChars = new char[(int) length];
- for (int i = 0; i < stringChars.length; i++)
- {
- stringChars[i] = (char) stringBytes[i];
- }
-
- return new String(stringChars);
- }
- }
-
- public static byte[] readLongstr(DataInput buffer) throws IOException
- {
- long length = ((long)(buffer.readInt())) & 0xFFFFFFFFL;
- if (length == 0)
- {
- return null;
- }
- else
- {
- byte[] result = new byte[(int) length];
- buffer.readFully(result);
-
- return result;
- }
- }
-
- public static long readTimestamp(DataInput buffer) throws IOException
- {
- return buffer.readLong();
- }
-
- static byte[] hexToByteArray(String id)
- {
- // Should check param for null, long enough for this check, upper-case and trailing char
- String s = (id.charAt(1) == 'x') ? id.substring(2) : id; // strip 0x
-
- int len = s.length();
- int byte_len = len / 2;
- byte[] b = new byte[byte_len];
-
- for (int i = 0; i < byte_len; i++)
- {
- // fixme: refine these repetitive subscript calcs.
- int ch = i * 2;
-
- byte b1 = Byte.parseByte(s.substring(ch, ch + 1), 16);
- byte b2 = Byte.parseByte(s.substring(ch + 1, ch + 2), 16);
-
- b[i] = (byte) ((b1 * 16) + b2);
- }
-
- return (b);
- }
-
- public static char[] convertToHexCharArray(byte[] from)
- {
- int length = from.length;
- char[] result_buff = new char[(length * 2) + 2];
-
- result_buff[0] = '0';
- result_buff[1] = 'x';
-
- int bite;
- int dest = 2;
-
- for (int i = 0; i < length; i++)
- {
- bite = from[i];
-
- if (bite < 0)
- {
- bite += 256;
- }
-
- result_buff[dest++] = hex_chars[bite >> 4];
- result_buff[dest++] = hex_chars[bite & 0x0f];
- }
-
- return (result_buff);
- }
-
- public static String convertToHexString(byte[] from)
- {
- return (new String(convertToHexCharArray(from)));
- }
-
- public static String convertToHexString(ByteBuffer bb)
- {
- int size = bb.limit();
-
- byte[] from = new byte[size];
-
- for (int i = 0; i < size; i++)
- {
- from[i] = bb.get(i);
- }
-
- return (new String(convertToHexCharArray(from)));
- }
-
- private static char[] hex_chars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
-
- // **** new methods
-
- // AMQP_BOOLEAN_PROPERTY_PREFIX
-
- public static void writeBoolean(DataOutput buffer, boolean aBoolean) throws IOException
- {
- buffer.write(aBoolean ? 1 : 0);
- }
-
- public static boolean readBoolean(DataInput buffer) throws IOException
- {
- byte packedValue = buffer.readByte();
-
- return (packedValue == 1);
- }
-
- public static int encodedBooleanLength()
- {
- return 1;
- }
-
- // AMQP_BYTE_PROPERTY_PREFIX
- public static void writeByte(DataOutput buffer, byte aByte) throws IOException
- {
- buffer.writeByte(aByte);
- }
-
- public static byte readByte(DataInput buffer) throws IOException
- {
- return buffer.readByte();
- }
-
- public static int encodedByteLength()
- {
- return 1;
- }
-
- // AMQP_SHORT_PROPERTY_PREFIX
- public static void writeShort(DataOutput buffer, short aShort) throws IOException
- {
- buffer.writeShort(aShort);
- }
-
- public static short readShort(DataInput buffer) throws IOException
- {
- return buffer.readShort();
- }
-
- public static int encodedShortLength()
- {
- return 2;
- }
-
- // INTEGER_PROPERTY_PREFIX
- public static void writeInteger(DataOutput buffer, int aInteger) throws IOException
- {
- buffer.writeInt(aInteger);
- }
-
- public static int readInteger(DataInput buffer) throws IOException
- {
- return buffer.readInt();
- }
-
- public static int encodedIntegerLength()
- {
- return 4;
- }
-
- // AMQP_LONG_PROPERTY_PREFIX
- public static void writeLong(DataOutput buffer, long aLong) throws IOException
- {
- buffer.writeLong(aLong);
- }
-
- public static long readLong(DataInput buffer) throws IOException
- {
- return buffer.readLong();
- }
-
- public static int encodedLongLength()
- {
- return 8;
- }
-
- // Float_PROPERTY_PREFIX
- public static void writeFloat(DataOutput buffer, float aFloat) throws IOException
- {
- buffer.writeFloat(aFloat);
- }
-
- public static float readFloat(DataInput buffer) throws IOException
- {
- return buffer.readFloat();
- }
-
- public static int encodedFloatLength()
- {
- return 4;
- }
-
- // Double_PROPERTY_PREFIX
- public static void writeDouble(DataOutput buffer, Double aDouble) throws IOException
- {
- buffer.writeDouble(aDouble);
- }
-
- public static double readDouble(DataInput buffer) throws IOException
- {
- return buffer.readDouble();
- }
-
- public static int encodedDoubleLength()
- {
- return 8;
- }
-
- public static byte[] readBytes(DataInput buffer) throws IOException
- {
- long length = ((long)(buffer.readInt())) & 0xFFFFFFFFL;
- if (length == 0)
- {
- return null;
- }
- else
- {
- byte[] dataBytes = new byte[(int)length];
- buffer.readFully(dataBytes, 0, (int) length);
-
- return dataBytes;
- }
- }
-
- public static void writeBytes(DataOutput buffer, byte[] data) throws IOException
- {
- if (data != null)
- {
- // TODO: check length fits in an unsigned byte
- writeUnsignedInteger(buffer, (long)data.length);
- buffer.write(data);
- }
- else
- {
- writeUnsignedInteger(buffer, 0L);
- }
- }
-
- // CHAR_PROPERTY
- public static int encodedCharLength()
- {
- return encodedByteLength();
- }
-
- public static char readChar(DataInput buffer) throws IOException
- {
- // This is valid as we know that the Character is ASCII 0..127
- return (char) buffer.readByte();
- }
-
- public static void writeChar(DataOutput buffer, char character) throws IOException
- {
- // This is valid as we know that the Character is ASCII 0..127
- writeByte(buffer, (byte) character);
- }
-
- public static long readLongAsShortString(DataInput buffer) throws IOException
- {
- short length = (short) buffer.readUnsignedByte();
- short pos = 0;
- if (length == 0)
- {
- return 0L;
- }
-
- byte digit = buffer.readByte();
- boolean isNegative;
- long result = 0;
- if (digit == (byte) '-')
- {
- isNegative = true;
- pos++;
- digit = buffer.readByte();
- }
- else
- {
- isNegative = false;
- }
-
- result = digit - (byte) '0';
- pos++;
-
- while (pos < length)
- {
- pos++;
- digit = buffer.readByte();
- result = (result << 3) + (result << 1);
- result += digit - (byte) '0';
- }
-
- return result;
- }
-
- public static long readUnsignedInteger(DataInput buffer) throws IOException
- {
- long l = 0xFF & buffer.readByte();
- l <<= 8;
- l = l | (0xFF & buffer.readByte());
- l <<= 8;
- l = l | (0xFF & buffer.readByte());
- l <<= 8;
- l = l | (0xFF & buffer.readByte());
-
- return l;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeBoundBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeBoundBody.java
deleted file mode 100644
index e8dc2ae442..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeBoundBody.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ExchangeBoundBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 40;
- public static final int METHOD_ID = 22;
-
- // Fields declared in specification
- private final AMQShortString _exchange; // [exchange]
- private final AMQShortString _routingKey; // [routingKey]
- private final AMQShortString _queue; // [queue]
-
- // Constructor
- public ExchangeBoundBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _exchange = buffer.readAMQShortString();
- _routingKey = buffer.readAMQShortString();
- _queue = buffer.readAMQShortString();
- }
-
- public ExchangeBoundBody(
- AMQShortString exchange,
- AMQShortString routingKey,
- AMQShortString queue
- )
- {
- _exchange = exchange;
- _routingKey = routingKey;
- _queue = queue;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
- public final AMQShortString getQueue()
- {
- return _queue;
- }
-
- protected int getBodySize()
- {
- int size = 0;
- size += getSizeOf( _exchange );
- size += getSizeOf( _routingKey );
- size += getSizeOf( _queue );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _exchange );
- writeAMQShortString( buffer, _routingKey );
- writeAMQShortString( buffer, _queue );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchExchangeBound(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ExchangeBoundBodyImpl: ");
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "routingKey=" );
- buf.append( getRoutingKey() );
- buf.append( ", " );
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher)
- throws IOException
- {
-
- AMQShortString exchange = buffer.readAMQShortString();
- AMQShortString routingKey = buffer.readAMQShortString();
- AMQShortString queue = buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveExchangeBound(exchange, routingKey, queue);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeBoundOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeBoundOkBody.java
deleted file mode 100644
index ef91c1d635..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeBoundOkBody.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ExchangeBoundOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 40;
- public static final int METHOD_ID = 23;
- public static final int OK = 0;
- public static final int EXCHANGE_NOT_FOUND = 1;
- public static final int QUEUE_NOT_FOUND = 2;
- public static final int NO_BINDINGS = 3;
- public static final int QUEUE_NOT_BOUND = 4;
- public static final int NO_QUEUE_BOUND_WITH_RK = 5;
- public static final int SPECIFIC_QUEUE_NOT_BOUND_WITH_RK = 6;
-
- // Fields declared in specification
- private final int _replyCode; // [replyCode]
- private final AMQShortString _replyText; // [replyText]
-
- // Constructor
- public ExchangeBoundOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _replyCode = buffer.readUnsignedShort();
- _replyText = buffer.readAMQShortString();
- }
-
- public ExchangeBoundOkBody(
- int replyCode,
- AMQShortString replyText
- )
- {
- _replyCode = replyCode;
- _replyText = replyText;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getReplyCode()
- {
- return _replyCode;
- }
- public final AMQShortString getReplyText()
- {
- return _replyText;
- }
-
- protected int getBodySize()
- {
- int size = 2;
- size += getSizeOf( _replyText );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _replyCode );
- writeAMQShortString( buffer, _replyText );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchExchangeBoundOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ExchangeBoundOkBodyImpl: ");
- buf.append( "replyCode=" );
- buf.append( getReplyCode() );
- buf.append( ", " );
- buf.append( "replyText=" );
- buf.append( getReplyText() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher)
- throws IOException
- {
-
- int replyCode = buffer.readUnsignedShort();
- AMQShortString replyText = buffer.readAMQShortString();
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveExchangeBoundOk(replyCode, replyText);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeclareBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeclareBody.java
deleted file mode 100644
index 4001ba7aa0..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeclareBody.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ExchangeDeclareBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 40;
- public static final int METHOD_ID = 10;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _exchange; // [exchange]
- private final AMQShortString _type; // [type]
- private final byte _bitfield0; // [passive, durable, autoDelete, internal, nowait]
- private final FieldTable _arguments; // [arguments]
-
- // Constructor
- public ExchangeDeclareBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _exchange = buffer.readAMQShortString();
- _type = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- _arguments = EncodingUtils.readFieldTable(buffer);
- }
-
- public ExchangeDeclareBody(
- int ticket,
- AMQShortString exchange,
- AMQShortString type,
- boolean passive,
- boolean durable,
- boolean autoDelete,
- boolean internal,
- boolean nowait,
- FieldTable arguments
- )
- {
- _ticket = ticket;
- _exchange = exchange;
- _type = type;
- byte bitfield0 = (byte)0;
- if( passive )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- if( durable )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 1));
- }
-
- if( autoDelete )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 2));
- }
-
- if( internal )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 3));
- }
-
- if( nowait )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 4));
- }
-
- _bitfield0 = bitfield0;
- _arguments = arguments;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final AMQShortString getType()
- {
- return _type;
- }
- public final boolean getPassive()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final boolean getDurable()
- {
- return (((int)(_bitfield0)) & ( 1 << 1)) != 0;
- }
- public final boolean getAutoDelete()
- {
- return (((int)(_bitfield0)) & ( 1 << 2)) != 0;
- }
- public final boolean getInternal()
- {
- return (((int)(_bitfield0)) & ( 1 << 3)) != 0;
- }
- public final boolean getNowait()
- {
- return (((int)(_bitfield0)) & ( 1 << 4)) != 0;
- }
- public final FieldTable getArguments()
- {
- return _arguments;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _exchange );
- size += getSizeOf( _type );
- size += getSizeOf( _arguments );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _exchange );
- writeAMQShortString( buffer, _type );
- writeBitfield( buffer, _bitfield0 );
- writeFieldTable( buffer, _arguments );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchExchangeDeclare(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ExchangeDeclareBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "type=" );
- buf.append( getType() );
- buf.append( ", " );
- buf.append( "passive=" );
- buf.append( getPassive() );
- buf.append( ", " );
- buf.append( "durable=" );
- buf.append( getDurable() );
- buf.append( ", " );
- buf.append( "autoDelete=" );
- buf.append( getAutoDelete() );
- buf.append( ", " );
- buf.append( "internal=" );
- buf.append( getInternal() );
- buf.append( ", " );
- buf.append( "nowait=" );
- buf.append( getNowait() );
- buf.append( ", " );
- buf.append( "arguments=" );
- buf.append( getArguments() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException, AMQFrameDecodingException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString exchange = buffer.readAMQShortString();
- AMQShortString type = buffer.readAMQShortString();
- byte bitfield = buffer.readByte();
- boolean passive = (bitfield & 0x1) == 0x1;
- boolean durable = (bitfield & 0x2) == 0x2;
- boolean autoDelete = (bitfield & 0x4) == 0x4;
- boolean internal = (bitfield & 0x8) == 0x8;
- boolean nowait = (bitfield & 0x10) == 0x10;
- FieldTable arguments = EncodingUtils.readFieldTable(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveExchangeDeclare(exchange,
- type,
- passive,
- durable,
- autoDelete,
- internal,
- nowait,
- arguments);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeclareOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeclareOkBody.java
deleted file mode 100644
index 68b193cfb0..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeclareOkBody.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ExchangeDeclareOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 40;
- public static final int METHOD_ID = 11;
-
- // Fields declared in specification
-
- // Constructor
- public ExchangeDeclareOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- }
-
- public ExchangeDeclareOkBody(
- )
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- int size = 0;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchExchangeDeclareOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ExchangeDeclareOkBodyImpl: ");
- buf.append("]");
- return buf.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeleteBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeleteBody.java
deleted file mode 100644
index f4646315cd..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeleteBody.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ExchangeDeleteBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 40;
- public static final int METHOD_ID = 20;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _exchange; // [exchange]
- private final byte _bitfield0; // [ifUnused, nowait]
-
- // Constructor
- public ExchangeDeleteBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _exchange = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- }
-
- public ExchangeDeleteBody(
- int ticket,
- AMQShortString exchange,
- boolean ifUnused,
- boolean nowait
- )
- {
- _ticket = ticket;
- _exchange = exchange;
- byte bitfield0 = (byte)0;
- if( ifUnused )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- if( nowait )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 1));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final boolean getIfUnused()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final boolean getNowait()
- {
- return (((int)(_bitfield0)) & ( 1 << 1)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _exchange );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _exchange );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchExchangeDelete(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ExchangeDeleteBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "ifUnused=" );
- buf.append( getIfUnused() );
- buf.append( ", " );
- buf.append( "nowait=" );
- buf.append( getNowait() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher)
- throws IOException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString exchange = buffer.readAMQShortString();
- byte bitfield = buffer.readByte();
- boolean ifUnused = (bitfield & 0x01) == 0x01;
- boolean nowait = (bitfield & 0x02) == 0x02;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveExchangeDelete(exchange, ifUnused, nowait);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeleteOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeleteOkBody.java
deleted file mode 100644
index 7af0b02ef0..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExchangeDeleteOkBody.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class ExchangeDeleteOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 40;
- public static final int METHOD_ID = 21;
-
- // Fields declared in specification
-
- // Constructor
- public ExchangeDeleteOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- }
-
- public ExchangeDeleteOkBody(
- )
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- int size = 0;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchExchangeDeleteOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[ExchangeDeleteOkBodyImpl: ");
- buf.append("]");
- return buf.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExtendedDataInput.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ExtendedDataInput.java
deleted file mode 100644
index 04c1677892..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ExtendedDataInput.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-
-public interface ExtendedDataInput extends DataInput
-{
- AMQShortString readAMQShortString();
-
- int available();
-
- int position();
-
- void position(int position);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldArray.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldArray.java
deleted file mode 100644
index d61d0e8385..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldArray.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.AbstractCollection;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-public class FieldArray<T> extends AbstractCollection<T>
-{
-
- private final Collection<T> _underlying;
-
- private FieldArray(final Collection<T> underlying)
- {
- _underlying = underlying;
- }
-
- @Override
- public Iterator<T> iterator()
- {
- return _underlying.iterator();
- }
-
- @Override
- public int size()
- {
- return _underlying.size();
- }
-
- public int getEncodingSize()
- {
- int size = 0;
- for( T obj : this)
- {
- size += AMQTypedValue.toTypedValue(obj).getEncodingSize()+1;
- }
- return size;
- }
-
- public static <T> FieldArray<T> asFieldArray(Collection<T> collection)
- {
- if(collection instanceof FieldArray)
- {
- return (FieldArray<T>) collection;
- }
- else
- {
- validateCollection(collection);
- return new FieldArray<>(collection);
- }
- }
-
- private static final Set<Class<?>> SUPPORTED_CLASSES = new HashSet<>(Arrays.asList(Boolean.class,
- Byte.class,
- Short.class,
- Character.class,
- Integer.class,
- Long.class,
- Float.class,
- Double.class,
- String.class,
- FieldTable.class,
- Date.class,
- BigDecimal.class,
- byte[].class));
-
- private static <T> void validateCollection(final Collection<T> collection)
- {
- for(T val : collection)
- {
- if(!(val == null || SUPPORTED_CLASSES.contains(val.getClass()) || val instanceof Collection || val instanceof Map))
- {
- throw new IllegalArgumentException("Cannot convert an object of type " + val.getClass().getName());
- }
-
- }
- }
-
- public void writeToBuffer(final DataOutput buffer) throws IOException
- {
- buffer.writeInt(getEncodingSize());
- for( T obj : this)
- {
- AMQTypedValue.toTypedValue(obj).writeToBuffer(buffer);
- }
- }
-
- public static FieldArray<?> readFromBuffer(final DataInput buffer) throws IOException
- {
- ArrayList<Object> result = new ArrayList<>();
- int size = EncodingUtils.readInteger(buffer);
- byte[] data = new byte[size];
- buffer.readFully(data);
- ByteArrayDataInput slicedBuffer = new ByteArrayDataInput(data);
- while(slicedBuffer.available() > 0)
- {
- result.add(AMQTypedValue.readFromBuffer(slicedBuffer).getValue());
- }
- return new FieldArray<>(result);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
deleted file mode 100644
index 9a455ce868..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
+++ /dev/null
@@ -1,1181 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.AMQPInvalidClassException;
-
-// extends FieldTable
-public class FieldTable
-{
- private static final Logger _logger = LoggerFactory.getLogger(FieldTable.class);
- private static final String STRICT_AMQP_NAME = "STRICT_AMQP";
- private static final boolean STRICT_AMQP = Boolean.valueOf(System.getProperty(STRICT_AMQP_NAME, "false"));
-
- private byte[] _encodedForm;
- private int _encodedFormOffset;
- private LinkedHashMap<AMQShortString, AMQTypedValue> _properties = null;
- private long _encodedSize;
- private static final int INITIAL_HASHMAP_CAPACITY = 16;
- private static final int INITIAL_ENCODED_FORM_SIZE = 256;
- private final boolean _strictAMQP;
-
- public FieldTable()
- {
- this(STRICT_AMQP);
- }
-
-
- public FieldTable(boolean strictAMQP)
- {
- super();
- _strictAMQP = strictAMQP;
- }
-
- /**
- * Construct a new field table.
- *
- * @param buffer the buffer from which to read data. The length byte must be read already
- * @param length the length of the field table. Must be great than 0.
- * @throws IOException if there is an issue reading the buffer
- */
- public FieldTable(DataInput buffer, long length) throws IOException
- {
- this();
- _encodedForm = new byte[(int) length];
- buffer.readFully(_encodedForm);
- _encodedSize = length;
- }
-
- public FieldTable(byte[] encodedForm, int offset, int length)
- {
- this();
- _encodedForm = encodedForm;
- _encodedFormOffset = offset;
- _encodedSize = length;
- }
-
-
- public boolean isClean()
- {
- return _encodedForm != null;
- }
-
- public AMQTypedValue getProperty(AMQShortString string)
- {
- checkPropertyName(string);
-
- synchronized (this)
- {
- if (_properties == null)
- {
- if (_encodedForm == null)
- {
- return null;
- }
- else
- {
- populateFromBuffer();
- }
- }
- }
-
- if (_properties == null)
- {
- return null;
- }
- else
- {
- return _properties.get(string);
- }
- }
-
- private void populateFromBuffer()
- {
- try
- {
- setFromBuffer();
- }
- catch (AMQFrameDecodingException e)
- {
- _logger.error("Error decoding FieldTable in deferred decoding mode ", e);
- throw new IllegalArgumentException(e);
- }
- catch (IOException e)
- {
- _logger.error("Unexpected IO exception decoding field table");
- throw new IllegalArgumentException(e);
-
- }
- }
-
- private AMQTypedValue setProperty(AMQShortString key, AMQTypedValue val)
- {
- checkPropertyName(key);
- initMapIfNecessary();
- if (_properties.containsKey(key))
- {
- _encodedForm = null;
-
- if (val == null)
- {
- return removeKey(key);
- }
- }
- else if ((_encodedForm != null) && (val != null))
- {
- // We have updated data to store in the buffer
- // So clear the _encodedForm to allow it to be rebuilt later
- // this is safer than simply appending to any existing buffer.
- _encodedForm = null;
- }
- else if (val == null)
- {
- return null;
- }
-
- AMQTypedValue oldVal = _properties.put(key, val);
- if (oldVal != null)
- {
- _encodedSize -= oldVal.getEncodingSize();
- }
- else
- {
- _encodedSize += EncodingUtils.encodedShortStringLength(key) + 1;
- }
-
- _encodedSize += val.getEncodingSize();
-
- return oldVal;
- }
-
- private void initMapIfNecessary()
- {
- synchronized (this)
- {
- if (_properties == null)
- {
- if ((_encodedForm == null) || (_encodedSize == 0))
- {
- _properties = new LinkedHashMap<AMQShortString, AMQTypedValue>();
- }
- else
- {
- populateFromBuffer();
- }
- }
-
- }
- }
-
- public Boolean getBoolean(String string)
- {
- return getBoolean(AMQShortString.valueOf(string));
- }
-
- public Boolean getBoolean(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.BOOLEAN))
- {
- return (Boolean) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public Byte getByte(String string)
- {
- return getByte(AMQShortString.valueOf(string));
- }
-
- public Byte getByte(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.BYTE))
- {
- return (Byte) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public Short getShort(String string)
- {
- return getShort(AMQShortString.valueOf(string));
- }
-
- public Short getShort(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.SHORT))
- {
- return (Short) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public Integer getInteger(String string)
- {
- return getInteger(AMQShortString.valueOf(string));
- }
-
- public Integer getInteger(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.INT))
- {
- return (Integer) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public Long getLong(String string)
- {
- return getLong(AMQShortString.valueOf(string));
- }
-
- public Long getLong(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.LONG))
- {
- return (Long) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public Float getFloat(String string)
- {
- return getFloat(AMQShortString.valueOf(string));
- }
-
- public Float getFloat(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.FLOAT))
- {
- return (Float) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public Double getDouble(String string)
- {
- return getDouble(AMQShortString.valueOf(string));
- }
-
- public Double getDouble(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.DOUBLE))
- {
- return (Double) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public String getString(String string)
- {
- return getString(AMQShortString.valueOf(string));
- }
-
- public String getString(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && ((value.getType() == AMQType.WIDE_STRING) || (value.getType() == AMQType.ASCII_STRING)))
- {
- return (String) value.getValue();
- }
- else if ((value != null) && (value.getValue() != null) && !(value.getValue() instanceof byte[]))
- {
- return String.valueOf(value.getValue());
- }
- else
- {
- return null;
- }
-
- }
-
- public Character getCharacter(String string)
- {
- return getCharacter(AMQShortString.valueOf(string));
- }
-
- public Character getCharacter(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.ASCII_CHARACTER))
- {
- return (Character) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public byte[] getBytes(String string)
- {
- return getBytes(AMQShortString.valueOf(string));
- }
-
- public byte[] getBytes(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if ((value != null) && (value.getType() == AMQType.BINARY))
- {
- return (byte[]) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Extracts a value from the field table that is itself a FieldTable associated with the specified parameter name.
- *
- * @param string The name of the parameter to get the associated FieldTable value for.
- *
- * @return The associated FieldTable value, or <tt>null</tt> if the associated value is not of FieldTable type or
- * not present in the field table at all.
- */
- public FieldTable getFieldTable(String string)
- {
- return getFieldTable(AMQShortString.valueOf(string));
- }
-
- /**
- * Extracts a value from the field table that is itself a FieldTable associated with the specified parameter name.
- *
- * @param string The name of the parameter to get the associated FieldTable value for.
- *
- * @return The associated FieldTable value, or <tt>null</tt> if the associated value is not of FieldTable type or
- * not present in the field table at all.
- */
- public FieldTable getFieldTable(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
-
- if ((value != null) && (value.getType() == AMQType.FIELD_TABLE))
- {
- return (FieldTable) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public Object getObject(String string)
- {
- return getObject(AMQShortString.valueOf(string));
- }
-
- public Object getObject(AMQShortString string)
- {
- AMQTypedValue value = getProperty(string);
- if (value != null)
- {
- return value.getValue();
- }
- else
- {
- return value;
- }
-
- }
-
- public Long getTimestamp(AMQShortString name)
- {
- AMQTypedValue value = getProperty(name);
- if ((value != null) && (value.getType() == AMQType.TIMESTAMP))
- {
- return (Long) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- public BigDecimal getDecimal(AMQShortString propertyName)
- {
- AMQTypedValue value = getProperty(propertyName);
- if ((value != null) && (value.getType() == AMQType.DECIMAL))
- {
- return (BigDecimal) value.getValue();
- }
- else
- {
- return null;
- }
- }
-
- // ************ Setters
- public Object setBoolean(String string, Boolean b)
- {
- return setBoolean(AMQShortString.valueOf(string), b);
- }
-
- public Object setBoolean(AMQShortString string, Boolean b)
- {
- return setProperty(string, AMQType.BOOLEAN.asTypedValue(b));
- }
-
- public Object setByte(String string, Byte b)
- {
- return setByte(AMQShortString.valueOf(string), b);
- }
-
- public Object setByte(AMQShortString string, Byte b)
- {
- return setProperty(string, AMQType.BYTE.asTypedValue(b));
- }
-
- public Object setShort(String string, Short i)
- {
- return setShort(AMQShortString.valueOf(string), i);
- }
-
- public Object setShort(AMQShortString string, Short i)
- {
- return setProperty(string, AMQType.SHORT.asTypedValue(i));
- }
-
- public Object setInteger(String string, int i)
- {
- return setInteger(AMQShortString.valueOf(string), i);
- }
-
- public Object setInteger(AMQShortString string, int i)
- {
- return setProperty(string, AMQTypedValue.createAMQTypedValue(i));
- }
-
- public Object setLong(String string, long l)
- {
- return setLong(AMQShortString.valueOf(string), l);
- }
-
- public Object setLong(AMQShortString string, long l)
- {
- return setProperty(string, AMQTypedValue.createAMQTypedValue(l));
- }
-
- public Object setFloat(String string, Float f)
- {
- return setFloat(AMQShortString.valueOf(string), f);
- }
-
- public Object setFloat(AMQShortString string, Float v)
- {
- return setProperty(string, AMQType.FLOAT.asTypedValue(v));
- }
-
- public Object setDouble(String string, Double d)
- {
- return setDouble(AMQShortString.valueOf(string), d);
- }
-
- public Object setDouble(AMQShortString string, Double v)
- {
- return setProperty(string, AMQType.DOUBLE.asTypedValue(v));
- }
-
- public Object setString(String string, String s)
- {
- return setString(AMQShortString.valueOf(string), s);
- }
-
- public Object setAsciiString(AMQShortString string, String value)
- {
- if (value == null)
- {
- return setProperty(string, AMQType.VOID.asTypedValue(null));
- }
- else
- {
- return setProperty(string, AMQType.ASCII_STRING.asTypedValue(value));
- }
- }
-
- public Object setString(AMQShortString string, String value)
- {
- if (value == null)
- {
- return setProperty(string, AMQType.VOID.asTypedValue(null));
- }
- else
- {
- return setProperty(string, AMQType.LONG_STRING.asTypedValue(value));
- }
- }
-
- public Object setChar(String string, char c)
- {
- return setChar(AMQShortString.valueOf(string), c);
- }
-
- public Object setChar(AMQShortString string, char c)
- {
- return setProperty(string, AMQType.ASCII_CHARACTER.asTypedValue(c));
- }
-
- public Object setFieldArray(String string, Collection<?> collection)
- {
- return setFieldArray(AMQShortString.valueOf(string), collection);
- }
- public Object setFieldArray(AMQShortString string, Collection<?> collection)
- {
- return setProperty(string, AMQType.FIELD_ARRAY.asTypedValue(collection));
- }
-
- public Object setBytes(String string, byte[] b)
- {
- return setBytes(AMQShortString.valueOf(string), b);
- }
-
- public Object setBytes(AMQShortString string, byte[] bytes)
- {
- return setProperty(string, AMQType.BINARY.asTypedValue(bytes));
- }
-
- public Object setBytes(String string, byte[] bytes, int start, int length)
- {
- return setBytes(AMQShortString.valueOf(string), bytes, start, length);
- }
-
- public Object setBytes(AMQShortString string, byte[] bytes, int start, int length)
- {
- byte[] newBytes = new byte[length];
- System.arraycopy(bytes, start, newBytes, 0, length);
-
- return setBytes(string, bytes);
- }
-
- public Object setObject(String string, Object o)
- {
- return setObject(AMQShortString.valueOf(string), o);
- }
-
- public Object setTimestamp(AMQShortString string, long datetime)
- {
- return setProperty(string, AMQType.TIMESTAMP.asTypedValue(datetime));
- }
-
- public Object setDecimal(AMQShortString string, BigDecimal decimal)
- {
- if (decimal.longValue() > Integer.MAX_VALUE)
- {
- throw new UnsupportedOperationException("AMQP does not support decimals larger than " + Integer.MAX_VALUE);
- }
-
- if (decimal.scale() > Byte.MAX_VALUE)
- {
- throw new UnsupportedOperationException("AMQP does not support decimal scales larger than " + Byte.MAX_VALUE);
- }
-
- return setProperty(string, AMQType.DECIMAL.asTypedValue(decimal));
- }
-
- public Object setVoid(AMQShortString string)
- {
- return setProperty(string, AMQType.VOID.asTypedValue(null));
- }
-
- /**
- * Associates a nested field table with the specified parameter name.
- *
- * @param string The name of the parameter to store in the table.
- * @param ftValue The field table value to associate with the parameter name.
- *
- * @return The stored value.
- */
- public Object setFieldTable(String string, FieldTable ftValue)
- {
- return setFieldTable(AMQShortString.valueOf(string), ftValue);
- }
-
- /**
- * Associates a nested field table with the specified parameter name.
- *
- * @param string The name of the parameter to store in the table.
- * @param ftValue The field table value to associate with the parameter name.
- *
- * @return The stored value.
- */
- public Object setFieldTable(AMQShortString string, FieldTable ftValue)
- {
- return setProperty(string, AMQType.FIELD_TABLE.asTypedValue(ftValue));
- }
-
- public Object setObject(AMQShortString string, Object object)
- {
- if (object instanceof Boolean)
- {
- return setBoolean(string, (Boolean) object);
- }
- else if (object instanceof Byte)
- {
- return setByte(string, (Byte) object);
- }
- else if (object instanceof Short)
- {
- return setShort(string, (Short) object);
- }
- else if (object instanceof Integer)
- {
- return setInteger(string, (Integer) object);
- }
- else if (object instanceof Long)
- {
- return setLong(string, (Long) object);
- }
- else if (object instanceof Float)
- {
- return setFloat(string, (Float) object);
- }
- else if (object instanceof Double)
- {
- return setDouble(string, (Double) object);
- }
- else if (object instanceof String)
- {
- return setString(string, (String) object);
- }
- else if (object instanceof Character)
- {
- return setChar(string, (Character) object);
- }
- else if (object instanceof Collection)
- {
- return setFieldArray(string, (Collection)object);
- }
- else if (object instanceof FieldTable)
- {
- return setFieldTable(string, (FieldTable) object);
- }
- else if (object instanceof Map)
- {
- return setFieldTable(string, FieldTable.convertToFieldTable((Map) object));
- }
- else if (object instanceof Date)
- {
- return setTimestamp(string, ((Date) object).getTime());
- }
- else if (object instanceof BigDecimal)
- {
- return setDecimal(string, (BigDecimal) object);
- }
- else if (object instanceof byte[])
- {
- return setBytes(string, (byte[]) object);
- }
-
- throw new AMQPInvalidClassException(AMQPInvalidClassException.INVALID_OBJECT_MSG + (object == null ? "null" : object.getClass()));
- }
-
- public boolean isNullStringValue(String name)
- {
- AMQTypedValue value = getProperty(AMQShortString.valueOf(name));
-
- return (value != null) && (value.getType() == AMQType.VOID);
- }
-
- // ***** Methods
-
- public Enumeration getPropertyNames()
- {
- return Collections.enumeration(keys());
- }
-
- public boolean propertyExists(AMQShortString propertyName)
- {
- return itemExists(propertyName);
- }
-
- public boolean propertyExists(String propertyName)
- {
- return itemExists(propertyName);
- }
-
- public boolean itemExists(AMQShortString propertyName)
- {
- checkPropertyName(propertyName);
- initMapIfNecessary();
-
- return _properties.containsKey(propertyName);
- }
-
- public boolean itemExists(String string)
- {
- return itemExists(AMQShortString.valueOf(string));
- }
-
- public String toString()
- {
- initMapIfNecessary();
-
- return _properties.toString();
- }
-
- private void checkPropertyName(AMQShortString propertyName)
- {
- if (propertyName == null)
- {
- throw new IllegalArgumentException("Property name must not be null");
- }
- else if (propertyName.length() == 0)
- {
- throw new IllegalArgumentException("Property name must not be the empty string");
- }
-
- if (_strictAMQP)
- {
- checkIdentiferFormat(propertyName);
- }
- }
-
- protected static void checkIdentiferFormat(AMQShortString propertyName)
- {
- // AMQP Spec: 4.2.5.5 Field Tables
- // Guidelines for implementers:
- // * Field names MUST start with a letter, '$' or '#' and may continue with
- // letters, '$' or '#', digits, or underlines, to a maximum length of 128
- // characters.
- // * The server SHOULD validate field names and upon receiving an invalid
- // field name, it SHOULD signal a connection exception with reply code
- // 503 (syntax error). Conformance test: amq_wlp_table_01.
- // * A peer MUST handle duplicate fields by using only the first instance.
-
- // AMQP length limit
- if (propertyName.length() > 128)
- {
- throw new IllegalArgumentException("AMQP limits property names to 128 characters");
- }
-
- // AMQ start character
- if (!(Character.isLetter(propertyName.charAt(0)) || (propertyName.charAt(0) == '$')
- || (propertyName.charAt(0) == '#') || (propertyName.charAt(0) == '_'))) // Not official AMQP added for JMS.
- {
- throw new IllegalArgumentException("Identifier '" + propertyName
- + "' does not start with a valid AMQP start character");
- }
- }
-
- // ************************* Byte Buffer Processing
-
- public void writeToBuffer(DataOutput buffer) throws IOException
- {
- final boolean trace = _logger.isDebugEnabled();
-
- if (trace)
- {
- _logger.debug("FieldTable::writeToBuffer: Writing encoded length of " + getEncodedSize() + "...");
- if (_properties != null)
- {
- _logger.debug(_properties.toString());
- }
- }
-
- EncodingUtils.writeUnsignedInteger(buffer, getEncodedSize());
-
- putDataInBuffer(buffer);
- }
-
- public byte[] getDataAsBytes()
- {
- if(_encodedForm == null)
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try
- {
- putDataInBuffer(new DataOutputStream(baos));
- return baos.toByteArray();
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException("IO Exception should never be thrown here");
- }
-
- }
- else if(_encodedFormOffset == 0 && _encodedSize == _encodedForm.length)
- {
- return _encodedForm.clone();
- }
- else
- {
- byte[] encodedCopy = new byte[(int) _encodedSize];
- System.arraycopy(_encodedForm,_encodedFormOffset,encodedCopy,0,(int)_encodedSize);
- return encodedCopy;
- }
-
- }
-
- public long getEncodedSize()
- {
- return _encodedSize;
- }
-
- private void recalculateEncodedSize()
- {
-
- int encodedSize = 0;
- if (_properties != null)
- {
- for (Map.Entry<AMQShortString, AMQTypedValue> e : _properties.entrySet())
- {
- encodedSize += EncodingUtils.encodedShortStringLength(e.getKey());
- encodedSize++; // the byte for the encoding Type
- encodedSize += e.getValue().getEncodingSize();
-
- }
- }
-
- _encodedSize = encodedSize;
- }
-
- public void addAll(FieldTable fieldTable)
- {
- initMapIfNecessary();
- fieldTable.initMapIfNecessary();
- if (fieldTable._properties != null)
- {
- _encodedForm = null;
- _properties.putAll(fieldTable._properties);
- recalculateEncodedSize();
- }
- }
-
- public static Map<String, Object> convertToMap(final FieldTable fieldTable)
- {
- final Map<String, Object> map = new HashMap<String, Object>();
-
- if(fieldTable != null)
- {
- fieldTable.processOverElements(
- new FieldTableElementProcessor()
- {
-
- public boolean processElement(String propertyName, AMQTypedValue value)
- {
- Object val = value.getValue();
- if(val instanceof AMQShortString)
- {
- val = val.toString();
- }
- map.put(propertyName, val);
- return true;
- }
-
- public Object getResult()
- {
- return map;
- }
- });
- }
- return map;
- }
-
-
- public static interface FieldTableElementProcessor
- {
- public boolean processElement(String propertyName, AMQTypedValue value);
-
- public Object getResult();
- }
-
- public Object processOverElements(FieldTableElementProcessor processor)
- {
- initMapIfNecessary();
- if (_properties != null)
- {
- for (Map.Entry<AMQShortString, AMQTypedValue> e : _properties.entrySet())
- {
- boolean result = processor.processElement(e.getKey().toString(), e.getValue());
- if (!result)
- {
- break;
- }
- }
- }
-
- return processor.getResult();
-
- }
-
- public int size()
- {
- initMapIfNecessary();
-
- return _properties.size();
-
- }
-
- public boolean isEmpty()
- {
- return size() == 0;
- }
-
- public boolean containsKey(AMQShortString key)
- {
- initMapIfNecessary();
-
- return _properties.containsKey(key);
- }
-
- public boolean containsKey(String key)
- {
- return containsKey(AMQShortString.valueOf(key));
- }
-
- public Set<String> keys()
- {
- initMapIfNecessary();
- Set<String> keys = new LinkedHashSet<String>();
- for (AMQShortString key : _properties.keySet())
- {
- keys.add(key.toString());
- }
-
- return keys;
- }
-
- public Iterator<Map.Entry<AMQShortString, AMQTypedValue>> iterator()
- {
- initMapIfNecessary();
- return _properties.entrySet().iterator();
- }
-
- public Object get(String key)
- {
- return get(AMQShortString.valueOf(key));
- }
-
- public Object get(AMQShortString key)
- {
- return getObject(key);
- }
-
- public Object put(AMQShortString key, Object value)
- {
- return setObject(key, value);
- }
-
- public Object remove(String key)
- {
-
- return remove(AMQShortString.valueOf(key));
-
- }
-
- public Object remove(AMQShortString key)
- {
- AMQTypedValue val = removeKey(key);
-
- return (val == null) ? null : val.getValue();
-
- }
-
- public AMQTypedValue removeKey(AMQShortString key)
- {
- initMapIfNecessary();
- _encodedForm = null;
- AMQTypedValue value = _properties.remove(key);
- if (value == null)
- {
- return null;
- }
- else
- {
- _encodedSize -= EncodingUtils.encodedShortStringLength(key);
- _encodedSize--;
- _encodedSize -= value.getEncodingSize();
-
- return value;
- }
-
- }
-
- public void clear()
- {
- initMapIfNecessary();
- _encodedForm = null;
- _properties.clear();
- _encodedSize = 0;
- }
-
- public Set<AMQShortString> keySet()
- {
- initMapIfNecessary();
-
- return _properties.keySet();
- }
-
- private void putDataInBuffer(DataOutput buffer) throws IOException
- {
-
- if (_encodedForm != null)
- {
- buffer.write(_encodedForm,_encodedFormOffset,(int)_encodedSize);
- }
- else if (_properties != null)
- {
- final Iterator<Map.Entry<AMQShortString, AMQTypedValue>> it = _properties.entrySet().iterator();
-
- // If there are values then write out the encoded Size... could check _encodedSize != 0
- // write out the total length, which we have kept up to date as data is added
-
- while (it.hasNext())
- {
- final Map.Entry<AMQShortString, AMQTypedValue> me = it.next();
- try
- {
- // Write the actual parameter name
- EncodingUtils.writeShortStringBytes(buffer, me.getKey());
- me.getValue().writeToBuffer(buffer);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- }
- }
-
- private void setFromBuffer() throws AMQFrameDecodingException, IOException
- {
-
- ByteArrayDataInput baid = new ByteArrayDataInput(_encodedForm, _encodedFormOffset, (int)_encodedSize);
-
- if (_encodedSize > 0)
- {
-
-
- _properties = new LinkedHashMap<AMQShortString, AMQTypedValue>(INITIAL_HASHMAP_CAPACITY);
-
- do
- {
-
- final AMQShortString key = baid.readAMQShortString();
- AMQTypedValue value = AMQTypedValue.readFromBuffer(baid);
- _properties.put(key, value);
-
- }
- while (baid.available() > 0);
-
- }
-
- }
-
- public int hashCode()
- {
- initMapIfNecessary();
-
- return _properties.hashCode();
- }
-
- public boolean equals(Object o)
- {
- if (o == this)
- {
- return true;
- }
-
- if (o == null)
- {
- return false;
- }
-
- if (!(o instanceof FieldTable))
- {
- return false;
- }
-
- initMapIfNecessary();
-
- FieldTable f = (FieldTable) o;
- f.initMapIfNecessary();
-
- return _properties.equals(f._properties);
- }
-
- public static FieldTable convertToFieldTable(Map<String, Object> map)
- {
- if (map != null)
- {
- FieldTable table = new FieldTable();
- for(Map.Entry<String,Object> entry : map.entrySet())
- {
- table.put(AMQShortString.valueOf(entry.getKey()), entry.getValue());
- }
-
- return table;
- }
- else
- {
- return null;
- }
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTableFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTableFactory.java
deleted file mode 100644
index a2d4d27396..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTableFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInput;
-import java.io.IOException;
-
-public class FieldTableFactory
-{
- private FieldTableFactory()
- {
- }
-
- public static FieldTable newFieldTable()
- {
- return new FieldTable();
- }
-
- public static FieldTable newFieldTable(DataInput byteBuffer, long length) throws AMQFrameDecodingException, IOException
- {
- return new FieldTable(byteBuffer, length);
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/FrameCreatingMethodProcessor.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/FrameCreatingMethodProcessor.java
deleted file mode 100644
index 0d160a73d5..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/FrameCreatingMethodProcessor.java
+++ /dev/null
@@ -1,629 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class FrameCreatingMethodProcessor implements MethodProcessor<FrameCreatingMethodProcessor.ClientAndServerChannelMethodProcessor>,
- ClientMethodProcessor<FrameCreatingMethodProcessor.ClientAndServerChannelMethodProcessor>,
- ServerMethodProcessor<FrameCreatingMethodProcessor.ClientAndServerChannelMethodProcessor>
-{
- private ProtocolVersion _protocolVersion;
-
- private final List<AMQDataBlock> _processedMethods = new ArrayList<>();
- private int _classId;
- private int _methodId;
-
- public FrameCreatingMethodProcessor(final ProtocolVersion protocolVersion)
- {
- _protocolVersion = protocolVersion;
- }
-
- public List<AMQDataBlock> getProcessedMethods()
- {
- return _processedMethods;
- }
-
- @Override
- public void receiveConnectionStart(final short versionMajor,
- final short versionMinor,
- final FieldTable serverProperties,
- final byte[] mechanisms,
- final byte[] locales)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionStartBody(versionMajor, versionMinor, serverProperties, mechanisms, locales)));
- }
-
- @Override
- public void receiveConnectionStartOk(final FieldTable clientProperties,
- final AMQShortString mechanism,
- final byte[] response,
- final AMQShortString locale)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionStartOkBody(clientProperties, mechanism, response, locale)));
- }
-
- @Override
- public void receiveConnectionSecure(final byte[] challenge)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionSecureBody(challenge)));
- }
-
- @Override
- public void receiveConnectionSecureOk(final byte[] response)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionSecureOkBody(response)));
- }
-
- @Override
- public void receiveConnectionTune(final int channelMax, final long frameMax, final int heartbeat)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionTuneBody(channelMax, frameMax, heartbeat)));
- }
-
- @Override
- public void receiveConnectionTuneOk(final int channelMax, final long frameMax, final int heartbeat)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionTuneOkBody(channelMax, frameMax, heartbeat)));
- }
-
- @Override
- public void receiveConnectionOpen(final AMQShortString virtualHost,
- final AMQShortString capabilities,
- final boolean insist)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionOpenBody(virtualHost, capabilities, insist)));
- }
-
- @Override
- public void receiveConnectionOpenOk(final AMQShortString knownHosts)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionOpenOkBody(knownHosts)));
- }
-
- @Override
- public void receiveConnectionRedirect(final AMQShortString host, final AMQShortString knownHosts)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionRedirectBody(getProtocolVersion(), host, knownHosts)));
- }
-
- @Override
- public void receiveConnectionClose(final int replyCode,
- final AMQShortString replyText,
- final int classId,
- final int methodId)
- {
- _processedMethods.add(new AMQFrame(0, new ConnectionCloseBody(getProtocolVersion(), replyCode, replyText, classId, methodId)));
- }
-
- @Override
- public void receiveConnectionCloseOk()
- {
- _processedMethods.add(new AMQFrame(0, ProtocolVersion.v8_0.equals(getProtocolVersion())
- ? ConnectionCloseOkBody.CONNECTION_CLOSE_OK_0_8
- : ConnectionCloseOkBody.CONNECTION_CLOSE_OK_0_9));
- }
-
- @Override
- public void receiveChannelOpen(final int channelId)
- {
- _processedMethods.add(new AMQFrame(channelId, new ChannelOpenBody()));
- }
-
- private void receiveExchangeBoundOk(final int channelId, final int replyCode, final AMQShortString replyText)
- {
- _processedMethods.add(new AMQFrame(channelId, new ExchangeBoundOkBody(replyCode, replyText)));
- }
-
- @Override
- public void receiveHeartbeat()
- {
- _processedMethods.add(new AMQFrame(0, new HeartbeatBody()));
- }
-
- @Override
- public ProtocolVersion getProtocolVersion()
- {
- return _protocolVersion;
- }
-
- @Override
- public ClientAndServerChannelMethodProcessor getChannelMethodProcessor(final int channelId)
- {
- return new FrameCreatingChannelMethodProcessor(channelId);
- }
-
- public void setProtocolVersion(final ProtocolVersion protocolVersion)
- {
- _protocolVersion = protocolVersion;
- }
-
- @Override
- public void receiveProtocolHeader(final ProtocolInitiation protocolInitiation)
- {
- _processedMethods.add(protocolInitiation);
- }
-
- @Override
- public void setCurrentMethod(final int classId, final int methodId)
- {
- _classId = classId;
- _methodId = methodId;
- }
-
- @Override
- public boolean ignoreAllButCloseOk()
- {
- return false;
- }
-
- public int getClassId()
- {
- return _classId;
- }
-
- public int getMethodId()
- {
- return _methodId;
- }
-
- public static interface ClientAndServerChannelMethodProcessor extends ServerChannelMethodProcessor, ClientChannelMethodProcessor
- {
-
- }
-
- private class FrameCreatingChannelMethodProcessor implements ClientAndServerChannelMethodProcessor
- {
- private final int _channelId;
-
- private FrameCreatingChannelMethodProcessor(final int channelId)
- {
- _channelId = channelId;
- }
-
-
- @Override
- public void receiveChannelOpenOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, ProtocolVersion.v8_0.equals(getProtocolVersion())
- ? ChannelOpenOkBody.INSTANCE_0_8
- : ChannelOpenOkBody.INSTANCE_0_9));
- }
-
- @Override
- public void receiveChannelAlert(final int replyCode, final AMQShortString replyText, final FieldTable details)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ChannelAlertBody(replyCode, replyText, details)));
- }
-
- @Override
- public void receiveAccessRequestOk(final int ticket)
- {
- _processedMethods.add(new AMQFrame(_channelId, new AccessRequestOkBody(ticket)));
- }
-
- @Override
- public void receiveExchangeDeclareOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, new ExchangeDeclareOkBody()));
- }
-
- @Override
- public void receiveExchangeDeleteOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, new ExchangeDeleteOkBody()));
- }
-
- @Override
- public void receiveExchangeBoundOk(final int replyCode, final AMQShortString replyText)
- {
- FrameCreatingMethodProcessor.this.receiveExchangeBoundOk(_channelId, replyCode, replyText);
- }
-
- @Override
- public void receiveQueueBindOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueueBindOkBody()));
- }
-
- @Override
- public void receiveQueueUnbindOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueueUnbindOkBody()));
- }
-
- @Override
- public void receiveQueueDeclareOk(final AMQShortString queue, final long messageCount, final long consumerCount)
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueueDeclareOkBody(queue, messageCount, consumerCount)));
- }
-
- @Override
- public void receiveQueuePurgeOk(final long messageCount)
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueuePurgeOkBody(messageCount)));
- }
-
- @Override
- public void receiveQueueDeleteOk(final long messageCount)
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueueDeleteOkBody(messageCount)));
- }
-
- @Override
- public void receiveBasicRecoverSyncOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicRecoverSyncOkBody(getProtocolVersion())));
- }
-
- @Override
- public void receiveBasicQosOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicQosOkBody()));
- }
-
- @Override
- public void receiveBasicConsumeOk(final AMQShortString consumerTag)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicConsumeOkBody(consumerTag)));
- }
-
- @Override
- public void receiveBasicCancelOk(final AMQShortString consumerTag)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicCancelOkBody(consumerTag)));
- }
-
- @Override
- public void receiveBasicReturn(final int replyCode,
- final AMQShortString replyText,
- final AMQShortString exchange,
- final AMQShortString routingKey)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicReturnBody(replyCode,
- replyText,
- exchange,
- routingKey)));
- }
-
- @Override
- public void receiveBasicDeliver(final AMQShortString consumerTag,
- final long deliveryTag,
- final boolean redelivered,
- final AMQShortString exchange,
- final AMQShortString routingKey)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicDeliverBody(consumerTag,
- deliveryTag,
- redelivered,
- exchange,
- routingKey)));
- }
-
- @Override
- public void receiveBasicGetOk(final long deliveryTag,
- final boolean redelivered,
- final AMQShortString exchange,
- final AMQShortString routingKey,
- final long messageCount)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicGetOkBody(deliveryTag,
- redelivered,
- exchange,
- routingKey,
- messageCount)));
- }
-
- @Override
- public void receiveBasicGetEmpty()
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicGetEmptyBody((AMQShortString)null)));
- }
-
- @Override
- public void receiveTxSelectOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, TxSelectOkBody.INSTANCE));
- }
-
- @Override
- public void receiveTxCommitOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, TxCommitOkBody.INSTANCE));
- }
-
- @Override
- public void receiveTxRollbackOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, TxRollbackOkBody.INSTANCE));
- }
-
- @Override
- public void receiveConfirmSelectOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, ConfirmSelectOkBody.INSTANCE));
- }
-
- @Override
- public void receiveAccessRequest(final AMQShortString realm,
- final boolean exclusive,
- final boolean passive,
- final boolean active,
- final boolean write,
- final boolean read)
- {
- _processedMethods.add(new AMQFrame(_channelId, new AccessRequestBody(realm,
- exclusive,
- passive,
- active,
- write,
- read)));
- }
-
- @Override
- public void receiveExchangeDeclare(final AMQShortString exchange,
- final AMQShortString type,
- final boolean passive,
- final boolean durable,
- final boolean autoDelete,
- final boolean internal,
- final boolean nowait,
- final FieldTable arguments)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ExchangeDeclareBody(0,
- exchange,
- type,
- passive,
- durable,
- autoDelete,
- internal,
- nowait,
- arguments)));
- }
-
- @Override
- public void receiveExchangeDelete(final AMQShortString exchange, final boolean ifUnused, final boolean nowait)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ExchangeDeleteBody(0, exchange, ifUnused, nowait)));
- }
-
- @Override
- public void receiveExchangeBound(final AMQShortString exchange,
- final AMQShortString routingKey,
- final AMQShortString queue)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ExchangeBoundBody(exchange, routingKey, queue)));
- }
-
- @Override
- public void receiveQueueDeclare(final AMQShortString queue,
- final boolean passive,
- final boolean durable,
- final boolean exclusive,
- final boolean autoDelete,
- final boolean nowait,
- final FieldTable arguments)
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueueDeclareBody(0,
- queue,
- passive,
- durable,
- exclusive,
- autoDelete,
- nowait,
- arguments)));
- }
-
- @Override
- public void receiveQueueBind(final AMQShortString queue,
- final AMQShortString exchange,
- final AMQShortString bindingKey,
- final boolean nowait,
- final FieldTable arguments)
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueueBindBody(0,
- queue,
- exchange,
- bindingKey,
- nowait,
- arguments)));
- }
-
- @Override
- public void receiveQueuePurge(final AMQShortString queue, final boolean nowait)
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueuePurgeBody(0, queue, nowait)));
- }
-
- @Override
- public void receiveQueueDelete(final AMQShortString queue,
- final boolean ifUnused,
- final boolean ifEmpty,
- final boolean nowait)
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueueDeleteBody(0, queue, ifUnused, ifEmpty, nowait)));
- }
-
- @Override
- public void receiveQueueUnbind(final AMQShortString queue,
- final AMQShortString exchange,
- final AMQShortString bindingKey,
- final FieldTable arguments)
- {
- _processedMethods.add(new AMQFrame(_channelId, new QueueUnbindBody(0,
- queue,
- exchange,
- bindingKey,
- arguments)));
- }
-
- @Override
- public void receiveBasicRecover(final boolean requeue, final boolean sync)
- {
- if(ProtocolVersion.v8_0.equals(getProtocolVersion()) || !sync)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicRecoverBody(requeue)));
- }
- else
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicRecoverSyncBody(getProtocolVersion(), requeue)));
- }
- }
-
- @Override
- public void receiveBasicQos(final long prefetchSize, final int prefetchCount, final boolean global)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicQosBody(prefetchSize, prefetchCount, global)));
- }
-
- @Override
- public void receiveBasicConsume(final AMQShortString queue,
- final AMQShortString consumerTag,
- final boolean noLocal,
- final boolean noAck,
- final boolean exclusive,
- final boolean nowait,
- final FieldTable arguments)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicConsumeBody(0,
- queue,
- consumerTag,
- noLocal,
- noAck,
- exclusive,
- nowait,
- arguments)));
- }
-
- @Override
- public void receiveBasicCancel(final AMQShortString consumerTag, final boolean noWait)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicCancelBody(consumerTag, noWait)));
- }
-
- @Override
- public void receiveBasicPublish(final AMQShortString exchange,
- final AMQShortString routingKey,
- final boolean mandatory,
- final boolean immediate)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicPublishBody(0,
- exchange,
- routingKey,
- mandatory,
- immediate)));
- }
-
- @Override
- public void receiveBasicGet(final AMQShortString queue, final boolean noAck)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicGetBody(0, queue, noAck)));
- }
-
- @Override
- public void receiveBasicAck(final long deliveryTag, final boolean multiple)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicAckBody(deliveryTag, multiple)));
- }
-
- @Override
- public void receiveBasicReject(final long deliveryTag, final boolean requeue)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicRejectBody(deliveryTag, requeue)));
- }
-
- @Override
- public void receiveTxSelect()
- {
- _processedMethods.add(new AMQFrame(_channelId, TxSelectBody.INSTANCE));
- }
-
- @Override
- public void receiveTxCommit()
- {
- _processedMethods.add(new AMQFrame(_channelId, TxCommitBody.INSTANCE));
- }
-
- @Override
- public void receiveTxRollback()
- {
- _processedMethods.add(new AMQFrame(_channelId, TxRollbackBody.INSTANCE));
- }
-
- @Override
- public void receiveConfirmSelect(final boolean nowait)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ConfirmSelectBody(nowait)));
- }
-
- @Override
- public void receiveChannelFlow(final boolean active)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ChannelFlowBody(active)));
- }
-
- @Override
- public void receiveChannelFlowOk(final boolean active)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ChannelFlowOkBody(active)));
- }
-
- @Override
- public void receiveChannelClose(final int replyCode,
- final AMQShortString replyText,
- final int classId,
- final int methodId)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ChannelCloseBody(replyCode, replyText, classId, methodId)));
- }
-
- @Override
- public void receiveChannelCloseOk()
- {
- _processedMethods.add(new AMQFrame(_channelId, ChannelCloseOkBody.INSTANCE));
- }
-
- @Override
- public void receiveMessageContent(final byte[] data)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ContentBody(data)));
- }
-
- @Override
- public void receiveMessageHeader(final BasicContentHeaderProperties properties, final long bodySize)
- {
- _processedMethods.add(new AMQFrame(_channelId, new ContentHeaderBody(properties, bodySize)));
- }
-
- @Override
- public boolean ignoreAllButCloseOk()
- {
- return false;
- }
-
- @Override
- public void receiveBasicNack(final long deliveryTag, final boolean multiple, final boolean requeue)
- {
- _processedMethods.add(new AMQFrame(_channelId, new BasicNackBody(deliveryTag, multiple, requeue)));
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/HeartbeatBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/HeartbeatBody.java
deleted file mode 100644
index 3afc082c89..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/HeartbeatBody.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
-import org.apache.qpid.transport.ByteBufferSender;
-
-public class HeartbeatBody implements AMQBody
-{
- public static final byte TYPE = 8;
- public static final AMQFrame FRAME = new HeartbeatBody().toFrame();
-
- public HeartbeatBody()
- {
-
- }
-
- public HeartbeatBody(DataInputStream buffer, long size) throws IOException
- {
- if(size > 0)
- {
- //allow other implementations to have a payload, but ignore it:
- buffer.skip(size);
- }
- }
-
- public byte getFrameType()
- {
- return TYPE;
- }
-
- public int getSize()
- {
- return 0;//heartbeats we generate have no payload
- }
-
- public void writePayload(DataOutput buffer)
- {
- }
-
- @Override
- public long writePayload(final ByteBufferSender sender) throws IOException
- {
- return 0l;
- }
-
- public void handle(final int channelId, final AMQVersionAwareProtocolSession session)
- throws AMQException
- {
- session.heartbeatBodyReceived(channelId, this);
- }
-
- protected void populateFromBuffer(DataInputStream buffer, long size) throws AMQFrameDecodingException, IOException
- {
- if(size > 0)
- {
- //allow other implementations to have a payload, but ignore it:
- buffer.skip(size);
- }
- }
-
- public AMQFrame toFrame()
- {
- return new AMQFrame(0, this);
- }
-
- public static void process(final int channel,
- final MarkableDataInput in,
- final MethodProcessor processor,
- final long bodySize) throws IOException
- {
-
- if(bodySize > 0)
- {
- in.skip(bodySize);
- }
- processor.receiveHeartbeat();
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/MessagePublishInfo.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/MessagePublishInfo.java
deleted file mode 100644
index cc8f7eab58..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/MessagePublishInfo.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-public final class MessagePublishInfo
-{
- private AMQShortString _exchange;
- private boolean _immediate;
- private boolean _mandatory;
- private AMQShortString _routingKey;
-
- public MessagePublishInfo()
- {
- }
-
- public MessagePublishInfo(AMQShortString exchange, boolean immediate, boolean mandatory,
- AMQShortString routingKey)
- {
- _exchange = exchange;
- _immediate = immediate;
- _mandatory = mandatory;
- _routingKey = routingKey;
- }
-
- public AMQShortString getExchange()
- {
- return _exchange;
- }
-
- public void setExchange(AMQShortString exchange)
- {
- _exchange = exchange;
- }
-
- public boolean isImmediate()
- {
- return _immediate;
- }
-
- public void setImmediate(boolean immedate)
- {
- _immediate = immedate;
- }
-
- public boolean isMandatory()
- {
- return _mandatory;
- }
-
- public void setMandatory(boolean mandatory)
- {
- _mandatory = mandatory;
- }
-
- public AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
-
- public void setRoutingKey(AMQShortString routingKey)
- {
- _routingKey = routingKey;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodDispatcher.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodDispatcher.java
deleted file mode 100644
index a485397a5e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodDispatcher.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-9
- * 0-91
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-public interface MethodDispatcher extends
- ClientMethodDispatcher, ServerMethodDispatcher
-{
-
- boolean dispatchBasicNack(BasicNackBody basicNackBody, int channelId);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodProcessor.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodProcessor.java
deleted file mode 100644
index 62c0cd3c6d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodProcessor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-public interface MethodProcessor<T extends ChannelMethodProcessor>
-{
- ProtocolVersion getProtocolVersion();
-
- T getChannelMethodProcessor(int channelId);
-
- void receiveConnectionClose(int replyCode, AMQShortString replyText, int classId, int methodId);
-
- void receiveConnectionCloseOk();
-
- void receiveHeartbeat();
-
- void receiveProtocolHeader(ProtocolInitiation protocolInitiation);
-
- void setCurrentMethod(int classId, int methodId);
-
- boolean ignoreAllButCloseOk();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodRegistry.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodRegistry.java
deleted file mode 100644
index d6ff437c3f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodRegistry.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-9
- * 0-91
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-public final class MethodRegistry
-{
- private ProtocolVersion _protocolVersion;
-
-
- public MethodRegistry(ProtocolVersion pv)
- {
- _protocolVersion = pv;
- }
-
- public void setProtocolVersion(final ProtocolVersion protocolVersion)
- {
- _protocolVersion = protocolVersion;
- }
-
- public final AccessRequestBody createAccessRequestBody(final AMQShortString realm,
- final boolean exclusive,
- final boolean passive,
- final boolean active,
- final boolean write,
- final boolean read)
- {
- return new AccessRequestBody(realm,
- exclusive,
- passive,
- active,
- write,
- read);
- }
-
- public final AccessRequestOkBody createAccessRequestOkBody(final int ticket)
- {
- return new AccessRequestOkBody(ticket);
- }
-
-
- public final BasicQosBody createBasicQosBody(final long prefetchSize,
- final int prefetchCount,
- final boolean global)
- {
- return new BasicQosBody(prefetchSize,
- prefetchCount,
- global);
- }
-
- public final BasicQosOkBody createBasicQosOkBody()
- {
- return new BasicQosOkBody();
- }
-
- public final BasicConsumeBody createBasicConsumeBody(final int ticket,
- final AMQShortString queue,
- final AMQShortString consumerTag,
- final boolean noLocal,
- final boolean noAck,
- final boolean exclusive,
- final boolean nowait,
- final FieldTable arguments)
- {
- return new BasicConsumeBody(ticket,
- queue,
- consumerTag,
- noLocal,
- noAck,
- exclusive,
- nowait,
- arguments);
- }
-
- public final BasicConsumeOkBody createBasicConsumeOkBody(final AMQShortString consumerTag)
- {
- return new BasicConsumeOkBody(consumerTag);
- }
-
- public final BasicCancelBody createBasicCancelBody(final AMQShortString consumerTag,
- final boolean nowait)
- {
- return new BasicCancelBody(consumerTag,
- nowait);
- }
-
- public final BasicCancelOkBody createBasicCancelOkBody(final AMQShortString consumerTag)
- {
- return new BasicCancelOkBody(consumerTag);
- }
-
- public final BasicPublishBody createBasicPublishBody(final int ticket,
- final AMQShortString exchange,
- final AMQShortString routingKey,
- final boolean mandatory,
- final boolean immediate)
- {
- return new BasicPublishBody(ticket,
- exchange,
- routingKey,
- mandatory,
- immediate);
- }
-
- public final BasicReturnBody createBasicReturnBody(final int replyCode,
- final AMQShortString replyText,
- final AMQShortString exchange,
- final AMQShortString routingKey)
- {
- return new BasicReturnBody(replyCode,
- replyText,
- exchange,
- routingKey);
- }
-
- public final BasicDeliverBody createBasicDeliverBody(final AMQShortString consumerTag,
- final long deliveryTag,
- final boolean redelivered,
- final AMQShortString exchange,
- final AMQShortString routingKey)
- {
- return new BasicDeliverBody(consumerTag,
- deliveryTag,
- redelivered,
- exchange,
- routingKey);
- }
-
- public final BasicGetBody createBasicGetBody(final int ticket,
- final AMQShortString queue,
- final boolean noAck)
- {
- return new BasicGetBody(ticket,
- queue,
- noAck);
- }
-
- public final BasicGetOkBody createBasicGetOkBody(final long deliveryTag,
- final boolean redelivered,
- final AMQShortString exchange,
- final AMQShortString routingKey,
- final long messageCount)
- {
- return new BasicGetOkBody(deliveryTag,
- redelivered,
- exchange,
- routingKey,
- messageCount);
- }
-
- public final BasicGetEmptyBody createBasicGetEmptyBody(final AMQShortString clusterId)
- {
- return new BasicGetEmptyBody(clusterId);
- }
-
- public final BasicAckBody createBasicAckBody(final long deliveryTag,
- final boolean multiple)
- {
- return new BasicAckBody(deliveryTag,
- multiple);
- }
-
- public final BasicRejectBody createBasicRejectBody(final long deliveryTag,
- final boolean requeue)
- {
- return new BasicRejectBody(deliveryTag,
- requeue);
- }
-
- public final BasicRecoverBody createBasicRecoverBody(final boolean requeue)
- {
- return new BasicRecoverBody(requeue);
- }
-
-
- public final BasicRecoverSyncOkBody createBasicRecoverSyncOkBody()
- {
- return new BasicRecoverSyncOkBody(_protocolVersion);
- }
-
-
- public final BasicRecoverSyncBody createBasicRecoverSyncBody(final boolean requeue)
- {
- return new BasicRecoverSyncBody(_protocolVersion, requeue);
- }
-
- public final ChannelAlertBody createChannelAlertBody(final int replyCode,
- final AMQShortString replyText,
- final FieldTable details)
- {
- return new ChannelAlertBody(replyCode,
- replyText,
- details);
- }
-
- public final ChannelOpenBody createChannelOpenBody(final AMQShortString outOfBand)
- {
- return new ChannelOpenBody();
- }
-
- public final ChannelOpenOkBody createChannelOpenOkBody(byte[] channelId)
- {
- return createChannelOpenOkBody();
- }
-
- public final ChannelOpenOkBody createChannelOpenOkBody()
- {
- return _protocolVersion.equals(ProtocolVersion.v8_0)
- ? ChannelOpenOkBody.INSTANCE_0_8
- : ChannelOpenOkBody.INSTANCE_0_9;
- }
-
- public final ChannelFlowBody createChannelFlowBody(final boolean active)
- {
- return new ChannelFlowBody(active);
- }
-
- public final ChannelFlowOkBody createChannelFlowOkBody(final boolean active)
- {
- return new ChannelFlowOkBody(active);
- }
-
- public final ChannelCloseBody createChannelCloseBody(final int replyCode, final AMQShortString replyText,
- final int classId,
- final int methodId
- )
- {
- return new ChannelCloseBody(replyCode,
- replyText,
- classId,
- methodId);
- }
-
- public final ChannelCloseOkBody createChannelCloseOkBody()
- {
- return ChannelCloseOkBody.INSTANCE;
- }
-
-
-
-
- public final ConnectionStartBody createConnectionStartBody(final short versionMajor,
- final short versionMinor,
- final FieldTable serverProperties,
- final byte[] mechanisms,
- final byte[] locales)
- {
- return new ConnectionStartBody(versionMajor,
- versionMinor,
- serverProperties,
- mechanisms,
- locales);
- }
-
- public final ConnectionStartOkBody createConnectionStartOkBody(final FieldTable clientProperties,
- final AMQShortString mechanism,
- final byte[] response,
- final AMQShortString locale)
- {
- return new ConnectionStartOkBody(clientProperties,
- mechanism,
- response,
- locale);
- }
-
- public final ConnectionSecureBody createConnectionSecureBody(final byte[] challenge)
- {
- return new ConnectionSecureBody(challenge);
- }
-
- public final ConnectionSecureOkBody createConnectionSecureOkBody(final byte[] response)
- {
- return new ConnectionSecureOkBody(response);
- }
-
- public final ConnectionTuneBody createConnectionTuneBody(final int channelMax,
- final long frameMax,
- final int heartbeat)
- {
- return new ConnectionTuneBody(channelMax,
- frameMax,
- heartbeat);
- }
-
- public final ConnectionTuneOkBody createConnectionTuneOkBody(final int channelMax,
- final long frameMax,
- final int heartbeat)
- {
- return new ConnectionTuneOkBody(channelMax,
- frameMax,
- heartbeat);
- }
-
- public final ConnectionOpenBody createConnectionOpenBody(final AMQShortString virtualHost,
- final AMQShortString capabilities,
- final boolean insist)
- {
- return new ConnectionOpenBody(virtualHost,
- capabilities,
- insist);
- }
-
- public final ConnectionOpenOkBody createConnectionOpenOkBody(final AMQShortString knownHosts)
- {
- return new ConnectionOpenOkBody(knownHosts);
- }
-
- public final ConnectionRedirectBody createConnectionRedirectBody(final AMQShortString host,
- final AMQShortString knownHosts)
- {
- return new ConnectionRedirectBody(_protocolVersion,
- host,
- knownHosts);
- }
-
- public final ConnectionCloseBody createConnectionCloseBody(final int replyCode,
- final AMQShortString replyText,
- final int classId,
- final int methodId)
- {
- return new ConnectionCloseBody(_protocolVersion,
- replyCode,
- replyText,
- classId,
- methodId);
- }
-
- public final ConnectionCloseOkBody createConnectionCloseOkBody()
- {
- return ProtocolVersion.v8_0.equals(_protocolVersion)
- ? ConnectionCloseOkBody.CONNECTION_CLOSE_OK_0_8
- : ConnectionCloseOkBody.CONNECTION_CLOSE_OK_0_9;
- }
-
-
- public final ExchangeDeclareBody createExchangeDeclareBody(final int ticket,
- final AMQShortString exchange,
- final AMQShortString type,
- final boolean passive,
- final boolean durable,
- final boolean autoDelete,
- final boolean internal,
- final boolean nowait,
- final FieldTable arguments)
- {
- return new ExchangeDeclareBody(ticket,
- exchange,
- type,
- passive,
- durable,
- autoDelete,
- internal,
- nowait,
- arguments);
- }
-
- public final ExchangeDeclareOkBody createExchangeDeclareOkBody()
- {
- return new ExchangeDeclareOkBody();
- }
-
- public final ExchangeDeleteBody createExchangeDeleteBody(final int ticket,
- final AMQShortString exchange,
- final boolean ifUnused,
- final boolean nowait)
- {
- return new ExchangeDeleteBody(ticket,
- exchange,
- ifUnused,
- nowait
- );
- }
-
- public final ExchangeDeleteOkBody createExchangeDeleteOkBody()
- {
- return new ExchangeDeleteOkBody();
- }
-
- public final ExchangeBoundBody createExchangeBoundBody(final AMQShortString exchange,
- final AMQShortString routingKey,
- final AMQShortString queue)
- {
- return new ExchangeBoundBody(exchange,
- routingKey,
- queue);
- }
-
- public final ExchangeBoundOkBody createExchangeBoundOkBody(final int replyCode,
- final AMQShortString replyText)
- {
- return new ExchangeBoundOkBody(replyCode,
- replyText);
- }
-
-
- public final QueueDeclareBody createQueueDeclareBody(final int ticket,
- final AMQShortString queue,
- final boolean passive,
- final boolean durable,
- final boolean exclusive,
- final boolean autoDelete,
- final boolean nowait,
- final FieldTable arguments)
- {
- return new QueueDeclareBody(ticket,
- queue,
- passive,
- durable,
- exclusive,
- autoDelete,
- nowait,
- arguments);
- }
-
- public final QueueDeclareOkBody createQueueDeclareOkBody(final AMQShortString queue,
- final long messageCount,
- final long consumerCount)
- {
- return new QueueDeclareOkBody(queue,
- messageCount,
- consumerCount);
- }
-
- public final QueueBindBody createQueueBindBody(final int ticket,
- final AMQShortString queue,
- final AMQShortString exchange,
- final AMQShortString routingKey,
- final boolean nowait,
- final FieldTable arguments)
- {
- return new QueueBindBody(ticket,
- queue,
- exchange,
- routingKey,
- nowait,
- arguments);
- }
-
- public final QueueBindOkBody createQueueBindOkBody()
- {
- return new QueueBindOkBody();
- }
-
- public final QueuePurgeBody createQueuePurgeBody(final int ticket,
- final AMQShortString queue,
- final boolean nowait)
- {
- return new QueuePurgeBody(ticket,
- queue,
- nowait);
- }
-
- public final QueuePurgeOkBody createQueuePurgeOkBody(final long messageCount)
- {
- return new QueuePurgeOkBody(messageCount);
- }
-
- public final QueueDeleteBody createQueueDeleteBody(final int ticket,
- final AMQShortString queue,
- final boolean ifUnused,
- final boolean ifEmpty,
- final boolean nowait)
- {
- return new QueueDeleteBody(ticket,
- queue,
- ifUnused,
- ifEmpty,
- nowait);
- }
-
- public final QueueDeleteOkBody createQueueDeleteOkBody(final long messageCount)
- {
- return new QueueDeleteOkBody(messageCount);
- }
-
- public final QueueUnbindBody createQueueUnbindBody(final int ticket,
- final AMQShortString queue,
- final AMQShortString exchange,
- final AMQShortString routingKey,
- final FieldTable arguments)
- {
- return new QueueUnbindBody(ticket,
- queue,
- exchange,
- routingKey,
- arguments);
- }
-
- public final QueueUnbindOkBody createQueueUnbindOkBody()
- {
- return new QueueUnbindOkBody();
- }
-
-
- public final TxSelectBody createTxSelectBody()
- {
- return TxSelectBody.INSTANCE;
- }
-
- public final TxSelectOkBody createTxSelectOkBody()
- {
- return TxSelectOkBody.INSTANCE;
- }
-
- public final TxCommitBody createTxCommitBody()
- {
- return TxCommitBody.INSTANCE;
- }
-
- public final TxCommitOkBody createTxCommitOkBody()
- {
- return TxCommitOkBody.INSTANCE;
- }
-
- public final TxRollbackBody createTxRollbackBody()
- {
- return TxRollbackBody.INSTANCE;
- }
-
- public final TxRollbackOkBody createTxRollbackOkBody()
- {
- return TxRollbackOkBody.INSTANCE;
- }
-
- public ProtocolVersion getProtocolVersion()
- {
- return _protocolVersion;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolInitiation.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolInitiation.java
deleted file mode 100644
index 9c8d2a8578..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolInitiation.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.util.BytesDataOutput;
-
-public class ProtocolInitiation extends AMQDataBlock implements EncodableAMQDataBlock
-{
-
- // TODO: generate these constants automatically from the xml protocol spec file
- private static final byte[] AMQP_HEADER = new byte[]{(byte)'A',(byte)'M',(byte)'Q',(byte)'P'};
-
- private static final byte CURRENT_PROTOCOL_CLASS = 1;
- private static final byte TCP_PROTOCOL_INSTANCE = 1;
-
- private final byte[] _protocolHeader;
- private final byte _protocolClass;
- private final byte _protocolInstance;
- private final byte _protocolMajor;
- private final byte _protocolMinor;
-
- public ProtocolInitiation(byte[] protocolHeader, byte protocolClass, byte protocolInstance, byte protocolMajor, byte protocolMinor)
- {
- _protocolHeader = protocolHeader;
- _protocolClass = protocolClass;
- _protocolInstance = protocolInstance;
- _protocolMajor = protocolMajor;
- _protocolMinor = protocolMinor;
- }
-
- public ProtocolInitiation(ProtocolVersion pv)
- {
- this(AMQP_HEADER,
- pv.equals(ProtocolVersion.v0_91) ? 0 : CURRENT_PROTOCOL_CLASS,
- pv.equals(ProtocolVersion.v0_91) ? 0 : TCP_PROTOCOL_INSTANCE,
- pv.equals(ProtocolVersion.v0_91) ? 9 : pv.getMajorVersion(),
- pv.equals(ProtocolVersion.v0_91) ? 1 : pv.getMinorVersion());
- }
-
- public ProtocolInitiation(MarkableDataInput in) throws IOException
- {
- _protocolHeader = new byte[4];
- in.read(_protocolHeader);
-
- _protocolClass = in.readByte();
- _protocolInstance = in.readByte();
- _protocolMajor = in.readByte();
- _protocolMinor = in.readByte();
- }
-
- public long getSize()
- {
- return 4 + 1 + 1 + 1 + 1;
- }
-
- public void writePayload(DataOutput buffer) throws IOException
- {
-
- buffer.write(_protocolHeader);
- buffer.write(_protocolClass);
- buffer.write(_protocolInstance);
- buffer.write(_protocolMajor);
- buffer.write(_protocolMinor);
- }
-
- @Override
- public long writePayload(final ByteBufferSender sender) throws IOException
- {
- byte[] data = new byte[8];
- BytesDataOutput out = new BytesDataOutput(data);
- writePayload(out);
- sender.send(ByteBuffer.wrap(data));
- return 8l;
- }
-
- public boolean equals(Object o)
- {
- if (!(o instanceof ProtocolInitiation))
- {
- return false;
- }
-
- ProtocolInitiation pi = (ProtocolInitiation) o;
- if (pi._protocolHeader == null)
- {
- return false;
- }
-
- if (_protocolHeader.length != pi._protocolHeader.length)
- {
- return false;
- }
-
- for (int i = 0; i < _protocolHeader.length; i++)
- {
- if (_protocolHeader[i] != pi._protocolHeader[i])
- {
- return false;
- }
- }
-
- return (_protocolClass == pi._protocolClass &&
- _protocolInstance == pi._protocolInstance &&
- _protocolMajor == pi._protocolMajor &&
- _protocolMinor == pi._protocolMinor);
- }
-
- @Override
- public int hashCode()
- {
- int result = _protocolHeader != null ? Arrays.hashCode(_protocolHeader) : 0;
- result = 31 * result + (int) _protocolClass;
- result = 31 * result + (int) _protocolInstance;
- result = 31 * result + (int) _protocolMajor;
- result = 31 * result + (int) _protocolMinor;
- return result;
- }
-
- public static class Decoder //implements MessageDecoder
- {
- /**
- *
- * @param in input buffer
- * @return true if we have enough data to decode the PI frame fully, false if more
- * data is required
- * @throws IOException if there is an issue reading the input
- */
- public boolean decodable(MarkableDataInput in) throws IOException
- {
- return (in.available() >= 8);
- }
-
- }
-
- public ProtocolVersion checkVersion() throws AMQException
- {
-
- if(_protocolHeader.length != 4)
- {
- throw new AMQProtocolHeaderException("Protocol header should have exactly four octets", null);
- }
- for(int i = 0; i < 4; i++)
- {
- if(_protocolHeader[i] != AMQP_HEADER[i])
- {
- try
- {
- throw new AMQProtocolHeaderException("Protocol header is not correct: Got " + new String(_protocolHeader,"ISO-8859-1") + " should be: " + new String(AMQP_HEADER, "ISO-8859-1"), null);
- }
- catch (UnsupportedEncodingException e)
- {
-
- }
- }
- }
-
- ProtocolVersion pv;
-
- // Hack for 0-9-1 which changed how the header was defined
- if(_protocolInstance == 0 && _protocolMajor == 9 && _protocolMinor == 1)
- {
- pv = ProtocolVersion.v0_91;
- if (_protocolClass != 0)
- {
- throw new AMQProtocolClassException("Protocol class " + 0 + " was expected; received " +
- _protocolClass, null);
- }
- }
- else if (_protocolClass != CURRENT_PROTOCOL_CLASS)
- {
- throw new AMQProtocolClassException("Protocol class " + CURRENT_PROTOCOL_CLASS + " was expected; received " +
- _protocolClass, null);
- }
- else if (_protocolInstance != TCP_PROTOCOL_INSTANCE)
- {
- throw new AMQProtocolInstanceException("Protocol instance " + TCP_PROTOCOL_INSTANCE + " was expected; received " +
- _protocolInstance, null);
- }
- else
- {
- pv = new ProtocolVersion(_protocolMajor, _protocolMinor);
- }
-
-
- if (!pv.isSupported())
- {
- // TODO: add list of available versions in list to msg...
- throw new AMQProtocolVersionException("Protocol version " +
- _protocolMajor + "." + _protocolMinor + " not suppoerted by this version of the Qpid broker.", null);
- }
- return pv;
- }
-
- public byte getProtocolClass()
- {
- return _protocolClass;
- }
-
- public byte getProtocolInstance()
- {
- return _protocolInstance;
- }
-
- public byte getProtocolMajor()
- {
- return _protocolMajor;
- }
-
- public byte getProtocolMinor()
- {
- return _protocolMinor;
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer(new String(_protocolHeader, StandardCharsets.US_ASCII));
- buffer.append(Integer.toHexString(_protocolClass));
- buffer.append(Integer.toHexString(_protocolInstance));
- buffer.append(Integer.toHexString(_protocolMajor));
- buffer.append(Integer.toHexString(_protocolMinor));
- return buffer.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolVersion.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolVersion.java
deleted file mode 100644
index 33c613ec94..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolVersion.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-/*
-* This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
-* Supported AMQP versions:
-* 0-9
-* 0-91
-* 8-0
-*/
-
-package org.apache.qpid.framing;
-
-import java.util.SortedSet;
-import java.util.Collections;
-import java.util.TreeSet;
-import java.util.Map;
-import java.util.HashMap;
-
-public class ProtocolVersion implements Comparable
-{
- private final byte _majorVersion;
- private final byte _minorVersion;
- private final String _stringFormat;
-
- public ProtocolVersion(byte majorVersion, byte minorVersion)
- {
- _majorVersion = majorVersion;
- _minorVersion = minorVersion;
- _stringFormat = _majorVersion+"-"+_minorVersion;
- }
-
- public byte getMajorVersion()
- {
- return _majorVersion;
- }
-
- public byte getMinorVersion()
- {
- return _minorVersion;
- }
-
- public byte getActualMinorVersion()
- {
- return _minorVersion > 90 ? (byte) (_minorVersion / 10) : _minorVersion;
- }
-
- public byte getRevisionVersion()
- {
- return _minorVersion > 90 ? (byte) (_minorVersion % 10) : (byte) 0;
- }
-
- public String toString()
- {
- return _stringFormat;
- }
-
- public int compareTo(Object o)
- {
- ProtocolVersion pv = (ProtocolVersion) o;
-
- /*
- * 0-8 has it's major and minor numbers the wrong way round (it's actually 8-0)...
- * so we need to deal with that case specially
- */
-
- if((_majorVersion == (byte) 8) && (_minorVersion == (byte) 0))
- {
- ProtocolVersion fixedThis = new ProtocolVersion(_minorVersion, _majorVersion);
- return fixedThis.compareTo(pv);
- }
-
- if((pv.getMajorVersion() == (byte) 8) && (pv.getMinorVersion() == (byte) 0))
- {
- ProtocolVersion fixedOther = new ProtocolVersion(pv.getMinorVersion(), pv.getMajorVersion());
- return this.compareTo(fixedOther);
- }
-
- if(_majorVersion > pv.getMajorVersion())
- {
- return 1;
- }
- else if(_majorVersion < pv.getMajorVersion())
- {
- return -1;
- }
- else if(_minorVersion > pv.getMinorVersion())
- {
- return 1;
- }
- else if(getMinorVersion() < pv.getMinorVersion())
- {
- return -1;
- }
- else
- {
- return 0;
- }
-
- }
-
- public boolean equals(Object o)
- {
- return o != null && (o == this || (compareTo(o) == 0));
- }
-
- public int hashCode()
- {
- return (0xFF & (int)_minorVersion) | ((0xFF & (int)_majorVersion) << 8);
- }
-
- public boolean isSupported()
- {
- return _supportedVersions.contains(this);
- }
-
- public static ProtocolVersion getLatestSupportedVersion()
- {
- return _supportedVersions.last();
- }
-
- private static final SortedSet<ProtocolVersion> _supportedVersions;
- private static final Map<String, ProtocolVersion> _nameToVersionMap =
- new HashMap<String, ProtocolVersion>();
- private static final ProtocolVersion _defaultVersion;
-
- public static final ProtocolVersion v0_10 = new ProtocolVersion((byte)0,(byte)10);
-
- public static final ProtocolVersion v0_9 = new ProtocolVersion((byte)0,(byte)9);
- public static final ProtocolVersion v0_91 = new ProtocolVersion((byte)0,(byte)91);
- public static final ProtocolVersion v8_0 = new ProtocolVersion((byte)8,(byte)0);
-
- static
- {
- SortedSet<ProtocolVersion> versions = new TreeSet<ProtocolVersion>();
-
- versions.add(v0_10);
- _nameToVersionMap.put("0-10", v0_10);
- versions.add(v0_9);
- _nameToVersionMap.put("0-9", v0_9);
- versions.add(v0_91);
- _nameToVersionMap.put("0-91", v0_91);
- versions.add(v8_0);
- _nameToVersionMap.put("8-0", v8_0);
- _supportedVersions = Collections.unmodifiableSortedSet(versions);
-
- ProtocolVersion systemDefinedVersion =
- _nameToVersionMap.get(System.getProperty("org.apache.qpid.amqp_version"));
-
- _defaultVersion = (systemDefinedVersion == null)
- ? getLatestSupportedVersion()
- : systemDefinedVersion;
- }
-
- public static SortedSet<ProtocolVersion> getSupportedProtocolVersions()
- {
- return _supportedVersions;
- }
-
- public static ProtocolVersion parse(String name)
- {
- return _nameToVersionMap.get(name);
- }
-
- public static ProtocolVersion defaultProtocolVersion()
- {
- return _defaultVersion;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueBindBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueBindBody.java
deleted file mode 100644
index 2b7e26a7f0..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueBindBody.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueueBindBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 20;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _queue; // [queue]
- private final AMQShortString _exchange; // [exchange]
- private final AMQShortString _routingKey; // [routingKey]
- private final byte _bitfield0; // [nowait]
- private final FieldTable _arguments; // [arguments]
-
- // Constructor
- public QueueBindBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _queue = buffer.readAMQShortString();
- _exchange = buffer.readAMQShortString();
- _routingKey = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- _arguments = EncodingUtils.readFieldTable(buffer);
- }
-
- public QueueBindBody(
- int ticket,
- AMQShortString queue,
- AMQShortString exchange,
- AMQShortString routingKey,
- boolean nowait,
- FieldTable arguments
- )
- {
- _ticket = ticket;
- _queue = queue;
- _exchange = exchange;
- _routingKey = routingKey;
- byte bitfield0 = (byte)0;
- if( nowait )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- _bitfield0 = bitfield0;
- _arguments = arguments;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getQueue()
- {
- return _queue;
- }
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
- public final boolean getNowait()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final FieldTable getArguments()
- {
- return _arguments;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _queue );
- size += getSizeOf( _exchange );
- size += getSizeOf( _routingKey );
- size += getSizeOf( _arguments );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _queue );
- writeAMQShortString( buffer, _exchange );
- writeAMQShortString( buffer, _routingKey );
- writeBitfield( buffer, _bitfield0 );
- writeFieldTable( buffer, _arguments );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueueBind(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueueBindBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append( ", " );
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "routingKey=" );
- buf.append( getRoutingKey() );
- buf.append( ", " );
- buf.append( "nowait=" );
- buf.append( getNowait() );
- buf.append( ", " );
- buf.append( "arguments=" );
- buf.append( getArguments() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException, AMQFrameDecodingException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString queue = buffer.readAMQShortString();
- AMQShortString exchange = buffer.readAMQShortString();
- AMQShortString bindingKey = buffer.readAMQShortString();
- boolean nowait = (buffer.readByte() & 0x01) == 0x01;
- FieldTable arguments = EncodingUtils.readFieldTable(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveQueueBind(queue, exchange, bindingKey, nowait, arguments);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueBindOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueBindOkBody.java
deleted file mode 100644
index cf6b18b932..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueBindOkBody.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueueBindOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 21;
-
- // Fields declared in specification
-
- // Constructor
- public QueueBindOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- }
-
- public QueueBindOkBody(
- )
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- int size = 0;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueueBindOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueueBindOkBodyImpl: ");
- buf.append("]");
- return buf.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeclareBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeclareBody.java
deleted file mode 100644
index 5a359dc8df..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeclareBody.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueueDeclareBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 10;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _queue; // [queue]
- private final byte _bitfield0; // [passive, durable, exclusive, autoDelete, nowait]
- private final FieldTable _arguments; // [arguments]
-
- // Constructor
- public QueueDeclareBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _queue = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- _arguments = EncodingUtils.readFieldTable(buffer);
- }
-
- public QueueDeclareBody(
- int ticket,
- AMQShortString queue,
- boolean passive,
- boolean durable,
- boolean exclusive,
- boolean autoDelete,
- boolean nowait,
- FieldTable arguments
- )
- {
- _ticket = ticket;
- _queue = queue;
- byte bitfield0 = (byte)0;
- if( passive )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- if( durable )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 1));
- }
-
- if( exclusive )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 2));
- }
-
- if( autoDelete )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 3));
- }
-
- if( nowait )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 4));
- }
-
- _bitfield0 = bitfield0;
- _arguments = arguments;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getQueue()
- {
- return _queue;
- }
- public final boolean getPassive()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final boolean getDurable()
- {
- return (((int)(_bitfield0)) & ( 1 << 1)) != 0;
- }
- public final boolean getExclusive()
- {
- return (((int)(_bitfield0)) & ( 1 << 2)) != 0;
- }
- public final boolean getAutoDelete()
- {
- return (((int)(_bitfield0)) & ( 1 << 3)) != 0;
- }
- public final boolean getNowait()
- {
- return (((int)(_bitfield0)) & ( 1 << 4)) != 0;
- }
- public final FieldTable getArguments()
- {
- return _arguments;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _queue );
- size += getSizeOf( _arguments );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _queue );
- writeBitfield( buffer, _bitfield0 );
- writeFieldTable( buffer, _arguments );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueueDeclare(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueueDeclareBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append( ", " );
- buf.append( "passive=" );
- buf.append( getPassive() );
- buf.append( ", " );
- buf.append( "durable=" );
- buf.append( getDurable() );
- buf.append( ", " );
- buf.append( "exclusive=" );
- buf.append( getExclusive() );
- buf.append( ", " );
- buf.append( "autoDelete=" );
- buf.append( getAutoDelete() );
- buf.append( ", " );
- buf.append( "nowait=" );
- buf.append( getNowait() );
- buf.append( ", " );
- buf.append( "arguments=" );
- buf.append( getArguments() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException, AMQFrameDecodingException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString queue = buffer.readAMQShortString();
- byte bitfield = buffer.readByte();
-
- boolean passive = (bitfield & 0x01 ) == 0x01;
- boolean durable = (bitfield & 0x02 ) == 0x02;
- boolean exclusive = (bitfield & 0x04 ) == 0x04;
- boolean autoDelete = (bitfield & 0x08 ) == 0x08;
- boolean nowait = (bitfield & 0x010 ) == 0x010;
- FieldTable arguments = EncodingUtils.readFieldTable(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveQueueDeclare(queue, passive, durable, exclusive, autoDelete, nowait, arguments);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeclareOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeclareOkBody.java
deleted file mode 100644
index cf6fc656b3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeclareOkBody.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueueDeclareOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 11;
-
- // Fields declared in specification
- private final AMQShortString _queue; // [queue]
- private final long _messageCount; // [messageCount]
- private final long _consumerCount; // [consumerCount]
-
- // Constructor
- public QueueDeclareOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _queue = buffer.readAMQShortString();
- _messageCount = EncodingUtils.readUnsignedInteger(buffer);
- _consumerCount = EncodingUtils.readUnsignedInteger(buffer);
- }
-
- public QueueDeclareOkBody(
- AMQShortString queue,
- long messageCount,
- long consumerCount
- )
- {
- _queue = queue;
- _messageCount = messageCount;
- _consumerCount = consumerCount;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final AMQShortString getQueue()
- {
- return _queue;
- }
- public final long getMessageCount()
- {
- return _messageCount;
- }
- public final long getConsumerCount()
- {
- return _consumerCount;
- }
-
- protected int getBodySize()
- {
- int size = 8;
- size += getSizeOf( _queue );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeAMQShortString( buffer, _queue );
- writeUnsignedInteger( buffer, _messageCount );
- writeUnsignedInteger( buffer, _consumerCount );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueueDeclareOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueueDeclareOkBodyImpl: ");
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append( ", " );
- buf.append( "messageCount=" );
- buf.append( getMessageCount() );
- buf.append( ", " );
- buf.append( "consumerCount=" );
- buf.append( getConsumerCount() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher) throws IOException
- {
- AMQShortString queue = buffer.readAMQShortString();
- long messageCount = EncodingUtils.readUnsignedInteger(buffer);
- long consumerCount = EncodingUtils.readUnsignedInteger(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveQueueDeclareOk(queue, messageCount, consumerCount);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeleteBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeleteBody.java
deleted file mode 100644
index ea933dc644..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeleteBody.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueueDeleteBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 40;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _queue; // [queue]
- private final byte _bitfield0; // [ifUnused, ifEmpty, nowait]
-
- // Constructor
- public QueueDeleteBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _queue = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- }
-
- public QueueDeleteBody(
- int ticket,
- AMQShortString queue,
- boolean ifUnused,
- boolean ifEmpty,
- boolean nowait
- )
- {
- _ticket = ticket;
- _queue = queue;
- byte bitfield0 = (byte)0;
- if( ifUnused )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
-
- if( ifEmpty )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 1));
- }
-
- if( nowait )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 2));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getQueue()
- {
- return _queue;
- }
- public final boolean getIfUnused()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
- public final boolean getIfEmpty()
- {
- return (((int)(_bitfield0)) & ( 1 << 1)) != 0;
- }
- public final boolean getNowait()
- {
- return (((int)(_bitfield0)) & ( 1 << 2)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _queue );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _queue );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueueDelete(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueueDeleteBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append( ", " );
- buf.append( "ifUnused=" );
- buf.append( getIfUnused() );
- buf.append( ", " );
- buf.append( "ifEmpty=" );
- buf.append( getIfEmpty() );
- buf.append( ", " );
- buf.append( "nowait=" );
- buf.append( getNowait() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString queue = buffer.readAMQShortString();
- byte bitfield = buffer.readByte();
-
- boolean ifUnused = (bitfield & 0x01) == 0x01;
- boolean ifEmpty = (bitfield & 0x02) == 0x02;
- boolean nowait = (bitfield & 0x04) == 0x04;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveQueueDelete(queue, ifUnused, ifEmpty, nowait);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeleteOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeleteOkBody.java
deleted file mode 100644
index 6d50153c15..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueDeleteOkBody.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueueDeleteOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 41;
-
- // Fields declared in specification
- private final long _messageCount; // [messageCount]
-
- // Constructor
- public QueueDeleteOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _messageCount = EncodingUtils.readUnsignedInteger(buffer);
- }
-
- public QueueDeleteOkBody(
- long messageCount
- )
- {
- _messageCount = messageCount;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final long getMessageCount()
- {
- return _messageCount;
- }
-
- protected int getBodySize()
- {
- int size = 4;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedInteger( buffer, _messageCount );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueueDeleteOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueueDeleteOkBodyImpl: ");
- buf.append( "messageCount=" );
- buf.append( getMessageCount() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher) throws IOException
- {
- long messageCount = EncodingUtils.readUnsignedInteger(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveQueueDeleteOk(messageCount);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueuePurgeBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueuePurgeBody.java
deleted file mode 100644
index 58a424387c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueuePurgeBody.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueuePurgeBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 30;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _queue; // [queue]
- private final byte _bitfield0; // [nowait]
-
- // Constructor
- public QueuePurgeBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _queue = buffer.readAMQShortString();
- _bitfield0 = buffer.readByte();
- }
-
- public QueuePurgeBody(
- int ticket,
- AMQShortString queue,
- boolean nowait
- )
- {
- _ticket = ticket;
- _queue = queue;
- byte bitfield0 = (byte)0;
- if( nowait )
- {
- bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
- }
- _bitfield0 = bitfield0;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getQueue()
- {
- return _queue;
- }
- public final boolean getNowait()
- {
- return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
- }
-
- protected int getBodySize()
- {
- int size = 3;
- size += getSizeOf( _queue );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _queue );
- writeBitfield( buffer, _bitfield0 );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueuePurge(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueuePurgeBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append( ", " );
- buf.append( "nowait=" );
- buf.append( getNowait() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString queue = buffer.readAMQShortString();
- boolean nowait = (buffer.readByte() & 0x01) == 0x01;
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveQueuePurge(queue, nowait);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueuePurgeOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueuePurgeOkBody.java
deleted file mode 100644
index acab2bc052..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueuePurgeOkBody.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueuePurgeOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 31;
-
- // Fields declared in specification
- private final long _messageCount; // [messageCount]
-
- // Constructor
- public QueuePurgeOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _messageCount = EncodingUtils.readUnsignedInteger(buffer);
- }
-
- public QueuePurgeOkBody(
- long messageCount
- )
- {
- _messageCount = messageCount;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final long getMessageCount()
- {
- return _messageCount;
- }
-
- protected int getBodySize()
- {
- int size = 4;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedInteger( buffer, _messageCount );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueuePurgeOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueuePurgeOkBodyImpl: ");
- buf.append( "messageCount=" );
- buf.append( getMessageCount() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ClientChannelMethodProcessor dispatcher) throws IOException
- {
- long messageCount = EncodingUtils.readUnsignedInteger(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveQueuePurgeOk(messageCount);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueUnbindBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueUnbindBody.java
deleted file mode 100644
index 30c5d19d27..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueUnbindBody.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-91
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueueUnbindBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 50;
-
- // Fields declared in specification
- private final int _ticket; // [ticket]
- private final AMQShortString _queue; // [queue]
- private final AMQShortString _exchange; // [exchange]
- private final AMQShortString _routingKey; // [routingKey]
- private final FieldTable _arguments; // [arguments]
-
- // Constructor
- public QueueUnbindBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- _ticket = buffer.readUnsignedShort();
- _queue = buffer.readAMQShortString();
- _exchange = buffer.readAMQShortString();
- _routingKey = buffer.readAMQShortString();
- _arguments = EncodingUtils.readFieldTable(buffer);
- }
-
- public QueueUnbindBody(
- int ticket,
- AMQShortString queue,
- AMQShortString exchange,
- AMQShortString routingKey,
- FieldTable arguments
- )
- {
- _ticket = ticket;
- _queue = queue;
- _exchange = exchange;
- _routingKey = routingKey;
- _arguments = arguments;
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
- public final int getTicket()
- {
- return _ticket;
- }
- public final AMQShortString getQueue()
- {
- return _queue;
- }
- public final AMQShortString getExchange()
- {
- return _exchange;
- }
- public final AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
- public final FieldTable getArguments()
- {
- return _arguments;
- }
-
- protected int getBodySize()
- {
- int size = 2;
- size += getSizeOf( _queue );
- size += getSizeOf( _exchange );
- size += getSizeOf( _routingKey );
- size += getSizeOf( _arguments );
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- writeUnsignedShort( buffer, _ticket );
- writeAMQShortString( buffer, _queue );
- writeAMQShortString( buffer, _exchange );
- writeAMQShortString( buffer, _routingKey );
- writeFieldTable( buffer, _arguments );
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueueUnbind(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueueUnbindBodyImpl: ");
- buf.append( "ticket=" );
- buf.append( getTicket() );
- buf.append( ", " );
- buf.append( "queue=" );
- buf.append( getQueue() );
- buf.append( ", " );
- buf.append( "exchange=" );
- buf.append( getExchange() );
- buf.append( ", " );
- buf.append( "routingKey=" );
- buf.append( getRoutingKey() );
- buf.append( ", " );
- buf.append( "arguments=" );
- buf.append( getArguments() );
- buf.append("]");
- return buf.toString();
- }
-
- public static void process(final MarkableDataInput buffer,
- final ServerChannelMethodProcessor dispatcher) throws IOException, AMQFrameDecodingException
- {
-
- int ticket = buffer.readUnsignedShort();
- AMQShortString queue = buffer.readAMQShortString();
- AMQShortString exchange = buffer.readAMQShortString();
- AMQShortString routingKey = buffer.readAMQShortString();
- FieldTable arguments = EncodingUtils.readFieldTable(buffer);
- if(!dispatcher.ignoreAllButCloseOk())
- {
- dispatcher.receiveQueueUnbind(queue, exchange, routingKey, arguments);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueUnbindOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueUnbindOkBody.java
deleted file mode 100644
index 2e504d6fc7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/QueueUnbindOkBody.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-91
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.MarkableDataInput;
-
-public class QueueUnbindOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 50;
- public static final int METHOD_ID = 51;
-
- // Fields declared in specification
-
- // Constructor
- public QueueUnbindOkBody(MarkableDataInput buffer) throws AMQFrameDecodingException, IOException
- {
- }
-
- public QueueUnbindOkBody(
- )
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- int size = 0;
- return size;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchQueueUnbindOk(this, channelId);
- }
-
- public String toString()
- {
- StringBuilder buf = new StringBuilder("[QueueUnbindOkBodyImpl: ");
- buf.append("]");
- return buf.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerChannelMethodProcessor.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerChannelMethodProcessor.java
deleted file mode 100644
index 6d43accc96..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerChannelMethodProcessor.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-public interface ServerChannelMethodProcessor extends ChannelMethodProcessor
-{
- void receiveAccessRequest(AMQShortString realm,
- boolean exclusive,
- boolean passive,
- boolean active,
- boolean write, boolean read);
-
- void receiveExchangeDeclare(AMQShortString exchange,
- AMQShortString type,
- boolean passive,
- boolean durable,
- boolean autoDelete, boolean internal, boolean nowait, final FieldTable arguments);
-
- void receiveExchangeDelete(AMQShortString exchange, boolean ifUnused, boolean nowait);
-
- void receiveExchangeBound(AMQShortString exchange, AMQShortString routingKey, AMQShortString queue);
-
- void receiveQueueDeclare(AMQShortString queue,
- boolean passive,
- boolean durable,
- boolean exclusive,
- boolean autoDelete, boolean nowait, FieldTable arguments);
-
- void receiveQueueBind(AMQShortString queue,
- AMQShortString exchange,
- AMQShortString bindingKey,
- boolean nowait, FieldTable arguments);
-
- void receiveQueuePurge(AMQShortString queue, boolean nowait);
-
- void receiveQueueDelete(AMQShortString queue, boolean ifUnused, boolean ifEmpty, boolean nowait);
-
- void receiveQueueUnbind(AMQShortString queue,
- AMQShortString exchange,
- AMQShortString bindingKey,
- FieldTable arguments);
-
- void receiveBasicRecover(final boolean requeue, boolean sync);
-
- void receiveBasicQos(long prefetchSize, int prefetchCount, boolean global);
-
- void receiveBasicConsume(AMQShortString queue,
- AMQShortString consumerTag,
- boolean noLocal,
- boolean noAck,
- boolean exclusive, boolean nowait, FieldTable arguments);
-
- void receiveBasicCancel(AMQShortString consumerTag, boolean noWait);
-
- void receiveBasicPublish(AMQShortString exchange,
- AMQShortString routingKey,
- boolean mandatory,
- boolean immediate);
-
- void receiveBasicGet(AMQShortString queue, boolean noAck);
-
- void receiveBasicAck(long deliveryTag, boolean multiple);
-
- void receiveBasicReject(long deliveryTag, boolean requeue);
-
-
-
- void receiveTxSelect();
-
- void receiveTxCommit();
-
- void receiveTxRollback();
-
- void receiveConfirmSelect(boolean nowait);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerMethodDispatcher.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerMethodDispatcher.java
deleted file mode 100644
index d3961a1a59..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerMethodDispatcher.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 0-9
- * 0-91
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import org.apache.qpid.AMQException;
-
-public interface ServerMethodDispatcher
-{
- boolean dispatchAccessRequest(AccessRequestBody accessRequestBody, int channelId) throws AMQException;
-
- public boolean dispatchBasicAck(BasicAckBody body, int channelId) throws AMQException;
- public boolean dispatchBasicCancel(BasicCancelBody body, int channelId) throws AMQException;
- public boolean dispatchBasicConsume(BasicConsumeBody body, int channelId) throws AMQException;
- public boolean dispatchBasicGet(BasicGetBody body, int channelId) throws AMQException;
- public boolean dispatchBasicPublish(BasicPublishBody body, int channelId) throws AMQException;
- public boolean dispatchBasicQos(BasicQosBody body, int channelId) throws AMQException;
- public boolean dispatchBasicRecover(BasicRecoverBody body, int channelId) throws AMQException;
- public boolean dispatchBasicReject(BasicRejectBody body, int channelId) throws AMQException;
- public boolean dispatchChannelClose(ChannelCloseBody body, int channelId) throws AMQException;
- public boolean dispatchChannelCloseOk(ChannelCloseOkBody body, int channelId) throws AMQException;
- public boolean dispatchChannelFlow(ChannelFlowBody body, int channelId) throws AMQException;
- public boolean dispatchChannelFlowOk(ChannelFlowOkBody body, int channelId) throws AMQException;
- public boolean dispatchChannelOpen(ChannelOpenBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionClose(ConnectionCloseBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionCloseOk(ConnectionCloseOkBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionOpen(ConnectionOpenBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionSecureOk(ConnectionSecureOkBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionStartOk(ConnectionStartOkBody body, int channelId) throws AMQException;
- public boolean dispatchConnectionTuneOk(ConnectionTuneOkBody body, int channelId) throws AMQException;
- public boolean dispatchExchangeBound(ExchangeBoundBody body, int channelId) throws AMQException;
- public boolean dispatchExchangeDeclare(ExchangeDeclareBody body, int channelId) throws AMQException;
- public boolean dispatchExchangeDelete(ExchangeDeleteBody body, int channelId) throws AMQException;
- public boolean dispatchQueueBind(QueueBindBody body, int channelId) throws AMQException;
- public boolean dispatchQueueDeclare(QueueDeclareBody body, int channelId) throws AMQException;
- public boolean dispatchQueueDelete(QueueDeleteBody body, int channelId) throws AMQException;
- public boolean dispatchQueuePurge(QueuePurgeBody body, int channelId) throws AMQException;
- public boolean dispatchTxCommit(TxCommitBody body, int channelId) throws AMQException;
- public boolean dispatchTxRollback(TxRollbackBody body, int channelId) throws AMQException;
- public boolean dispatchTxSelect(TxSelectBody body, int channelId) throws AMQException;
-
- boolean dispatchQueueUnbind(QueueUnbindBody queueUnbindBody, int channelId) throws AMQException;
-
- boolean dispatchBasicRecoverSync(BasicRecoverSyncBody basicRecoverSyncBody, int channelId) throws AMQException;
-
- boolean dispatchConfirmSelect(ConfirmSelectBody confirmSelectBody, int channelId) throws AMQException;
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerMethodProcessor.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerMethodProcessor.java
deleted file mode 100644
index 77b4a1fc6b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ServerMethodProcessor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-public interface ServerMethodProcessor<T extends ServerChannelMethodProcessor> extends MethodProcessor<T>
-{
- void receiveConnectionStartOk(FieldTable clientProperties,
- AMQShortString mechanism,
- byte[] response,
- AMQShortString locale);
-
- void receiveConnectionSecureOk(byte[] response);
-
- void receiveConnectionTuneOk(int channelMax, long frameMax, int heartbeat);
-
- void receiveConnectionOpen(AMQShortString virtualHost, AMQShortString capabilities, boolean insist);
-
- void receiveChannelOpen(int channelId);
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxCommitBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/TxCommitBody.java
deleted file mode 100644
index 63c12dffc6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxCommitBody.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-
-public class TxCommitBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 90;
- public static final int METHOD_ID = 20;
-
- public static final TxCommitBody INSTANCE = new TxCommitBody();
-
- // Constructor
-
-
- public TxCommitBody()
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchTxCommit(this, channelId);
- }
-
- public String toString()
- {
- return "[TxCommitBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxCommitOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/TxCommitOkBody.java
deleted file mode 100644
index c1a8dd0d23..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxCommitOkBody.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-
-public class TxCommitOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 90;
- public static final int METHOD_ID = 21;
-
- public static final TxCommitOkBody INSTANCE = new TxCommitOkBody();
-
- // Constructor
- private TxCommitOkBody()
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchTxCommitOk(this, channelId);
- }
-
- public String toString()
- {
- return "[TxCommitOkBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxRollbackBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/TxRollbackBody.java
deleted file mode 100644
index 97ac5ddcba..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxRollbackBody.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-
-public class TxRollbackBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 90;
- public static final int METHOD_ID = 30;
-
- public static final TxRollbackBody INSTANCE = new TxRollbackBody();
-
-
- private TxRollbackBody()
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchTxRollback(this, channelId);
- }
-
- public String toString()
- {
- return "[TxRollbackBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxRollbackOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/TxRollbackOkBody.java
deleted file mode 100644
index d8ab92c1c3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxRollbackOkBody.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-
-public class TxRollbackOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 90;
- public static final int METHOD_ID = 31;
-
- public static final TxRollbackOkBody INSTANCE = new TxRollbackOkBody();
-
- // Constructor
-
- private TxRollbackOkBody()
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchTxRollbackOk(this, channelId);
- }
-
- public String toString()
- {
- return "[TxRollbackOkBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxSelectBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/TxSelectBody.java
deleted file mode 100644
index 79af85f177..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxSelectBody.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-
-public class TxSelectBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 90;
- public static final int METHOD_ID = 10;
-
- public static final TxSelectBody INSTANCE = new TxSelectBody();
-
- // Fields declared in specification
-
- // Constructor
-
- private TxSelectBody()
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchTxSelect(this, channelId);
- }
-
- public String toString()
- {
- return "[TxSelectBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxSelectOkBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/TxSelectOkBody.java
deleted file mode 100644
index 64c8979deb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/framing/TxSelectOkBody.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/*
- * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
- * Supported AMQP version:
- * 8-0
- */
-
-package org.apache.qpid.framing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-
-public class TxSelectOkBody extends AMQMethodBodyImpl implements EncodableAMQDataBlock, AMQMethodBody
-{
-
- public static final int CLASS_ID = 90;
- public static final int METHOD_ID = 11;
-
- public static final TxSelectOkBody INSTANCE = new TxSelectOkBody();
-
- private TxSelectOkBody()
- {
- }
-
- public int getClazz()
- {
- return CLASS_ID;
- }
-
- public int getMethod()
- {
- return METHOD_ID;
- }
-
-
- protected int getBodySize()
- {
- return 0;
- }
-
- public void writeMethodPayload(DataOutput buffer) throws IOException
- {
- }
-
- public boolean execute(MethodDispatcher dispatcher, int channelId) throws AMQException
- {
- return dispatcher.dispatchTxSelectOk(this, channelId);
- }
-
- public String toString()
- {
- return "[TxSelectOkBody]";
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/Address.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/Address.java
deleted file mode 100644
index 92cf1c91d5..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/Address.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging;
-
-import org.apache.qpid.messaging.util.AddressParser;
-
-import static org.apache.qpid.messaging.util.PyPrint.pprint;
-
-import java.io.Serializable;
-import java.util.Map;
-
-
-/**
- * Address
- *
- */
-
-public class Address implements Serializable
-{
-
- private static final long serialVersionUID = 6096143531336726036L;
-
- private String _name;
- private String _subject;
- private Map _options;
- private final String _myToString;
-
- public static Address parse(String address)
- {
- return new AddressParser(address).parse();
- }
-
- public Address(String name, String subject, Map options)
- {
- this._name = name;
- this._subject = subject;
- this._options = options;
- this._myToString = String.format("%s/%s; %s", pprint(_name), pprint(_subject), pprint(_options));
- }
-
- public String getName()
- {
- return _name;
- }
-
- public String getSubject()
- {
- return _subject;
- }
-
- public Map getOptions()
- {
- return _options;
- }
-
- public String toString()
- {
- return _myToString;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/AddressParser.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/AddressParser.java
deleted file mode 100644
index 4e3782673c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/AddressParser.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.messaging.Address;
-
-
-/**
- * AddressParser
- *
- */
-
-public class AddressParser extends Parser
-{
-
- private static Lexicon lxi = new Lexicon();
-
- private static Token.Type LBRACE = lxi.define("LBRACE", "\\{");
- private static Token.Type RBRACE = lxi.define("RBRACE", "\\}");
- private static Token.Type LBRACK = lxi.define("LBRACK", "\\[");
- private static Token.Type RBRACK = lxi.define("RBRACK", "\\]");
- private static Token.Type COLON = lxi.define("COLON", ":");
- private static Token.Type SEMI = lxi.define("SEMI", ";");
- private static Token.Type SLASH = lxi.define("SLASH", "/");
- private static Token.Type COMMA = lxi.define("COMMA", ",");
- private static Token.Type NUMBER = lxi.define("NUMBER", "[+-]?[0-9]*\\.?[0-9]+");
- private static Token.Type TRUE = lxi.define("TRUE", "True");
- private static Token.Type FALSE = lxi.define("FALSE", "False");
- private static Token.Type ID = lxi.define("ID", "[a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?");
- private static Token.Type STRING = lxi.define("STRING", "\"(?:[^\\\"]|\\.)*\"|'(?:[^\\']|\\.)*'");
- private static Token.Type ESC = lxi.define("ESC", "\\\\[^ux]|\\\\x[0-9a-fA-F][0-9a-fA-F]|\\\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]");
- private static Token.Type SYM = lxi.define("SYM", "[.#*%@$^!+-]");
- private static Token.Type WSPACE = lxi.define("WSPACE", "[\\s]+");
- private static Token.Type EOF = lxi.eof("EOF");
-
- private static Lexer LEXER = lxi.compile();
-
- private static final int MAX_CACHED_ENTRIES = Integer.getInteger(ClientProperties.QPID_MAX_CACHED_ADDR_OPTION_STRINGS,
- ClientProperties.DEFAULT_MAX_CACHED_ADDR_OPTION_STRINGS);
-
- // stores address options maps for options strings that we have encountered; using a synchronizedMap wrapper
- // in case multiple threads are parsing addresses.
- private static Map<String, Map<Object, Object>> optionsMaps =
- Collections.synchronizedMap(
- new LinkedHashMap<String, Map<Object, Object>>(MAX_CACHED_ENTRIES +1,1.1f,true)
- {
- @Override
- protected boolean removeEldestEntry(Map.Entry<String,Map<Object, Object>> eldest)
- {
- return size() > MAX_CACHED_ENTRIES;
- }
-
- });
-
- public static List<Token> lex(String input)
- {
- return LEXER.lex(input);
- }
-
- static List<Token> wlex(String input)
- {
- List<Token> tokens = new ArrayList<Token>();
- for (Token t : lex(input))
- {
- if (t.getType() != WSPACE)
- {
- tokens.add(t);
- }
- }
- return tokens;
- }
-
- static String unquote(String st, Token tok)
- {
- StringBuilder result = new StringBuilder();
- for (int i = 1; i < st.length() - 1; i++)
- {
- char ch = st.charAt(i);
- if (ch == '\\')
- {
- char code = st.charAt(i+1);
- switch (code)
- {
- case '\n':
- break;
- case '\\':
- result.append('\\');
- break;
- case '\'':
- result.append('\'');
- break;
- case '"':
- result.append('"');
- break;
- case 'a':
- result.append((char) 0x07);
- break;
- case 'b':
- result.append((char) 0x08);
- break;
- case 'f':
- result.append('\f');
- break;
- case 'n':
- result.append('\n');
- break;
- case 'r':
- result.append('\r');
- break;
- case 't':
- result.append('\t');
- break;
- case 'u':
- result.append(decode(st.substring(i+2, i+6)));
- i += 4;
- break;
- case 'v':
- result.append((char) 0x0b);
- break;
- case 'o':
- result.append(decode(st.substring(i+2, i+4), 8));
- i += 2;
- break;
- case 'x':
- result.append(decode(st.substring(i+2, i+4)));
- i += 2;
- break;
- default:
- throw new ParseError(tok);
- }
- i += 1;
- }
- else
- {
- result.append(ch);
- }
- }
-
- return result.toString();
- }
-
- static char[] decode(String hex)
- {
- return decode(hex, 16);
- }
-
- static char[] decode(String code, int radix)
- {
- return Character.toChars(Integer.parseInt(code, radix));
- }
-
- static String tok2str(Token tok)
- {
- Token.Type type = tok.getType();
- String value = tok.getValue();
-
- if (type == STRING)
- {
- return unquote(value, tok);
- }
- else if (type == ESC)
- {
- if (value.charAt(1) == 'x' || value.charAt(1) == 'u')
- {
- return new String(decode(value.substring(2)));
- }
- else
- {
- return value.substring(1);
- }
- }
- else
- {
- return value;
- }
- }
-
- static Object tok2obj(Token tok)
- {
- Token.Type type = tok.getType();
- String value = tok.getValue();
- if (type == STRING)
- {
- return unquote(value, tok);
- }
- else if (type == NUMBER)
- {
- if (value.indexOf('.') >= 0)
- {
- return Double.valueOf(value);
- }
- else
- {
- return Integer.decode(value);
- }
- }
- else if (type == TRUE)
- {
- return true;
- }
- else if (type == FALSE)
- {
- return false;
- }
- else
- {
- return value;
- }
- }
-
- static String toks2str(List<Token> toks)
- {
- if (toks.size() > 0)
- {
- StringBuilder result = new StringBuilder();
- for (Token t : toks)
- {
- result.append(tok2str(t));
- }
- return result.toString();
- }
- else
- {
- return null;
- }
- }
-
- public AddressParser(String input)
- {
- super(wlex(input));
- }
-
- public Address parse()
- {
- Address result = address();
- eat(EOF);
- return result;
- }
-
- public Address address()
- {
- String name = toks2str(eat_until(SLASH, SEMI, EOF));
-
- if (name == null)
- {
- throw new ParseError(next());
- }
-
- String subject;
- if (matches(SLASH))
- {
- eat(SLASH);
- subject = toks2str(eat_until(SEMI, EOF));
- if ("None".equals(subject))
- {
- subject = null;
- }
- }
- else
- {
- subject = null;
- }
-
- Map<Object, Object> options;
- if (matches(SEMI))
- {
- eat(SEMI);
-
- // get the remaining string denoting the options and see if we've already encountered an address
- // with the same options before
- String optionsString = toks2str(remainder());
- Map<Object,Object> storedMap = optionsMaps.get(optionsString);
- if (storedMap == null)
- {
- // if these are new options, construct a new map and store it in the encountered collection
- options = Collections.unmodifiableMap(map());
- optionsMaps.put(optionsString, options);
- }
- else
- {
- // if we already have the map for these options, use the stored map
- options = storedMap;
- eat_until(EOF);
- }
- }
- else
- {
- options = null;
- }
-
- return new Address(name, subject, options);
- }
-
- public Map<Object,Object> map()
- {
- eat(LBRACE);
-
- Map<Object,Object> result = new HashMap<Object,Object>();
- while (true)
- {
- if (matches(NUMBER, STRING, ID, LBRACE, LBRACK))
- {
- keyval(result);
- if (matches(COMMA))
- {
- eat(COMMA);
- }
- else if (matches(RBRACE))
- {
- break;
- }
- else
- {
- throw new ParseError(next(), COMMA, RBRACE);
- }
- }
- else if (matches(RBRACE))
- {
- break;
- }
- else
- {
- throw new ParseError(next(), NUMBER, STRING, ID, LBRACE, LBRACK,
- RBRACE);
- }
- }
-
- eat(RBRACE);
- return result;
- }
-
- void keyval(Map<Object,Object> map)
- {
- Object key = value();
- eat(COLON);
- Object val = value();
- map.put(key, val);
- }
-
- Object value()
- {
- if (matches(NUMBER, STRING, ID, TRUE, FALSE))
- {
- return tok2obj(eat());
- }
- else if (matches(LBRACE))
- {
- return map();
- }
- else if (matches(LBRACK))
- {
- return list();
- }
- else
- {
- throw new ParseError(next(), NUMBER, STRING, ID, LBRACE, LBRACK);
- }
- }
-
- List<Object> list()
- {
- eat(LBRACK);
-
- List<Object> result = new ArrayList<Object>();
-
- while (true)
- {
- if (matches(RBRACK))
- {
- break;
- }
- else
- {
- result.add(value());
- if (matches(COMMA))
- {
- eat(COMMA);
- }
- else if (matches(RBRACK))
- {
- break;
- }
- else
- {
- throw new ParseError(next(), COMMA, RBRACK);
- }
- }
- }
-
- eat(RBRACK);
- return result;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/JAddr.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/JAddr.java
deleted file mode 100644
index c5c2cacd1a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/JAddr.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-import org.apache.qpid.messaging.Address;
-
-import static org.apache.qpid.messaging.util.PyPrint.pprint;
-
-import java.io.InputStreamReader;
-import java.util.List;
-
-
-/**
- * JAddr
- *
- */
-
-public class JAddr
-{
- private JAddr()
- {
- }
-
- public static final void main(String[] args) throws Exception
- {
- StringBuilder addr = new StringBuilder();
- InputStreamReader reader = new InputStreamReader(System.in);
-
- char[] buf = new char[1024];
- while (true)
- {
- int n = reader.read(buf, 0, buf.length);
- if (n < 0)
- {
- break;
- }
- addr.append(buf, 0, n);
- }
-
- if ("parse".equals(args[0]))
- {
- try
- {
- Address address = Address.parse(addr.toString());
- System.out.println(pprint_address(address));
- }
- catch (ParseError e)
- {
- System.out.println(String.format("ERROR: %s", e.getMessage()));
- }
- }
- else
- {
- List<Token> tokens = AddressParser.lex(addr.toString());
- for (Token t : tokens)
- {
- String value = t.getValue();
- if (value != null)
- {
- value = value.replace("\\", "\\\\").replace("\n", "\\n");
- System.out.println(String.format("%s:%s:%s", t.getType(), t.getPosition(), value));
- }
- else
- {
- System.out.println(String.format("%s:%s", t.getType(), t.getPosition()));
- }
- }
- }
- }
-
- private static String pprint_address(Address addr)
- {
- return String.format("NAME: %s\nSUBJECT: %s\nOPTIONS: %s",
- pprint(addr.getName()),
- pprint(addr.getSubject()),
- pprint(addr.getOptions()));
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/LexError.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/LexError.java
deleted file mode 100644
index b8d346dca4..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/LexError.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-
-/**
- * LexError
- *
- */
-
-public class LexError extends RuntimeException
-{
-
- public LexError(String msg)
- {
- super(msg);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Lexer.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Lexer.java
deleted file mode 100644
index 9638ec78e2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Lexer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-
-/**
- * Lexer
- *
- */
-
-public class Lexer
-{
-
- private List<Token.Type> types;
- private Token.Type eof;
- private Pattern rexp;
-
- public Lexer(List<Token.Type> types, Token.Type eof, Pattern rexp)
- {
- this.types = types;
- this.eof = eof;
- this.rexp = rexp;
- }
-
- public List<Token> lex(final String st)
- {
- List<Token> tokens = new ArrayList<Token>();
-
- int position = 0;
- Matcher m = rexp.matcher(st);
- OUTER: while (position < st.length())
- {
- m.region(position, st.length());
- if (m.lookingAt())
- {
- for (int i = 1; i <= m.groupCount(); i++)
- {
- String value = m.group(i);
- if (value != null)
- {
- tokens.add(new Token(types.get(i-1), value, st, m.start(i)));
- position = m.end(i);
- continue OUTER;
- }
- }
- throw new RuntimeException("no group matched");
- }
- else
- {
- throw new LexError("unrecognized characters line:" + LineInfo.get(st, position));
- }
- }
-
- tokens.add(new Token(eof, null, st, position));
-
- return tokens;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Lexicon.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Lexicon.java
deleted file mode 100644
index 9ab610f37a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Lexicon.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-
-/**
- * Lexicon
- *
- */
-
-public class Lexicon
-{
-
- private List<Token.Type> types;
- private Token.Type eof;
-
- public Lexicon()
- {
- this.types = new ArrayList<Token.Type>();
- this.eof = null;
- }
-
- public Token.Type define(String name, String pattern)
- {
- Token.Type t = new Token.Type(name, pattern);
- types.add(t);
- return t;
- }
-
- public Token.Type eof(String name)
- {
- Token.Type t = new Token.Type(name, null);
- eof = t;
- return t;
- }
-
- public Lexer compile()
- {
- StringBuilder joined = new StringBuilder();
- for (Token.Type t : types)
- {
- if (joined.length() > 0)
- {
- joined.append('|');
- }
- joined.append('(').append(t.getPattern()).append(')');
- }
- Pattern rexp = Pattern.compile(joined.toString());
- return new Lexer(new ArrayList<Token.Type>(types), eof, rexp);
- }
-
- public static final void main(String[] args)
- {
- StringBuilder input = new StringBuilder();
- for (String a : args)
- {
- if (input.length() > 0)
- {
- input.append(" ");
- }
-
- input.append(a);
- }
-
- Lexicon lxi = new Lexicon();
- lxi.define("FOR", "for");
- lxi.define("IF", "if");
- lxi.define("LPAREN", "\\(");
- lxi.define("RPAREN", "\\)");
- lxi.define("ID", "[\\S]+");
- lxi.define("WSPACE", "[\\s]+");
- lxi.eof("EOF");
- Lexer lx = lxi.compile();
-
- for (Token t : lx.lex(input.toString()))
- {
- System.out.println(t);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/LineInfo.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/LineInfo.java
deleted file mode 100644
index 4952fc38a3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/LineInfo.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-
-/**
- * LineInfo
- *
- */
-
-public class LineInfo
-{
-
- public static LineInfo get(String st, int position)
- {
- int idx = 0;
- int line = 1;
- int column = 0;
- int line_pos = 0;
- while (idx < position)
- {
- if (st.charAt(idx) == '\n')
- {
- line += 1;
- column = 0;
- line_pos = idx;
- }
-
- column += 1;
- idx += 1;
- }
-
- int end = st.indexOf('\n', line_pos);
- if (end < 0)
- {
- end = st.length();
- }
-
- String text = st.substring(line_pos, end);
-
- return new LineInfo(line, column, text);
- }
-
- private int line;
- private int column;
- private String text;
-
- public LineInfo(int line, int column, String text)
- {
- this.line = line;
- this.column = column;
- this.text = text;
- }
-
- public int getLine()
- {
- return line;
- }
-
- public int getColumn()
- {
- return column;
- }
-
- public String getText()
- {
- return text;
- }
-
- public String toString()
- {
- return String.format("%s,%s:%s", line, column, text);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/ParseError.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/ParseError.java
deleted file mode 100644
index ce758e15fa..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/ParseError.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-import org.apache.qpid.util.Strings;
-
-
-/**
- * ParseError
- *
- */
-
-public class ParseError extends RuntimeException
-{
-
- private static String msg(Token token, Token.Type ... expected)
- {
- LineInfo li = token.getLineInfo();
- String exp = Strings.join(", ", expected);
- if (expected.length > 1)
- {
- exp = String.format("(%s)", exp);
- }
-
- if (expected.length > 0)
- {
- return String.format("expecting %s, got %s line:%s", exp, token, li);
- }
- else
- {
- return String.format("unexpected token %s line:%s", token, li);
- }
- }
-
- public ParseError(Token token, Token.Type ... expected)
- {
- super(msg(token, expected));
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Parser.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Parser.java
deleted file mode 100644
index 3019326963..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Parser.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * Parser
- *
- */
-
-class Parser
-{
-
- private List<Token> tokens;
- private int idx = 0;
-
- Parser(List<Token> tokens)
- {
- this.tokens = tokens;
- this.idx = 0;
- }
-
- Token next()
- {
- return tokens.get(idx);
- }
-
- boolean matches(Token.Type ... types)
- {
- for (Token.Type t : types)
- {
- if (next().getType() == t)
- {
- return true;
- }
- }
- return false;
- }
-
- Token eat(Token.Type ... types)
- {
- if (types.length > 0 && !matches(types))
- {
- throw new ParseError(next(), types);
- }
- else
- {
- Token t = next();
- idx += 1;
- return t;
- }
- }
-
- List<Token> eat_until(Token.Type ... types)
- {
- List<Token> result = new ArrayList<Token>();
- while (!matches(types))
- {
- result.add(eat());
- }
- return result;
- }
-
- /**
- * Returns the remaining list of tokens, without eating them
- */
- List<Token> remainder()
- {
- List<Token> result = new ArrayList<Token>();
- for (int i = idx; i < tokens.size(); i++)
- {
- result.add(tokens.get(i));
- }
- return result;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/PyPrint.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/PyPrint.java
deleted file mode 100644
index 2681893482..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/PyPrint.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * PyPrint
- *
- */
-
-public class PyPrint
-{
- private PyPrint()
- {
- }
-
- public static String pprint(Object obj)
- {
- if (obj instanceof Map)
- {
- return pprint_map((Map) obj);
- }
- else if (obj instanceof List)
- {
- return pprint_list((List) obj);
- }
- else if (obj instanceof String)
- {
- return pprint_string((String) obj);
- }
- else if (obj instanceof Boolean)
- {
- return ((Boolean) obj).booleanValue() ? "True" : "False";
- }
- else if (obj == null)
- {
- return "None";
- }
- else
- {
- return obj.toString();
- }
- }
-
- private static String indent(String st)
- {
- return " " + st.replace("\n", "\n ");
- }
-
- private static String pprint_map(Map<Object,Object> map)
- {
- List<String> items = new ArrayList<String>();
- for (Map.Entry me : map.entrySet())
- {
- items.add(String.format("%s: %s", pprint(me.getKey()),
- pprint(me.getValue())));
- }
- Collections.sort(items);
- return pprint_items("{", items, "}");
- }
-
- private static String pprint_list(List list)
- {
- List<String> items = new ArrayList<String>();
- for (Object o : list)
- {
- items.add(pprint(o));
- }
- return pprint_items("[", items, "]");
- }
-
- private static String pprint_items(String start, List<String> items,
- String end)
- {
- StringBuilder result = new StringBuilder();
- for (String item : items)
- {
- if (result.length() > 0)
- {
- result.append(",\n");
- }
- result.append(indent(item));
- }
-
- if (result.length() > 0)
- {
- return String.format("%s\n%s\n%s", start, result, end);
- }
- else
- {
- return String.format("%s%s", start, end);
- }
- }
-
- private static String pprint_string(String st)
- {
- StringBuilder result = new StringBuilder();
- result.append('\'');
- for (int i = 0; i < st.length(); i++)
- {
- char c = st.charAt(i);
- switch (c)
- {
- case '\'':
- result.append("\\'");
- break;
- case '\n':
- result.append("\\n");
- break;
- default:
- if (c >= 0x80)
- {
- result.append(String.format("\\u%04x", (int)c));
- }
- else
- {
- result.append(c);
- }
- break;
- }
- }
- result.append('\'');
- return result.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Token.java b/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Token.java
deleted file mode 100644
index b9458d7997..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/messaging/util/Token.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.messaging.util;
-
-
-/**
- * Token
- *
- */
-
-public class Token
-{
-
- public static class Type
- {
-
- private String name;
- private String pattern;
-
- Type(String name, String pattern)
- {
- this.name = name;
- this.pattern = pattern;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getPattern()
- {
- return pattern;
- }
-
- public String toString()
- {
- return name;
- }
-
- }
-
- private Type type;
- private String value;
- private String input;
- private int position;
-
- Token(Type type, String value, String input, int position)
- {
- this.type = type;
- this.value = value;
- this.input = input;
- this.position = position;
- }
-
- public Type getType()
- {
- return type;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public int getPosition()
- {
- return position;
- }
-
- public LineInfo getLineInfo()
- {
- return LineInfo.get(input, position);
- }
-
- public String toString()
- {
- if (value == null)
- {
- return type.toString();
- }
- else
- {
- return String.format("%s(%s)", type, value);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java b/qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java
deleted file mode 100644
index c9fbd824c5..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.pool;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-
-/**
- * ReferenceCountingExecutorService wraps an ExecutorService in order to provide shared reference to it. It counts
- * the references taken, instantiating the service on the first reference, and shutting it down when the last
- * reference is released.
- *
- * <p>It is important to ensure that an executor service is correctly shut down as failing to do so prevents the JVM
- * from terminating due to the existence of non-daemon threads.
- *
- * <p>
- * TODO Might be more elegant to make this actually implement ExecutorService, providing better hiding of the
- * implementation details. Also this class introduces a pattern (albeit specific to this usage) that could be
- * generalized to reference count anything. That is, on first instance call a create method, on release of last
- * instance call a destroy method. This could definitely be abstracted out as a re-usable piece of code; a
- * reference counting factory. It could then be re-used to do reference counting in other places (such as
- * messages). Countable objects have a simple create/destroy life cycle, capturable by an interface that the
- * ref counting factory can call to manage the lifecycle.
- * <p>
- * TODO The {@link #getPool()} method breaks the encapsulation of the reference counter. Generally when getPool is used
- * further checks are applied to ensure that the executor service has not been shutdown. This passes responsibility
- * for managing the lifecycle of the reference counted object onto the caller rather than neatly encapsulating it
- * here. Could think about adding more state to the lifecycle, to mark ref counted objects as invalid, and have an
- * isValid method, or could make calling code deal with RejectedExecutionException raised by shutdown executors.
- */
-public class ReferenceCountingExecutorService
-{
-
-
- /** Defines the smallest thread pool that will be allocated, irrespective of the number of processors. */
- private static final int MINIMUM_POOL_SIZE = 4;
-
- /** Holds the number of processors on the machine. */
- private static final int NUM_CPUS = Runtime.getRuntime().availableProcessors();
-
- /** Defines the thread pool size to use, which is the larger of the number of CPUs or the minimum size. */
- private static final int DEFAULT_POOL_SIZE = Math.max(NUM_CPUS, MINIMUM_POOL_SIZE);
-
- /**
- * Holds the singleton instance of this reference counter. This is only created once, statically, so the
- * {@link #getInstance()} method does not need to be synchronized.
- */
- private static final ReferenceCountingExecutorService _instance = new ReferenceCountingExecutorService();
-
- /** This lock is used to ensure that reference counts are updated atomically with create/destroy operations. */
- private final Object _lock = new Object();
-
- /** The shared executor service that is reference counted. */
- private ExecutorService _pool;
-
- /** Holds the number of references given out to the executor service. */
- private int _refCount = 0;
-
- /** Holds the number of executor threads to create. */
- private int _poolSize = Integer.getInteger("amqj.read_write_pool_size", DEFAULT_POOL_SIZE);
-
- /** Thread Factory used to create thread of the pool. */
- private ThreadFactory _threadFactory = new SuppressingInheritedAccessControlContextThreadFactory();
-
- /**
- * Retrieves the singleton instance of this reference counter.
- *
- * @return The singleton instance of this reference counter.
- */
- public static ReferenceCountingExecutorService getInstance()
- {
- return _instance;
- }
-
- /**
- * Private constructor to ensure that only a singleton instance can be created.
- */
- private ReferenceCountingExecutorService()
- { }
-
- /**
- * Provides a reference to a shared executor service, incrementing the reference count.
- *
- * @return An executor service.
- */
- public ExecutorService acquireExecutorService()
- {
- synchronized (_lock)
- {
- if (_refCount++ == 0)
- {
- _pool = new ThreadPoolExecutor(_poolSize, _poolSize,
- 0L, TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue<Runnable>(),
- _threadFactory);
- }
-
- return _pool;
- }
- }
-
- /**
- * Releases a reference to a shared executor service, decrementing the reference count. If the reference count falls
- * to zero, the executor service is shut down.
- */
- public void releaseExecutorService()
- {
- synchronized (_lock)
- {
- if (--_refCount == 0)
- {
- _pool.shutdownNow();
- }
- }
- }
-
- /**
- * Provides access to the executor service, without touching the reference count.
- *
- * @return The shared executor service, or <tt>null</tt> if none has been instantiated yet.
- */
- public ExecutorService getPool()
- {
- return _pool;
- }
-
- /**
- * Return the ReferenceCount to this ExecutorService
- * @return reference count
- */
- public int getReferenceCount()
- {
- return _refCount;
- }
-
- /**
- *
- * Return the thread factory used by the {@link ThreadPoolExecutor} to create new threads.
- *
- * @return thread factory
- */
- public ThreadFactory getThreadFactory()
- {
- return _threadFactory;
- }
-
- /**
- * Sets the thread factory used by the {@link ThreadPoolExecutor} to create new threads.
- * <p>
- * If the pool has been already created, the change will have no effect until
- * {@link #getReferenceCount()} reaches zero and the pool recreated. For this reason,
- * callers must invoke this method <i>before</i> calling {@link #acquireExecutorService()}.
- *
- * @param threadFactory thread factory
- */
- public void setThreadFactory(final ThreadFactory threadFactory)
- {
- if (threadFactory == null)
- {
- throw new NullPointerException("threadFactory cannot be null");
- }
- _threadFactory = threadFactory;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactory.java
deleted file mode 100644
index 37ce8f5d67..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactory.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.pool;
-
-
-import javax.security.auth.Subject;
-import java.security.PrivilegedAction;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-/**
- * <code>ThreadFactory</code> to create threads with empty inherited <code>java.security.AccessControlContext</code>
- * <p></p>
- * It delegates thread creation to <code>Executors</code> default thread factory.
- */
-public class SuppressingInheritedAccessControlContextThreadFactory implements ThreadFactory
-{
- private final ThreadFactory _defaultThreadFactory = Executors.defaultThreadFactory();
-
- @Override
- public Thread newThread(final Runnable runnable)
- {
- return Subject.doAsPrivileged(null, new PrivilegedAction<Thread>()
- {
- @Override
- public Thread run()
- {
- return _defaultThreadFactory.newThread(runnable);
- }
- }, null);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/properties/ConnectionStartProperties.java b/qpid/java/common/src/main/java/org/apache/qpid/properties/ConnectionStartProperties.java
deleted file mode 100644
index 3569b4b460..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/properties/ConnectionStartProperties.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid.properties;
-
-import org.apache.qpid.transport.util.Logger;
-import org.apache.qpid.util.SystemUtils;
-
-/**
- * Constants for the various properties clients can
- * set values for during the ConnectionStartOk reply.
- */
-public class ConnectionStartProperties
-{
- private static final Logger LOGGER = Logger.get(ConnectionStartProperties.class);
-
- /**
- * Used for 0-8/0-9/0-9-1 connections to choose to close
- * the connection when a transactional session receives a 'mandatory' message which
- * can't be routed rather than returning the message.
- */
- public static final String QPID_CLOSE_WHEN_NO_ROUTE = "qpid.close_when_no_route";
-
- public static final String QPID_MESSAGE_COMPRESSION_SUPPORTED = "qpid.message_compression_supported";
-
-
- public static final String CLIENT_ID_0_10 = "clientName";
- public static final String CLIENT_ID_0_8 = "instance";
-
- public static final String VERSION_0_8 = "version";
- public static final String VERSION_0_10 = "qpid.client_version";
-
- public static final String PROCESS = "qpid.client_process";
-
- public static final String PID = "qpid.client_pid";
-
- public static final String PLATFORM = "platform";
-
- public static final String PRODUCT ="product";
-
- public static final String SESSION_FLOW = "qpid.session_flow";
-
- public static final String QPID_CONFIRMED_PUBLISH_SUPPORTED = "qpid.confirmed_publish_supported";
-
- public static final int _pid;
-
- public static final String _platformInfo;
-
- static
- {
-
- _pid = SystemUtils.getProcessPidAsInt();
-
- if (_pid == -1)
- {
- LOGGER.warn("Unable to get the process's PID");
- }
-
- StringBuilder fullSystemInfo = new StringBuilder(System.getProperty("java.runtime.name"));
- fullSystemInfo.append(", ");
- fullSystemInfo.append(System.getProperty("java.runtime.version"));
- fullSystemInfo.append(", ");
- fullSystemInfo.append(System.getProperty("java.vendor"));
- fullSystemInfo.append(", ");
- fullSystemInfo.append(SystemUtils.getOSArch());
- fullSystemInfo.append(", ");
- fullSystemInfo.append(SystemUtils.getOSName());
- fullSystemInfo.append(", ");
- fullSystemInfo.append(SystemUtils.getOSVersion());
- fullSystemInfo.append(", ");
- fullSystemInfo.append(System.getProperty("sun.os.patch.level"));
-
- _platformInfo = fullSystemInfo.toString();
- }
-
- public static int getPID()
- {
- return _pid;
- }
-
- public static String getPlatformInfo()
- {
- return _platformInfo;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQConstant.java b/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQConstant.java
deleted file mode 100644
index 5e39409382..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQConstant.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.protocol;
-
-import org.apache.qpid.framing.AMQShortString;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 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.
- * <p>
- * 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?
- * <p>
- * TODO 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.
- */
-public final class AMQConstant
-{
- /** Defines a map from codes to constants. */
- private static Map<Integer, AMQConstant> _codeMap = new HashMap<Integer, AMQConstant>();
-
- /** Indicates that the method completed successfully. */
- public static final AMQConstant REPLY_SUCCESS = new AMQConstant(200, "reply success", true);
-
- public static final AMQConstant FRAME_END = new AMQConstant(206, "frame end", true);
-
- /**
- * 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.
- */
- public static final AMQConstant NOT_DELIVERED = new AMQConstant(310, "not delivered", true);
-
- /**
- * The client attempted to transfer content larger than the server could accept at the present time. The client
- * may retry at a later time.
- */
- public static final AMQConstant MESSAGE_TOO_LARGE = new AMQConstant(311, "message too large", true);
-
- /**
- * 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.
- */
- public static final AMQConstant NO_ROUTE = new AMQConstant(312, "no route", true);
-
- /**
- * 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.
- */
- public static final AMQConstant NO_CONSUMERS = new AMQConstant(313, "no consumers", true);
-
- /**
- * An operator intervened to close the connection for some reason. The client may retry at some later date.
- */
- public static final AMQConstant CONNECTION_FORCED = new AMQConstant(320, "connection forced", true);
-
- /** The client tried to work with an unknown virtual host or cluster. */
- public static final AMQConstant INVALID_PATH = new AMQConstant(402, "invalid path", true);
-
- /** The client attempted to work with a server entity to which it has no access due to security settings. */
- public static final AMQConstant ACCESS_REFUSED = new AMQConstant(403, "access refused", true);
-
- /** The client attempted to work with a server entity that does not exist. */
- public static final AMQConstant NOT_FOUND = new AMQConstant(404, "not found", true);
-
- /**
- * The client attempted to work with a server entity to which it has no access because another client is
- * working with it.
- */
- public static final AMQConstant ALREADY_EXISTS = new AMQConstant(405, "Already exists", true);
-
- /** The client requested a method that was not allowed because some precondition failed. */
- public static final AMQConstant IN_USE = new AMQConstant(406, "In use", true);
-
- public static final AMQConstant INVALID_ROUTING_KEY = new AMQConstant(407, "routing key invalid", true);
-
- public static final AMQConstant REQUEST_TIMEOUT = new AMQConstant(408, "Request Timeout", true);
-
- public static final AMQConstant ARGUMENT_INVALID = new AMQConstant(409, "argument invalid", true);
-
- /**
- * The client sent a malformed frame that the server could not decode. This strongly implies a programming error
- * in the client.
- */
- public static final AMQConstant FRAME_ERROR = new AMQConstant(501, "frame error", true);
-
- /**
- * The client sent a frame that contained illegal values for one or more fields. This strongly implies a
- * programming error in the client.
- */
- public static final AMQConstant SYNTAX_ERROR = new AMQConstant(502, "syntax error", true);
-
- /**
- * 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.
- */
- public static final AMQConstant COMMAND_INVALID = new AMQConstant(503, "command invalid", true);
-
- /**
- * The client attempted to work with a channel that had not been correctly opened. This most likely indicates a
- * fault in the client layer.
- */
- public static final AMQConstant CHANNEL_ERROR = new AMQConstant(504, "channel error", true);
-
- /**
- * 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.
- */
- public static final AMQConstant RESOURCE_ERROR = new AMQConstant(506, "resource error", true);
-
- /**
- * 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.
- */
- public static final AMQConstant NOT_ALLOWED = new AMQConstant(530, "not allowed", true);
-
- /** The client tried to use functionality that is not implemented in the server. */
- public static final AMQConstant NOT_IMPLEMENTED = new AMQConstant(540, "not implemented", true);
-
- /**
- * 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.
- */
- public static final AMQConstant INTERNAL_ERROR = new AMQConstant(541, "internal error", true);
-
- public static final AMQConstant FRAME_MIN_SIZE = new AMQConstant(4096, "frame min size", true);
-
- public static final AMQConstant INVALID_ARGUMENT = new AMQConstant(542, "invalid argument", true);
- /**
- * The client imp does not support the protocol version
- */
- public static final AMQConstant UNSUPPORTED_CLIENT_PROTOCOL_ERROR = new AMQConstant(543, "client unsupported protocol", true);
-
- /** The AMQP status code. */
- private int _code;
-
- /** A short description of the status code. */
- private AMQShortString _name;
-
- /**
- * Creates a new AMQP status code.
- *
- * @param code The code.
- * @param name A short description of the code.
- * @param map <tt>true</tt> to register the code as a known code, <tt>false</tt> otherwise.
- */
- private AMQConstant(int code, String name, boolean map)
- {
- _code = code;
- _name = new AMQShortString(name);
- if (map)
- {
- _codeMap.put(Integer.valueOf(code), this);
- }
- }
-
- /**
- * 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.
- *
- * @param code The AMQP status code.
- *
- * @return The AMQP status code encapsulated as a constant.
- */
- public static AMQConstant getConstant(int code)
- {
- AMQConstant c = _codeMap.get(Integer.valueOf(code));
- if (c == null)
- {
- c = new AMQConstant(code, "unknown code", false);
- }
-
- return c;
- }
-
- /**
- * Gets the underlying AMQP status code.
- *
- * @return The AMQP status code.
- */
- public int getCode()
- {
- return _code;
- }
-
- /**
- * Gets a short description of the status code.
- *
- * @return A short description of the status code.
- */
- public AMQShortString getName()
- {
- return _name;
- }
-
- /**
- * Renders the constant as a string, mainly for debugging purposes.
- *
- * @return The status code and its description.
- */
- public String toString()
- {
- return _code + ": " + _name;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQMethodEvent.java b/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQMethodEvent.java
deleted file mode 100644
index 9b38f7926b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQMethodEvent.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.protocol;
-
-import org.apache.qpid.framing.AMQMethodBody;
-
-/**
- * AMQMethodEvent encapsulates an AMQP method call, and the channel on which that method call occurred.
- *
- * <p>Supplies the:
- * <ul>
- * <li>channel id</li>
- * <li>protocol method</li>
- * </ul>
- *
- * <p>As the event contains the context in which it occurred, event listeners do not need to be statefull.
- * to listeners. Events are often handled by {@link AMQMethodListener}s.
- */
-public class AMQMethodEvent<M extends AMQMethodBody>
-{
- /** Holds the method call. */
- private final M _method;
-
- /** Holds the channel handle for the method call. */
- private final int _channelId;
-
- /**
- * Creates a method event to encasulate a method call and channel.
- *
- * @param channelId The channel on which the method call occurred.
- * @param method The method call.
- */
- public AMQMethodEvent(int channelId, M method)
- {
- _channelId = channelId;
- _method = method;
- }
-
- /**
- * Gets the method call.
- *
- * @return The method call.
- */
- public M getMethod()
- {
- return _method;
- }
-
- /**
- * Gets the channel handle for the method call.
- *
- * @return The channel handle for the method call.
- */
- public int getChannelId()
- {
- return _channelId;
- }
-
- /**
- * Prints the method call as a string, mainly for debugging purposes.
- *
- * @return The method call as a string, mainly for debugging purposes.
- */
- public String toString()
- {
- StringBuilder buf = new StringBuilder("Method event: ");
- buf.append("\nChannel id: ").append(_channelId);
- buf.append("\nMethod: ").append(_method);
-
- return buf.toString();
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQMethodListener.java b/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQMethodListener.java
deleted file mode 100644
index 3e7c67493d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQMethodListener.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.protocol;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQMethodBody;
-
-/**
- * AMQMethodListener is a listener that receives notifications of AMQP methods. The methods are packaged as events in
- * {@link AMQMethodEvent}.
- *
- * <p>An event listener may be associated with a particular context, usually an AMQP channel, and in addition to
- * receiving method events will be notified of errors on that context. This enables listeners to perform any clean
- * up that they need to do before the context is closed or retried.
- * <p>
- * TODO Document why the exception is passed to the error method. Is it so that the exception can be passed
- * from the event handling thread to another thread and rethown from there? It is unusual to pass exceptions as
- * method arguments, because they have their own mechanism for propagating through the call stack, so some
- * explanation ought to be provided.
- */
-public interface AMQMethodListener
-{
- /**
- * Notifies the listener that an AMQP method event has occurred.
- *
- * @param evt The AMQP method event (contains the method and channel).
- *
- * @return true if the handler processes the method frame, false otherwise. Note that this does
- * not prohibit the method event being delivered to subsequent listeners but can be used to determine if
- * nobody has dealt with an incoming method frame.
- *
- * @throws AMQException if an error has occurred. This exception may be delivered to all registered listeners using
- * the error() method (see below) allowing them to perform cleanup if necessary.
- * <p>
- * TODO Consider narrowing the exception.
- */
- <B extends AMQMethodBody> boolean methodReceived(AMQMethodEvent<B> evt) throws AMQException;
-
- /**
- * Notifies the listener of an error on the event context to which it is listening. The listener should perform
- * any necessary clean-up for the context.
- *
- * @param e The underlying exception that is the source of the error.
- */
- void error(Exception e);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java b/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java
deleted file mode 100644
index 0a050becdc..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.protocol;
-
-import org.apache.qpid.framing.AMQDataBlock;
-
-/**
- * AMQProtocolWriter provides a method to write a frame of data 'to the wire', in the context of the object
- * that implements the method, usually some sort of session. The block of data, encapsulated by {@link AMQDataBlock},
- * will be encoded as it is written.
- */
-public interface AMQProtocolWriter
-{
- /**
- * Writes a frame to the wire, encoding it as necessary, for example, into a sequence of bytes.
- *
- * @param frame The frame to be encoded and written.
- */
- public void writeFrame(AMQDataBlock frame);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQVersionAwareProtocolSession.java b/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQVersionAwareProtocolSession.java
deleted file mode 100644
index 73c8653677..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/protocol/AMQVersionAwareProtocolSession.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.protocol;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.HeartbeatBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.transport.ByteBufferSender;
-
-
-/**
- * AMQVersionAwareProtocolSession is implemented by all AMQP session classes, that need to provide an awareness to
- * callers of the version of the AMQP protocol that they are able to work with.
- * <p>
- * TODO Why is this a seperate interface to {@link ProtocolVersionAware}, could they be combined into a single
- * interface and one of them eliminated? Move getRegistry method to ProtocolVersionAware, make the sessions
- * implement AMQProtocolWriter directly and drop this interface.
- */
-public interface AMQVersionAwareProtocolSession extends AMQProtocolWriter, ProtocolVersionAware
-{
- /**
- * Gets the method registry for a specific version of the AMQP.
- *
- * @return The method registry for a specific version of the AMQP.
- */
-
- MethodRegistry getMethodRegistry();
-
-
- public void methodFrameReceived(int channelId, AMQMethodBody body) throws AMQException;
- public void contentHeaderReceived(int channelId, ContentHeaderBody body) throws AMQException;
- public void contentBodyReceived(int channelId, ContentBody body) throws AMQException;
- public void heartbeatBodyReceived(int channelId, HeartbeatBody body) throws AMQException;
-
-
- public void setSender(ByteBufferSender sender);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolEngine.java b/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolEngine.java
deleted file mode 100644
index f73f6d931a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolEngine.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.protocol;
-
-import java.net.SocketAddress;
-
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.network.NetworkConnection;
-import org.apache.qpid.transport.network.TransportActivity;
-
-/**
- * A ProtocolEngine is a Receiver for java.nio.ByteBuffers. It takes the data passed to it in the received
- * decodes it and then process the result.
- */
-public interface ProtocolEngine extends ByteBufferReceiver, TransportActivity
-{
- // Returns the remote address of the NetworkDriver
- SocketAddress getRemoteAddress();
-
- // Returns the local address of the NetworkDriver
- SocketAddress getLocalAddress();
-
- // Returns number of bytes written
- long getWrittenBytes();
-
- // Returns number of bytes read
- long getReadBytes();
-
- // Called by the NetworkDriver when the socket has been closed for reading
- void closed();
-
- // Called when the NetworkEngine has not written data for the specified period of time (will trigger a
- // heartbeat)
- void writerIdle();
-
- // Called when the NetworkEngine has not read data for the specified period of time (will close the connection)
- void readerIdle();
-
- void encryptedTransport();
-
- public void setNetworkConnection(NetworkConnection network, ByteBufferSender sender);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolEngineFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolEngineFactory.java
deleted file mode 100644
index 50448f1fe1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolEngineFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.protocol;
-
-import java.net.SocketAddress;
-
-public interface ProtocolEngineFactory
-{
-
- // Returns a new instance of a ProtocolEngine
- ProtocolEngine newProtocolEngine(final SocketAddress remoteSocketAddress);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolVersionAware.java b/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolVersionAware.java
deleted file mode 100644
index f12cd9af8e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/protocol/ProtocolVersionAware.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.protocol;
-
-import org.apache.qpid.framing.ProtocolVersion;
-
-/**
- * ProtocolVersionAware is implemented by all AMQP handling classes, that need to provide an awareness to callers of
- * the version of the AMQP protocol that they are able to handle.
- */
-public interface ProtocolVersionAware
-{
- /**
- * @deprecated
- * Reports the AMQP minor version, that the implementer can handle.
- *
- * @return The AMQP minor version.
- */
- public byte getProtocolMinorVersion();
-
- /**
- * @deprecated
- * Reports the AMQP major version, that the implementer can handle.
- *
- * @return The AMQP major version.
- */
- public byte getProtocolMajorVersion();
-
- public ProtocolVersion getProtocolVersion();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java
deleted file mode 100644
index e9dec362a6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.ssl;
-
-import org.apache.qpid.transport.network.security.ssl.QpidClientX509KeyManager;
-import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager;
-import org.apache.qpid.transport.network.security.ssl.SSLUtil;
-
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * Factory used to create SSLContexts. SSL needs to be configured
- * before this will work.
- *
- */
-public class SSLContextFactory
-{
- public static final String TRANSPORT_LAYER_SECURITY_CODE = "TLS";
-
- private SSLContextFactory()
- {
- //no instances
- }
-
- public static SSLContext buildClientContext(final String trustStorePath,
- final String trustStorePassword, final String trustStoreType,
- final String trustManagerFactoryAlgorithm, final String keyStorePath,
- final String keyStorePassword, final String keyStoreType,
- final String keyManagerFactoryAlgorithm, final String certAlias)
- throws GeneralSecurityException, IOException
- {
- return buildContext(trustStorePath,
- trustStorePassword,
- trustStoreType,
- trustManagerFactoryAlgorithm,
- keyStorePath,
- keyStorePassword,
- keyStoreType,
- keyManagerFactoryAlgorithm,
- certAlias);
- }
-
- private static SSLContext buildContext(String trustStorePath,
- String trustStorePassword,
- String trustStoreType,
- String trustManagerFactoryAlgorithm,
- String keyStorePath,
- String keyStorePassword,
- String keyStoreType,
- String keyManagerFactoryAlgorithm, String certAlias)
- throws GeneralSecurityException, IOException
- {
- // Initialize the SSLContext to work with our key managers.
- final SSLContext sslContext = SSLContext
- .getInstance(TRANSPORT_LAYER_SECURITY_CODE);
-
- final TrustManager[] trustManagers;
- final KeyManager[] keyManagers;
-
- if (trustStorePath != null)
- {
- final KeyStore ts = SSLUtil.getInitializedKeyStore(trustStorePath,
- trustStorePassword, trustStoreType);
- final TrustManagerFactory tmf = TrustManagerFactory
- .getInstance(trustManagerFactoryAlgorithm);
- tmf.init(ts);
-
- trustManagers = tmf.getTrustManagers();
- }
- else
- {
- trustManagers = null;
- }
-
- if (keyStorePath != null)
- {
- if (certAlias != null)
- {
- keyManagers = new KeyManager[] { new QpidClientX509KeyManager(
- certAlias, keyStorePath, keyStoreType, keyStorePassword,
- keyManagerFactoryAlgorithm) };
- }
- else
- {
- final KeyStore ks = SSLUtil.getInitializedKeyStore(
- keyStorePath, keyStorePassword, keyStoreType);
-
- char[] keyStoreCharPassword = keyStorePassword == null ? null : keyStorePassword.toCharArray();
- // Set up key manager factory to use our key store
- final KeyManagerFactory kmf = KeyManagerFactory
- .getInstance(keyManagerFactoryAlgorithm);
- kmf.init(ks, keyStoreCharPassword);
- keyManagers = kmf.getKeyManagers();
- }
- }
- else
- {
- keyManagers = null;
- }
-
- sslContext.init(keyManagers, trustManagers, null);
-
- return sslContext;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/thread/DefaultThreadFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/thread/DefaultThreadFactory.java
deleted file mode 100644
index a96dac4109..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/thread/DefaultThreadFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.thread;
-
-
-
-public class DefaultThreadFactory implements ThreadFactory
-{
-
- private final LoggingUncaughtExceptionHandler _loggingUncaughtExceptionHandler = new LoggingUncaughtExceptionHandler();
-
- public Thread createThread(Runnable r)
- {
- Thread t = new Thread(r);
- t.setUncaughtExceptionHandler(_loggingUncaughtExceptionHandler);
- return t;
- }
-
- public Thread createThread(Runnable r, int priority)
- {
- Thread t = createThread(r);
- t.setPriority(priority);
- return t;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/thread/LoggingUncaughtExceptionHandler.java b/qpid/java/common/src/main/java/org/apache/qpid/thread/LoggingUncaughtExceptionHandler.java
deleted file mode 100644
index 58d80454b7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/thread/LoggingUncaughtExceptionHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.thread;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.Thread.UncaughtExceptionHandler;
-
-/**
- *
- * An {@link UncaughtExceptionHandler} that writes the exception to the application log via
- * the SLF4J framework. Once registered with {@link Thread#setUncaughtExceptionHandler(UncaughtExceptionHandler)}
- * it will be invoked by the JVM when a thread has been <i>abruptly</i> terminated due to an uncaught exception.
- * Owing to the contract of {@link Runnable#run()}, the only possible exception types which can cause such a termination
- * are instances of {@link RuntimeException} and {@link Error}. These exceptions are catastrophic and the client must
- * restart the JVM.
- * <p>
- * The implementation also invokes {@link ThreadGroup#uncaughtException(Thread, Throwable)}. This
- * is done to retain compatibility with any monitoring solutions (for example, log scraping of
- * standard error) that existing users of older Qpid client libraries may have in place.
- *
- */
-public class LoggingUncaughtExceptionHandler implements UncaughtExceptionHandler
-{
- private static final Logger _logger = LoggerFactory.getLogger(LoggingUncaughtExceptionHandler.class);
-
- @Override
- public void uncaughtException(Thread t, Throwable e)
- {
- try
- {
- _logger.error("Uncaught exception in thread \"{}\"", t.getName(), e);
- }
- finally
- {
- // Invoke the thread group's handler too for compatibility with any
- // existing clients who are already scraping stderr for such conditions.
- t.getThreadGroup().uncaughtException(t, e);
- }
- }
-} \ No newline at end of file
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/thread/QpidThreadExecutor.java b/qpid/java/common/src/main/java/org/apache/qpid/thread/QpidThreadExecutor.java
deleted file mode 100644
index 06f5e6b835..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/thread/QpidThreadExecutor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.thread;
-
-import java.util.concurrent.Executor;
-
-public class QpidThreadExecutor implements Executor
-{
- public void execute(Runnable command)
- {
- try
- {
- Threading.getThreadFactory().createThread(command).start();
- }
- catch(Exception e)
- {
- throw new RuntimeException("Error creating a thread using Qpid thread factory",e);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/thread/RealtimeThreadFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/thread/RealtimeThreadFactory.java
deleted file mode 100644
index 631ee98b94..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/thread/RealtimeThreadFactory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.thread;
-
-
-import java.lang.reflect.Constructor;
-
-public class RealtimeThreadFactory implements ThreadFactory
-{
- private final LoggingUncaughtExceptionHandler _loggingUncaughtExceptionHandler = new LoggingUncaughtExceptionHandler();
-
- private Class threadClass;
- private Constructor threadConstructor;
- private Constructor priorityParameterConstructor;
- private int defaultRTThreadPriority = 20;
-
- public RealtimeThreadFactory() throws Exception
- {
- defaultRTThreadPriority = Integer.getInteger("qpid.rt_thread_priority",20);
- threadClass = Class.forName("javax.realtime.RealtimeThread");
-
- Class schedulingParametersClass = Class.forName("javax.realtime.SchedulingParameters");
- Class releaseParametersClass = Class.forName("javax.realtime.ReleaseParameters");
- Class memoryParametersClass = Class.forName("javax.realtime.MemoryParameters");
- Class memoryAreaClass = Class.forName("javax.realtime.MemoryArea");
- Class processingGroupParametersClass = Class.forName("javax.realtime.ProcessingGroupParameters");
-
- Class[] paramTypes = new Class[]{schedulingParametersClass,
- releaseParametersClass,
- memoryParametersClass,
- memoryAreaClass,
- processingGroupParametersClass,
- java.lang.Runnable.class};
-
- threadConstructor = threadClass.getConstructor(paramTypes);
-
- Class priorityParameterClass = Class.forName("javax.realtime.PriorityParameters");
- priorityParameterConstructor = priorityParameterClass.getConstructor(new Class[]{int.class});
- }
-
- public Thread createThread(Runnable r) throws Exception
- {
- return createThread(r,defaultRTThreadPriority);
- }
-
- public Thread createThread(Runnable r, int priority) throws Exception
- {
- Object priorityParams = priorityParameterConstructor.newInstance(priority);
- Thread thread = (Thread)threadConstructor.newInstance(priorityParams,null,null,null,null,r);
- thread.setUncaughtExceptionHandler(_loggingUncaughtExceptionHandler);
- return thread;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/thread/ThreadFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/thread/ThreadFactory.java
deleted file mode 100644
index c8f1cbfcba..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/thread/ThreadFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.thread;
-
-
-public interface ThreadFactory
-{
- public Thread createThread(Runnable r) throws Exception;
- public Thread createThread(Runnable r, int priority) throws Exception;
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/thread/Threading.java b/qpid/java/common/src/main/java/org/apache/qpid/thread/Threading.java
deleted file mode 100644
index d3ccc138dd..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/thread/Threading.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.thread;
-
-
-public final class Threading
-{
- private static ThreadFactory threadFactory;
-
- private Threading()
- {
- }
-
- static {
- try
- {
- Class threadFactoryClass =
- Class.forName(System.getProperty("qpid.thread_factory",
- "org.apache.qpid.thread.DefaultThreadFactory"));
-
- threadFactory = (ThreadFactory)threadFactoryClass.newInstance();
- }
- catch(Exception e)
- {
- throw new Error("Error occured while loading thread factory",e);
- }
- }
-
- public static ThreadFactory getThreadFactory()
- {
- return threadFactory;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Acquired.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Acquired.java
deleted file mode 100644
index 28e6e4c4e6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Acquired.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class Acquired extends Struct {
-
- public static final int TYPE = 1028;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet transfers;
-
-
- public Acquired() {}
-
-
- public Acquired(RangeSet transfers) {
- if(transfers != null) {
- setTransfers(transfers);
- }
-
- }
-
-
-
-
- public final boolean hasTransfers() {
- return (packing_flags & 256) != 0;
- }
-
- public final Acquired clearTransfers() {
- packing_flags &= ~256;
- this.transfers = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getTransfers() {
- return transfers;
- }
-
- public final Acquired setTransfers(RangeSet value) {
- this.transfers = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final Acquired transfers(RangeSet value) {
- return setTransfers(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.transfers);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.transfers = dec.readSequenceSet();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("transfers", getTransfers());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Binary.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Binary.java
deleted file mode 100644
index e3e6f81f7c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Binary.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import static org.apache.qpid.transport.util.Functions.str;
-
-import java.nio.ByteBuffer;
-
-
-/**
- * Binary
- *
- */
-
-public final class Binary
-{
-
- private byte[] bytes;
- private int offset;
- private int size;
- private int hash = 0;
-
- public Binary(byte[] bytes, int offset, int size)
- {
- if (offset + size > bytes.length)
- {
- throw new ArrayIndexOutOfBoundsException();
- }
-
- this.bytes = bytes;
- this.offset = offset;
- this.size = size;
- }
-
- public Binary(byte[] bytes)
- {
- this(bytes, 0, bytes.length);
- }
-
- public final byte[] getBytes()
- {
- byte[] result = new byte[size];
- System.arraycopy(bytes, offset, result, 0, size);
- return result;
- }
-
- public final byte[] array()
- {
- return bytes;
- }
-
- public final int offset()
- {
- return offset;
- }
-
- public final int size()
- {
- return size;
- }
-
- public final Binary slice(int low, int high)
- {
- int sz;
-
- if (high < 0)
- {
- sz = size + high;
- }
- else
- {
- sz = high - low;
- }
-
- if (sz < 0)
- {
- sz = 0;
- }
-
- return new Binary(bytes, offset + low, sz);
- }
-
- public final int hashCode()
- {
- if (hash == 0)
- {
- int hc = 0;
- for (int i = 0; i < size; i++)
- {
- hc = 31*hc + (0xFF & bytes[offset + i]);
- }
- hash = hc;
- }
-
- return hash;
- }
-
- public final boolean equals(Object o)
- {
- if (!(o instanceof Binary))
- {
- return false;
- }
-
- Binary buf = (Binary) o;
- if (this.size != buf.size)
- {
- return false;
- }
-
- for (int i = 0; i < size; i++)
- {
- if (bytes[offset + i] != buf.bytes[buf.offset + i])
- {
- return false;
- }
- }
-
- return true;
- }
-
- public String toString()
- {
- return str(ByteBuffer.wrap(bytes, offset, size));
- }
-
- public boolean hasExcessCapacity()
- {
- return size != bytes.length;
- }
-
- public Binary copy()
- {
- return new Binary(getBytes());
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Binding.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Binding.java
deleted file mode 100644
index f703c01567..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Binding.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * Binding
- *
- */
-
-public interface Binding<E>
-{
-
- E endpoint(ByteBufferSender sender);
-
- ByteBufferReceiver receiver(E endpoint);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ByteBufferReceiver.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ByteBufferReceiver.java
deleted file mode 100644
index 1015f061c8..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ByteBufferReceiver.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import java.nio.ByteBuffer;
-
-public interface ByteBufferReceiver
-{
- void received(ByteBuffer msg);
-
- void exception(Throwable t);
-
- void closed();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ByteBufferSender.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ByteBufferSender.java
deleted file mode 100644
index 7dcaf61a26..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ByteBufferSender.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import java.nio.ByteBuffer;
-
-public interface ByteBufferSender
-{
- void send(ByteBuffer msg);
-
- void flush();
-
- void close();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
deleted file mode 100644
index 7c4e264ade..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import static org.apache.qpid.transport.Connection.State.OPEN;
-import static org.apache.qpid.transport.Connection.State.RESUMING;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.security.sasl.SaslClient;
-import javax.security.sasl.SaslException;
-
-import org.apache.qpid.common.QpidProperties;
-import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.properties.ConnectionStartProperties;
-import org.apache.qpid.transport.util.Logger;
-
-
-/**
- * ClientDelegate
- *
- */
-
-public class ClientDelegate extends ConnectionDelegate
-{
- private static final Logger log = Logger.get(ClientDelegate.class);
-
-
-
- private final ConnectionSettings _connectionSettings;
-
- public ClientDelegate(ConnectionSettings settings)
- {
- _connectionSettings = settings;
- }
-
- public void init(Connection conn, ProtocolHeader hdr)
- {
- if (!(hdr.getMajor() == 0 && hdr.getMinor() == 10))
- {
- conn.exception(new ProtocolVersionException(hdr.getMajor(), hdr.getMinor()));
- }
- }
-
- @Override
- public void connectionStart(Connection conn, ConnectionStart start)
- {
- Map<String,Object> clientProperties = new HashMap<String,Object>();
-
- if(_connectionSettings.getClientProperties() != null)
- {
- clientProperties.putAll(_connectionSettings.getClientProperties());
- }
-
- clientProperties.put(ConnectionStartProperties.SESSION_FLOW, 1);
- clientProperties.put(ConnectionStartProperties.PID, ConnectionStartProperties.getPID());
- clientProperties.put(ConnectionStartProperties.PROCESS, System.getProperty(ClientProperties.PROCESS_NAME, "Qpid Java Client"));
- clientProperties.put(ConnectionStartProperties.VERSION_0_10, QpidProperties.getReleaseVersion());
- clientProperties.put(ConnectionStartProperties.PRODUCT, QpidProperties.getProductName());
- clientProperties.put(ConnectionStartProperties.PLATFORM, ConnectionStartProperties.getPlatformInfo());
-
- List<Object> brokerMechs = start.getMechanisms();
- if (brokerMechs == null || brokerMechs.isEmpty())
- {
- conn.connectionStartOk
- (clientProperties, null, null, conn.getLocale());
- return;
- }
- conn.setServerProperties(start.getServerProperties());
-
- try
- {
- final SaslClient sc = createSaslClient(brokerMechs);
-
- conn.setSaslClient(sc);
-
- byte[] response = sc.hasInitialResponse() ?
- sc.evaluateChallenge(new byte[0]) : null;
- conn.connectionStartOk
- (clientProperties, sc.getMechanismName(), response,
- conn.getLocale());
- }
- catch (ConnectionException ce)
- {
- conn.exception(ce);
- }
- catch (SaslException e)
- {
- conn.exception(e);
- }
- }
-
-
- protected SaslClient createSaslClient(List<Object> brokerMechs) throws ConnectionException, SaslException
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void connectionSecure(Connection conn, ConnectionSecure secure)
- {
- SaslClient sc = conn.getSaslClient();
- try
- {
- byte[] response = sc.evaluateChallenge(secure.getChallenge());
- conn.connectionSecureOk(response);
- }
- catch (SaslException e)
- {
- conn.exception(e);
- }
- }
-
- @Override
- public void connectionTune(Connection conn, ConnectionTune tune)
- {
- int heartbeatInterval = _connectionSettings.getHeartbeatInterval010();
- float heartbeatTimeoutFactor = _connectionSettings.getHeartbeatTimeoutFactor();
- int actualHeartbeatInterval = calculateHeartbeatInterval(heartbeatInterval,
- tune.getHeartbeatMin(),
- tune.getHeartbeatMax());
- int maxFrameSize = tune.getMaxFrameSize();
- int settingsMaxFrameSize = conn.getConnectionSettings().getMaxFrameSize();
- if(maxFrameSize == 0 && settingsMaxFrameSize != 0 && settingsMaxFrameSize < 0xffff)
- {
- maxFrameSize = Math.max(Constant.MIN_MAX_FRAME_SIZE, settingsMaxFrameSize);
- }
- else if(maxFrameSize != 0 && settingsMaxFrameSize != 0)
- {
- maxFrameSize = Math.max(Constant.MIN_MAX_FRAME_SIZE, Math.min(maxFrameSize, settingsMaxFrameSize));
- }
- conn.connectionTuneOk(tune.getChannelMax(),
- maxFrameSize,
- actualHeartbeatInterval);
-
- conn.getNetworkConnection().setMaxReadIdle((int)(actualHeartbeatInterval*heartbeatTimeoutFactor));
- conn.getNetworkConnection().setMaxWriteIdle(actualHeartbeatInterval);
- conn.setMaxFrameSize(maxFrameSize == 0 ? 0xffff : maxFrameSize);
-
- int channelMax = tune.getChannelMax();
- //0 means no implied limit, except available server resources
- //(or that forced by protocol limitations [0xFFFF])
- conn.setChannelMax(channelMax == 0 ? Connection.MAX_CHANNEL_MAX : channelMax);
-
- conn.connectionOpen(_connectionSettings.getVhost(), null, Option.INSIST);
- }
-
- @Override
- public void connectionOpenOk(Connection conn, ConnectionOpenOk ok)
- {
- if (conn.isConnectionResuming())
- {
- conn.setState(RESUMING);
- }
- else
- {
- conn.setState(OPEN);
- }
- }
-
- @Override
- public void connectionRedirect(Connection conn, ConnectionRedirect redir)
- {
- conn.setRedirecting(true);
- conn.getSender().close();
- for(ConnectionListener listener : conn.getListeners())
- {
- if(listener.redirect(redir.getHost(), redir.getKnownHosts()))
- {
- break;
- }
- }
- }
-
- @Override
- public void connectionHeartbeat(Connection conn, ConnectionHeartbeat hearbeat)
- {
- conn.connectionHeartbeat();
- }
-
- /**
- * Currently the spec specified the min and max for heartbeat using secs
- */
- int calculateHeartbeatInterval(int heartbeat,int min, int max)
- {
- int i = heartbeat;
- if (i == 0)
- {
- log.info("Heartbeat interval is 0 sec. Heartbeats are disabled.");
- return 0; // heartbeats are disabled.
- }
- else if (i >= min && i <= max)
- {
- return i;
- }
- else
- {
- log.info("The broker does not support the configured connection heartbeat interval of %s sec," +
- " using the brokers max supported value of %s sec instead.", i,max);
- return max;
- }
- }
-
- public ConnectionSettings getConnectionSettings()
- {
- return _connectionSettings;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java
deleted file mode 100644
index 59237f8c69..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java
+++ /dev/null
@@ -1,881 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import static org.apache.qpid.transport.Connection.State.CLOSED;
-import static org.apache.qpid.transport.Connection.State.CLOSING;
-import static org.apache.qpid.transport.Connection.State.NEW;
-import static org.apache.qpid.transport.Connection.State.OPEN;
-import static org.apache.qpid.transport.Connection.State.OPENING;
-
-import java.net.SocketAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.security.sasl.SaslClient;
-import javax.security.sasl.SaslServer;
-
-import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.properties.ConnectionStartProperties;
-import org.apache.qpid.transport.network.Assembler;
-import org.apache.qpid.transport.network.Disassembler;
-import org.apache.qpid.transport.network.InputHandler;
-import org.apache.qpid.transport.network.NetworkConnection;
-import org.apache.qpid.transport.network.OutgoingNetworkTransport;
-import org.apache.qpid.transport.network.Transport;
-import org.apache.qpid.transport.network.TransportActivity;
-import org.apache.qpid.transport.network.security.SecurityLayer;
-import org.apache.qpid.transport.network.security.SecurityLayerFactory;
-import org.apache.qpid.transport.util.Logger;
-import org.apache.qpid.transport.util.Waiter;
-import org.apache.qpid.util.Strings;
-
-
-/**
- * Connection
- *
- * @author Rafael H. Schloming
- *
- * TODO the channels map should probably be replaced with something
- * more efficient, e.g. an array or a map implementation that can use
- * short instead of Short
- */
-
-public class Connection extends ConnectionInvoker
- implements ProtocolEventReceiver, ProtocolEventSender
-{
-
- protected static final Logger log = Logger.get(Connection.class);
-
- //Usable channels are numbered 0 to <ChannelMax> - 1
- public static final int MAX_CHANNEL_MAX = 0xFFFF;
- public static final int MIN_USABLE_CHANNEL_NUM = 0;
- private long _lastSendTime;
- private long _lastReadTime;
- private NetworkConnection _networkConnection;
- private FrameSizeObserver _frameSizeObserver;
- private boolean _messageCompressionSupported;
- private final AtomicBoolean _redirecting = new AtomicBoolean();
-
- public enum State { NEW, CLOSED, OPENING, OPEN, CLOSING, CLOSE_RCVD, RESUMING }
-
- static class DefaultConnectionListener implements ConnectionListener
- {
- public void opened(Connection conn) {}
- public void exception(Connection conn, ConnectionException exception)
- {
- log.error(exception, "connection exception");
- }
- public void closed(Connection conn) {}
-
- @Override
- public boolean redirect(final String host, final List<Object> knownHosts)
- {
- return false;
- }
- }
-
- public static interface SessionFactory
- {
- Session newSession(Connection conn, Binary name, long expiry, boolean isNoReplay);
- }
-
- private static final class DefaultSessionFactory implements SessionFactory
- {
-
- public Session newSession(final Connection conn, final Binary name, final long expiry, final boolean isNoReplay)
- {
- return new Session(conn, name, expiry, isNoReplay);
- }
- }
-
- private static final SessionFactory DEFAULT_SESSION_FACTORY = new DefaultSessionFactory();
-
- private SessionFactory _sessionFactory = DEFAULT_SESSION_FACTORY;
-
- private ConnectionDelegate delegate;
- private ProtocolEventSender sender;
-
- final private Map<Binary,Session> sessions = new HashMap<Binary,Session>();
- final private Map<Integer,Session> channels = new ConcurrentHashMap<Integer,Session>();
-
- private State state = NEW;
- final private Object lock = new Object();
- private long timeout = 60000;
- private List<ConnectionListener> listeners = new ArrayList<ConnectionListener>();
- private ConnectionException error = null;
-
- private int channelMax = 1;
- private String locale;
- private SaslServer saslServer;
- private SaslClient saslClient;
- private int idleTimeout = 0;
- private Map<String,Object> _serverProperties;
- private String userID;
- private ConnectionSettings conSettings;
- private SecurityLayer securityLayer;
-
- private final AtomicBoolean connectionLost = new AtomicBoolean(false);
-
- private SocketAddress _remoteAddress;
- private SocketAddress _localAddress;
-
- public Connection() {}
-
- public void setConnectionDelegate(ConnectionDelegate delegate)
- {
- this.delegate = delegate;
- }
-
- public void addConnectionListener(ConnectionListener listener)
- {
- listeners.add(listener);
- }
-
- public List<ConnectionListener> getListeners()
- {
- return Collections.unmodifiableList(listeners);
- }
-
- public ProtocolEventSender getSender()
- {
- return sender;
- }
-
- public void setSender(ProtocolEventSender sender)
- {
- this.sender = sender;
- }
-
- protected void setState(State state)
- {
- synchronized (lock)
- {
- this.state = state;
- lock.notifyAll();
- }
- }
-
- void setLocale(String locale)
- {
- this.locale = locale;
- }
-
- String getLocale()
- {
- return locale;
- }
-
- void setSaslServer(SaslServer saslServer)
- {
- this.saslServer = saslServer;
- }
-
- SaslServer getSaslServer()
- {
- return saslServer;
- }
-
- void setSaslClient(SaslClient saslClient)
- {
- this.saslClient = saslClient;
- }
-
- public SaslClient getSaslClient()
- {
- return saslClient;
- }
-
- public void connect(String host, int port, String vhost, String username, String password, boolean ssl, String saslMechs)
- {
- connect(host, port, vhost, username, password, ssl, saslMechs, null);
- }
-
- public void connect(String host, int port, String vhost, String username, String password, boolean ssl, String saslMechs, Map<String,Object> clientProps)
- {
- ConnectionSettings settings = new ConnectionSettings();
- settings.setHost(host);
- settings.setPort(port);
- settings.setVhost(vhost);
- settings.setUsername(username);
- settings.setPassword(password);
- settings.setUseSSL(ssl);
- settings.setSaslMechs(saslMechs);
- settings.setClientProperties(clientProps);
- connect(settings);
- }
-
- public void connect(ConnectionSettings settings)
- {
-
- synchronized (lock)
- {
- conSettings = settings;
- _redirecting.set(false);
- state = OPENING;
- userID = settings.getUsername();
- connectionLost.set(false);
-
- securityLayer = SecurityLayerFactory.newInstance(getConnectionSettings());
-
- OutgoingNetworkTransport transport = Transport.getOutgoingTransportInstance(ProtocolVersion.v0_10);
- final InputHandler inputHandler = new InputHandler(new Assembler(this));
- addFrameSizeObserver(inputHandler);
- ByteBufferReceiver secureReceiver = securityLayer.receiver(inputHandler);
- if(secureReceiver instanceof ConnectionListener)
- {
- addConnectionListener((ConnectionListener)secureReceiver);
- }
-
- _networkConnection = transport.connect(settings, secureReceiver, new ConnectionActivity());
-
-
- setRemoteAddress(_networkConnection.getRemoteAddress());
- setLocalAddress(_networkConnection.getLocalAddress());
-
- final ByteBufferSender secureSender = securityLayer.sender(_networkConnection.getSender());
- if(secureSender instanceof ConnectionListener)
- {
- addConnectionListener((ConnectionListener)secureSender);
- }
- Disassembler disassembler = new Disassembler(secureSender, Constant.MIN_MAX_FRAME_SIZE);
- sender = disassembler;
- addFrameSizeObserver(disassembler);
-
- send(new ProtocolHeader(1, 0, 10));
-
- Waiter w = new Waiter(lock, timeout);
- while (w.hasTime() && ((state == OPENING && error == null) || isRedirecting()))
- {
- w.await();
- }
-
- if (error != null)
- {
- ConnectionException t = error;
- error = null;
- try
- {
- close();
- }
- catch (ConnectionException ce)
- {
- if (!(t instanceof ProtocolVersionException))
- {
- throw ce;
- }
- }
- t.rethrow();
- }
-
- switch (state)
- {
- case OPENING:
- close();
- throw new ConnectionException("connect() timed out");
- case OPEN:
- case RESUMING:
- connectionLost.set(false);
- break;
- case CLOSED:
- throw new ConnectionException("connect() aborted");
- default:
- throw new IllegalStateException(String.valueOf(state));
- }
- }
-
- for (ConnectionListener listener: listeners)
- {
- listener.opened(this);
- }
- }
-
- public Session createSession()
- {
- return createSession(0);
- }
-
- public Session createSession(long expiry)
- {
- return createSession(expiry, false);
- }
-
- public Session createSession(long expiry, boolean isNoReplay)
- {
- return createSession(UUID.randomUUID().toString(), expiry, isNoReplay);
- }
-
- public Session createSession(String name)
- {
- return createSession(name, 0);
- }
-
- public Session createSession(String name, long expiry)
- {
- return createSession(Strings.toUTF8(name), expiry);
- }
-
- public Session createSession(String name, long expiry,boolean isNoReplay)
- {
- return createSession(new Binary(Strings.toUTF8(name)), expiry, isNoReplay);
- }
-
- public Session createSession(byte[] name, long expiry)
- {
- return createSession(new Binary(name), expiry);
- }
-
- public Session createSession(Binary name, long expiry)
- {
- return createSession(name, expiry, false);
- }
-
- public Session createSession(Binary name, long expiry, boolean isNoReplay)
- {
- synchronized (lock)
- {
- Waiter w = new Waiter(lock, timeout);
- while (w.hasTime() && state != OPEN && error == null)
- {
- w.await();
- }
-
- if (state != OPEN)
- {
- throw new ConnectionException("Timed out waiting for connection to be ready. Current state is :" + state);
- }
-
- Session ssn = _sessionFactory.newSession(this, name, expiry, isNoReplay);
- registerSession(ssn);
- map(ssn);
- ssn.attach();
- return ssn;
- }
- }
-
- public void registerSession(Session ssn)
- {
- synchronized (lock)
- {
- sessions.put(ssn.getName(),ssn);
- }
- }
-
- public void removeSession(Session ssn)
- {
- synchronized (lock)
- {
- sessions.remove(ssn.getName());
- }
- }
-
- public void setSessionFactory(SessionFactory sessionFactory)
- {
- assert sessionFactory != null;
-
- _sessionFactory = sessionFactory;
- }
-
- public ConnectionDelegate getConnectionDelegate()
- {
- return delegate;
- }
-
- public void received(ProtocolEvent event)
- {
- _lastReadTime = System.currentTimeMillis();
- if(log.isDebugEnabled())
- {
- log.debug("RECV: [%s] %s", this, event);
- }
- event.delegate(this, delegate);
- }
-
- public void send(ProtocolEvent event)
- {
- _lastSendTime = System.currentTimeMillis();
- if(log.isDebugEnabled())
- {
- log.debug("SEND: [%s] %s", this, event);
- }
- ProtocolEventSender s = sender;
- if (s == null)
- {
- throw new ConnectionException("connection closed");
- }
- s.send(event);
- }
-
- public void flush()
- {
- if(log.isDebugEnabled())
- {
- log.debug("FLUSH: [%s]", this);
- }
- final ProtocolEventSender theSender = sender;
- if(theSender != null)
- {
- theSender.flush();
- }
- }
-
- protected void invoke(Method method)
- {
- method.setChannel(0);
- send(method);
- if (!method.isBatch())
- {
- flush();
- }
- }
-
- public void dispatch(Method method)
- {
- int channel = method.getChannel();
- Session ssn = getSession(channel);
- if(ssn != null)
- {
- ssn.received(method);
- }
- else
- {
- /*
- * A peer receiving any other control on a detached transport MUST discard it and
- * send a session.detached with the "not-attached" reason code.
- */
- if(log.isDebugEnabled())
- {
- log.debug("Control received on unattached channel : %d", channel);
- }
- invokeSessionDetached(channel, SessionDetachCode.NOT_ATTACHED);
- }
- }
-
- public int getChannelMax()
- {
- return channelMax;
- }
-
- void setChannelMax(int max)
- {
- channelMax = max;
- }
-
- private int map(Session ssn)
- {
- synchronized (lock)
- {
- //For a negotiated channelMax N, there are channels 0 to N-1 available.
- for (int i = 0; i < getChannelMax(); i++)
- {
- if (!channels.containsKey(i))
- {
- map(ssn, i);
- return i;
- }
- }
-
- throw new RuntimeException("no more channels available");
- }
- }
-
- void map(Session ssn, int channel)
- {
- synchronized (lock)
- {
- channels.put(channel, ssn);
- ssn.setChannel(channel);
- }
- }
-
- void unmap(Session ssn)
- {
- synchronized (lock)
- {
- channels.remove(ssn.getChannel());
- }
- }
-
- public Session getSession(int channel)
- {
- synchronized (lock)
- {
- return channels.get(channel);
- }
- }
-
- public void resume()
- {
- synchronized (lock)
- {
- for (Session ssn : sessions.values())
- {
- map(ssn);
- ssn.resume();
- }
-
- setState(OPEN);
- }
- }
-
- public void exception(ConnectionException e)
- {
- connectionLost.set(true);
- synchronized (lock)
- {
- switch (state)
- {
- case OPENING:
- case CLOSING:
- error = e;
- lock.notifyAll();
- return;
- }
- }
-
- for (ConnectionListener listener: listeners)
- {
- listener.exception(this, e);
- }
-
- }
-
- public void exception(Throwable t)
- {
- exception(new ConnectionException(t));
- }
-
- public void closeCode(ConnectionClose close)
- {
- synchronized (lock)
- {
- ConnectionCloseCode code = close.getReplyCode();
- if (code != ConnectionCloseCode.NORMAL)
- {
- exception(new ConnectionException(close));
- }
- }
- }
-
- public void closed()
- {
- if (state == OPEN)
- {
- exception(new ConnectionException("connection aborted"));
- }
-
- log.debug("connection closed: %s", this);
-
- synchronized (lock)
- {
- List<Session> values = new ArrayList<Session>(channels.values());
- for (Session ssn : values)
- {
- ssn.closed();
- }
-
- try
- {
- sender.close();
- }
- catch(Exception e)
- {
- // ignore.
- }
- sender = null;
- setState(CLOSED);
- }
-
- for (ConnectionListener listener: listeners)
- {
- listener.closed(this);
- }
- }
-
- public void close()
- {
- close(ConnectionCloseCode.NORMAL, null);
- }
-
-
- protected void sendConnectionClose(ConnectionCloseCode replyCode, String replyText, Option ... _options)
- {
- connectionClose(replyCode, replyText, _options);
- }
-
- public void close(ConnectionCloseCode replyCode, String replyText, Option ... _options)
- {
- synchronized (lock)
- {
- switch (state)
- {
- case OPEN:
- state = CLOSING;
- connectionClose(replyCode, replyText, _options);
- Waiter w = new Waiter(lock, timeout);
- while (w.hasTime() && state == CLOSING && error == null)
- {
- w.await();
- }
-
- if (error != null)
- {
- close(replyCode, replyText, _options);
- throw new ConnectionException(error);
- }
-
- switch (state)
- {
- case CLOSING:
- close(replyCode, replyText, _options);
- throw new ConnectionException("close() timed out");
- case CLOSED:
- break;
- default:
- throw new IllegalStateException(String.valueOf(state));
- }
- break;
- case CLOSED:
- break;
- default:
- if (sender != null)
- {
- sender.close();
- w = new Waiter(lock, timeout);
- while (w.hasTime() && sender != null && error == null)
- {
- w.await();
- }
-
- if (error != null)
- {
- throw new ConnectionException(error);
- }
-
- if (sender != null)
- {
- throw new ConnectionException("close() timed out");
- }
- }
- break;
- }
- }
- }
-
- public String getUserID()
- {
- return userID;
- }
-
- public void setUserID(String id)
- {
- userID = id;
- }
-
- public void setServerProperties(final Map<String, Object> serverProperties)
- {
- _serverProperties = serverProperties == null ? Collections.<String, Object>emptyMap() : serverProperties;
- _messageCompressionSupported = Boolean.parseBoolean(String.valueOf(_serverProperties.get(ConnectionStartProperties.QPID_MESSAGE_COMPRESSION_SUPPORTED)));
- }
-
- public Map<String, Object> getServerProperties()
- {
- return _serverProperties;
- }
-
- public String toString()
- {
- return String.format("conn:%x", System.identityHashCode(this));
- }
-
- public ConnectionSettings getConnectionSettings()
- {
- return conSettings;
- }
-
- public SecurityLayer getSecurityLayer()
- {
- return securityLayer;
- }
-
- public boolean isConnectionResuming()
- {
- return connectionLost.get();
- }
-
- protected boolean isConnectionLost()
- {
- return connectionLost.get();
- }
-
- protected Collection<Session> getChannels()
- {
- return new ArrayList<>(channels.values());
- }
-
- public boolean hasSessionWithName(final byte[] name)
- {
- return sessions.containsKey(new Binary(name));
- }
-
- public void notifyFailoverRequired()
- {
- for (Session ssn : getChannels())
- {
- ssn.notifyFailoverRequired();
- }
- }
-
- public SocketAddress getRemoteAddress()
- {
- return _remoteAddress;
- }
-
- public SocketAddress getLocalAddress()
- {
- return _localAddress;
- }
-
- protected void setRemoteAddress(SocketAddress remoteAddress)
- {
- _remoteAddress = remoteAddress;
- }
-
- protected void setLocalAddress(SocketAddress localAddress)
- {
- _localAddress = localAddress;
- }
-
-
- private void invokeSessionDetached(int channel, SessionDetachCode sessionDetachCode)
- {
- SessionDetached sessionDetached = new SessionDetached();
- sessionDetached.setChannel(channel);
- sessionDetached.setCode(sessionDetachCode);
- invoke(sessionDetached);
- }
-
-
- protected void doHeartBeat()
- {
- connectionHeartbeat();
- }
-
- private class ConnectionActivity implements TransportActivity
- {
- @Override
- public long getLastReadTime()
- {
- return _lastReadTime;
- }
-
- @Override
- public long getLastWriteTime()
- {
- return _lastSendTime;
- }
-
- @Override
- public void writerIdle()
- {
- getConnectionDelegate().writerIdle(Connection.this);
- connectionHeartbeat();
- }
-
- @Override
- public void readerIdle()
- {
- log.error("Closing connection as no heartbeat or other activity detected within specified interval");
- _networkConnection.close();
- }
- }
-
-
- public void setNetworkConnection(NetworkConnection network)
- {
- _networkConnection = network;
- }
-
- public NetworkConnection getNetworkConnection()
- {
- return _networkConnection;
- }
-
- public void setMaxFrameSize(final int maxFrameSize)
- {
- if(_frameSizeObserver != null)
- {
- _frameSizeObserver.setMaxFrameSize(maxFrameSize);
- }
- }
-
- public void addFrameSizeObserver(final FrameSizeObserver frameSizeObserver)
- {
- if(_frameSizeObserver == null)
- {
- _frameSizeObserver = frameSizeObserver;
- }
- else
- {
- final FrameSizeObserver currentObserver = _frameSizeObserver;
- _frameSizeObserver = new FrameSizeObserver()
- {
- @Override
- public void setMaxFrameSize(final int frameSize)
- {
- currentObserver.setMaxFrameSize(frameSize);
- frameSizeObserver.setMaxFrameSize(frameSize);
- }
- };
- }
- }
-
- public boolean isMessageCompressionSupported()
- {
- return _messageCompressionSupported;
- }
-
- public boolean isRedirecting()
- {
- return _redirecting.get();
- }
-
- public void setRedirecting(final boolean redirecting)
- {
- _redirecting.set(redirecting);
- }
-
- public boolean isClosing()
- {
- synchronized (lock)
- {
- return state == CLOSING || state == CLOSED;
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionClose.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionClose.java
deleted file mode 100644
index 8888f354d8..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionClose.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionClose extends Method {
-
- public static final int TYPE = 267;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private ConnectionCloseCode replyCode;
- private String replyText;
-
-
- public ConnectionClose() {}
-
-
- public ConnectionClose(ConnectionCloseCode replyCode, String replyText, Option ... _options) {
- if(replyCode != null) {
- setReplyCode(replyCode);
- }
- if(replyText != null) {
- setReplyText(replyText);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionClose(context, this);
- }
-
-
- public final boolean hasReplyCode() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionClose clearReplyCode() {
- packing_flags &= ~256;
- this.replyCode = null;
- setDirty(true);
- return this;
- }
-
- public final ConnectionCloseCode getReplyCode() {
- return replyCode;
- }
-
- public final ConnectionClose setReplyCode(ConnectionCloseCode value) {
- this.replyCode = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionClose replyCode(ConnectionCloseCode value) {
- return setReplyCode(value);
- }
-
- public final boolean hasReplyText() {
- return (packing_flags & 512) != 0;
- }
-
- public final ConnectionClose clearReplyText() {
- packing_flags &= ~512;
- this.replyText = null;
- setDirty(true);
- return this;
- }
-
- public final String getReplyText() {
- return replyText;
- }
-
- public final ConnectionClose setReplyText(String value) {
- this.replyText = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ConnectionClose replyText(String value) {
- return setReplyText(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint16(this.replyCode.getValue());
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.replyText);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.replyCode = ConnectionCloseCode.get(dec.readUint16());
- }
- if ((packing_flags & 512) != 0)
- {
- this.replyText = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("replyCode", getReplyCode());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("replyText", getReplyText());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionCloseCode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionCloseCode.java
deleted file mode 100644
index 18c5b257d2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionCloseCode.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum ConnectionCloseCode {
-
- NORMAL((int) 200),
- CONNECTION_FORCED((int) 320),
- INVALID_PATH((int) 402),
- FRAMING_ERROR((int) 501);
-
- private final int value;
-
- ConnectionCloseCode(int value)
- {
- this.value = value;
- }
-
- public int getValue()
- {
- return value;
- }
-
- public static ConnectionCloseCode get(int value)
- {
- switch (value)
- {
- case (int) 200: return NORMAL;
- case (int) 320: return CONNECTION_FORCED;
- case (int) 402: return INVALID_PATH;
- case (int) 501: return FRAMING_ERROR;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionCloseOk.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionCloseOk.java
deleted file mode 100644
index b954ac2162..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionCloseOk.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionCloseOk extends Method {
-
- public static final int TYPE = 268;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
-
-
-
-
- public ConnectionCloseOk(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionCloseOk(context, this);
- }
-
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionDelegate.java
deleted file mode 100644
index b3379890f3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionDelegate.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.transport.util.Logger;
-
-import static org.apache.qpid.transport.Connection.State.CLOSE_RCVD;
-
-
-/**
- * ConnectionDelegate
- *
- * @author Rafael H. Schloming
- */
-
-/**
- * Currently only implemented client specific methods
- * the server specific methods are dummy impls for testing
- *
- * the connectionClose is kind of different for both sides
- */
-public abstract class ConnectionDelegate
- extends MethodDelegate<Connection>
- implements ProtocolDelegate<Connection>
-{
-
- private static final Logger log = Logger.get(ConnectionDelegate.class);
-
- public void control(Connection conn, Method method)
- {
- method.dispatch(conn, this);
- }
-
- public void command(Connection conn, Method method)
- {
- method.dispatch(conn, this);
- }
-
- public void error(Connection conn, ProtocolError error)
- {
- conn.exception(new ConnectionException(error.getMessage()));
- }
-
- public void handle(Connection conn, Method method)
- {
- conn.dispatch(method);
- }
-
- @Override public void connectionHeartbeat(Connection conn, ConnectionHeartbeat hearbeat)
- {
- // do nothing
- }
-
- @Override public void connectionClose(Connection conn, ConnectionClose close)
- {
- sendConnectionCloseOkAndCloseSender(conn);
- conn.closeCode(close);
- conn.setState(CLOSE_RCVD);
- }
-
- protected void sendConnectionCloseOkAndCloseSender(Connection conn)
- {
- conn.connectionCloseOk();
- conn.getSender().close();
- }
-
- @Override public void connectionCloseOk(Connection conn, ConnectionCloseOk ok)
- {
- conn.getSender().close();
- }
-
- @Override public void sessionDetach(Connection conn, SessionDetach dtc)
- {
- Session ssn = conn.getSession(dtc.getChannel());
- ssn.sessionDetached(dtc.getName(), ssn.getDetachCode() == null? SessionDetachCode.NORMAL: ssn.getDetachCode());
- conn.unmap(ssn);
- ssn.closed();
- }
-
- @Override public void sessionDetached(Connection conn, SessionDetached dtc)
- {
- Session ssn = conn.getSession(dtc.getChannel());
- if (ssn != null)
- {
- ssn.setDetachCode(dtc.getCode());
- conn.unmap(ssn);
- ssn.closed();
- }
- }
-
- public void writerIdle(final Connection connection)
- {
- connection.doHeartBeat();
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionException.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionException.java
deleted file mode 100644
index 6d3972eb43..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionException.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * ConnectionException
- *
- */
-
-public class ConnectionException extends TransportException
-{
-
- private ConnectionClose close;
-
- public ConnectionException(String message, ConnectionClose close, Throwable cause)
- {
- super(message, cause);
- this.close = close;
- }
-
- public ConnectionException(String message)
- {
- this(message, null, null);
- }
-
- public ConnectionException(String message, Throwable cause)
- {
- this(message, null, cause);
- }
-
- public ConnectionException(Throwable cause)
- {
- this(cause.getMessage(), null, cause);
- }
-
- public ConnectionException(ConnectionClose close)
- {
- this(close.getReplyText(), close, null);
- }
-
- public ConnectionClose getClose()
- {
- return close;
- }
-
- @Override public void rethrow()
- {
- throw new ConnectionException(getMessage(), close, this);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionHeartbeat.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionHeartbeat.java
deleted file mode 100644
index 190bca0eaa..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionHeartbeat.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionHeartbeat extends Method {
-
- public static final int TYPE = 266;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
-
-
-
-
- public ConnectionHeartbeat(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionHeartbeat(context, this);
- }
-
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionInvoker.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionInvoker.java
deleted file mode 100644
index 29045e17de..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionInvoker.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.Map;
-
-public abstract class ConnectionInvoker {
-
- final void connectionStart(Map<String,Object> serverProperties, java.util.List<Object> mechanisms, java.util.List<Object> locales, Option ... _options) {
- invoke(new ConnectionStart(serverProperties, mechanisms, locales, _options));
- }
-
- final void connectionStartOk(Map<String,Object> clientProperties, String mechanism, byte[] response, String locale, Option ... _options) {
- invoke(new ConnectionStartOk(clientProperties, mechanism, response, locale, _options));
- }
-
- final void connectionSecure(byte[] challenge, Option ... _options) {
- invoke(new ConnectionSecure(challenge, _options));
- }
-
- final void connectionSecureOk(byte[] response, Option ... _options) {
- invoke(new ConnectionSecureOk(response, _options));
- }
-
- final void connectionTune(int channelMax, int maxFrameSize, int heartbeatMin, int heartbeatMax, Option ... _options) {
- invoke(new ConnectionTune(channelMax, maxFrameSize, heartbeatMin, heartbeatMax, _options));
- }
-
- final void connectionTuneOk(int channelMax, int maxFrameSize, int heartbeat, Option ... _options) {
- invoke(new ConnectionTuneOk(channelMax, maxFrameSize, heartbeat, _options));
- }
-
- final void connectionOpen(String virtualHost, java.util.List<Object> capabilities, Option ... _options) {
- invoke(new ConnectionOpen(virtualHost, capabilities, _options));
- }
-
- final void connectionOpenOk(java.util.List<Object> knownHosts, Option ... _options) {
- invoke(new ConnectionOpenOk(knownHosts, _options));
- }
-
- final void connectionRedirect(String host, java.util.List<Object> knownHosts, Option ... _options) {
- invoke(new ConnectionRedirect(host, knownHosts, _options));
- }
-
- final void connectionHeartbeat(Option ... _options) {
- invoke(new ConnectionHeartbeat(_options));
- }
-
- final void connectionClose(ConnectionCloseCode replyCode, String replyText, Option ... _options) {
- invoke(new ConnectionClose(replyCode, replyText, _options));
- }
-
- final void connectionCloseOk(Option ... _options) {
- invoke(new ConnectionCloseOk(_options));
- }
-
- protected abstract void invoke(Method method);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionListener.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionListener.java
deleted file mode 100644
index b055b9f5e1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-import java.util.List;
-
-/**
- * ConnectionListener
- *
- */
-
-public interface ConnectionListener
-{
-
- void opened(Connection connection);
-
- void exception(Connection connection, ConnectionException exception);
-
- void closed(Connection connection);
-
- boolean redirect(String host, List<Object> knownHosts);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionOpen.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionOpen.java
deleted file mode 100644
index b17a3810f2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionOpen.java
+++ /dev/null
@@ -1,235 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionOpen extends Method {
-
- public static final int TYPE = 263;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private String virtualHost;
- private java.util.List<Object> capabilities;
-
-
- public ConnectionOpen() {}
-
-
- public ConnectionOpen(String virtualHost, java.util.List<Object> capabilities, Option ... _options) {
- if(virtualHost != null) {
- setVirtualHost(virtualHost);
- }
- if(capabilities != null) {
- setCapabilities(capabilities);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case INSIST: packing_flags |= 1024; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionOpen(context, this);
- }
-
-
- public final boolean hasVirtualHost() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionOpen clearVirtualHost() {
- packing_flags &= ~256;
- this.virtualHost = null;
- setDirty(true);
- return this;
- }
-
- public final String getVirtualHost() {
- return virtualHost;
- }
-
- public final ConnectionOpen setVirtualHost(String value) {
- this.virtualHost = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionOpen virtualHost(String value) {
- return setVirtualHost(value);
- }
-
- public final boolean hasCapabilities() {
- return (packing_flags & 512) != 0;
- }
-
- public final ConnectionOpen clearCapabilities() {
- packing_flags &= ~512;
- this.capabilities = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.List<Object> getCapabilities() {
- return capabilities;
- }
-
- public final ConnectionOpen setCapabilities(java.util.List<Object> value) {
- this.capabilities = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ConnectionOpen capabilities(java.util.List<Object> value) {
- return setCapabilities(value);
- }
-
- public final boolean hasInsist() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ConnectionOpen clearInsist() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getInsist() {
- return hasInsist();
- }
-
- public final ConnectionOpen setInsist(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ConnectionOpen insist(boolean value) {
- return setInsist(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.virtualHost);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeArray(this.capabilities);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.virtualHost = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.capabilities = dec.readArray();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("virtualHost", getVirtualHost());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("capabilities", getCapabilities());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("insist", getInsist());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionOpenOk.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionOpenOk.java
deleted file mode 100644
index 0cbbba51bb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionOpenOk.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionOpenOk extends Method {
-
- public static final int TYPE = 264;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private java.util.List<Object> knownHosts;
-
-
- public ConnectionOpenOk() {}
-
-
- public ConnectionOpenOk(java.util.List<Object> knownHosts, Option ... _options) {
- if(knownHosts != null) {
- setKnownHosts(knownHosts);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionOpenOk(context, this);
- }
-
-
- public final boolean hasKnownHosts() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionOpenOk clearKnownHosts() {
- packing_flags &= ~256;
- this.knownHosts = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.List<Object> getKnownHosts() {
- return knownHosts;
- }
-
- public final ConnectionOpenOk setKnownHosts(java.util.List<Object> value) {
- this.knownHosts = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionOpenOk knownHosts(java.util.List<Object> value) {
- return setKnownHosts(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeArray(this.knownHosts);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.knownHosts = dec.readArray();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("knownHosts", getKnownHosts());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionRedirect.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionRedirect.java
deleted file mode 100644
index c84758c54c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionRedirect.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionRedirect extends Method {
-
- public static final int TYPE = 265;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private String host;
- private java.util.List<Object> knownHosts;
-
-
- public ConnectionRedirect() {}
-
-
- public ConnectionRedirect(String host, java.util.List<Object> knownHosts, Option ... _options) {
- if(host != null) {
- setHost(host);
- }
- if(knownHosts != null) {
- setKnownHosts(knownHosts);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionRedirect(context, this);
- }
-
-
- public final boolean hasHost() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionRedirect clearHost() {
- packing_flags &= ~256;
- this.host = null;
- setDirty(true);
- return this;
- }
-
- public final String getHost() {
- return host;
- }
-
- public final ConnectionRedirect setHost(String value) {
- this.host = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionRedirect host(String value) {
- return setHost(value);
- }
-
- public final boolean hasKnownHosts() {
- return (packing_flags & 512) != 0;
- }
-
- public final ConnectionRedirect clearKnownHosts() {
- packing_flags &= ~512;
- this.knownHosts = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.List<Object> getKnownHosts() {
- return knownHosts;
- }
-
- public final ConnectionRedirect setKnownHosts(java.util.List<Object> value) {
- this.knownHosts = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ConnectionRedirect knownHosts(java.util.List<Object> value) {
- return setKnownHosts(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr16(this.host);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeArray(this.knownHosts);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.host = dec.readStr16();
- }
- if ((packing_flags & 512) != 0)
- {
- this.knownHosts = dec.readArray();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("host", getHost());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("knownHosts", getKnownHosts());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSecure.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSecure.java
deleted file mode 100644
index 44fbac2b19..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSecure.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionSecure extends Method {
-
- public static final int TYPE = 259;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private byte[] challenge;
-
-
- public ConnectionSecure() {}
-
-
- public ConnectionSecure(byte[] challenge, Option ... _options) {
- if(challenge != null) {
- setChallenge(challenge);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionSecure(context, this);
- }
-
-
- public final boolean hasChallenge() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionSecure clearChallenge() {
- packing_flags &= ~256;
- this.challenge = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getChallenge() {
- return challenge;
- }
-
- public final ConnectionSecure setChallenge(byte[] value) {
- this.challenge = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionSecure challenge(byte[] value) {
- return setChallenge(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeVbin32(this.challenge);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.challenge = dec.readVbin32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("challenge", getChallenge());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSecureOk.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSecureOk.java
deleted file mode 100644
index 2a2b7df83a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSecureOk.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionSecureOk extends Method {
-
- public static final int TYPE = 260;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private byte[] response;
-
-
- public ConnectionSecureOk() {}
-
-
- public ConnectionSecureOk(byte[] response, Option ... _options) {
- if(response != null) {
- setResponse(response);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionSecureOk(context, this);
- }
-
-
- public final boolean hasResponse() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionSecureOk clearResponse() {
- packing_flags &= ~256;
- this.response = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getResponse() {
- return response;
- }
-
- public final ConnectionSecureOk setResponse(byte[] value) {
- this.response = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionSecureOk response(byte[] value) {
- return setResponse(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeVbin32(this.response);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.response = dec.readVbin32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("response", getResponse());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java
deleted file mode 100644
index 7f7799bd45..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import static org.apache.qpid.configuration.ClientProperties.AMQJ_HEARTBEAT_DELAY;
-import static org.apache.qpid.configuration.ClientProperties.AMQJ_HEARTBEAT_TIMEOUT_FACTOR;
-import static org.apache.qpid.configuration.ClientProperties.IDLE_TIMEOUT_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.QPID_HEARTBEAT_INTERVAL;
-import static org.apache.qpid.configuration.ClientProperties.QPID_HEARTBEAT_INTERVAL_010_DEFAULT;
-import static org.apache.qpid.configuration.ClientProperties.QPID_HEARTBEAT_TIMEOUT_FACTOR;
-import static org.apache.qpid.configuration.ClientProperties.QPID_HEARTBEAT_TIMEOUT_FACTOR_DEFAULT;
-import static org.apache.qpid.configuration.ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.QPID_SSL_KEY_MANAGER_FACTORY_ALGORITHM_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.QPID_SSL_KEY_STORE_CERT_TYPE_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.QPID_SSL_TRUST_MANAGER_FACTORY_ALGORITHM_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.QPID_SSL_TRUST_STORE_CERT_TYPE_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.QPID_TCP_NODELAY_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.RECEIVE_BUFFER_SIZE_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.SEND_BUFFER_SIZE_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME;
-import static org.apache.qpid.configuration.ClientProperties.LEGACY_SEND_BUFFER_SIZE_PROP_NAME;
-
-import java.security.KeyStore;
-import java.util.Map;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.TrustManagerFactory;
-
-import org.apache.qpid.configuration.QpidProperty;
-
-
-/**
- * A ConnectionSettings object can only be associated with
- * one Connection object. I have added an assertion that will
- * throw an exception if it is used by more than on Connection
- *
- */
-public class ConnectionSettings
-{
- public static final String WILDCARD_ADDRESS = "*";
-
-
- private String protocol = "tcp";
- private String host = "localhost";
- private String vhost;
- private String username;
- private String password;
- private int port = 5672;
- private boolean tcpNodelay = QpidProperty.booleanProperty(Boolean.TRUE, QPID_TCP_NODELAY_PROP_NAME, AMQJ_TCP_NODELAY_PROP_NAME).get();
- private int maxChannelCount = 32767;
- private int maxFrameSize = 65535;
- private Integer hearbeatIntervalLegacyMs = QpidProperty.intProperty(null, IDLE_TIMEOUT_PROP_NAME).get();
- private Integer heartbeatInterval = QpidProperty.intProperty(null, QPID_HEARTBEAT_INTERVAL, AMQJ_HEARTBEAT_DELAY).get();
- private float heartbeatTimeoutFactor = QpidProperty.floatProperty(QPID_HEARTBEAT_TIMEOUT_FACTOR_DEFAULT, QPID_HEARTBEAT_TIMEOUT_FACTOR, AMQJ_HEARTBEAT_TIMEOUT_FACTOR).get();
- private int connectTimeout = 30000;
- private int readBufferSize = QpidProperty.intProperty(65535, RECEIVE_BUFFER_SIZE_PROP_NAME, LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME).get();
- private int writeBufferSize = QpidProperty.intProperty(65535, SEND_BUFFER_SIZE_PROP_NAME, LEGACY_SEND_BUFFER_SIZE_PROP_NAME).get();;
-
- // SSL props
- private boolean useSSL;
- private String keyStorePath = System.getProperty("javax.net.ssl.keyStore");
- private String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword");
- private String keyStoreType = System.getProperty("javax.net.ssl.keyStoreType",KeyStore.getDefaultType());
- private String keyManagerFactoryAlgorithm = QpidProperty.stringProperty(KeyManagerFactory.getDefaultAlgorithm(), QPID_SSL_KEY_MANAGER_FACTORY_ALGORITHM_PROP_NAME, QPID_SSL_KEY_STORE_CERT_TYPE_PROP_NAME).get();
- private String trustManagerFactoryAlgorithm = QpidProperty.stringProperty(TrustManagerFactory.getDefaultAlgorithm(), QPID_SSL_TRUST_MANAGER_FACTORY_ALGORITHM_PROP_NAME, QPID_SSL_TRUST_STORE_CERT_TYPE_PROP_NAME).get();
- private String trustStorePath = System.getProperty("javax.net.ssl.trustStore");
- private String trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
- private String trustStoreType = System.getProperty("javax.net.ssl.trustStoreType",KeyStore.getDefaultType());
- private String certAlias;
- private boolean verifyHostname;
-
- // SASL props
- private String saslMechs = System.getProperty("qpid.sasl_mechs", null);
- private String saslProtocol = System.getProperty("qpid.sasl_protocol", "AMQP");
- private String saslServerName = System.getProperty("qpid.sasl_server_name", "localhost");
- private boolean useSASLEncryption;
-
- private Map<String, Object> _clientProperties;
-
- public boolean isTcpNodelay()
- {
- return tcpNodelay;
- }
-
- public void setTcpNodelay(boolean tcpNodelay)
- {
- this.tcpNodelay = tcpNodelay;
- }
-
- /**
- * Gets the heartbeat interval (seconds) for 0-8/9/9-1 protocols.
- * 0 means heartbeating is disabled.
- * null means use the broker-supplied value.
- * @return the heartbeat interval
- */
- public Integer getHeartbeatInterval08()
- {
- if (heartbeatInterval != null)
- {
- return heartbeatInterval;
- }
- else if (hearbeatIntervalLegacyMs != null)
- {
- return hearbeatIntervalLegacyMs / 1000;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Gets the heartbeat interval (seconds) for the 0-10 protocol.
- * 0 means heartbeating is disabled.
- * @return the heartbeat interval
- */
- public int getHeartbeatInterval010()
- {
- if (heartbeatInterval != null)
- {
- return heartbeatInterval;
- }
- else if (hearbeatIntervalLegacyMs != null)
- {
- return hearbeatIntervalLegacyMs / 1000;
- }
- else
- {
- return QPID_HEARTBEAT_INTERVAL_010_DEFAULT;
- }
- }
-
- public void setHeartbeatInterval(int heartbeatInterval)
- {
- this.heartbeatInterval = heartbeatInterval;
- }
-
- public float getHeartbeatTimeoutFactor()
- {
- return this.heartbeatTimeoutFactor;
- }
-
- public String getProtocol()
- {
- return protocol;
- }
-
- public void setProtocol(String protocol)
- {
- this.protocol = protocol;
- }
-
- public String getHost()
- {
- return host;
- }
-
- public void setHost(String host)
- {
- this.host = host;
- }
-
- public int getPort()
- {
- return port;
- }
-
- public void setPort(int port)
- {
- this.port = port;
- }
-
- public String getVhost()
- {
- return vhost;
- }
-
- public void setVhost(String vhost)
- {
- this.vhost = vhost;
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public void setUsername(String username)
- {
- this.username = username;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- public boolean isUseSSL()
- {
- return useSSL;
- }
-
- public void setUseSSL(boolean useSSL)
- {
- this.useSSL = useSSL;
- }
-
- public boolean isUseSASLEncryption()
- {
- return useSASLEncryption;
- }
-
- public void setUseSASLEncryption(boolean useSASLEncryption)
- {
- this.useSASLEncryption = useSASLEncryption;
- }
-
- public String getSaslMechs()
- {
- return saslMechs;
- }
-
- public void setSaslMechs(String saslMechs)
- {
- this.saslMechs = saslMechs;
- }
-
- public String getSaslProtocol()
- {
- return saslProtocol;
- }
-
- public void setSaslProtocol(String saslProtocol)
- {
- this.saslProtocol = saslProtocol;
- }
-
- public String getSaslServerName()
- {
- return saslServerName;
- }
-
- public void setSaslServerName(String saslServerName)
- {
- this.saslServerName = saslServerName;
- }
-
- public int getMaxChannelCount()
- {
- return maxChannelCount;
- }
-
- public void setMaxChannelCount(int maxChannelCount)
- {
- this.maxChannelCount = maxChannelCount;
- }
-
- public int getMaxFrameSize()
- {
- return maxFrameSize;
- }
-
- public void setMaxFrameSize(int maxFrameSize)
- {
- this.maxFrameSize = maxFrameSize;
- }
-
- public void setClientProperties(final Map<String, Object> clientProperties)
- {
- _clientProperties = clientProperties;
- }
-
- public Map<String, Object> getClientProperties()
- {
- return _clientProperties;
- }
-
- public String getKeyStorePath()
- {
- return keyStorePath;
- }
-
- public void setKeyStorePath(String keyStorePath)
- {
- this.keyStorePath = keyStorePath;
- }
-
- public String getKeyStorePassword()
- {
- return keyStorePassword;
- }
-
- public void setKeyStorePassword(String keyStorePassword)
- {
- this.keyStorePassword = keyStorePassword;
- }
-
- public void setKeyStoreType(String keyStoreType)
- {
- this.keyStoreType = keyStoreType;
- }
-
- public String getKeyStoreType()
- {
- return keyStoreType;
- }
-
- public String getTrustStorePath()
- {
- return trustStorePath;
- }
-
- public void setTrustStorePath(String trustStorePath)
- {
- this.trustStorePath = trustStorePath;
- }
-
- public String getTrustStorePassword()
- {
- return trustStorePassword;
- }
-
- public void setTrustStorePassword(String trustStorePassword)
- {
- this.trustStorePassword = trustStorePassword;
- }
-
- public String getCertAlias()
- {
- return certAlias;
- }
-
- public void setCertAlias(String certAlias)
- {
- this.certAlias = certAlias;
- }
-
- public boolean isVerifyHostname()
- {
- return verifyHostname;
- }
-
- public void setVerifyHostname(boolean verifyHostname)
- {
- this.verifyHostname = verifyHostname;
- }
-
- public String getKeyManagerFactoryAlgorithm()
- {
- return keyManagerFactoryAlgorithm;
- }
-
- public void setKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm)
- {
- this.keyManagerFactoryAlgorithm = keyManagerFactoryAlgorithm;
- }
-
- public String getTrustManagerFactoryAlgorithm()
- {
- return trustManagerFactoryAlgorithm;
- }
-
- public void setTrustManagerFactoryAlgorithm(String trustManagerFactoryAlgorithm)
- {
- this.trustManagerFactoryAlgorithm = trustManagerFactoryAlgorithm;
- }
-
- public String getTrustStoreType()
- {
- return trustStoreType;
- }
-
- public void setTrustStoreType(String trustStoreType)
- {
- this.trustStoreType = trustStoreType;
- }
-
- public int getConnectTimeout()
- {
- return connectTimeout;
- }
-
- public void setConnectTimeout(int connectTimeout)
- {
- this.connectTimeout = connectTimeout;
- }
-
- public int getReadBufferSize()
- {
- return readBufferSize;
- }
-
- public void setReadBufferSize(int readBufferSize)
- {
- this.readBufferSize = readBufferSize;
- }
-
- public int getWriteBufferSize()
- {
- return writeBufferSize;
- }
-
- public void setWriteBufferSize(int writeBufferSize)
- {
- this.writeBufferSize = writeBufferSize;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionStart.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionStart.java
deleted file mode 100644
index 6193122c56..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionStart.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionStart extends Method {
-
- public static final int TYPE = 257;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private Map<String,Object> serverProperties;
- private java.util.List<Object> mechanisms;
- private java.util.List<Object> locales;
-
-
- public ConnectionStart() {}
-
-
- public ConnectionStart(Map<String,Object> serverProperties, java.util.List<Object> mechanisms, java.util.List<Object> locales, Option ... _options) {
- if(serverProperties != null) {
- setServerProperties(serverProperties);
- }
- if(mechanisms != null) {
- setMechanisms(mechanisms);
- }
- if(locales != null) {
- setLocales(locales);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionStart(context, this);
- }
-
-
- public final boolean hasServerProperties() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionStart clearServerProperties() {
- packing_flags &= ~256;
- this.serverProperties = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getServerProperties() {
- return serverProperties;
- }
-
- public final ConnectionStart setServerProperties(Map<String,Object> value) {
- this.serverProperties = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionStart serverProperties(Map<String,Object> value) {
- return setServerProperties(value);
- }
-
- public final boolean hasMechanisms() {
- return (packing_flags & 512) != 0;
- }
-
- public final ConnectionStart clearMechanisms() {
- packing_flags &= ~512;
- this.mechanisms = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.List<Object> getMechanisms() {
- return mechanisms;
- }
-
- public final ConnectionStart setMechanisms(java.util.List<Object> value) {
- this.mechanisms = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ConnectionStart mechanisms(java.util.List<Object> value) {
- return setMechanisms(value);
- }
-
- public final boolean hasLocales() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ConnectionStart clearLocales() {
- packing_flags &= ~1024;
- this.locales = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.List<Object> getLocales() {
- return locales;
- }
-
- public final ConnectionStart setLocales(java.util.List<Object> value) {
- this.locales = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ConnectionStart locales(java.util.List<Object> value) {
- return setLocales(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeMap(this.serverProperties);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeArray(this.mechanisms);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeArray(this.locales);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.serverProperties = dec.readMap();
- }
- if ((packing_flags & 512) != 0)
- {
- this.mechanisms = dec.readArray();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.locales = dec.readArray();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("serverProperties", getServerProperties());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("mechanisms", getMechanisms());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("locales", getLocales());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionStartOk.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionStartOk.java
deleted file mode 100644
index 13fe27de34..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionStartOk.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionStartOk extends Method {
-
- public static final int TYPE = 258;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private Map<String,Object> clientProperties;
- private String mechanism;
- private byte[] response;
- private String locale;
-
-
- public ConnectionStartOk() {}
-
-
- public ConnectionStartOk(Map<String,Object> clientProperties, String mechanism, byte[] response, String locale, Option ... _options) {
- if(clientProperties != null) {
- setClientProperties(clientProperties);
- }
- if(mechanism != null) {
- setMechanism(mechanism);
- }
- if(response != null) {
- setResponse(response);
- }
- if(locale != null) {
- setLocale(locale);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionStartOk(context, this);
- }
-
-
- public final boolean hasClientProperties() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionStartOk clearClientProperties() {
- packing_flags &= ~256;
- this.clientProperties = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getClientProperties() {
- return clientProperties;
- }
-
- public final ConnectionStartOk setClientProperties(Map<String,Object> value) {
- this.clientProperties = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionStartOk clientProperties(Map<String,Object> value) {
- return setClientProperties(value);
- }
-
- public final boolean hasMechanism() {
- return (packing_flags & 512) != 0;
- }
-
- public final ConnectionStartOk clearMechanism() {
- packing_flags &= ~512;
- this.mechanism = null;
- setDirty(true);
- return this;
- }
-
- public final String getMechanism() {
- return mechanism;
- }
-
- public final ConnectionStartOk setMechanism(String value) {
- this.mechanism = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ConnectionStartOk mechanism(String value) {
- return setMechanism(value);
- }
-
- public final boolean hasResponse() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ConnectionStartOk clearResponse() {
- packing_flags &= ~1024;
- this.response = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getResponse() {
- return response;
- }
-
- public final ConnectionStartOk setResponse(byte[] value) {
- this.response = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ConnectionStartOk response(byte[] value) {
- return setResponse(value);
- }
-
- public final boolean hasLocale() {
- return (packing_flags & 2048) != 0;
- }
-
- public final ConnectionStartOk clearLocale() {
- packing_flags &= ~2048;
- this.locale = null;
- setDirty(true);
- return this;
- }
-
- public final String getLocale() {
- return locale;
- }
-
- public final ConnectionStartOk setLocale(String value) {
- this.locale = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final ConnectionStartOk locale(String value) {
- return setLocale(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeMap(this.clientProperties);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.mechanism);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeVbin32(this.response);
- }
- if ((packing_flags & 2048) != 0)
- {
- enc.writeStr8(this.locale);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.clientProperties = dec.readMap();
- }
- if ((packing_flags & 512) != 0)
- {
- this.mechanism = dec.readStr8();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.response = dec.readVbin32();
- }
- if ((packing_flags & 2048) != 0)
- {
- this.locale = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("clientProperties", getClientProperties());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("mechanism", getMechanism());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("response", getResponse());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("locale", getLocale());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionTune.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionTune.java
deleted file mode 100644
index b838532878..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionTune.java
+++ /dev/null
@@ -1,272 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionTune extends Method {
-
- public static final int TYPE = 261;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private int channelMax;
- private int maxFrameSize;
- private int heartbeatMin;
- private int heartbeatMax;
-
-
- public ConnectionTune() {}
-
-
- public ConnectionTune(int channelMax, int maxFrameSize, int heartbeatMin, int heartbeatMax, Option ... _options) {
- setChannelMax(channelMax);
- setMaxFrameSize(maxFrameSize);
- setHeartbeatMin(heartbeatMin);
- setHeartbeatMax(heartbeatMax);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionTune(context, this);
- }
-
-
- public final boolean hasChannelMax() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionTune clearChannelMax() {
- packing_flags &= ~256;
- this.channelMax = 0;
- setDirty(true);
- return this;
- }
-
- public final int getChannelMax() {
- return channelMax;
- }
-
- public final ConnectionTune setChannelMax(int value) {
- this.channelMax = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionTune channelMax(int value) {
- return setChannelMax(value);
- }
-
- public final boolean hasMaxFrameSize() {
- return (packing_flags & 512) != 0;
- }
-
- public final ConnectionTune clearMaxFrameSize() {
- packing_flags &= ~512;
- this.maxFrameSize = 0;
- setDirty(true);
- return this;
- }
-
- public final int getMaxFrameSize() {
- return maxFrameSize;
- }
-
- public final ConnectionTune setMaxFrameSize(int value) {
- this.maxFrameSize = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ConnectionTune maxFrameSize(int value) {
- return setMaxFrameSize(value);
- }
-
- public final boolean hasHeartbeatMin() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ConnectionTune clearHeartbeatMin() {
- packing_flags &= ~1024;
- this.heartbeatMin = 0;
- setDirty(true);
- return this;
- }
-
- public final int getHeartbeatMin() {
- return heartbeatMin;
- }
-
- public final ConnectionTune setHeartbeatMin(int value) {
- this.heartbeatMin = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ConnectionTune heartbeatMin(int value) {
- return setHeartbeatMin(value);
- }
-
- public final boolean hasHeartbeatMax() {
- return (packing_flags & 2048) != 0;
- }
-
- public final ConnectionTune clearHeartbeatMax() {
- packing_flags &= ~2048;
- this.heartbeatMax = 0;
- setDirty(true);
- return this;
- }
-
- public final int getHeartbeatMax() {
- return heartbeatMax;
- }
-
- public final ConnectionTune setHeartbeatMax(int value) {
- this.heartbeatMax = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final ConnectionTune heartbeatMax(int value) {
- return setHeartbeatMax(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint16(this.channelMax);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint16(this.maxFrameSize);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeUint16(this.heartbeatMin);
- }
- if ((packing_flags & 2048) != 0)
- {
- enc.writeUint16(this.heartbeatMax);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.channelMax = dec.readUint16();
- }
- if ((packing_flags & 512) != 0)
- {
- this.maxFrameSize = dec.readUint16();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.heartbeatMin = dec.readUint16();
- }
- if ((packing_flags & 2048) != 0)
- {
- this.heartbeatMax = dec.readUint16();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("channelMax", getChannelMax());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("maxFrameSize", getMaxFrameSize());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("heartbeatMin", getHeartbeatMin());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("heartbeatMax", getHeartbeatMax());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionTuneOk.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionTuneOk.java
deleted file mode 100644
index 17b5d34752..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionTuneOk.java
+++ /dev/null
@@ -1,232 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ConnectionTuneOk extends Method {
-
- public static final int TYPE = 262;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L1;
- }
-
- public final boolean isConnectionControl()
- {
- return true;
- }
-
- private short packing_flags = 0;
- private int channelMax;
- private int maxFrameSize;
- private int heartbeat;
-
-
- public ConnectionTuneOk() {}
-
-
- public ConnectionTuneOk(int channelMax, int maxFrameSize, int heartbeat, Option ... _options) {
- setChannelMax(channelMax);
- setMaxFrameSize(maxFrameSize);
- setHeartbeat(heartbeat);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.connectionTuneOk(context, this);
- }
-
-
- public final boolean hasChannelMax() {
- return (packing_flags & 256) != 0;
- }
-
- public final ConnectionTuneOk clearChannelMax() {
- packing_flags &= ~256;
- this.channelMax = 0;
- setDirty(true);
- return this;
- }
-
- public final int getChannelMax() {
- return channelMax;
- }
-
- public final ConnectionTuneOk setChannelMax(int value) {
- this.channelMax = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ConnectionTuneOk channelMax(int value) {
- return setChannelMax(value);
- }
-
- public final boolean hasMaxFrameSize() {
- return (packing_flags & 512) != 0;
- }
-
- public final ConnectionTuneOk clearMaxFrameSize() {
- packing_flags &= ~512;
- this.maxFrameSize = 0;
- setDirty(true);
- return this;
- }
-
- public final int getMaxFrameSize() {
- return maxFrameSize;
- }
-
- public final ConnectionTuneOk setMaxFrameSize(int value) {
- this.maxFrameSize = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ConnectionTuneOk maxFrameSize(int value) {
- return setMaxFrameSize(value);
- }
-
- public final boolean hasHeartbeat() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ConnectionTuneOk clearHeartbeat() {
- packing_flags &= ~1024;
- this.heartbeat = 0;
- setDirty(true);
- return this;
- }
-
- public final int getHeartbeat() {
- return heartbeat;
- }
-
- public final ConnectionTuneOk setHeartbeat(int value) {
- this.heartbeat = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ConnectionTuneOk heartbeat(int value) {
- return setHeartbeat(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint16(this.channelMax);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint16(this.maxFrameSize);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeUint16(this.heartbeat);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.channelMax = dec.readUint16();
- }
- if ((packing_flags & 512) != 0)
- {
- this.maxFrameSize = dec.readUint16();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.heartbeat = dec.readUint16();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("channelMax", getChannelMax());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("maxFrameSize", getMaxFrameSize());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("heartbeat", getHeartbeat());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Constant.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Constant.java
deleted file mode 100644
index 17355d3465..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Constant.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-
-
-public interface Constant
-{
- public static final int MIN_MAX_FRAME_SIZE = 4096;
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DeliveryProperties.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DeliveryProperties.java
deleted file mode 100644
index ded5a42247..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DeliveryProperties.java
+++ /dev/null
@@ -1,593 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class DeliveryProperties extends Struct {
-
- public static final int TYPE = 1025;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private MessageDeliveryPriority priority;
- private MessageDeliveryMode deliveryMode;
- private long ttl;
- private long timestamp;
- private long expiration;
- private String exchange;
- private String routingKey;
- private String resumeId;
- private long resumeTtl;
-
-
- public DeliveryProperties() {}
-
-
- public DeliveryProperties(MessageDeliveryPriority priority, MessageDeliveryMode deliveryMode, long ttl, long timestamp, long expiration, String exchange, String routingKey, String resumeId, long resumeTtl, Option ... _options) {
- if(priority != null) {
- setPriority(priority);
- }
- if(deliveryMode != null) {
- setDeliveryMode(deliveryMode);
- }
- setTtl(ttl);
- setTimestamp(timestamp);
- setExpiration(expiration);
- if(exchange != null) {
- setExchange(exchange);
- }
- if(routingKey != null) {
- setRoutingKey(routingKey);
- }
- if(resumeId != null) {
- setResumeId(resumeId);
- }
- setResumeTtl(resumeTtl);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case DISCARD_UNROUTABLE: packing_flags |= 256; break;
- case IMMEDIATE: packing_flags |= 512; break;
- case REDELIVERED: packing_flags |= 1024; break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
-
-
-
- public final boolean hasDiscardUnroutable() {
- return (packing_flags & 256) != 0;
- }
-
- public final DeliveryProperties clearDiscardUnroutable() {
- packing_flags &= ~256;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getDiscardUnroutable() {
- return hasDiscardUnroutable();
- }
-
- public final DeliveryProperties setDiscardUnroutable(boolean value) {
-
- if (value)
- {
- packing_flags |= 256;
- }
- else
- {
- packing_flags &= ~256;
- }
-
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties discardUnroutable(boolean value) {
- return setDiscardUnroutable(value);
- }
-
- public final boolean hasImmediate() {
- return (packing_flags & 512) != 0;
- }
-
- public final DeliveryProperties clearImmediate() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getImmediate() {
- return hasImmediate();
- }
-
- public final DeliveryProperties setImmediate(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties immediate(boolean value) {
- return setImmediate(value);
- }
-
- public final boolean hasRedelivered() {
- return (packing_flags & 1024) != 0;
- }
-
- public final DeliveryProperties clearRedelivered() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getRedelivered() {
- return hasRedelivered();
- }
-
- public final DeliveryProperties setRedelivered(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties redelivered(boolean value) {
- return setRedelivered(value);
- }
-
- public final boolean hasPriority() {
- return (packing_flags & 2048) != 0;
- }
-
- public final DeliveryProperties clearPriority() {
- packing_flags &= ~2048;
- this.priority = null;
- setDirty(true);
- return this;
- }
-
- public final MessageDeliveryPriority getPriority() {
- return priority;
- }
-
- public final DeliveryProperties setPriority(MessageDeliveryPriority value) {
- this.priority = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties priority(MessageDeliveryPriority value) {
- return setPriority(value);
- }
-
- public final boolean hasDeliveryMode() {
- return (packing_flags & 4096) != 0;
- }
-
- public final DeliveryProperties clearDeliveryMode() {
- packing_flags &= ~4096;
- this.deliveryMode = null;
- setDirty(true);
- return this;
- }
-
- public final MessageDeliveryMode getDeliveryMode() {
- return deliveryMode;
- }
-
- public final DeliveryProperties setDeliveryMode(MessageDeliveryMode value) {
- this.deliveryMode = value;
- packing_flags |= 4096;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties deliveryMode(MessageDeliveryMode value) {
- return setDeliveryMode(value);
- }
-
- public final boolean hasTtl() {
- return (packing_flags & 8192) != 0;
- }
-
- public final DeliveryProperties clearTtl() {
- packing_flags &= ~8192;
- this.ttl = 0;
- setDirty(true);
- return this;
- }
-
- public final long getTtl() {
- return ttl;
- }
-
- public final DeliveryProperties setTtl(long value) {
- this.ttl = value;
- packing_flags |= 8192;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties ttl(long value) {
- return setTtl(value);
- }
-
- public final boolean hasTimestamp() {
- return (packing_flags & 16384) != 0;
- }
-
- public final DeliveryProperties clearTimestamp() {
- packing_flags &= ~16384;
- this.timestamp = 0;
- setDirty(true);
- return this;
- }
-
- public final long getTimestamp() {
- return timestamp;
- }
-
- public final DeliveryProperties setTimestamp(long value) {
- this.timestamp = value;
- packing_flags |= 16384;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties timestamp(long value) {
- return setTimestamp(value);
- }
-
- public final boolean hasExpiration() {
- return (packing_flags & 32768) != 0;
- }
-
- public final DeliveryProperties clearExpiration() {
- packing_flags &= ~32768;
- this.expiration = 0;
- setDirty(true);
- return this;
- }
-
- public final long getExpiration() {
- return expiration;
- }
-
- public final DeliveryProperties setExpiration(long value) {
- this.expiration = value;
- packing_flags |= 32768;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties expiration(long value) {
- return setExpiration(value);
- }
-
- public final boolean hasExchange() {
- return (packing_flags & 1) != 0;
- }
-
- public final DeliveryProperties clearExchange() {
- packing_flags &= ~1;
- this.exchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getExchange() {
- return exchange;
- }
-
- public final DeliveryProperties setExchange(String value) {
- this.exchange = value;
- packing_flags |= 1;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties exchange(String value) {
- return setExchange(value);
- }
-
- public final boolean hasRoutingKey() {
- return (packing_flags & 2) != 0;
- }
-
- public final DeliveryProperties clearRoutingKey() {
- packing_flags &= ~2;
- this.routingKey = null;
- setDirty(true);
- return this;
- }
-
- public final String getRoutingKey() {
- return routingKey;
- }
-
- public final DeliveryProperties setRoutingKey(String value) {
- this.routingKey = value;
- packing_flags |= 2;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties routingKey(String value) {
- return setRoutingKey(value);
- }
-
- public final boolean hasResumeId() {
- return (packing_flags & 4) != 0;
- }
-
- public final DeliveryProperties clearResumeId() {
- packing_flags &= ~4;
- this.resumeId = null;
- setDirty(true);
- return this;
- }
-
- public final String getResumeId() {
- return resumeId;
- }
-
- public final DeliveryProperties setResumeId(String value) {
- this.resumeId = value;
- packing_flags |= 4;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties resumeId(String value) {
- return setResumeId(value);
- }
-
- public final boolean hasResumeTtl() {
- return (packing_flags & 8) != 0;
- }
-
- public final DeliveryProperties clearResumeTtl() {
- packing_flags &= ~8;
- this.resumeTtl = 0;
- setDirty(true);
- return this;
- }
-
- public final long getResumeTtl() {
- return resumeTtl;
- }
-
- public final DeliveryProperties setResumeTtl(long value) {
- this.resumeTtl = value;
- packing_flags |= 8;
- setDirty(true);
- return this;
- }
-
- public final DeliveryProperties resumeTtl(long value) {
- return setResumeTtl(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 2048) != 0)
- {
- enc.writeUint8(this.priority.getValue());
- }
- if ((packing_flags & 4096) != 0)
- {
- enc.writeUint8(this.deliveryMode.getValue());
- }
- if ((packing_flags & 8192) != 0)
- {
- enc.writeUint64(this.ttl);
- }
- if ((packing_flags & 16384) != 0)
- {
- enc.writeDatetime(this.timestamp);
- }
- if ((packing_flags & 32768) != 0)
- {
- enc.writeDatetime(this.expiration);
- }
- if ((packing_flags & 1) != 0)
- {
- enc.writeStr8(this.exchange);
- }
- if ((packing_flags & 2) != 0)
- {
- enc.writeStr8(this.routingKey);
- }
- if ((packing_flags & 4) != 0)
- {
- enc.writeStr16(this.resumeId);
- }
- if ((packing_flags & 8) != 0)
- {
- enc.writeUint64(this.resumeTtl);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 2048) != 0)
- {
- this.priority = MessageDeliveryPriority.get(dec.readUint8());
- }
- if ((packing_flags & 4096) != 0)
- {
- this.deliveryMode = MessageDeliveryMode.get(dec.readUint8());
- }
- if ((packing_flags & 8192) != 0)
- {
- this.ttl = dec.readUint64();
- }
- if ((packing_flags & 16384) != 0)
- {
- this.timestamp = dec.readDatetime();
- }
- if ((packing_flags & 32768) != 0)
- {
- this.expiration = dec.readDatetime();
- }
- if ((packing_flags & 1) != 0)
- {
- this.exchange = dec.readStr8();
- }
- if ((packing_flags & 2) != 0)
- {
- this.routingKey = dec.readStr8();
- }
- if ((packing_flags & 4) != 0)
- {
- this.resumeId = dec.readStr16();
- }
- if ((packing_flags & 8) != 0)
- {
- this.resumeTtl = dec.readUint64();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("discardUnroutable", getDiscardUnroutable());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("immediate", getImmediate());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("redelivered", getRedelivered());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("priority", getPriority());
- }
- if ((packing_flags & 4096) != 0)
- {
- result.put("deliveryMode", getDeliveryMode());
- }
- if ((packing_flags & 8192) != 0)
- {
- result.put("ttl", getTtl());
- }
- if ((packing_flags & 16384) != 0)
- {
- result.put("timestamp", getTimestamp());
- }
- if ((packing_flags & 32768) != 0)
- {
- result.put("expiration", getExpiration());
- }
- if ((packing_flags & 1) != 0)
- {
- result.put("exchange", getExchange());
- }
- if ((packing_flags & 2) != 0)
- {
- result.put("routingKey", getRoutingKey());
- }
- if ((packing_flags & 4) != 0)
- {
- result.put("resumeId", getResumeId());
- }
- if ((packing_flags & 8) != 0)
- {
- result.put("resumeTtl", getResumeTtl());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxCommit.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxCommit.java
deleted file mode 100644
index 315b37025d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxCommit.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxCommit extends Method {
-
- public static final int TYPE = 1540;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private Xid xid;
-
-
- public DtxCommit() {}
-
-
- public DtxCommit(Xid xid, Option ... _options) {
- if(xid != null) {
- setXid(xid);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case ONE_PHASE: packing_flags |= 512; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxCommit(context, this);
- }
-
-
- public final boolean hasXid() {
- return (packing_flags & 256) != 0;
- }
-
- public final DtxCommit clearXid() {
- packing_flags &= ~256;
- this.xid = null;
- setDirty(true);
- return this;
- }
-
- public final Xid getXid() {
- return xid;
- }
-
- public final DtxCommit setXid(Xid value) {
- this.xid = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final DtxCommit xid(Xid value) {
- return setXid(value);
- }
-
- public final boolean hasOnePhase() {
- return (packing_flags & 512) != 0;
- }
-
- public final DtxCommit clearOnePhase() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getOnePhase() {
- return hasOnePhase();
- }
-
- public final DtxCommit setOnePhase(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final DtxCommit onePhase(boolean value) {
- return setOnePhase(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStruct(Xid.TYPE, this.xid);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.xid = (Xid)dec.readStruct(Xid.TYPE);
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("xid", getXid());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("onePhase", getOnePhase());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxEnd.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxEnd.java
deleted file mode 100644
index 70cac46379..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxEnd.java
+++ /dev/null
@@ -1,232 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxEnd extends Method {
-
- public static final int TYPE = 1539;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private Xid xid;
-
-
- public DtxEnd() {}
-
-
- public DtxEnd(Xid xid, Option ... _options) {
- if(xid != null) {
- setXid(xid);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case FAIL: packing_flags |= 512; break;
- case SUSPEND: packing_flags |= 1024; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxEnd(context, this);
- }
-
-
- public final boolean hasXid() {
- return (packing_flags & 256) != 0;
- }
-
- public final DtxEnd clearXid() {
- packing_flags &= ~256;
- this.xid = null;
- setDirty(true);
- return this;
- }
-
- public final Xid getXid() {
- return xid;
- }
-
- public final DtxEnd setXid(Xid value) {
- this.xid = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final DtxEnd xid(Xid value) {
- return setXid(value);
- }
-
- public final boolean hasFail() {
- return (packing_flags & 512) != 0;
- }
-
- public final DtxEnd clearFail() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getFail() {
- return hasFail();
- }
-
- public final DtxEnd setFail(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final DtxEnd fail(boolean value) {
- return setFail(value);
- }
-
- public final boolean hasSuspend() {
- return (packing_flags & 1024) != 0;
- }
-
- public final DtxEnd clearSuspend() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getSuspend() {
- return hasSuspend();
- }
-
- public final DtxEnd setSuspend(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final DtxEnd suspend(boolean value) {
- return setSuspend(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStruct(Xid.TYPE, this.xid);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.xid = (Xid)dec.readStruct(Xid.TYPE);
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("xid", getXid());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("fail", getFail());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("suspend", getSuspend());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxForget.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxForget.java
deleted file mode 100644
index 0d57488e78..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxForget.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxForget extends Method {
-
- public static final int TYPE = 1541;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private Xid xid;
-
-
- public DtxForget() {}
-
-
- public DtxForget(Xid xid, Option ... _options) {
- if(xid != null) {
- setXid(xid);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxForget(context, this);
- }
-
-
- public final boolean hasXid() {
- return (packing_flags & 256) != 0;
- }
-
- public final DtxForget clearXid() {
- packing_flags &= ~256;
- this.xid = null;
- setDirty(true);
- return this;
- }
-
- public final Xid getXid() {
- return xid;
- }
-
- public final DtxForget setXid(Xid value) {
- this.xid = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final DtxForget xid(Xid value) {
- return setXid(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStruct(Xid.TYPE, this.xid);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.xid = (Xid)dec.readStruct(Xid.TYPE);
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("xid", getXid());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxGetTimeout.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxGetTimeout.java
deleted file mode 100644
index 42293a865f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxGetTimeout.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxGetTimeout extends Method {
-
- public static final int TYPE = 1542;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private Xid xid;
-
-
- public DtxGetTimeout() {}
-
-
- public DtxGetTimeout(Xid xid, Option ... _options) {
- if(xid != null) {
- setXid(xid);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxGetTimeout(context, this);
- }
-
-
- public final boolean hasXid() {
- return (packing_flags & 256) != 0;
- }
-
- public final DtxGetTimeout clearXid() {
- packing_flags &= ~256;
- this.xid = null;
- setDirty(true);
- return this;
- }
-
- public final Xid getXid() {
- return xid;
- }
-
- public final DtxGetTimeout setXid(Xid value) {
- this.xid = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final DtxGetTimeout xid(Xid value) {
- return setXid(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStruct(Xid.TYPE, this.xid);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.xid = (Xid)dec.readStruct(Xid.TYPE);
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("xid", getXid());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxPrepare.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxPrepare.java
deleted file mode 100644
index 8a771e638f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxPrepare.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxPrepare extends Method {
-
- public static final int TYPE = 1543;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private Xid xid;
-
-
- public DtxPrepare() {}
-
-
- public DtxPrepare(Xid xid, Option ... _options) {
- if(xid != null) {
- setXid(xid);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxPrepare(context, this);
- }
-
-
- public final boolean hasXid() {
- return (packing_flags & 256) != 0;
- }
-
- public final DtxPrepare clearXid() {
- packing_flags &= ~256;
- this.xid = null;
- setDirty(true);
- return this;
- }
-
- public final Xid getXid() {
- return xid;
- }
-
- public final DtxPrepare setXid(Xid value) {
- this.xid = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final DtxPrepare xid(Xid value) {
- return setXid(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStruct(Xid.TYPE, this.xid);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.xid = (Xid)dec.readStruct(Xid.TYPE);
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("xid", getXid());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxRecover.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxRecover.java
deleted file mode 100644
index bbda4a0a60..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxRecover.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxRecover extends Method {
-
- public static final int TYPE = 1544;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
-
-
-
-
- public DtxRecover(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxRecover(context, this);
- }
-
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxRollback.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxRollback.java
deleted file mode 100644
index d3cb28638c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxRollback.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxRollback extends Method {
-
- public static final int TYPE = 1545;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private Xid xid;
-
-
- public DtxRollback() {}
-
-
- public DtxRollback(Xid xid, Option ... _options) {
- if(xid != null) {
- setXid(xid);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxRollback(context, this);
- }
-
-
- public final boolean hasXid() {
- return (packing_flags & 256) != 0;
- }
-
- public final DtxRollback clearXid() {
- packing_flags &= ~256;
- this.xid = null;
- setDirty(true);
- return this;
- }
-
- public final Xid getXid() {
- return xid;
- }
-
- public final DtxRollback setXid(Xid value) {
- this.xid = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final DtxRollback xid(Xid value) {
- return setXid(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStruct(Xid.TYPE, this.xid);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.xid = (Xid)dec.readStruct(Xid.TYPE);
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("xid", getXid());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxSelect.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxSelect.java
deleted file mode 100644
index b70a4884ff..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxSelect.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxSelect extends Method {
-
- public static final int TYPE = 1537;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
-
-
-
-
- public DtxSelect(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxSelect(context, this);
- }
-
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxSetTimeout.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxSetTimeout.java
deleted file mode 100644
index 0c8b78e12c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxSetTimeout.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxSetTimeout extends Method {
-
- public static final int TYPE = 1546;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private Xid xid;
- private long timeout;
-
-
- public DtxSetTimeout() {}
-
-
- public DtxSetTimeout(Xid xid, long timeout, Option ... _options) {
- if(xid != null) {
- setXid(xid);
- }
- setTimeout(timeout);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxSetTimeout(context, this);
- }
-
-
- public final boolean hasXid() {
- return (packing_flags & 256) != 0;
- }
-
- public final DtxSetTimeout clearXid() {
- packing_flags &= ~256;
- this.xid = null;
- setDirty(true);
- return this;
- }
-
- public final Xid getXid() {
- return xid;
- }
-
- public final DtxSetTimeout setXid(Xid value) {
- this.xid = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final DtxSetTimeout xid(Xid value) {
- return setXid(value);
- }
-
- public final boolean hasTimeout() {
- return (packing_flags & 512) != 0;
- }
-
- public final DtxSetTimeout clearTimeout() {
- packing_flags &= ~512;
- this.timeout = 0;
- setDirty(true);
- return this;
- }
-
- public final long getTimeout() {
- return timeout;
- }
-
- public final DtxSetTimeout setTimeout(long value) {
- this.timeout = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final DtxSetTimeout timeout(long value) {
- return setTimeout(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStruct(Xid.TYPE, this.xid);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint32(this.timeout);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.xid = (Xid)dec.readStruct(Xid.TYPE);
- }
- if ((packing_flags & 512) != 0)
- {
- this.timeout = dec.readUint32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("xid", getXid());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("timeout", getTimeout());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxStart.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxStart.java
deleted file mode 100644
index 7e60f1fbf1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxStart.java
+++ /dev/null
@@ -1,232 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class DtxStart extends Method {
-
- public static final int TYPE = 1538;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private Xid xid;
-
-
- public DtxStart() {}
-
-
- public DtxStart(Xid xid, Option ... _options) {
- if(xid != null) {
- setXid(xid);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case JOIN: packing_flags |= 512; break;
- case RESUME: packing_flags |= 1024; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.dtxStart(context, this);
- }
-
-
- public final boolean hasXid() {
- return (packing_flags & 256) != 0;
- }
-
- public final DtxStart clearXid() {
- packing_flags &= ~256;
- this.xid = null;
- setDirty(true);
- return this;
- }
-
- public final Xid getXid() {
- return xid;
- }
-
- public final DtxStart setXid(Xid value) {
- this.xid = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final DtxStart xid(Xid value) {
- return setXid(value);
- }
-
- public final boolean hasJoin() {
- return (packing_flags & 512) != 0;
- }
-
- public final DtxStart clearJoin() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getJoin() {
- return hasJoin();
- }
-
- public final DtxStart setJoin(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final DtxStart join(boolean value) {
- return setJoin(value);
- }
-
- public final boolean hasResume() {
- return (packing_flags & 1024) != 0;
- }
-
- public final DtxStart clearResume() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getResume() {
- return hasResume();
- }
-
- public final DtxStart setResume(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final DtxStart resume(boolean value) {
- return setResume(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStruct(Xid.TYPE, this.xid);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.xid = (Xid)dec.readStruct(Xid.TYPE);
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("xid", getXid());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("join", getJoin());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("resume", getResume());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxXaStatus.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxXaStatus.java
deleted file mode 100644
index 9300354ad4..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/DtxXaStatus.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum DtxXaStatus {
-
- XA_OK((int) 0),
- XA_RBROLLBACK((int) 1),
- XA_RBTIMEOUT((int) 2),
- XA_HEURHAZ((int) 3),
- XA_HEURCOM((int) 4),
- XA_HEURRB((int) 5),
- XA_HEURMIX((int) 6),
- XA_RDONLY((int) 7);
-
- private final int value;
-
- DtxXaStatus(int value)
- {
- this.value = value;
- }
-
- public int getValue()
- {
- return value;
- }
-
- public static DtxXaStatus get(int value)
- {
- switch (value)
- {
- case (int) 0: return XA_OK;
- case (int) 1: return XA_RBROLLBACK;
- case (int) 2: return XA_RBTIMEOUT;
- case (int) 3: return XA_HEURHAZ;
- case (int) 4: return XA_HEURCOM;
- case (int) 5: return XA_HEURRB;
- case (int) 6: return XA_HEURMIX;
- case (int) 7: return XA_RDONLY;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBind.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBind.java
deleted file mode 100644
index 6ef3b0b460..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBind.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExchangeBind extends Method {
-
- public static final int TYPE = 1796;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String queue;
- private String exchange;
- private String bindingKey;
- private Map<String,Object> arguments;
-
-
- public ExchangeBind() {}
-
-
- public ExchangeBind(String queue, String exchange, String bindingKey, Map<String,Object> arguments, Option ... _options) {
- if(queue != null) {
- setQueue(queue);
- }
- if(exchange != null) {
- setExchange(exchange);
- }
- if(bindingKey != null) {
- setBindingKey(bindingKey);
- }
- if(arguments != null) {
- setArguments(arguments);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.exchangeBind(context, this);
- }
-
-
- public final boolean hasQueue() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExchangeBind clearQueue() {
- packing_flags &= ~256;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final ExchangeBind setQueue(String value) {
- this.queue = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExchangeBind queue(String value) {
- return setQueue(value);
- }
-
- public final boolean hasExchange() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExchangeBind clearExchange() {
- packing_flags &= ~512;
- this.exchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getExchange() {
- return exchange;
- }
-
- public final ExchangeBind setExchange(String value) {
- this.exchange = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ExchangeBind exchange(String value) {
- return setExchange(value);
- }
-
- public final boolean hasBindingKey() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ExchangeBind clearBindingKey() {
- packing_flags &= ~1024;
- this.bindingKey = null;
- setDirty(true);
- return this;
- }
-
- public final String getBindingKey() {
- return bindingKey;
- }
-
- public final ExchangeBind setBindingKey(String value) {
- this.bindingKey = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ExchangeBind bindingKey(String value) {
- return setBindingKey(value);
- }
-
- public final boolean hasArguments() {
- return (packing_flags & 2048) != 0;
- }
-
- public final ExchangeBind clearArguments() {
- packing_flags &= ~2048;
- this.arguments = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getArguments() {
- return arguments;
- }
-
- public final ExchangeBind setArguments(Map<String,Object> value) {
- this.arguments = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final ExchangeBind arguments(Map<String,Object> value) {
- return setArguments(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.queue);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.exchange);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeStr8(this.bindingKey);
- }
- if ((packing_flags & 2048) != 0)
- {
- enc.writeMap(this.arguments);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.queue = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.exchange = dec.readStr8();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.bindingKey = dec.readStr8();
- }
- if ((packing_flags & 2048) != 0)
- {
- this.arguments = dec.readMap();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("queue", getQueue());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("exchange", getExchange());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("bindingKey", getBindingKey());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("arguments", getArguments());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBound.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBound.java
deleted file mode 100644
index 5847feed9b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBound.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExchangeBound extends Method {
-
- public static final int TYPE = 1798;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String exchange;
- private String queue;
- private String bindingKey;
- private Map<String,Object> arguments;
-
-
- public ExchangeBound() {}
-
-
- public ExchangeBound(String exchange, String queue, String bindingKey, Map<String,Object> arguments, Option ... _options) {
- if(exchange != null) {
- setExchange(exchange);
- }
- if(queue != null) {
- setQueue(queue);
- }
- if(bindingKey != null) {
- setBindingKey(bindingKey);
- }
- if(arguments != null) {
- setArguments(arguments);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.exchangeBound(context, this);
- }
-
-
- public final boolean hasExchange() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExchangeBound clearExchange() {
- packing_flags &= ~256;
- this.exchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getExchange() {
- return exchange;
- }
-
- public final ExchangeBound setExchange(String value) {
- this.exchange = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExchangeBound exchange(String value) {
- return setExchange(value);
- }
-
- public final boolean hasQueue() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExchangeBound clearQueue() {
- packing_flags &= ~512;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final ExchangeBound setQueue(String value) {
- this.queue = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ExchangeBound queue(String value) {
- return setQueue(value);
- }
-
- public final boolean hasBindingKey() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ExchangeBound clearBindingKey() {
- packing_flags &= ~1024;
- this.bindingKey = null;
- setDirty(true);
- return this;
- }
-
- public final String getBindingKey() {
- return bindingKey;
- }
-
- public final ExchangeBound setBindingKey(String value) {
- this.bindingKey = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ExchangeBound bindingKey(String value) {
- return setBindingKey(value);
- }
-
- public final boolean hasArguments() {
- return (packing_flags & 2048) != 0;
- }
-
- public final ExchangeBound clearArguments() {
- packing_flags &= ~2048;
- this.arguments = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getArguments() {
- return arguments;
- }
-
- public final ExchangeBound setArguments(Map<String,Object> value) {
- this.arguments = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final ExchangeBound arguments(Map<String,Object> value) {
- return setArguments(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.exchange);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.queue);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeStr8(this.bindingKey);
- }
- if ((packing_flags & 2048) != 0)
- {
- enc.writeMap(this.arguments);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.exchange = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.queue = dec.readStr8();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.bindingKey = dec.readStr8();
- }
- if ((packing_flags & 2048) != 0)
- {
- this.arguments = dec.readMap();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("exchange", getExchange());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("queue", getQueue());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("bindingKey", getBindingKey());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("arguments", getArguments());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBoundResult.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBoundResult.java
deleted file mode 100644
index 04d944ea33..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeBoundResult.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class ExchangeBoundResult extends Struct {
-
- public static final int TYPE = 1794;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
-
-
- public ExchangeBoundResult() {}
-
-
- public ExchangeBoundResult(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case EXCHANGE_NOT_FOUND: packing_flags |= 256; break;
- case QUEUE_NOT_FOUND: packing_flags |= 512; break;
- case QUEUE_NOT_MATCHED: packing_flags |= 1024; break;
- case KEY_NOT_MATCHED: packing_flags |= 2048; break;
- case ARGS_NOT_MATCHED: packing_flags |= 4096; break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
-
-
-
- public final boolean hasExchangeNotFound() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExchangeBoundResult clearExchangeNotFound() {
- packing_flags &= ~256;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getExchangeNotFound() {
- return hasExchangeNotFound();
- }
-
- public final ExchangeBoundResult setExchangeNotFound(boolean value) {
-
- if (value)
- {
- packing_flags |= 256;
- }
- else
- {
- packing_flags &= ~256;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeBoundResult exchangeNotFound(boolean value) {
- return setExchangeNotFound(value);
- }
-
- public final boolean hasQueueNotFound() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExchangeBoundResult clearQueueNotFound() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getQueueNotFound() {
- return hasQueueNotFound();
- }
-
- public final ExchangeBoundResult setQueueNotFound(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeBoundResult queueNotFound(boolean value) {
- return setQueueNotFound(value);
- }
-
- public final boolean hasQueueNotMatched() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ExchangeBoundResult clearQueueNotMatched() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getQueueNotMatched() {
- return hasQueueNotMatched();
- }
-
- public final ExchangeBoundResult setQueueNotMatched(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeBoundResult queueNotMatched(boolean value) {
- return setQueueNotMatched(value);
- }
-
- public final boolean hasKeyNotMatched() {
- return (packing_flags & 2048) != 0;
- }
-
- public final ExchangeBoundResult clearKeyNotMatched() {
- packing_flags &= ~2048;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getKeyNotMatched() {
- return hasKeyNotMatched();
- }
-
- public final ExchangeBoundResult setKeyNotMatched(boolean value) {
-
- if (value)
- {
- packing_flags |= 2048;
- }
- else
- {
- packing_flags &= ~2048;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeBoundResult keyNotMatched(boolean value) {
- return setKeyNotMatched(value);
- }
-
- public final boolean hasArgsNotMatched() {
- return (packing_flags & 4096) != 0;
- }
-
- public final ExchangeBoundResult clearArgsNotMatched() {
- packing_flags &= ~4096;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getArgsNotMatched() {
- return hasArgsNotMatched();
- }
-
- public final ExchangeBoundResult setArgsNotMatched(boolean value) {
-
- if (value)
- {
- packing_flags |= 4096;
- }
- else
- {
- packing_flags &= ~4096;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeBoundResult argsNotMatched(boolean value) {
- return setArgsNotMatched(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("exchangeNotFound", getExchangeNotFound());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("queueNotFound", getQueueNotFound());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("queueNotMatched", getQueueNotMatched());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("keyNotMatched", getKeyNotMatched());
- }
- if ((packing_flags & 4096) != 0)
- {
- result.put("argsNotMatched", getArgsNotMatched());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeDeclare.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeDeclare.java
deleted file mode 100644
index e339801f44..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeDeclare.java
+++ /dev/null
@@ -1,397 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExchangeDeclare extends Method {
-
- public static final int TYPE = 1793;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String exchange;
- private String type;
- private String alternateExchange;
- private Map<String,Object> arguments;
-
-
- public ExchangeDeclare() {}
-
-
- public ExchangeDeclare(String exchange, String type, String alternateExchange, Map<String,Object> arguments, Option ... _options) {
- if(exchange != null) {
- setExchange(exchange);
- }
- if(type != null) {
- setType(type);
- }
- if(alternateExchange != null) {
- setAlternateExchange(alternateExchange);
- }
- if(arguments != null) {
- setArguments(arguments);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case PASSIVE: packing_flags |= 2048; break;
- case DURABLE: packing_flags |= 4096; break;
- case AUTO_DELETE: packing_flags |= 8192; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.exchangeDeclare(context, this);
- }
-
-
- public final boolean hasExchange() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExchangeDeclare clearExchange() {
- packing_flags &= ~256;
- this.exchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getExchange() {
- return exchange;
- }
-
- public final ExchangeDeclare setExchange(String value) {
- this.exchange = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExchangeDeclare exchange(String value) {
- return setExchange(value);
- }
-
- public final boolean hasType() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExchangeDeclare clearType() {
- packing_flags &= ~512;
- this.type = null;
- setDirty(true);
- return this;
- }
-
- public final String getType() {
- return type;
- }
-
- public final ExchangeDeclare setType(String value) {
- this.type = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ExchangeDeclare type(String value) {
- return setType(value);
- }
-
- public final boolean hasAlternateExchange() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ExchangeDeclare clearAlternateExchange() {
- packing_flags &= ~1024;
- this.alternateExchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getAlternateExchange() {
- return alternateExchange;
- }
-
- public final ExchangeDeclare setAlternateExchange(String value) {
- this.alternateExchange = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ExchangeDeclare alternateExchange(String value) {
- return setAlternateExchange(value);
- }
-
- public final boolean hasPassive() {
- return (packing_flags & 2048) != 0;
- }
-
- public final ExchangeDeclare clearPassive() {
- packing_flags &= ~2048;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getPassive() {
- return hasPassive();
- }
-
- public final ExchangeDeclare setPassive(boolean value) {
-
- if (value)
- {
- packing_flags |= 2048;
- }
- else
- {
- packing_flags &= ~2048;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeDeclare passive(boolean value) {
- return setPassive(value);
- }
-
- public final boolean hasDurable() {
- return (packing_flags & 4096) != 0;
- }
-
- public final ExchangeDeclare clearDurable() {
- packing_flags &= ~4096;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getDurable() {
- return hasDurable();
- }
-
- public final ExchangeDeclare setDurable(boolean value) {
-
- if (value)
- {
- packing_flags |= 4096;
- }
- else
- {
- packing_flags &= ~4096;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeDeclare durable(boolean value) {
- return setDurable(value);
- }
-
- public final boolean hasAutoDelete() {
- return (packing_flags & 8192) != 0;
- }
-
- public final ExchangeDeclare clearAutoDelete() {
- packing_flags &= ~8192;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getAutoDelete() {
- return hasAutoDelete();
- }
-
- public final ExchangeDeclare setAutoDelete(boolean value) {
-
- if (value)
- {
- packing_flags |= 8192;
- }
- else
- {
- packing_flags &= ~8192;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeDeclare autoDelete(boolean value) {
- return setAutoDelete(value);
- }
-
- public final boolean hasArguments() {
- return (packing_flags & 16384) != 0;
- }
-
- public final ExchangeDeclare clearArguments() {
- packing_flags &= ~16384;
- this.arguments = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getArguments() {
- return arguments;
- }
-
- public final ExchangeDeclare setArguments(Map<String,Object> value) {
- this.arguments = value;
- packing_flags |= 16384;
- setDirty(true);
- return this;
- }
-
- public final ExchangeDeclare arguments(Map<String,Object> value) {
- return setArguments(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.exchange);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.type);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeStr8(this.alternateExchange);
- }
- if ((packing_flags & 16384) != 0)
- {
- enc.writeMap(this.arguments);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.exchange = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.type = dec.readStr8();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.alternateExchange = dec.readStr8();
- }
- if ((packing_flags & 16384) != 0)
- {
- this.arguments = dec.readMap();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("exchange", getExchange());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("type", getType());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("alternateExchange", getAlternateExchange());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("passive", getPassive());
- }
- if ((packing_flags & 4096) != 0)
- {
- result.put("durable", getDurable());
- }
- if ((packing_flags & 8192) != 0)
- {
- result.put("autoDelete", getAutoDelete());
- }
- if ((packing_flags & 16384) != 0)
- {
- result.put("arguments", getArguments());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeDelete.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeDelete.java
deleted file mode 100644
index a7dcd0cf2c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeDelete.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExchangeDelete extends Method {
-
- public static final int TYPE = 1794;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String exchange;
-
-
- public ExchangeDelete() {}
-
-
- public ExchangeDelete(String exchange, Option ... _options) {
- if(exchange != null) {
- setExchange(exchange);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case IF_UNUSED: packing_flags |= 512; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.exchangeDelete(context, this);
- }
-
-
- public final boolean hasExchange() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExchangeDelete clearExchange() {
- packing_flags &= ~256;
- this.exchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getExchange() {
- return exchange;
- }
-
- public final ExchangeDelete setExchange(String value) {
- this.exchange = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExchangeDelete exchange(String value) {
- return setExchange(value);
- }
-
- public final boolean hasIfUnused() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExchangeDelete clearIfUnused() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getIfUnused() {
- return hasIfUnused();
- }
-
- public final ExchangeDelete setIfUnused(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeDelete ifUnused(boolean value) {
- return setIfUnused(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.exchange);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.exchange = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("exchange", getExchange());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("ifUnused", getIfUnused());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeQuery.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeQuery.java
deleted file mode 100644
index d5f46e7bbf..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeQuery.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExchangeQuery extends Method {
-
- public static final int TYPE = 1795;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String name;
-
-
- public ExchangeQuery() {}
-
-
- public ExchangeQuery(String name, Option ... _options) {
- if(name != null) {
- setName(name);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.exchangeQuery(context, this);
- }
-
-
- public final boolean hasName() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExchangeQuery clearName() {
- packing_flags &= ~256;
- this.name = null;
- setDirty(true);
- return this;
- }
-
- public final String getName() {
- return name;
- }
-
- public final ExchangeQuery setName(String value) {
- this.name = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExchangeQuery name(String value) {
- return setName(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.name);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.name = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("name", getName());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeQueryResult.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeQueryResult.java
deleted file mode 100644
index 9f83a4aaa7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeQueryResult.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class ExchangeQueryResult extends Struct {
-
- public static final int TYPE = 1793;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String type;
- private Map<String,Object> arguments;
-
-
- public ExchangeQueryResult() {}
-
-
- public ExchangeQueryResult(String type, Map<String,Object> arguments, Option ... _options) {
- if(type != null) {
- setType(type);
- }
- if(arguments != null) {
- setArguments(arguments);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case DURABLE: packing_flags |= 512; break;
- case NOT_FOUND: packing_flags |= 1024; break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
-
-
-
- public final boolean hasType() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExchangeQueryResult clearType() {
- packing_flags &= ~256;
- this.type = null;
- setDirty(true);
- return this;
- }
-
- public final String getType() {
- return type;
- }
-
- public final ExchangeQueryResult setType(String value) {
- this.type = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExchangeQueryResult type(String value) {
- return setType(value);
- }
-
- public final boolean hasDurable() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExchangeQueryResult clearDurable() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getDurable() {
- return hasDurable();
- }
-
- public final ExchangeQueryResult setDurable(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeQueryResult durable(boolean value) {
- return setDurable(value);
- }
-
- public final boolean hasNotFound() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ExchangeQueryResult clearNotFound() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getNotFound() {
- return hasNotFound();
- }
-
- public final ExchangeQueryResult setNotFound(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final ExchangeQueryResult notFound(boolean value) {
- return setNotFound(value);
- }
-
- public final boolean hasArguments() {
- return (packing_flags & 2048) != 0;
- }
-
- public final ExchangeQueryResult clearArguments() {
- packing_flags &= ~2048;
- this.arguments = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getArguments() {
- return arguments;
- }
-
- public final ExchangeQueryResult setArguments(Map<String,Object> value) {
- this.arguments = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final ExchangeQueryResult arguments(Map<String,Object> value) {
- return setArguments(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.type);
- }
- if ((packing_flags & 2048) != 0)
- {
- enc.writeMap(this.arguments);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.type = dec.readStr8();
- }
- if ((packing_flags & 2048) != 0)
- {
- this.arguments = dec.readMap();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("type", getType());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("durable", getDurable());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("notFound", getNotFound());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("arguments", getArguments());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeUnbind.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeUnbind.java
deleted file mode 100644
index ba3fe95952..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExchangeUnbind.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExchangeUnbind extends Method {
-
- public static final int TYPE = 1797;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String queue;
- private String exchange;
- private String bindingKey;
-
-
- public ExchangeUnbind() {}
-
-
- public ExchangeUnbind(String queue, String exchange, String bindingKey, Option ... _options) {
- if(queue != null) {
- setQueue(queue);
- }
- if(exchange != null) {
- setExchange(exchange);
- }
- if(bindingKey != null) {
- setBindingKey(bindingKey);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.exchangeUnbind(context, this);
- }
-
-
- public final boolean hasQueue() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExchangeUnbind clearQueue() {
- packing_flags &= ~256;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final ExchangeUnbind setQueue(String value) {
- this.queue = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExchangeUnbind queue(String value) {
- return setQueue(value);
- }
-
- public final boolean hasExchange() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExchangeUnbind clearExchange() {
- packing_flags &= ~512;
- this.exchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getExchange() {
- return exchange;
- }
-
- public final ExchangeUnbind setExchange(String value) {
- this.exchange = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ExchangeUnbind exchange(String value) {
- return setExchange(value);
- }
-
- public final boolean hasBindingKey() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ExchangeUnbind clearBindingKey() {
- packing_flags &= ~1024;
- this.bindingKey = null;
- setDirty(true);
- return this;
- }
-
- public final String getBindingKey() {
- return bindingKey;
- }
-
- public final ExchangeUnbind setBindingKey(String value) {
- this.bindingKey = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ExchangeUnbind bindingKey(String value) {
- return setBindingKey(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.queue);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.exchange);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeStr8(this.bindingKey);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.queue = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.exchange = dec.readStr8();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.bindingKey = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("queue", getQueue());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("exchange", getExchange());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("bindingKey", getBindingKey());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionErrorCode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionErrorCode.java
deleted file mode 100644
index 0ba83296e7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionErrorCode.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum ExecutionErrorCode {
-
- UNAUTHORIZED_ACCESS((int) 403),
- NOT_FOUND((int) 404),
- RESOURCE_LOCKED((int) 405),
- PRECONDITION_FAILED((int) 406),
- RESOURCE_DELETED((int) 408),
- ILLEGAL_STATE((int) 409),
- COMMAND_INVALID((int) 503),
- RESOURCE_LIMIT_EXCEEDED((int) 506),
- NOT_ALLOWED((int) 530),
- ILLEGAL_ARGUMENT((int) 531),
- NOT_IMPLEMENTED((int) 540),
- INTERNAL_ERROR((int) 541),
- INVALID_ARGUMENT((int) 542);
-
- private final int value;
-
- ExecutionErrorCode(int value)
- {
- this.value = value;
- }
-
- public int getValue()
- {
- return value;
- }
-
- public static ExecutionErrorCode get(int value)
- {
- switch (value)
- {
- case (int) 403: return UNAUTHORIZED_ACCESS;
- case (int) 404: return NOT_FOUND;
- case (int) 405: return RESOURCE_LOCKED;
- case (int) 406: return PRECONDITION_FAILED;
- case (int) 408: return RESOURCE_DELETED;
- case (int) 409: return ILLEGAL_STATE;
- case (int) 503: return COMMAND_INVALID;
- case (int) 506: return RESOURCE_LIMIT_EXCEEDED;
- case (int) 530: return NOT_ALLOWED;
- case (int) 531: return ILLEGAL_ARGUMENT;
- case (int) 540: return NOT_IMPLEMENTED;
- case (int) 541: return INTERNAL_ERROR;
- case (int) 542: return INVALID_ARGUMENT;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionException.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionException.java
deleted file mode 100644
index 0f61272476..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionException.java
+++ /dev/null
@@ -1,398 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExecutionException extends Method {
-
- public static final int TYPE = 771;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private ExecutionErrorCode errorCode;
- private int commandId;
- private short classCode;
- private short commandCode;
- private short fieldIndex;
- private String description;
- private Map<String,Object> errorInfo;
-
-
- public ExecutionException() {}
-
-
- public ExecutionException(ExecutionErrorCode errorCode, int commandId, short classCode, short commandCode, short fieldIndex, String description, Map<String,Object> errorInfo, Option ... _options) {
- if(errorCode != null) {
- setErrorCode(errorCode);
- }
- setCommandId(commandId);
- setClassCode(classCode);
- setCommandCode(commandCode);
- setFieldIndex(fieldIndex);
- if(description != null) {
- setDescription(description);
- }
- if(errorInfo != null) {
- setErrorInfo(errorInfo);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.executionException(context, this);
- }
-
-
- public final boolean hasErrorCode() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExecutionException clearErrorCode() {
- packing_flags &= ~256;
- this.errorCode = null;
- setDirty(true);
- return this;
- }
-
- public final ExecutionErrorCode getErrorCode() {
- return errorCode;
- }
-
- public final ExecutionException setErrorCode(ExecutionErrorCode value) {
- this.errorCode = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExecutionException errorCode(ExecutionErrorCode value) {
- return setErrorCode(value);
- }
-
- public final boolean hasCommandId() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExecutionException clearCommandId() {
- packing_flags &= ~512;
- this.commandId = 0;
- setDirty(true);
- return this;
- }
-
- public final int getCommandId() {
- return commandId;
- }
-
- public final ExecutionException setCommandId(int value) {
- this.commandId = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ExecutionException commandId(int value) {
- return setCommandId(value);
- }
-
- public final boolean hasClassCode() {
- return (packing_flags & 1024) != 0;
- }
-
- public final ExecutionException clearClassCode() {
- packing_flags &= ~1024;
- this.classCode = 0;
- setDirty(true);
- return this;
- }
-
- public final short getClassCode() {
- return classCode;
- }
-
- public final ExecutionException setClassCode(short value) {
- this.classCode = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final ExecutionException classCode(short value) {
- return setClassCode(value);
- }
-
- public final boolean hasCommandCode() {
- return (packing_flags & 2048) != 0;
- }
-
- public final ExecutionException clearCommandCode() {
- packing_flags &= ~2048;
- this.commandCode = 0;
- setDirty(true);
- return this;
- }
-
- public final short getCommandCode() {
- return commandCode;
- }
-
- public final ExecutionException setCommandCode(short value) {
- this.commandCode = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final ExecutionException commandCode(short value) {
- return setCommandCode(value);
- }
-
- public final boolean hasFieldIndex() {
- return (packing_flags & 4096) != 0;
- }
-
- public final ExecutionException clearFieldIndex() {
- packing_flags &= ~4096;
- this.fieldIndex = 0;
- setDirty(true);
- return this;
- }
-
- public final short getFieldIndex() {
- return fieldIndex;
- }
-
- public final ExecutionException setFieldIndex(short value) {
- this.fieldIndex = value;
- packing_flags |= 4096;
- setDirty(true);
- return this;
- }
-
- public final ExecutionException fieldIndex(short value) {
- return setFieldIndex(value);
- }
-
- public final boolean hasDescription() {
- return (packing_flags & 8192) != 0;
- }
-
- public final ExecutionException clearDescription() {
- packing_flags &= ~8192;
- this.description = null;
- setDirty(true);
- return this;
- }
-
- public final String getDescription() {
- return description;
- }
-
- public final ExecutionException setDescription(String value) {
- this.description = value;
- packing_flags |= 8192;
- setDirty(true);
- return this;
- }
-
- public final ExecutionException description(String value) {
- return setDescription(value);
- }
-
- public final boolean hasErrorInfo() {
- return (packing_flags & 16384) != 0;
- }
-
- public final ExecutionException clearErrorInfo() {
- packing_flags &= ~16384;
- this.errorInfo = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getErrorInfo() {
- return errorInfo;
- }
-
- public final ExecutionException setErrorInfo(Map<String,Object> value) {
- this.errorInfo = value;
- packing_flags |= 16384;
- setDirty(true);
- return this;
- }
-
- public final ExecutionException errorInfo(Map<String,Object> value) {
- return setErrorInfo(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint16(this.errorCode.getValue());
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeSequenceNo(this.commandId);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeUint8(this.classCode);
- }
- if ((packing_flags & 2048) != 0)
- {
- enc.writeUint8(this.commandCode);
- }
- if ((packing_flags & 4096) != 0)
- {
- enc.writeUint8(this.fieldIndex);
- }
- if ((packing_flags & 8192) != 0)
- {
- enc.writeStr16(this.description);
- }
- if ((packing_flags & 16384) != 0)
- {
- enc.writeMap(this.errorInfo);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.errorCode = ExecutionErrorCode.get(dec.readUint16());
- }
- if ((packing_flags & 512) != 0)
- {
- this.commandId = dec.readSequenceNo();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.classCode = dec.readUint8();
- }
- if ((packing_flags & 2048) != 0)
- {
- this.commandCode = dec.readUint8();
- }
- if ((packing_flags & 4096) != 0)
- {
- this.fieldIndex = dec.readUint8();
- }
- if ((packing_flags & 8192) != 0)
- {
- this.description = dec.readStr16();
- }
- if ((packing_flags & 16384) != 0)
- {
- this.errorInfo = dec.readMap();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("errorCode", getErrorCode());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("commandId", getCommandId());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("classCode", getClassCode());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("commandCode", getCommandCode());
- }
- if ((packing_flags & 4096) != 0)
- {
- result.put("fieldIndex", getFieldIndex());
- }
- if ((packing_flags & 8192) != 0)
- {
- result.put("description", getDescription());
- }
- if ((packing_flags & 16384) != 0)
- {
- result.put("errorInfo", getErrorInfo());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionResult.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionResult.java
deleted file mode 100644
index 123848b7eb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionResult.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExecutionResult extends Method {
-
- public static final int TYPE = 770;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private int commandId;
- private Struct value;
-
-
- public ExecutionResult() {}
-
-
- public ExecutionResult(int commandId, Struct value, Option ... _options) {
- setCommandId(commandId);
- if(value != null) {
- setValue(value);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.executionResult(context, this);
- }
-
-
- public final boolean hasCommandId() {
- return (packing_flags & 256) != 0;
- }
-
- public final ExecutionResult clearCommandId() {
- packing_flags &= ~256;
- this.commandId = 0;
- setDirty(true);
- return this;
- }
-
- public final int getCommandId() {
- return commandId;
- }
-
- public final ExecutionResult setCommandId(int value) {
- this.commandId = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ExecutionResult commandId(int value) {
- return setCommandId(value);
- }
-
- public final boolean hasValue() {
- return (packing_flags & 512) != 0;
- }
-
- public final ExecutionResult clearValue() {
- packing_flags &= ~512;
- this.value = null;
- setDirty(true);
- return this;
- }
-
- public final Struct getValue() {
- return value;
- }
-
- public final ExecutionResult setValue(Struct value) {
- this.value = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ExecutionResult value(Struct value) {
- return setValue(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceNo(this.commandId);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStruct32(this.value);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.commandId = dec.readSequenceNo();
- }
- if ((packing_flags & 512) != 0)
- {
- this.value = dec.readStruct32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("commandId", getCommandId());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("value", getValue());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionSync.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionSync.java
deleted file mode 100644
index db35beb161..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ExecutionSync.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class ExecutionSync extends Method {
-
- public static final int TYPE = 769;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
-
-
-
-
- public ExecutionSync(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.executionSync(context, this);
- }
-
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Field.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Field.java
deleted file mode 100644
index bc6bf10041..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Field.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-/**
- * Field
- *
- */
-
-public abstract class Field<C,T>
-{
-
- private final Class<C> container;
- private final Class<T> type;
- private final String name;
- private final int index;
-
- Field(Class<C> container, Class<T> type, String name, int index)
- {
- this.container = container;
- this.type = type;
- this.name = name;
- this.index = index;
- }
-
- public final Class<C> getContainer()
- {
- return container;
- }
-
- public final Class<T> getType()
- {
- return type;
- }
-
- public final String getName()
- {
- return name;
- }
-
- public final int getIndex()
- {
- return index;
- }
-
- protected final C check(Object struct)
- {
- return container.cast(struct);
- }
-
- public abstract boolean has(Object struct);
-
- public abstract void has(Object struct, boolean value);
-
- public abstract T get(Object struct);
-
- public abstract void read(Decoder dec, Object struct);
-
- public abstract void write(Encoder enc, Object struct);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/FileReturnCode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/FileReturnCode.java
deleted file mode 100644
index 2c0b4d510b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/FileReturnCode.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum FileReturnCode {
-
- CONTENT_TOO_LARGE((int) 311),
- NO_ROUTE((int) 312),
- NO_CONSUMERS((int) 313);
-
- private final int value;
-
- FileReturnCode(int value)
- {
- this.value = value;
- }
-
- public int getValue()
- {
- return value;
- }
-
- public static FileReturnCode get(int value)
- {
- switch (value)
- {
- case (int) 311: return CONTENT_TOO_LARGE;
- case (int) 312: return NO_ROUTE;
- case (int) 313: return NO_CONSUMERS;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/FragmentProperties.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/FragmentProperties.java
deleted file mode 100644
index 0b9774355e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/FragmentProperties.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class FragmentProperties extends Struct {
-
- public static final int TYPE = 1026;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private long fragmentSize;
-
-
- public FragmentProperties() {}
-
-
- public FragmentProperties(long fragmentSize, Option ... _options) {
- setFragmentSize(fragmentSize);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case FIRST: packing_flags |= 256; break;
- case LAST: packing_flags |= 512; break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
-
-
-
- public final boolean hasFirst() {
- return (packing_flags & 256) != 0;
- }
-
- public final FragmentProperties clearFirst() {
- packing_flags &= ~256;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getFirst() {
- return hasFirst();
- }
-
- public final FragmentProperties setFirst(boolean value) {
-
- if (value)
- {
- packing_flags |= 256;
- }
- else
- {
- packing_flags &= ~256;
- }
-
- setDirty(true);
- return this;
- }
-
- public final FragmentProperties first(boolean value) {
- return setFirst(value);
- }
-
- public final boolean hasLast() {
- return (packing_flags & 512) != 0;
- }
-
- public final FragmentProperties clearLast() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getLast() {
- return hasLast();
- }
-
- public final FragmentProperties setLast(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final FragmentProperties last(boolean value) {
- return setLast(value);
- }
-
- public final boolean hasFragmentSize() {
- return (packing_flags & 1024) != 0;
- }
-
- public final FragmentProperties clearFragmentSize() {
- packing_flags &= ~1024;
- this.fragmentSize = 0;
- setDirty(true);
- return this;
- }
-
- public final long getFragmentSize() {
- return fragmentSize;
- }
-
- public final FragmentProperties setFragmentSize(long value) {
- this.fragmentSize = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final FragmentProperties fragmentSize(long value) {
- return setFragmentSize(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 1024) != 0)
- {
- enc.writeUint64(this.fragmentSize);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 1024) != 0)
- {
- this.fragmentSize = dec.readUint64();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("first", getFirst());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("last", getLast());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("fragmentSize", getFragmentSize());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/FrameSizeObserver.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/FrameSizeObserver.java
deleted file mode 100644
index 94d0080fbb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/FrameSizeObserver.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-public interface FrameSizeObserver
-{
- void setMaxFrameSize(int frameSize);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Future.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Future.java
deleted file mode 100644
index d8cde61af5..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Future.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * Future
- *
- * @author Rafael H. Schloming
- */
-
-public interface Future<T>
-{
-
- T get();
-
- boolean isDone();
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/GetTimeoutResult.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/GetTimeoutResult.java
deleted file mode 100644
index ebff105464..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/GetTimeoutResult.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class GetTimeoutResult extends Struct {
-
- public static final int TYPE = 1538;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private long timeout;
-
-
- public GetTimeoutResult() {}
-
-
- public GetTimeoutResult(long timeout) {
- setTimeout(timeout);
-
- }
-
-
-
-
- public final boolean hasTimeout() {
- return (packing_flags & 256) != 0;
- }
-
- public final GetTimeoutResult clearTimeout() {
- packing_flags &= ~256;
- this.timeout = 0;
- setDirty(true);
- return this;
- }
-
- public final long getTimeout() {
- return timeout;
- }
-
- public final GetTimeoutResult setTimeout(long value) {
- this.timeout = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final GetTimeoutResult timeout(long value) {
- return setTimeout(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint32(this.timeout);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.timeout = dec.readUint32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("timeout", getTimeout());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Header.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Header.java
deleted file mode 100644
index 7ac75f9163..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Header.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import java.util.List;
-
-
-/**
- * Header
- *
- * @author Rafael H. Schloming
- */
-
-public class Header
-{
-
- private final DeliveryProperties _deliveryProps;
- private final MessageProperties _messageProps;
- private final List<Struct> _nonStandardProps;
-
- public Header(DeliveryProperties deliveryProps, MessageProperties messageProps)
- {
- this(deliveryProps, messageProps, null);
- }
-
- public Header(DeliveryProperties deliveryProps, MessageProperties messageProps, List<Struct> nonStandardProps)
- {
- _deliveryProps = deliveryProps;
- _messageProps = messageProps;
- _nonStandardProps = nonStandardProps;
- }
-
- public Struct[] getStructs()
- {
- int size = 0;
- if(_deliveryProps != null)
- {
- size++;
- }
- if(_messageProps != null)
- {
- size++;
- }
- if(_nonStandardProps != null)
- {
- size+=_nonStandardProps.size();
- }
- Struct[] structs = new Struct[size];
- int index = 0;
- if(_deliveryProps != null)
- {
- structs[index++] = _deliveryProps;
- }
- if(_messageProps != null)
- {
- structs[index++] = _messageProps;
- }
- if(_nonStandardProps != null)
- {
- for(Struct struct : _nonStandardProps)
- {
- structs[index++] = struct;
- }
- }
-
- return structs;
- }
-
- public DeliveryProperties getDeliveryProperties()
- {
- return _deliveryProps;
- }
-
- public MessageProperties getMessageProperties()
- {
- return _messageProps;
- }
-
- public List<Struct> getNonStandardProperties()
- {
- return _nonStandardProps;
- }
-
- public String toString()
- {
- StringBuilder str = new StringBuilder();
- str.append(" Header(");
- boolean first = true;
- if(_deliveryProps !=null)
- {
- first=false;
- str.append(_deliveryProps);
- }
- if(_messageProps != null)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- str.append(", ");
- }
- str.append(_messageProps);
- }
- if(_nonStandardProps != null)
- {
- for (Struct s : _nonStandardProps)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- str.append(", ");
- }
- str.append(s);
- }
- }
- str.append(')');
- return str.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAccept.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAccept.java
deleted file mode 100644
index e30a4e4f66..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAccept.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageAccept extends Method {
-
- public static final int TYPE = 1026;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet transfers;
-
-
- public MessageAccept() {}
-
-
- public MessageAccept(RangeSet transfers, Option ... _options) {
- if(transfers != null) {
- setTransfers(transfers);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageAccept(context, this);
- }
-
-
- public final boolean hasTransfers() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageAccept clearTransfers() {
- packing_flags &= ~256;
- this.transfers = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getTransfers() {
- return transfers;
- }
-
- public final MessageAccept setTransfers(RangeSet value) {
- this.transfers = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageAccept transfers(RangeSet value) {
- return setTransfers(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.transfers);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.transfers = dec.readSequenceSet();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("transfers", getTransfers());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcceptMode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcceptMode.java
deleted file mode 100644
index 0f11560c66..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcceptMode.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum MessageAcceptMode {
-
- EXPLICIT((short) 0),
- NONE((short) 1);
-
- private final short value;
-
- MessageAcceptMode(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static MessageAcceptMode get(short value)
- {
- switch (value)
- {
- case (short) 0: return EXPLICIT;
- case (short) 1: return NONE;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcquire.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcquire.java
deleted file mode 100644
index 6ef5283163..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcquire.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageAcquire extends Method {
-
- public static final int TYPE = 1029;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet transfers;
-
-
- public MessageAcquire() {}
-
-
- public MessageAcquire(RangeSet transfers, Option ... _options) {
- if(transfers != null) {
- setTransfers(transfers);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageAcquire(context, this);
- }
-
-
- public final boolean hasTransfers() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageAcquire clearTransfers() {
- packing_flags &= ~256;
- this.transfers = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getTransfers() {
- return transfers;
- }
-
- public final MessageAcquire setTransfers(RangeSet value) {
- this.transfers = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageAcquire transfers(RangeSet value) {
- return setTransfers(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.transfers);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.transfers = dec.readSequenceSet();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("transfers", getTransfers());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcquireMode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcquireMode.java
deleted file mode 100644
index 3d46baf1af..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageAcquireMode.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum MessageAcquireMode {
-
- PRE_ACQUIRED((short) 0),
- NOT_ACQUIRED((short) 1);
-
- private final short value;
-
- MessageAcquireMode(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static MessageAcquireMode get(short value)
- {
- switch (value)
- {
- case (short) 0: return PRE_ACQUIRED;
- case (short) 1: return NOT_ACQUIRED;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageCancel.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageCancel.java
deleted file mode 100644
index 1ab510150d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageCancel.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageCancel extends Method {
-
- public static final int TYPE = 1032;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String destination;
-
-
- public MessageCancel() {}
-
-
- public MessageCancel(String destination, Option ... _options) {
- if(destination != null) {
- setDestination(destination);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageCancel(context, this);
- }
-
-
- public final boolean hasDestination() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageCancel clearDestination() {
- packing_flags &= ~256;
- this.destination = null;
- setDirty(true);
- return this;
- }
-
- public final String getDestination() {
- return destination;
- }
-
- public final MessageCancel setDestination(String value) {
- this.destination = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageCancel destination(String value) {
- return setDestination(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.destination);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.destination = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("destination", getDestination());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageCreditUnit.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageCreditUnit.java
deleted file mode 100644
index f3ade93c69..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageCreditUnit.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum MessageCreditUnit {
-
- MESSAGE((short) 0),
- BYTE((short) 1);
-
- private final short value;
-
- MessageCreditUnit(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static MessageCreditUnit get(short value)
- {
- switch (value)
- {
- case (short) 0: return MESSAGE;
- case (short) 1: return BYTE;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageDeliveryMode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageDeliveryMode.java
deleted file mode 100644
index eb21465c10..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageDeliveryMode.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum MessageDeliveryMode {
-
- NON_PERSISTENT((short) 1),
- PERSISTENT((short) 2);
-
- private final short value;
-
- MessageDeliveryMode(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static MessageDeliveryMode get(short value)
- {
- switch (value)
- {
- case (short) 1: return NON_PERSISTENT;
- case (short) 2: return PERSISTENT;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageDeliveryPriority.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageDeliveryPriority.java
deleted file mode 100644
index d5d1b861e8..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageDeliveryPriority.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum MessageDeliveryPriority {
-
- LOWEST((short) 0),
- LOWER((short) 1),
- LOW((short) 2),
- BELOW_AVERAGE((short) 3),
- MEDIUM((short) 4),
- ABOVE_AVERAGE((short) 5),
- HIGH((short) 6),
- HIGHER((short) 7),
- VERY_HIGH((short) 8),
- HIGHEST((short) 9);
-
- private final short value;
-
- MessageDeliveryPriority(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static MessageDeliveryPriority get(short value)
- {
- switch (value)
- {
- case (short) 0: return LOWEST;
- case (short) 1: return LOWER;
- case (short) 2: return LOW;
- case (short) 3: return BELOW_AVERAGE;
- case (short) 4: return MEDIUM;
- case (short) 5: return ABOVE_AVERAGE;
- case (short) 6: return HIGH;
- case (short) 7: return HIGHER;
- case (short) 8: return VERY_HIGH;
- case (short) 9: return HIGHEST;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlow.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlow.java
deleted file mode 100644
index 0ece4245b3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlow.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageFlow extends Method {
-
- public static final int TYPE = 1034;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String destination;
- private MessageCreditUnit unit;
- private long value;
-
-
- public MessageFlow() {}
-
-
- public MessageFlow(String destination, MessageCreditUnit unit, long value, Option ... _options) {
- if(destination != null) {
- setDestination(destination);
- }
- if(unit != null) {
- setUnit(unit);
- }
- setValue(value);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageFlow(context, this);
- }
-
-
- public final boolean hasDestination() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageFlow clearDestination() {
- packing_flags &= ~256;
- this.destination = null;
- setDirty(true);
- return this;
- }
-
- public final String getDestination() {
- return destination;
- }
-
- public final MessageFlow setDestination(String value) {
- this.destination = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageFlow destination(String value) {
- return setDestination(value);
- }
-
- public final boolean hasUnit() {
- return (packing_flags & 512) != 0;
- }
-
- public final MessageFlow clearUnit() {
- packing_flags &= ~512;
- this.unit = null;
- setDirty(true);
- return this;
- }
-
- public final MessageCreditUnit getUnit() {
- return unit;
- }
-
- public final MessageFlow setUnit(MessageCreditUnit value) {
- this.unit = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final MessageFlow unit(MessageCreditUnit value) {
- return setUnit(value);
- }
-
- public final boolean hasValue() {
- return (packing_flags & 1024) != 0;
- }
-
- public final MessageFlow clearValue() {
- packing_flags &= ~1024;
- this.value = 0;
- setDirty(true);
- return this;
- }
-
- public final long getValue() {
- return value;
- }
-
- public final MessageFlow setValue(long value) {
- this.value = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final MessageFlow value(long value) {
- return setValue(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.destination);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint8(this.unit.getValue());
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeUint32(this.value);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.destination = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.unit = MessageCreditUnit.get(dec.readUint8());
- }
- if ((packing_flags & 1024) != 0)
- {
- this.value = dec.readUint32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("destination", getDestination());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("unit", getUnit());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("value", getValue());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlowMode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlowMode.java
deleted file mode 100644
index 60670260fb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlowMode.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum MessageFlowMode {
-
- CREDIT((short) 0),
- WINDOW((short) 1);
-
- private final short value;
-
- MessageFlowMode(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static MessageFlowMode get(short value)
- {
- switch (value)
- {
- case (short) 0: return CREDIT;
- case (short) 1: return WINDOW;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlush.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlush.java
deleted file mode 100644
index 8e093dd003..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageFlush.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageFlush extends Method {
-
- public static final int TYPE = 1035;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String destination;
-
-
- public MessageFlush() {}
-
-
- public MessageFlush(String destination, Option ... _options) {
- if(destination != null) {
- setDestination(destination);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageFlush(context, this);
- }
-
-
- public final boolean hasDestination() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageFlush clearDestination() {
- packing_flags &= ~256;
- this.destination = null;
- setDirty(true);
- return this;
- }
-
- public final String getDestination() {
- return destination;
- }
-
- public final MessageFlush setDestination(String value) {
- this.destination = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageFlush destination(String value) {
- return setDestination(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.destination);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.destination = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("destination", getDestination());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageProperties.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageProperties.java
deleted file mode 100644
index 37b5e7a052..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageProperties.java
+++ /dev/null
@@ -1,475 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class MessageProperties extends Struct {
-
- public static final int TYPE = 1027;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private long contentLength;
- private java.util.UUID messageId;
- private byte[] correlationId;
- private ReplyTo replyTo;
- private String contentType;
- private String contentEncoding;
- private byte[] userId;
- private byte[] appId;
- private Map<String,Object> applicationHeaders;
-
-
- public MessageProperties() {}
-
-
- public MessageProperties(long contentLength, java.util.UUID messageId, byte[] correlationId, ReplyTo replyTo, String contentType, String contentEncoding, byte[] userId, byte[] appId, Map<String,Object> applicationHeaders) {
- setContentLength(contentLength);
- if(messageId != null) {
- setMessageId(messageId);
- }
- if(correlationId != null) {
- setCorrelationId(correlationId);
- }
- if(replyTo != null) {
- setReplyTo(replyTo);
- }
- if(contentType != null) {
- setContentType(contentType);
- }
- if(contentEncoding != null) {
- setContentEncoding(contentEncoding);
- }
- if(userId != null) {
- setUserId(userId);
- }
- if(appId != null) {
- setAppId(appId);
- }
- if(applicationHeaders != null) {
- setApplicationHeaders(applicationHeaders);
- }
-
- }
-
-
-
-
- public final boolean hasContentLength() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageProperties clearContentLength() {
- packing_flags &= ~256;
- this.contentLength = 0;
- setDirty(true);
- return this;
- }
-
- public final long getContentLength() {
- return contentLength;
- }
-
- public final MessageProperties setContentLength(long value) {
- this.contentLength = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties contentLength(long value) {
- return setContentLength(value);
- }
-
- public final boolean hasMessageId() {
- return (packing_flags & 512) != 0;
- }
-
- public final MessageProperties clearMessageId() {
- packing_flags &= ~512;
- this.messageId = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.UUID getMessageId() {
- return messageId;
- }
-
- public final MessageProperties setMessageId(java.util.UUID value) {
- this.messageId = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties messageId(java.util.UUID value) {
- return setMessageId(value);
- }
-
- public final boolean hasCorrelationId() {
- return (packing_flags & 1024) != 0;
- }
-
- public final MessageProperties clearCorrelationId() {
- packing_flags &= ~1024;
- this.correlationId = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getCorrelationId() {
- return correlationId;
- }
-
- public final MessageProperties setCorrelationId(byte[] value) {
- this.correlationId = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties correlationId(byte[] value) {
- return setCorrelationId(value);
- }
-
- public final boolean hasReplyTo() {
- return (packing_flags & 2048) != 0;
- }
-
- public final MessageProperties clearReplyTo() {
- packing_flags &= ~2048;
- this.replyTo = null;
- setDirty(true);
- return this;
- }
-
- public final ReplyTo getReplyTo() {
- return replyTo;
- }
-
- public final MessageProperties setReplyTo(ReplyTo value) {
- this.replyTo = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties replyTo(ReplyTo value) {
- return setReplyTo(value);
- }
-
- public final boolean hasContentType() {
- return (packing_flags & 4096) != 0;
- }
-
- public final MessageProperties clearContentType() {
- packing_flags &= ~4096;
- this.contentType = null;
- setDirty(true);
- return this;
- }
-
- public final String getContentType() {
- return contentType;
- }
-
- public final MessageProperties setContentType(String value) {
- this.contentType = value;
- packing_flags |= 4096;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties contentType(String value) {
- return setContentType(value);
- }
-
- public final boolean hasContentEncoding() {
- return (packing_flags & 8192) != 0;
- }
-
- public final MessageProperties clearContentEncoding() {
- packing_flags &= ~8192;
- this.contentEncoding = null;
- setDirty(true);
- return this;
- }
-
- public final String getContentEncoding() {
- return contentEncoding;
- }
-
- public final MessageProperties setContentEncoding(String value) {
- this.contentEncoding = value;
- packing_flags |= 8192;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties contentEncoding(String value) {
- return setContentEncoding(value);
- }
-
- public final boolean hasUserId() {
- return (packing_flags & 16384) != 0;
- }
-
- public final MessageProperties clearUserId() {
- packing_flags &= ~16384;
- this.userId = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getUserId() {
- return userId;
- }
-
- public final MessageProperties setUserId(byte[] value) {
- this.userId = value;
- packing_flags |= 16384;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties userId(byte[] value) {
- return setUserId(value);
- }
-
- public final boolean hasAppId() {
- return (packing_flags & 32768) != 0;
- }
-
- public final MessageProperties clearAppId() {
- packing_flags &= ~32768;
- this.appId = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getAppId() {
- return appId;
- }
-
- public final MessageProperties setAppId(byte[] value) {
- this.appId = value;
- packing_flags |= 32768;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties appId(byte[] value) {
- return setAppId(value);
- }
-
- public final boolean hasApplicationHeaders() {
- return (packing_flags & 1) != 0;
- }
-
- public final MessageProperties clearApplicationHeaders() {
- packing_flags &= ~1;
- this.applicationHeaders = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getApplicationHeaders() {
- return applicationHeaders;
- }
-
- public final MessageProperties setApplicationHeaders(Map<String,Object> value) {
- this.applicationHeaders = value;
- packing_flags |= 1;
- setDirty(true);
- return this;
- }
-
- public final MessageProperties applicationHeaders(Map<String,Object> value) {
- return setApplicationHeaders(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint64(this.contentLength);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUuid(this.messageId);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeVbin16(this.correlationId);
- }
- if ((packing_flags & 2048) != 0)
- {
- enc.writeStruct(ReplyTo.TYPE, this.replyTo);
- }
- if ((packing_flags & 4096) != 0)
- {
- enc.writeStr8(this.contentType);
- }
- if ((packing_flags & 8192) != 0)
- {
- enc.writeStr8(this.contentEncoding);
- }
- if ((packing_flags & 16384) != 0)
- {
- enc.writeVbin16(this.userId);
- }
- if ((packing_flags & 32768) != 0)
- {
- enc.writeVbin16(this.appId);
- }
- if ((packing_flags & 1) != 0)
- {
- enc.writeMap(this.applicationHeaders);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.contentLength = dec.readUint64();
- }
- if ((packing_flags & 512) != 0)
- {
- this.messageId = dec.readUuid();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.correlationId = dec.readVbin16();
- }
- if ((packing_flags & 2048) != 0)
- {
- this.replyTo = (ReplyTo)dec.readStruct(ReplyTo.TYPE);
- }
- if ((packing_flags & 4096) != 0)
- {
- this.contentType = dec.readStr8();
- }
- if ((packing_flags & 8192) != 0)
- {
- this.contentEncoding = dec.readStr8();
- }
- if ((packing_flags & 16384) != 0)
- {
- this.userId = dec.readVbin16();
- }
- if ((packing_flags & 32768) != 0)
- {
- this.appId = dec.readVbin16();
- }
- if ((packing_flags & 1) != 0)
- {
- this.applicationHeaders = dec.readMap();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("contentLength", getContentLength());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("messageId", getMessageId());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("correlationId", getCorrelationId());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("replyTo", getReplyTo());
- }
- if ((packing_flags & 4096) != 0)
- {
- result.put("contentType", getContentType());
- }
- if ((packing_flags & 8192) != 0)
- {
- result.put("contentEncoding", getContentEncoding());
- }
- if ((packing_flags & 16384) != 0)
- {
- result.put("userId", getUserId());
- }
- if ((packing_flags & 32768) != 0)
- {
- result.put("appId", getAppId());
- }
- if ((packing_flags & 1) != 0)
- {
- result.put("applicationHeaders", getApplicationHeaders());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageReject.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageReject.java
deleted file mode 100644
index 60cb37d55c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageReject.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageReject extends Method {
-
- public static final int TYPE = 1027;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet transfers;
- private MessageRejectCode code;
- private String text;
-
-
- public MessageReject() {}
-
-
- public MessageReject(RangeSet transfers, MessageRejectCode code, String text, Option ... _options) {
- if(transfers != null) {
- setTransfers(transfers);
- }
- if(code != null) {
- setCode(code);
- }
- if(text != null) {
- setText(text);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageReject(context, this);
- }
-
-
- public final boolean hasTransfers() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageReject clearTransfers() {
- packing_flags &= ~256;
- this.transfers = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getTransfers() {
- return transfers;
- }
-
- public final MessageReject setTransfers(RangeSet value) {
- this.transfers = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageReject transfers(RangeSet value) {
- return setTransfers(value);
- }
-
- public final boolean hasCode() {
- return (packing_flags & 512) != 0;
- }
-
- public final MessageReject clearCode() {
- packing_flags &= ~512;
- this.code = null;
- setDirty(true);
- return this;
- }
-
- public final MessageRejectCode getCode() {
- return code;
- }
-
- public final MessageReject setCode(MessageRejectCode value) {
- this.code = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final MessageReject code(MessageRejectCode value) {
- return setCode(value);
- }
-
- public final boolean hasText() {
- return (packing_flags & 1024) != 0;
- }
-
- public final MessageReject clearText() {
- packing_flags &= ~1024;
- this.text = null;
- setDirty(true);
- return this;
- }
-
- public final String getText() {
- return text;
- }
-
- public final MessageReject setText(String value) {
- this.text = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final MessageReject text(String value) {
- return setText(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.transfers);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint16(this.code.getValue());
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeStr8(this.text);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.transfers = dec.readSequenceSet();
- }
- if ((packing_flags & 512) != 0)
- {
- this.code = MessageRejectCode.get(dec.readUint16());
- }
- if ((packing_flags & 1024) != 0)
- {
- this.text = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("transfers", getTransfers());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("code", getCode());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("text", getText());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageRejectCode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageRejectCode.java
deleted file mode 100644
index dc41de100b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageRejectCode.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum MessageRejectCode {
-
- UNSPECIFIED((int) 0),
- UNROUTABLE((int) 1),
- IMMEDIATE((int) 2);
-
- private final int value;
-
- MessageRejectCode(int value)
- {
- this.value = value;
- }
-
- public int getValue()
- {
- return value;
- }
-
- public static MessageRejectCode get(int value)
- {
- switch (value)
- {
- case (int) 0: return UNSPECIFIED;
- case (int) 1: return UNROUTABLE;
- case (int) 2: return IMMEDIATE;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageRelease.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageRelease.java
deleted file mode 100644
index 557139dd01..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageRelease.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageRelease extends Method {
-
- public static final int TYPE = 1028;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet transfers;
-
-
- public MessageRelease() {}
-
-
- public MessageRelease(RangeSet transfers, Option ... _options) {
- if(transfers != null) {
- setTransfers(transfers);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SET_REDELIVERED: packing_flags |= 512; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageRelease(context, this);
- }
-
-
- public final boolean hasTransfers() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageRelease clearTransfers() {
- packing_flags &= ~256;
- this.transfers = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getTransfers() {
- return transfers;
- }
-
- public final MessageRelease setTransfers(RangeSet value) {
- this.transfers = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageRelease transfers(RangeSet value) {
- return setTransfers(value);
- }
-
- public final boolean hasSetRedelivered() {
- return (packing_flags & 512) != 0;
- }
-
- public final MessageRelease clearSetRedelivered() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getSetRedelivered() {
- return hasSetRedelivered();
- }
-
- public final MessageRelease setSetRedelivered(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final MessageRelease setRedelivered(boolean value) {
- return setSetRedelivered(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.transfers);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.transfers = dec.readSequenceSet();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("transfers", getTransfers());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("setRedelivered", getSetRedelivered());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageResume.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageResume.java
deleted file mode 100644
index e0dfbdfd57..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageResume.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageResume extends Method {
-
- public static final int TYPE = 1030;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String destination;
- private String resumeId;
-
-
- public MessageResume() {}
-
-
- public MessageResume(String destination, String resumeId, Option ... _options) {
- if(destination != null) {
- setDestination(destination);
- }
- if(resumeId != null) {
- setResumeId(resumeId);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageResume(context, this);
- }
-
-
- public final boolean hasDestination() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageResume clearDestination() {
- packing_flags &= ~256;
- this.destination = null;
- setDirty(true);
- return this;
- }
-
- public final String getDestination() {
- return destination;
- }
-
- public final MessageResume setDestination(String value) {
- this.destination = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageResume destination(String value) {
- return setDestination(value);
- }
-
- public final boolean hasResumeId() {
- return (packing_flags & 512) != 0;
- }
-
- public final MessageResume clearResumeId() {
- packing_flags &= ~512;
- this.resumeId = null;
- setDirty(true);
- return this;
- }
-
- public final String getResumeId() {
- return resumeId;
- }
-
- public final MessageResume setResumeId(String value) {
- this.resumeId = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final MessageResume resumeId(String value) {
- return setResumeId(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.destination);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr16(this.resumeId);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.destination = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.resumeId = dec.readStr16();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("destination", getDestination());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("resumeId", getResumeId());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageResumeResult.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageResumeResult.java
deleted file mode 100644
index 1524b09509..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageResumeResult.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class MessageResumeResult extends Struct {
-
- public static final int TYPE = 1029;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private long offset;
-
-
- public MessageResumeResult() {}
-
-
- public MessageResumeResult(long offset) {
- setOffset(offset);
-
- }
-
-
-
-
- public final boolean hasOffset() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageResumeResult clearOffset() {
- packing_flags &= ~256;
- this.offset = 0;
- setDirty(true);
- return this;
- }
-
- public final long getOffset() {
- return offset;
- }
-
- public final MessageResumeResult setOffset(long value) {
- this.offset = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageResumeResult offset(long value) {
- return setOffset(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint64(this.offset);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.offset = dec.readUint64();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("offset", getOffset());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageSetFlowMode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageSetFlowMode.java
deleted file mode 100644
index 09457b9764..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageSetFlowMode.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageSetFlowMode extends Method {
-
- public static final int TYPE = 1033;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String destination;
- private MessageFlowMode flowMode;
-
-
- public MessageSetFlowMode() {}
-
-
- public MessageSetFlowMode(String destination, MessageFlowMode flowMode, Option ... _options) {
- if(destination != null) {
- setDestination(destination);
- }
- if(flowMode != null) {
- setFlowMode(flowMode);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageSetFlowMode(context, this);
- }
-
-
- public final boolean hasDestination() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageSetFlowMode clearDestination() {
- packing_flags &= ~256;
- this.destination = null;
- setDirty(true);
- return this;
- }
-
- public final String getDestination() {
- return destination;
- }
-
- public final MessageSetFlowMode setDestination(String value) {
- this.destination = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageSetFlowMode destination(String value) {
- return setDestination(value);
- }
-
- public final boolean hasFlowMode() {
- return (packing_flags & 512) != 0;
- }
-
- public final MessageSetFlowMode clearFlowMode() {
- packing_flags &= ~512;
- this.flowMode = null;
- setDirty(true);
- return this;
- }
-
- public final MessageFlowMode getFlowMode() {
- return flowMode;
- }
-
- public final MessageSetFlowMode setFlowMode(MessageFlowMode value) {
- this.flowMode = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final MessageSetFlowMode flowMode(MessageFlowMode value) {
- return setFlowMode(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.destination);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint8(this.flowMode.getValue());
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.destination = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.flowMode = MessageFlowMode.get(dec.readUint8());
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("destination", getDestination());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("flowMode", getFlowMode());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageStop.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageStop.java
deleted file mode 100644
index 45bb0ffe68..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageStop.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageStop extends Method {
-
- public static final int TYPE = 1036;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String destination;
-
-
- public MessageStop() {}
-
-
- public MessageStop(String destination, Option ... _options) {
- if(destination != null) {
- setDestination(destination);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageStop(context, this);
- }
-
-
- public final boolean hasDestination() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageStop clearDestination() {
- packing_flags &= ~256;
- this.destination = null;
- setDirty(true);
- return this;
- }
-
- public final String getDestination() {
- return destination;
- }
-
- public final MessageStop setDestination(String value) {
- this.destination = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageStop destination(String value) {
- return setDestination(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.destination);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.destination = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("destination", getDestination());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageSubscribe.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageSubscribe.java
deleted file mode 100644
index 4f9a1edf64..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageSubscribe.java
+++ /dev/null
@@ -1,443 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageSubscribe extends Method {
-
- public static final int TYPE = 1031;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String queue;
- private String destination;
- private MessageAcceptMode acceptMode;
- private MessageAcquireMode acquireMode;
- private String resumeId;
- private long resumeTtl;
- private Map<String,Object> arguments;
-
-
- public MessageSubscribe() {}
-
-
- public MessageSubscribe(String queue, String destination, MessageAcceptMode acceptMode, MessageAcquireMode acquireMode, String resumeId, long resumeTtl, Map<String,Object> arguments, Option ... _options) {
- if(queue != null) {
- setQueue(queue);
- }
- if(destination != null) {
- setDestination(destination);
- }
- if(acceptMode != null) {
- setAcceptMode(acceptMode);
- }
- if(acquireMode != null) {
- setAcquireMode(acquireMode);
- }
- if(resumeId != null) {
- setResumeId(resumeId);
- }
- setResumeTtl(resumeTtl);
- if(arguments != null) {
- setArguments(arguments);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case EXCLUSIVE: packing_flags |= 4096; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageSubscribe(context, this);
- }
-
-
- public final boolean hasQueue() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageSubscribe clearQueue() {
- packing_flags &= ~256;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final MessageSubscribe setQueue(String value) {
- this.queue = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageSubscribe queue(String value) {
- return setQueue(value);
- }
-
- public final boolean hasDestination() {
- return (packing_flags & 512) != 0;
- }
-
- public final MessageSubscribe clearDestination() {
- packing_flags &= ~512;
- this.destination = null;
- setDirty(true);
- return this;
- }
-
- public final String getDestination() {
- return destination;
- }
-
- public final MessageSubscribe setDestination(String value) {
- this.destination = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final MessageSubscribe destination(String value) {
- return setDestination(value);
- }
-
- public final boolean hasAcceptMode() {
- return (packing_flags & 1024) != 0;
- }
-
- public final MessageSubscribe clearAcceptMode() {
- packing_flags &= ~1024;
- this.acceptMode = null;
- setDirty(true);
- return this;
- }
-
- public final MessageAcceptMode getAcceptMode() {
- return acceptMode;
- }
-
- public final MessageSubscribe setAcceptMode(MessageAcceptMode value) {
- this.acceptMode = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final MessageSubscribe acceptMode(MessageAcceptMode value) {
- return setAcceptMode(value);
- }
-
- public final boolean hasAcquireMode() {
- return (packing_flags & 2048) != 0;
- }
-
- public final MessageSubscribe clearAcquireMode() {
- packing_flags &= ~2048;
- this.acquireMode = null;
- setDirty(true);
- return this;
- }
-
- public final MessageAcquireMode getAcquireMode() {
- return acquireMode;
- }
-
- public final MessageSubscribe setAcquireMode(MessageAcquireMode value) {
- this.acquireMode = value;
- packing_flags |= 2048;
- setDirty(true);
- return this;
- }
-
- public final MessageSubscribe acquireMode(MessageAcquireMode value) {
- return setAcquireMode(value);
- }
-
- public final boolean hasExclusive() {
- return (packing_flags & 4096) != 0;
- }
-
- public final MessageSubscribe clearExclusive() {
- packing_flags &= ~4096;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getExclusive() {
- return hasExclusive();
- }
-
- public final MessageSubscribe setExclusive(boolean value) {
-
- if (value)
- {
- packing_flags |= 4096;
- }
- else
- {
- packing_flags &= ~4096;
- }
-
- setDirty(true);
- return this;
- }
-
- public final MessageSubscribe exclusive(boolean value) {
- return setExclusive(value);
- }
-
- public final boolean hasResumeId() {
- return (packing_flags & 8192) != 0;
- }
-
- public final MessageSubscribe clearResumeId() {
- packing_flags &= ~8192;
- this.resumeId = null;
- setDirty(true);
- return this;
- }
-
- public final String getResumeId() {
- return resumeId;
- }
-
- public final MessageSubscribe setResumeId(String value) {
- this.resumeId = value;
- packing_flags |= 8192;
- setDirty(true);
- return this;
- }
-
- public final MessageSubscribe resumeId(String value) {
- return setResumeId(value);
- }
-
- public final boolean hasResumeTtl() {
- return (packing_flags & 16384) != 0;
- }
-
- public final MessageSubscribe clearResumeTtl() {
- packing_flags &= ~16384;
- this.resumeTtl = 0;
- setDirty(true);
- return this;
- }
-
- public final long getResumeTtl() {
- return resumeTtl;
- }
-
- public final MessageSubscribe setResumeTtl(long value) {
- this.resumeTtl = value;
- packing_flags |= 16384;
- setDirty(true);
- return this;
- }
-
- public final MessageSubscribe resumeTtl(long value) {
- return setResumeTtl(value);
- }
-
- public final boolean hasArguments() {
- return (packing_flags & 32768) != 0;
- }
-
- public final MessageSubscribe clearArguments() {
- packing_flags &= ~32768;
- this.arguments = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getArguments() {
- return arguments;
- }
-
- public final MessageSubscribe setArguments(Map<String,Object> value) {
- this.arguments = value;
- packing_flags |= 32768;
- setDirty(true);
- return this;
- }
-
- public final MessageSubscribe arguments(Map<String,Object> value) {
- return setArguments(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.queue);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.destination);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeUint8(this.acceptMode.getValue());
- }
- if ((packing_flags & 2048) != 0)
- {
- enc.writeUint8(this.acquireMode.getValue());
- }
- if ((packing_flags & 8192) != 0)
- {
- enc.writeStr16(this.resumeId);
- }
- if ((packing_flags & 16384) != 0)
- {
- enc.writeUint64(this.resumeTtl);
- }
- if ((packing_flags & 32768) != 0)
- {
- enc.writeMap(this.arguments);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.queue = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.destination = dec.readStr8();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.acceptMode = MessageAcceptMode.get(dec.readUint8());
- }
- if ((packing_flags & 2048) != 0)
- {
- this.acquireMode = MessageAcquireMode.get(dec.readUint8());
- }
- if ((packing_flags & 8192) != 0)
- {
- this.resumeId = dec.readStr16();
- }
- if ((packing_flags & 16384) != 0)
- {
- this.resumeTtl = dec.readUint64();
- }
- if ((packing_flags & 32768) != 0)
- {
- this.arguments = dec.readMap();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("queue", getQueue());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("destination", getDestination());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("acceptMode", getAcceptMode());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("acquireMode", getAcquireMode());
- }
- if ((packing_flags & 4096) != 0)
- {
- result.put("exclusive", getExclusive());
- }
- if ((packing_flags & 8192) != 0)
- {
- result.put("resumeId", getResumeId());
- }
- if ((packing_flags & 16384) != 0)
- {
- result.put("resumeTtl", getResumeTtl());
- }
- if ((packing_flags & 32768) != 0)
- {
- result.put("arguments", getArguments());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageTransfer.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageTransfer.java
deleted file mode 100644
index 38fe5d89d8..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MessageTransfer.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import java.nio.ByteBuffer;
-import org.apache.qpid.util.Strings;
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class MessageTransfer extends Method {
-
- public static final int TYPE = 1025;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return true;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String destination;
- private MessageAcceptMode acceptMode;
- private MessageAcquireMode acquireMode;
- private Header header;
- private ByteBuffer body;
-
-
- public MessageTransfer() {}
-
-
- public MessageTransfer(String destination, MessageAcceptMode acceptMode, MessageAcquireMode acquireMode, Header header, java.nio.ByteBuffer body, Option ... _options) {
- if(destination != null) {
- setDestination(destination);
- }
- if(acceptMode != null) {
- setAcceptMode(acceptMode);
- }
- if(acquireMode != null) {
- setAcquireMode(acquireMode);
- }
- setHeader(header);
- setBody(body);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.messageTransfer(context, this);
- }
-
-
- public final boolean hasDestination() {
- return (packing_flags & 256) != 0;
- }
-
- public final MessageTransfer clearDestination() {
- packing_flags &= ~256;
- this.destination = null;
- setDirty(true);
- return this;
- }
-
- public final String getDestination() {
- return destination;
- }
-
- public final MessageTransfer setDestination(String value) {
- this.destination = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final MessageTransfer destination(String value) {
- return setDestination(value);
- }
-
- public final boolean hasAcceptMode() {
- return (packing_flags & 512) != 0;
- }
-
- public final MessageTransfer clearAcceptMode() {
- packing_flags &= ~512;
- this.acceptMode = null;
- setDirty(true);
- return this;
- }
-
- public final MessageAcceptMode getAcceptMode() {
- return acceptMode;
- }
-
- public final MessageTransfer setAcceptMode(MessageAcceptMode value) {
- this.acceptMode = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final MessageTransfer acceptMode(MessageAcceptMode value) {
- return setAcceptMode(value);
- }
-
- public final boolean hasAcquireMode() {
- return (packing_flags & 1024) != 0;
- }
-
- public final MessageTransfer clearAcquireMode() {
- packing_flags &= ~1024;
- this.acquireMode = null;
- setDirty(true);
- return this;
- }
-
- public final MessageAcquireMode getAcquireMode() {
- return acquireMode;
- }
-
- public final MessageTransfer setAcquireMode(MessageAcquireMode value) {
- this.acquireMode = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final MessageTransfer acquireMode(MessageAcquireMode value) {
- return setAcquireMode(value);
- }
-
-
- public final Header getHeader() {
- return this.header;
- }
-
- public final void setHeader(Header header) {
- this.header = header;
- }
-
- public final MessageTransfer header(Header header) {
- setHeader(header);
- return this;
- }
-
- public int getBodySize()
- {
- return this.body == null ? 0 : this.body.remaining();
- }
-
- public final ByteBuffer getBody() {
- if (this.body == null)
- {
- return null;
- }
- else
- {
- return this.body.slice();
- }
- }
-
- public final void setBody(ByteBuffer body) {
- this.body = body;
- }
-
- public final MessageTransfer body(ByteBuffer body)
- {
- setBody(body);
- return this;
- }
-
- public final byte[] getBodyBytes() {
- ByteBuffer buf = getBody();
- byte[] bytes = new byte[buf.remaining()];
- buf.get(bytes);
- return bytes;
- }
-
- public final void setBody(byte[] body)
- {
- setBody(ByteBuffer.wrap(body));
- }
-
- public final String getBodyString() {
- return Strings.fromUTF8(getBodyBytes());
- }
-
- public final void setBody(String body) {
- setBody(Strings.toUTF8(body));
- }
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.destination);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint8(this.acceptMode.getValue());
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeUint8(this.acquireMode.getValue());
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.destination = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.acceptMode = MessageAcceptMode.get(dec.readUint8());
- }
- if ((packing_flags & 1024) != 0)
- {
- this.acquireMode = MessageAcquireMode.get(dec.readUint8());
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("destination", getDestination());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("acceptMode", getAcceptMode());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("acquireMode", getAcquireMode());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java
deleted file mode 100644
index cddcd45d6f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.transport.network.Frame;
-
-import static org.apache.qpid.transport.util.Functions.str;
-
-import java.nio.ByteBuffer;
-
-/**
- * Method
- *
- * @author Rafael H. Schloming
- */
-
-public abstract class Method extends Struct implements ProtocolEvent
-{
-
-
- public static final Method create(int type)
- {
- // XXX: should generate separate factories for separate
- // namespaces
- return (Method) StructFactory.createInstruction(type);
- }
-
- // XXX: command subclass?
- public static interface CompletionListener
- {
- public void onComplete(Method method);
- }
-
- private int id;
- private int channel;
- private boolean idSet = false;
- private boolean sync = false;
- private boolean batch = false;
- private boolean unreliable = false;
- private CompletionListener completionListener;
-
- public final int getId()
- {
- return id;
- }
-
- void setId(int id)
- {
- this.id = id;
- this.idSet = true;
- }
-
- boolean idSet()
- {
- return idSet;
- }
-
- public final int getChannel()
- {
- return channel;
- }
-
- public final void setChannel(int channel)
- {
- this.channel = channel;
- }
-
- public final boolean isSync()
- {
- return sync;
- }
-
- public final void setSync(boolean value)
- {
- this.sync = value;
- }
-
- public final boolean isBatch()
- {
- return batch;
- }
-
- final void setBatch(boolean value)
- {
- this.batch = value;
- }
-
- public final boolean isUnreliable()
- {
- return unreliable;
- }
-
- final void setUnreliable(boolean value)
- {
- this.unreliable = value;
- }
-
- public abstract boolean hasPayload();
-
- public Header getHeader()
- {
- return null;
- }
-
- public void setHeader(Header header)
- {
- throw new UnsupportedOperationException();
- }
-
- public ByteBuffer getBody()
- {
- return null;
- }
-
- public void setBody(ByteBuffer body)
- {
- throw new UnsupportedOperationException();
- }
-
- public int getBodySize()
- {
- ByteBuffer body = getBody();
- if (body == null)
- {
- return 0;
- }
- else
- {
- return body.remaining();
- }
- }
-
- public abstract byte getEncodedTrack();
-
- public abstract <C> void dispatch(C context, MethodDelegate<C> delegate);
-
- public <C> void delegate(C context, ProtocolDelegate<C> delegate)
- {
- if (getEncodedTrack() == Frame.L4)
- {
- delegate.command(context, this);
- }
- else
- {
- delegate.control(context, this);
- }
- }
-
-
- public void setCompletionListener(CompletionListener completionListener)
- {
- this.completionListener = completionListener;
- }
-
- public void complete()
- {
- if(completionListener!= null)
- {
- completionListener.onComplete(this);
- completionListener = null;
- }
- }
-
- public boolean hasCompletionListener()
- {
- return completionListener != null;
- }
-
- public String toString()
- {
- StringBuilder str = new StringBuilder();
-
- str.append("ch=");
- str.append(channel);
-
- if (getEncodedTrack() == Frame.L4 && idSet)
- {
- str.append(" id=");
- str.append(id);
- }
-
- if (sync || batch)
- {
- str.append(" ");
- str.append("[");
- if (sync)
- {
- str.append("S");
- }
- if (batch)
- {
- str.append("B");
- }
- str.append("]");
- }
-
- str.append(" ");
- str.append(super.toString());
- Header hdr = getHeader();
- if (hdr != null)
- {
- for (Struct st : hdr.getStructs())
- {
- str.append("\n ");
- str.append(st);
- }
- }
- ByteBuffer body = getBody();
- if (body != null)
- {
- str.append("\n body=");
- str.append(str(body, 64));
- }
-
- return str.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/MethodDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/MethodDelegate.java
deleted file mode 100644
index 33f52d9f2b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/MethodDelegate.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public abstract class MethodDelegate<C> {
-
- public abstract void handle(C context, Method method);
-
- public void connectionStart(C context, ConnectionStart method) {
- handle(context, method);
- }
- public void connectionStartOk(C context, ConnectionStartOk method) {
- handle(context, method);
- }
- public void connectionSecure(C context, ConnectionSecure method) {
- handle(context, method);
- }
- public void connectionSecureOk(C context, ConnectionSecureOk method) {
- handle(context, method);
- }
- public void connectionTune(C context, ConnectionTune method) {
- handle(context, method);
- }
- public void connectionTuneOk(C context, ConnectionTuneOk method) {
- handle(context, method);
- }
- public void connectionOpen(C context, ConnectionOpen method) {
- handle(context, method);
- }
- public void connectionOpenOk(C context, ConnectionOpenOk method) {
- handle(context, method);
- }
- public void connectionRedirect(C context, ConnectionRedirect method) {
- handle(context, method);
- }
- public void connectionHeartbeat(C context, ConnectionHeartbeat method) {
- handle(context, method);
- }
- public void connectionClose(C context, ConnectionClose method) {
- handle(context, method);
- }
- public void connectionCloseOk(C context, ConnectionCloseOk method) {
- handle(context, method);
- }
- public void sessionAttach(C context, SessionAttach method) {
- handle(context, method);
- }
- public void sessionAttached(C context, SessionAttached method) {
- handle(context, method);
- }
- public void sessionDetach(C context, SessionDetach method) {
- handle(context, method);
- }
- public void sessionDetached(C context, SessionDetached method) {
- handle(context, method);
- }
- public void sessionRequestTimeout(C context, SessionRequestTimeout method) {
- handle(context, method);
- }
- public void sessionTimeout(C context, SessionTimeout method) {
- handle(context, method);
- }
- public void sessionCommandPoint(C context, SessionCommandPoint method) {
- handle(context, method);
- }
- public void sessionExpected(C context, SessionExpected method) {
- handle(context, method);
- }
- public void sessionConfirmed(C context, SessionConfirmed method) {
- handle(context, method);
- }
- public void sessionCompleted(C context, SessionCompleted method) {
- handle(context, method);
- }
- public void sessionKnownCompleted(C context, SessionKnownCompleted method) {
- handle(context, method);
- }
- public void sessionFlush(C context, SessionFlush method) {
- handle(context, method);
- }
- public void sessionGap(C context, SessionGap method) {
- handle(context, method);
- }
- public void executionSync(C context, ExecutionSync method) {
- handle(context, method);
- }
- public void executionResult(C context, ExecutionResult method) {
- handle(context, method);
- }
- public void executionException(C context, ExecutionException method) {
- handle(context, method);
- }
- public void messageTransfer(C context, MessageTransfer method) {
- handle(context, method);
- }
- public void messageAccept(C context, MessageAccept method) {
- handle(context, method);
- }
- public void messageReject(C context, MessageReject method) {
- handle(context, method);
- }
- public void messageRelease(C context, MessageRelease method) {
- handle(context, method);
- }
- public void messageAcquire(C context, MessageAcquire method) {
- handle(context, method);
- }
- public void messageResume(C context, MessageResume method) {
- handle(context, method);
- }
- public void messageSubscribe(C context, MessageSubscribe method) {
- handle(context, method);
- }
- public void messageCancel(C context, MessageCancel method) {
- handle(context, method);
- }
- public void messageSetFlowMode(C context, MessageSetFlowMode method) {
- handle(context, method);
- }
- public void messageFlow(C context, MessageFlow method) {
- handle(context, method);
- }
- public void messageFlush(C context, MessageFlush method) {
- handle(context, method);
- }
- public void messageStop(C context, MessageStop method) {
- handle(context, method);
- }
- public void txSelect(C context, TxSelect method) {
- handle(context, method);
- }
- public void txCommit(C context, TxCommit method) {
- handle(context, method);
- }
- public void txRollback(C context, TxRollback method) {
- handle(context, method);
- }
- public void dtxSelect(C context, DtxSelect method) {
- handle(context, method);
- }
- public void dtxStart(C context, DtxStart method) {
- handle(context, method);
- }
- public void dtxEnd(C context, DtxEnd method) {
- handle(context, method);
- }
- public void dtxCommit(C context, DtxCommit method) {
- handle(context, method);
- }
- public void dtxForget(C context, DtxForget method) {
- handle(context, method);
- }
- public void dtxGetTimeout(C context, DtxGetTimeout method) {
- handle(context, method);
- }
- public void dtxPrepare(C context, DtxPrepare method) {
- handle(context, method);
- }
- public void dtxRecover(C context, DtxRecover method) {
- handle(context, method);
- }
- public void dtxRollback(C context, DtxRollback method) {
- handle(context, method);
- }
- public void dtxSetTimeout(C context, DtxSetTimeout method) {
- handle(context, method);
- }
- public void exchangeDeclare(C context, ExchangeDeclare method) {
- handle(context, method);
- }
- public void exchangeDelete(C context, ExchangeDelete method) {
- handle(context, method);
- }
- public void exchangeQuery(C context, ExchangeQuery method) {
- handle(context, method);
- }
- public void exchangeBind(C context, ExchangeBind method) {
- handle(context, method);
- }
- public void exchangeUnbind(C context, ExchangeUnbind method) {
- handle(context, method);
- }
- public void exchangeBound(C context, ExchangeBound method) {
- handle(context, method);
- }
- public void queueDeclare(C context, QueueDeclare method) {
- handle(context, method);
- }
- public void queueDelete(C context, QueueDelete method) {
- handle(context, method);
- }
- public void queuePurge(C context, QueuePurge method) {
- handle(context, method);
- }
- public void queueQuery(C context, QueueQuery method) {
- handle(context, method);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkEventReceiver.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkEventReceiver.java
deleted file mode 100644
index 8b9c3f4f83..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkEventReceiver.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.transport.network.NetworkEvent;
-
-public interface NetworkEventReceiver
-{
- void received(NetworkEvent msg);
-
- void exception(Throwable t);
-
- void closed();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkTransportConfiguration.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkTransportConfiguration.java
deleted file mode 100644
index 7af3b7af39..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkTransportConfiguration.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import java.net.InetSocketAddress;
-import java.util.Collection;
-
-/**
- * This interface provides a means for NetworkDrivers to configure TCP options such as incoming and outgoing
- * buffer sizes and set particular options on the socket. NetworkDrivers should honour the values returned
- * from here if the underlying implementation supports them.
- */
-public interface NetworkTransportConfiguration
-{
- // Taken from Socket
- boolean getTcpNoDelay();
-
- // The amount of memory in bytes to allocate to the incoming buffer
- int getReceiveBufferSize();
-
- // The amount of memory in bytes to allocate to the outgoing buffer
- int getSendBufferSize();
-
- InetSocketAddress getAddress();
-
- boolean needClientAuth();
-
- boolean wantClientAuth();
-
- Collection<String> getEnabledCipherSuites();
-
- Collection<String> getDisabledCipherSuites();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Option.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Option.java
deleted file mode 100644
index 72187795b3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Option.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum Option {
-
- SYNC,
- DISCARD_UNROUTABLE,
- IMMEDIATE,
- REDELIVERED,
- FIRST,
- LAST,
- DURABLE,
- NOT_FOUND,
- EXCHANGE_NOT_FOUND,
- QUEUE_NOT_FOUND,
- QUEUE_NOT_MATCHED,
- KEY_NOT_MATCHED,
- ARGS_NOT_MATCHED,
- EXCLUSIVE,
- AUTO_DELETE,
- INSIST,
- FORCE,
- TIMELY_REPLY,
- EXPECTED,
- CONFIRMED,
- COMPLETED,
- SET_REDELIVERED,
- JOIN,
- RESUME,
- FAIL,
- SUSPEND,
- ONE_PHASE,
- PASSIVE,
- IF_UNUSED,
- IF_EMPTY,
-
- BATCH,
- UNRELIABLE,
- NONE
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolDelegate.java
deleted file mode 100644
index a90948fc1d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolDelegate.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * ProtocolDelegate
- *
- */
-
-public interface ProtocolDelegate<C>
-{
-
- void init(C context, ProtocolHeader header);
-
- void control(C context, Method control);
-
- void command(C context, Method command);
-
- void error(C context, ProtocolError error);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolError.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolError.java
deleted file mode 100644
index 8a5edc302e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolError.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.transport.network.NetworkDelegate;
-import org.apache.qpid.transport.network.NetworkEvent;
-
-
-/**
- * ProtocolError
- *
- * @author Rafael H. Schloming
- */
-
-public final class ProtocolError implements NetworkEvent, ProtocolEvent
-{
-
- private int channel;
- private final byte track;
- private final String format;
- private final Object[] args;
-
- public ProtocolError(byte track, String format, Object ... args)
- {
- this.track = track;
- this.format = format;
- this.args = args;
- }
-
- public int getChannel()
- {
- return channel;
- }
-
- public void setChannel(int channel)
- {
- this.channel = channel;
- }
-
- public byte getEncodedTrack()
- {
- return track;
- }
-
- public boolean isConnectionControl()
- {
- return false;
- }
-
- public String getMessage()
- {
- return String.format(format, args);
- }
-
- public <C> void delegate(C context, ProtocolDelegate<C> delegate)
- {
- delegate.error(context, this);
- }
-
- public void delegate(NetworkDelegate delegate)
- {
- delegate.error(this);
- }
-
- public String toString()
- {
- return String.format("protocol error: %s", getMessage());
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEvent.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEvent.java
deleted file mode 100644
index b51a540701..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * ProtocolEvent
- *
- */
-
-public interface ProtocolEvent
-{
-
- int getChannel();
-
- void setChannel(int channel);
-
- byte getEncodedTrack();
-
- <C> void delegate(C context, ProtocolDelegate<C> delegate);
-
- boolean isConnectionControl();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEventReceiver.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEventReceiver.java
deleted file mode 100644
index e4ab540ce9..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEventReceiver.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-public interface ProtocolEventReceiver
-{
- void received(ProtocolEvent msg);
-
- void exception(Throwable t);
-
- void closed();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEventSender.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEventSender.java
deleted file mode 100644
index 418f31b42a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolEventSender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-public interface ProtocolEventSender
-{
- void send(ProtocolEvent msg);
-
- void flush();
-
- void close();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java
deleted file mode 100644
index 3959dc8d95..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.transport.network.Frame;
-import org.apache.qpid.transport.network.NetworkDelegate;
-import org.apache.qpid.transport.network.NetworkEvent;
-
-import java.nio.ByteBuffer;
-
-
-/**
- * ProtocolHeader
- *
- * @author Rafael H. Schloming
- */
-
-public final class ProtocolHeader implements NetworkEvent, ProtocolEvent
-{
-
- private static final byte[] AMQP = {'A', 'M', 'Q', 'P' };
- private static final byte CLASS = 1;
-
- final private byte protoClass;
- final private byte instance;
- final private byte major;
- final private byte minor;
- private int channel;
-
- public ProtocolHeader(byte protoClass, byte instance, byte major, byte minor)
- {
- this.protoClass = protoClass;
- this.instance = instance;
- this.major = major;
- this.minor = minor;
- }
-
- public ProtocolHeader(int instance, int major, int minor)
- {
- this(CLASS, (byte) instance, (byte) major, (byte) minor);
- }
-
- public byte getInstance()
- {
- return instance;
- }
-
- public byte getMajor()
- {
- return major;
- }
-
- public byte getMinor()
- {
- return minor;
- }
-
- public int getChannel()
- {
- return channel;
- }
-
- public void setChannel(int channel)
- {
- this.channel = channel;
- }
-
- public byte getEncodedTrack()
- {
- return Frame.L1;
- }
-
- public boolean isConnectionControl()
- {
- return false;
- }
-
- public ByteBuffer toByteBuffer()
- {
- ByteBuffer buf = ByteBuffer.allocate(8);
- buf.put(AMQP);
- buf.put(protoClass);
- buf.put(instance);
- buf.put(major);
- buf.put(minor);
- buf.flip();
- return buf;
- }
-
- public <C> void delegate(C context, ProtocolDelegate<C> delegate)
- {
- delegate.init(context, this);
- }
-
- public void delegate(NetworkDelegate delegate)
- {
- delegate.init(this);
- }
-
- public String toString()
- {
- return String.format("AMQP.%d %d-%d", instance, major, minor);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolVersionException.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolVersionException.java
deleted file mode 100644
index db8064268c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ProtocolVersionException.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * ProtocolVersionException
- *
- */
-
-public final class ProtocolVersionException extends ConnectionException
-{
-
- private final byte major;
- private final byte minor;
-
- public ProtocolVersionException(byte major, byte minor, Throwable cause)
- {
- super(String.format("version mismatch: %s-%s", major, minor), cause);
- this.major = major;
- this.minor = minor;
- }
-
- public ProtocolVersionException(byte major, byte minor)
- {
- this(major, minor, null);
- }
-
- public byte getMajor()
- {
- return this.major;
- }
-
- public byte getMinor()
- {
- return this.minor;
- }
-
- @Override public void rethrow()
- {
- throw new ProtocolVersionException(major, minor, this);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueDeclare.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueDeclare.java
deleted file mode 100644
index 2b7495e622..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueDeclare.java
+++ /dev/null
@@ -1,394 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class QueueDeclare extends Method {
-
- public static final int TYPE = 2049;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String queue;
- private String alternateExchange;
- private Map<String,Object> arguments;
-
-
- public QueueDeclare() {}
-
-
- public QueueDeclare(String queue, String alternateExchange, Map<String,Object> arguments, Option ... _options) {
- if(queue != null) {
- setQueue(queue);
- }
- if(alternateExchange != null) {
- setAlternateExchange(alternateExchange);
- }
- if(arguments != null) {
- setArguments(arguments);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case PASSIVE: packing_flags |= 1024; break;
- case DURABLE: packing_flags |= 2048; break;
- case EXCLUSIVE: packing_flags |= 4096; break;
- case AUTO_DELETE: packing_flags |= 8192; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.queueDeclare(context, this);
- }
-
-
- public final boolean hasQueue() {
- return (packing_flags & 256) != 0;
- }
-
- public final QueueDeclare clearQueue() {
- packing_flags &= ~256;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final QueueDeclare setQueue(String value) {
- this.queue = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final QueueDeclare queue(String value) {
- return setQueue(value);
- }
-
- public final boolean hasAlternateExchange() {
- return (packing_flags & 512) != 0;
- }
-
- public final QueueDeclare clearAlternateExchange() {
- packing_flags &= ~512;
- this.alternateExchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getAlternateExchange() {
- return alternateExchange;
- }
-
- public final QueueDeclare setAlternateExchange(String value) {
- this.alternateExchange = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final QueueDeclare alternateExchange(String value) {
- return setAlternateExchange(value);
- }
-
- public final boolean hasPassive() {
- return (packing_flags & 1024) != 0;
- }
-
- public final QueueDeclare clearPassive() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getPassive() {
- return hasPassive();
- }
-
- public final QueueDeclare setPassive(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueDeclare passive(boolean value) {
- return setPassive(value);
- }
-
- public final boolean hasDurable() {
- return (packing_flags & 2048) != 0;
- }
-
- public final QueueDeclare clearDurable() {
- packing_flags &= ~2048;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getDurable() {
- return hasDurable();
- }
-
- public final QueueDeclare setDurable(boolean value) {
-
- if (value)
- {
- packing_flags |= 2048;
- }
- else
- {
- packing_flags &= ~2048;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueDeclare durable(boolean value) {
- return setDurable(value);
- }
-
- public final boolean hasExclusive() {
- return (packing_flags & 4096) != 0;
- }
-
- public final QueueDeclare clearExclusive() {
- packing_flags &= ~4096;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getExclusive() {
- return hasExclusive();
- }
-
- public final QueueDeclare setExclusive(boolean value) {
-
- if (value)
- {
- packing_flags |= 4096;
- }
- else
- {
- packing_flags &= ~4096;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueDeclare exclusive(boolean value) {
- return setExclusive(value);
- }
-
- public final boolean hasAutoDelete() {
- return (packing_flags & 8192) != 0;
- }
-
- public final QueueDeclare clearAutoDelete() {
- packing_flags &= ~8192;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getAutoDelete() {
- return hasAutoDelete();
- }
-
- public final QueueDeclare setAutoDelete(boolean value) {
-
- if (value)
- {
- packing_flags |= 8192;
- }
- else
- {
- packing_flags &= ~8192;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueDeclare autoDelete(boolean value) {
- return setAutoDelete(value);
- }
-
- public final boolean hasArguments() {
- return (packing_flags & 16384) != 0;
- }
-
- public final QueueDeclare clearArguments() {
- packing_flags &= ~16384;
- this.arguments = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getArguments() {
- return arguments;
- }
-
- public final QueueDeclare setArguments(Map<String,Object> value) {
- this.arguments = value;
- packing_flags |= 16384;
- setDirty(true);
- return this;
- }
-
- public final QueueDeclare arguments(Map<String,Object> value) {
- return setArguments(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.queue);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.alternateExchange);
- }
- if ((packing_flags & 16384) != 0)
- {
- enc.writeMap(this.arguments);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.queue = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.alternateExchange = dec.readStr8();
- }
- if ((packing_flags & 16384) != 0)
- {
- this.arguments = dec.readMap();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("queue", getQueue());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("alternateExchange", getAlternateExchange());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("passive", getPassive());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("durable", getDurable());
- }
- if ((packing_flags & 4096) != 0)
- {
- result.put("exclusive", getExclusive());
- }
- if ((packing_flags & 8192) != 0)
- {
- result.put("autoDelete", getAutoDelete());
- }
- if ((packing_flags & 16384) != 0)
- {
- result.put("arguments", getArguments());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueDelete.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueDelete.java
deleted file mode 100644
index 2c0040ff1d..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueDelete.java
+++ /dev/null
@@ -1,232 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class QueueDelete extends Method {
-
- public static final int TYPE = 2050;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String queue;
-
-
- public QueueDelete() {}
-
-
- public QueueDelete(String queue, Option ... _options) {
- if(queue != null) {
- setQueue(queue);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case IF_UNUSED: packing_flags |= 512; break;
- case IF_EMPTY: packing_flags |= 1024; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.queueDelete(context, this);
- }
-
-
- public final boolean hasQueue() {
- return (packing_flags & 256) != 0;
- }
-
- public final QueueDelete clearQueue() {
- packing_flags &= ~256;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final QueueDelete setQueue(String value) {
- this.queue = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final QueueDelete queue(String value) {
- return setQueue(value);
- }
-
- public final boolean hasIfUnused() {
- return (packing_flags & 512) != 0;
- }
-
- public final QueueDelete clearIfUnused() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getIfUnused() {
- return hasIfUnused();
- }
-
- public final QueueDelete setIfUnused(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueDelete ifUnused(boolean value) {
- return setIfUnused(value);
- }
-
- public final boolean hasIfEmpty() {
- return (packing_flags & 1024) != 0;
- }
-
- public final QueueDelete clearIfEmpty() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getIfEmpty() {
- return hasIfEmpty();
- }
-
- public final QueueDelete setIfEmpty(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueDelete ifEmpty(boolean value) {
- return setIfEmpty(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.queue);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.queue = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("queue", getQueue());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("ifUnused", getIfUnused());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("ifEmpty", getIfEmpty());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueuePurge.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/QueuePurge.java
deleted file mode 100644
index 972149e251..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueuePurge.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class QueuePurge extends Method {
-
- public static final int TYPE = 2051;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String queue;
-
-
- public QueuePurge() {}
-
-
- public QueuePurge(String queue, Option ... _options) {
- if(queue != null) {
- setQueue(queue);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.queuePurge(context, this);
- }
-
-
- public final boolean hasQueue() {
- return (packing_flags & 256) != 0;
- }
-
- public final QueuePurge clearQueue() {
- packing_flags &= ~256;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final QueuePurge setQueue(String value) {
- this.queue = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final QueuePurge queue(String value) {
- return setQueue(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.queue);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.queue = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("queue", getQueue());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueQuery.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueQuery.java
deleted file mode 100644
index 22da74f6b7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueQuery.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class QueueQuery extends Method {
-
- public static final int TYPE = 2052;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String queue;
-
-
- public QueueQuery() {}
-
-
- public QueueQuery(String queue, Option ... _options) {
- if(queue != null) {
- setQueue(queue);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.queueQuery(context, this);
- }
-
-
- public final boolean hasQueue() {
- return (packing_flags & 256) != 0;
- }
-
- public final QueueQuery clearQueue() {
- packing_flags &= ~256;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final QueueQuery setQueue(String value) {
- this.queue = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final QueueQuery queue(String value) {
- return setQueue(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.queue);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.queue = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("queue", getQueue());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueQueryResult.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueQueryResult.java
deleted file mode 100644
index ca0c027603..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/QueueQueryResult.java
+++ /dev/null
@@ -1,429 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class QueueQueryResult extends Struct {
-
- public static final int TYPE = 2049;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String queue;
- private String alternateExchange;
- private Map<String,Object> arguments;
- private long messageCount;
- private long subscriberCount;
-
-
- public QueueQueryResult() {}
-
-
- public QueueQueryResult(String queue, String alternateExchange, Map<String,Object> arguments, long messageCount, long subscriberCount, Option ... _options) {
- if(queue != null) {
- setQueue(queue);
- }
- if(alternateExchange != null) {
- setAlternateExchange(alternateExchange);
- }
- if(arguments != null) {
- setArguments(arguments);
- }
- setMessageCount(messageCount);
- setSubscriberCount(subscriberCount);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case DURABLE: packing_flags |= 1024; break;
- case EXCLUSIVE: packing_flags |= 2048; break;
- case AUTO_DELETE: packing_flags |= 4096; break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
-
-
-
- public final boolean hasQueue() {
- return (packing_flags & 256) != 0;
- }
-
- public final QueueQueryResult clearQueue() {
- packing_flags &= ~256;
- this.queue = null;
- setDirty(true);
- return this;
- }
-
- public final String getQueue() {
- return queue;
- }
-
- public final QueueQueryResult setQueue(String value) {
- this.queue = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final QueueQueryResult queue(String value) {
- return setQueue(value);
- }
-
- public final boolean hasAlternateExchange() {
- return (packing_flags & 512) != 0;
- }
-
- public final QueueQueryResult clearAlternateExchange() {
- packing_flags &= ~512;
- this.alternateExchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getAlternateExchange() {
- return alternateExchange;
- }
-
- public final QueueQueryResult setAlternateExchange(String value) {
- this.alternateExchange = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final QueueQueryResult alternateExchange(String value) {
- return setAlternateExchange(value);
- }
-
- public final boolean hasDurable() {
- return (packing_flags & 1024) != 0;
- }
-
- public final QueueQueryResult clearDurable() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getDurable() {
- return hasDurable();
- }
-
- public final QueueQueryResult setDurable(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueQueryResult durable(boolean value) {
- return setDurable(value);
- }
-
- public final boolean hasExclusive() {
- return (packing_flags & 2048) != 0;
- }
-
- public final QueueQueryResult clearExclusive() {
- packing_flags &= ~2048;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getExclusive() {
- return hasExclusive();
- }
-
- public final QueueQueryResult setExclusive(boolean value) {
-
- if (value)
- {
- packing_flags |= 2048;
- }
- else
- {
- packing_flags &= ~2048;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueQueryResult exclusive(boolean value) {
- return setExclusive(value);
- }
-
- public final boolean hasAutoDelete() {
- return (packing_flags & 4096) != 0;
- }
-
- public final QueueQueryResult clearAutoDelete() {
- packing_flags &= ~4096;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getAutoDelete() {
- return hasAutoDelete();
- }
-
- public final QueueQueryResult setAutoDelete(boolean value) {
-
- if (value)
- {
- packing_flags |= 4096;
- }
- else
- {
- packing_flags &= ~4096;
- }
-
- setDirty(true);
- return this;
- }
-
- public final QueueQueryResult autoDelete(boolean value) {
- return setAutoDelete(value);
- }
-
- public final boolean hasArguments() {
- return (packing_flags & 8192) != 0;
- }
-
- public final QueueQueryResult clearArguments() {
- packing_flags &= ~8192;
- this.arguments = null;
- setDirty(true);
- return this;
- }
-
- public final Map<String,Object> getArguments() {
- return arguments;
- }
-
- public final QueueQueryResult setArguments(Map<String,Object> value) {
- this.arguments = value;
- packing_flags |= 8192;
- setDirty(true);
- return this;
- }
-
- public final QueueQueryResult arguments(Map<String,Object> value) {
- return setArguments(value);
- }
-
- public final boolean hasMessageCount() {
- return (packing_flags & 16384) != 0;
- }
-
- public final QueueQueryResult clearMessageCount() {
- packing_flags &= ~16384;
- this.messageCount = 0;
- setDirty(true);
- return this;
- }
-
- public final long getMessageCount() {
- return messageCount;
- }
-
- public final QueueQueryResult setMessageCount(long value) {
- this.messageCount = value;
- packing_flags |= 16384;
- setDirty(true);
- return this;
- }
-
- public final QueueQueryResult messageCount(long value) {
- return setMessageCount(value);
- }
-
- public final boolean hasSubscriberCount() {
- return (packing_flags & 32768) != 0;
- }
-
- public final QueueQueryResult clearSubscriberCount() {
- packing_flags &= ~32768;
- this.subscriberCount = 0;
- setDirty(true);
- return this;
- }
-
- public final long getSubscriberCount() {
- return subscriberCount;
- }
-
- public final QueueQueryResult setSubscriberCount(long value) {
- this.subscriberCount = value;
- packing_flags |= 32768;
- setDirty(true);
- return this;
- }
-
- public final QueueQueryResult subscriberCount(long value) {
- return setSubscriberCount(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.queue);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.alternateExchange);
- }
- if ((packing_flags & 8192) != 0)
- {
- enc.writeMap(this.arguments);
- }
- if ((packing_flags & 16384) != 0)
- {
- enc.writeUint32(this.messageCount);
- }
- if ((packing_flags & 32768) != 0)
- {
- enc.writeUint32(this.subscriberCount);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.queue = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.alternateExchange = dec.readStr8();
- }
- if ((packing_flags & 8192) != 0)
- {
- this.arguments = dec.readMap();
- }
- if ((packing_flags & 16384) != 0)
- {
- this.messageCount = dec.readUint32();
- }
- if ((packing_flags & 32768) != 0)
- {
- this.subscriberCount = dec.readUint32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("queue", getQueue());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("alternateExchange", getAlternateExchange());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("durable", getDurable());
- }
- if ((packing_flags & 2048) != 0)
- {
- result.put("exclusive", getExclusive());
- }
- if ((packing_flags & 4096) != 0)
- {
- result.put("autoDelete", getAutoDelete());
- }
- if ((packing_flags & 8192) != 0)
- {
- result.put("arguments", getArguments());
- }
- if ((packing_flags & 16384) != 0)
- {
- result.put("messageCount", getMessageCount());
- }
- if ((packing_flags & 32768) != 0)
- {
- result.put("subscriberCount", getSubscriberCount());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Range.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Range.java
deleted file mode 100644
index 413ec8e8fd..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Range.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import static org.apache.qpid.util.Serial.gt;
-import static org.apache.qpid.util.Serial.le;
-import static org.apache.qpid.util.Serial.max;
-import static org.apache.qpid.util.Serial.min;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-
-/**
- * Range
- *
- * @author Rafael H. Schloming
- */
-
-public abstract class Range implements RangeSet
-{
- public static Range newInstance(int point)
- {
- return new PointImpl(point);
- }
-
- public static Range newInstance(int lower, int upper)
- {
- return lower == upper ? new PointImpl(lower) : new RangeImpl(lower, upper);
- }
-
- public abstract int getLower();
-
- public abstract int getUpper();
-
- public abstract boolean includes(int value);
-
- public abstract boolean includes(Range range);
-
- public abstract boolean intersects(Range range);
-
- public abstract boolean touches(Range range);
-
- public abstract Range span(Range range);
-
- public abstract List<Range> subtract(Range range);
-
-
- public Range intersect(Range range)
- {
- int l = max(getLower(), range.getLower());
- int r = min(getUpper(), range.getUpper());
- if (gt(l, r))
- {
- return null;
- }
- else
- {
- return newInstance(l, r);
- }
- }
-
-
-
- public int size()
- {
- return 1;
- }
-
- public Iterator<Range> iterator()
- {
- return new RangeIterator();
- }
-
- public Range getFirst()
- {
- return this;
- }
-
- public Range getLast()
- {
- return this;
- }
-
- public void add(Range range)
- {
- throw new UnsupportedOperationException();
- }
-
- public void add(int lower, int upper)
- {
- throw new UnsupportedOperationException();
- }
-
- public void add(int value)
- {
- throw new UnsupportedOperationException();
- }
-
- public void clear()
- {
- throw new UnsupportedOperationException();
- }
-
- public void subtract(RangeSet rangeSet)
- {
- throw new UnsupportedOperationException();
- }
-
- public RangeSet copy()
- {
- RangeSet rangeSet = RangeSetFactory.createRangeSet();
- rangeSet.add(this);
- return rangeSet;
- }
-
- private static class PointImpl extends Range
- {
- private final int point;
-
- private PointImpl(int point)
- {
- this.point = point;
- }
-
- public int getLower()
- {
- return point;
- }
-
- public int getUpper()
- {
- return point;
- }
-
- public boolean includes(int value)
- {
- return value == point;
- }
-
-
- public boolean includes(Range range)
- {
- return range.getLower() == point && range.getUpper() == point;
- }
-
- public boolean intersects(Range range)
- {
- return range.includes(point);
- }
-
- public boolean touches(Range range)
- {
- return intersects(range) ||
- includes(range.getUpper() + 1) || includes(range.getLower() - 1) ||
- range.includes(point + 1) || range.includes(point - 1);
- }
-
- public Range span(Range range)
- {
- return newInstance(min(point, range.getLower()), max(point, range.getUpper()));
- }
-
- public List<Range> subtract(Range range)
- {
- if(range.includes(point))
- {
- return Collections.emptyList();
- }
- else
- {
- return Collections.singletonList((Range) this);
- }
- }
-
- public String toString()
- {
- return "[" + point + ", " + point + "]";
- }
-
-
- }
-
- private static class RangeImpl extends Range
- {
- private final int lower;
- private final int upper;
-
- private RangeImpl(int lower, int upper)
- {
- this.lower = lower;
- this.upper = upper;
- }
-
- public int getLower()
- {
- return lower;
- }
-
- public int getUpper()
- {
- return upper;
- }
-
- public boolean includes(int value)
- {
- return le(lower, value) && le(value, upper);
- }
-
- public boolean includes(Range range)
- {
- return includes(range.getLower()) && includes(range.getUpper());
- }
-
- public boolean intersects(Range range)
- {
- return (includes(range.getLower()) || includes(range.getUpper()) ||
- range.includes(lower) || range.includes(upper));
- }
-
- public boolean touches(Range range)
- {
- return (intersects(range) ||
- includes(range.getUpper() + 1) || includes(range.getLower() - 1) ||
- range.includes(upper + 1) || range.includes(lower - 1));
- }
-
- public Range span(Range range)
- {
- return newInstance(min(lower, range.getLower()), max(upper, range.getUpper()));
- }
-
- public List<Range> subtract(Range range)
- {
- List<Range> result = new ArrayList<Range>();
-
- if (includes(range.getLower()) && le(lower, range.getLower() - 1))
- {
- result.add(newInstance(lower, range.getLower() - 1));
- }
-
- if (includes(range.getUpper()) && le(range.getUpper() + 1, upper))
- {
- result.add(newInstance(range.getUpper() + 1, upper));
- }
-
- if (result.isEmpty() && !range.includes(this))
- {
- result.add(this);
- }
-
- return result;
- }
-
-
- public String toString()
- {
- return "[" + lower + ", " + upper + "]";
- }
- }
-
-
- private class RangeIterator implements Iterator<Range>
- {
- private boolean atFirst = true;
-
- public boolean hasNext()
- {
- return atFirst;
- }
-
- public Range next()
- {
-
- Range range = atFirst ? Range.this : null;
- atFirst = false;
- return range;
- }
-
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSet.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSet.java
deleted file mode 100644
index 19990a4610..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSet.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import java.util.Iterator;
-
-/**
- * RangeSet
- *
- * @author Rafael H. Schloming
- */
-
-public interface RangeSet extends Iterable<Range>
-{
-
- int size();
-
- Iterator<Range> iterator();
-
- Range getFirst();
-
- Range getLast();
-
- boolean includes(Range range);
-
- boolean includes(int n);
-
- void add(Range range);
-
- void add(int lower, int upper);
-
- void add(int value);
-
- void subtract(final RangeSet other);
-
- void clear();
-
- RangeSet copy();
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSetFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSetFactory.java
deleted file mode 100644
index 0f049aba8e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSetFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-public class RangeSetFactory
-{
- private RangeSetFactory()
- {
- }
-
- public static RangeSet createRangeSet()
- {
- return new RangeSetImpl();
- }
-
- public static RangeSet createRangeSet(int size)
- {
- return new RangeSetImpl(size);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSetImpl.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSetImpl.java
deleted file mode 100644
index adf18e2920..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/RangeSetImpl.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import static org.apache.qpid.util.Serial.lt;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-public class RangeSetImpl implements RangeSet
-{
-
- private List<Range> ranges;
-
- public RangeSetImpl()
- {
- ranges = new ArrayList<Range>();
- }
-
- public RangeSetImpl(int size)
- {
- ranges = new ArrayList<Range>(size);
- }
-
-
- public RangeSetImpl(org.apache.qpid.transport.RangeSetImpl copy)
- {
- ranges = new ArrayList<Range>(copy.ranges);
- }
-
- public int size()
- {
- return ranges.size();
- }
-
- public Iterator<Range> iterator()
- {
- return ranges.iterator();
- }
-
- public Range getFirst()
- {
- return ranges.get(0);
- }
-
- public Range getLast()
- {
- return ranges.get(ranges.size() - 1);
- }
-
- public boolean includes(Range range)
- {
- for (Range r : this)
- {
- if (r.includes(range))
- {
- return true;
- }
- }
-
- return false;
- }
-
- public boolean includes(int n)
- {
- for (Range r : this)
- {
- if (r.includes(n))
- {
- return true;
- }
- }
-
- return false;
- }
-
- public void add(Range range)
- {
- ListIterator<Range> it = ranges.listIterator();
-
- while (it.hasNext())
- {
- Range next = it.next();
- if (range.touches(next))
- {
- it.remove();
- range = range.span(next);
- }
- else if (lt(range.getUpper(), next.getLower()))
- {
- it.previous();
- it.add(range);
- return;
- }
- }
-
- it.add(range);
- }
-
- public void add(int lower, int upper)
- {
- switch(ranges.size())
- {
- case 0:
- ranges.add(Range.newInstance(lower, upper));
- break;
-
- case 1:
- Range first = ranges.get(0);
- if(first.getUpper() + 1 >= lower && upper >= first.getUpper())
- {
- ranges.set(0, Range.newInstance(first.getLower(), upper));
- break;
- }
-
- default:
- add(Range.newInstance(lower, upper));
- }
-
-
- }
-
- public void add(int value)
- {
- add(value, value);
- }
-
- public void clear()
- {
- ranges.clear();
- }
-
- public void subtract(final RangeSet other)
- {
- final Iterator<Range> otherIter = other.iterator() ;
- if (otherIter.hasNext())
- {
- Range otherRange = otherIter.next();
- final ListIterator<Range> iter = ranges.listIterator() ;
- if (iter.hasNext())
- {
- Range range = iter.next();
- do
- {
- if (otherRange.getUpper() < range.getLower())
- {
- otherRange = nextRange(otherIter) ;
- }
- else if (range.getUpper() < otherRange.getLower())
- {
- range = nextRange(iter) ;
- }
- else
- {
- final boolean first = range.getLower() < otherRange.getLower() ;
- final boolean second = otherRange.getUpper() < range.getUpper() ;
-
- if (first)
- {
- iter.set(Range.newInstance(range.getLower(), otherRange.getLower()-1)) ;
- if (second)
- {
- iter.add(Range.newInstance(otherRange.getUpper()+1, range.getUpper())) ;
- iter.previous() ;
- range = iter.next() ;
- }
- else
- {
- range = nextRange(iter) ;
- }
- }
- else if (second)
- {
- range = Range.newInstance(otherRange.getUpper()+1, range.getUpper()) ;
- iter.set(range) ;
- otherRange = nextRange(otherIter) ;
- }
- else
- {
- iter.remove() ;
- range = nextRange(iter) ;
- }
- }
- }
- while ((otherRange != null) && (range != null)) ;
- }
- }
- }
-
- private Range nextRange(final Iterator<Range> iter)
- {
- return (iter.hasNext() ? iter.next() : null) ;
- }
-
- public RangeSet copy()
- {
- return new org.apache.qpid.transport.RangeSetImpl(this);
- }
-
- public String toString()
- {
- StringBuffer str = new StringBuffer();
- str.append("{");
- boolean first = true;
- for (Range range : ranges)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- str.append(", ");
- }
- str.append(range);
- }
- str.append("}");
- return str.toString();
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/RecoverResult.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/RecoverResult.java
deleted file mode 100644
index 7a78f373f6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/RecoverResult.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class RecoverResult extends Struct {
-
- public static final int TYPE = 1539;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private java.util.List<Object> inDoubt;
-
-
- public RecoverResult() {}
-
-
- public RecoverResult(java.util.List<Object> inDoubt) {
- if(inDoubt != null) {
- setInDoubt(inDoubt);
- }
-
- }
-
-
-
-
- public final boolean hasInDoubt() {
- return (packing_flags & 256) != 0;
- }
-
- public final RecoverResult clearInDoubt() {
- packing_flags &= ~256;
- this.inDoubt = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.List<Object> getInDoubt() {
- return inDoubt;
- }
-
- public final RecoverResult setInDoubt(java.util.List<Object> value) {
- this.inDoubt = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final RecoverResult inDoubt(java.util.List<Object> value) {
- return setInDoubt(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeArray(this.inDoubt);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.inDoubt = dec.readArray();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("inDoubt", getInDoubt());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ReplyTo.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ReplyTo.java
deleted file mode 100644
index 38340db5ce..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ReplyTo.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class ReplyTo extends Struct {
-
- public static final int TYPE = -3;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 2;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private String exchange;
- private String routingKey;
-
-
- public ReplyTo() {}
-
-
- public ReplyTo(String exchange, String routingKey) {
- if(exchange != null) {
- setExchange(exchange);
- }
- if(routingKey != null) {
- setRoutingKey(routingKey);
- }
-
- }
-
-
-
-
- public final boolean hasExchange() {
- return (packing_flags & 256) != 0;
- }
-
- public final ReplyTo clearExchange() {
- packing_flags &= ~256;
- this.exchange = null;
- setDirty(true);
- return this;
- }
-
- public final String getExchange() {
- return exchange;
- }
-
- public final ReplyTo setExchange(String value) {
- this.exchange = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final ReplyTo exchange(String value) {
- return setExchange(value);
- }
-
- public final boolean hasRoutingKey() {
- return (packing_flags & 512) != 0;
- }
-
- public final ReplyTo clearRoutingKey() {
- packing_flags &= ~512;
- this.routingKey = null;
- setDirty(true);
- return this;
- }
-
- public final String getRoutingKey() {
- return routingKey;
- }
-
- public final ReplyTo setRoutingKey(String value) {
- this.routingKey = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final ReplyTo routingKey(String value) {
- return setRoutingKey(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeStr8(this.exchange);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeStr8(this.routingKey);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.exchange = dec.readStr8();
- }
- if ((packing_flags & 512) != 0)
- {
- this.routingKey = dec.readStr8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("exchange", getExchange());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("routingKey", getRoutingKey());
- }
-
-
- return result;
- }
-
- public boolean equals(final Object obj){
- if (this == obj){
- return true;
- }
-
- if(!(obj instanceof ReplyTo)){
- return false;
- }
-
- final ReplyTo reply = (ReplyTo) obj;
- return (routingKey == null ? reply.getRoutingKey() == null : routingKey.equals(reply.getRoutingKey()))
- && (exchange == null ? reply.getExchange() == null : exchange.equals(reply.getExchange()));
- }
-
- public int hashCode(){
- int result = routingKey == null ? 1 : routingKey.hashCode();
- return 31 * result + (exchange == null ? 5 : exchange.hashCode());
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SegmentType.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SegmentType.java
deleted file mode 100644
index c9ba87abf4..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SegmentType.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum SegmentType {
-
- CONTROL((short) 0),
- COMMAND((short) 1),
- HEADER((short) 2),
- BODY((short) 3);
-
- private final short value;
-
- SegmentType(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static SegmentType get(short value)
- {
- switch (value)
- {
- case (short) 0: return CONTROL;
- case (short) 1: return COMMAND;
- case (short) 2: return HEADER;
- case (short) 3: return BODY;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SenderClosedException.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SenderClosedException.java
deleted file mode 100644
index 924c327861..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SenderClosedException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * SenderClosedException
- *
- */
-
-public class SenderClosedException extends SenderException
-{
-
- public SenderClosedException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public SenderClosedException(String message)
- {
- super(message);
- }
-
- public SenderClosedException(Throwable cause)
- {
- super(cause);
- }
-
- public void rethrow()
- {
- throw new SenderClosedException(getMessage(), this);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SenderException.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SenderException.java
deleted file mode 100644
index a96079dc27..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SenderException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * SenderException
- *
- */
-
-public class SenderException extends TransportException
-{
-
- public SenderException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public SenderException(String message)
- {
- super(message);
- }
-
- public SenderException(Throwable cause)
- {
- super(cause);
- }
-
- public void rethrow()
- {
- throw new SenderException(getMessage(), this);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java
deleted file mode 100644
index f8fd286f17..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import static org.apache.qpid.transport.Connection.State.OPEN;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.security.sasl.Sasl;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * ServerDelegate
- */
-public class ServerDelegate extends ConnectionDelegate
-{
- protected static final Logger _logger = LoggerFactory.getLogger(ServerDelegate.class);
-
- private List<Object> _locales;
- private List<Object> _mechanisms;
- private Map<String, Object> _clientProperties;
-
-
- public ServerDelegate()
- {
- this(null, Collections.emptyList(), Collections.singletonList((Object)"utf8"));
- }
-
- protected ServerDelegate(Map<String, Object> clientProperties, List<Object> mechanisms, List<Object> locales)
- {
- _clientProperties = clientProperties;
- _mechanisms = mechanisms;
- _locales = locales;
- }
-
- public void init(Connection conn, ProtocolHeader hdr)
- {
- conn.send(new ProtocolHeader(1, 0, 10));
-
- conn.connectionStart(_clientProperties, _mechanisms, _locales);
- }
-
- @Override
- public void connectionStartOk(Connection conn, ConnectionStartOk ok)
- {
- conn.setLocale(ok.getLocale());
- String mechanism = ok.getMechanism();
-
- if (mechanism == null || mechanism.length() == 0)
- {
- conn.connectionClose(ConnectionCloseCode.CONNECTION_FORCED,
- "No Sasl mechanism was specified");
- return;
- }
-
- try
- {
-
- SaslServer ss = createSaslServer(conn, mechanism);
- if (ss == null)
- {
- conn.connectionClose(ConnectionCloseCode.CONNECTION_FORCED,
- "No SaslServer could be created for mechanism: " + mechanism);
- return;
- }
- conn.setSaslServer(ss);
- secure(conn, ok.getResponse());
- }
- catch (SaslException e)
- {
- connectionAuthFailed(conn, e);
- }
- }
-
- protected SaslServer createSaslServer(Connection conn, String mechanism)
- throws SaslException
- {
- SaslServer ss = Sasl.createSaslServer(mechanism, "AMQP", "localhost", null, null);
- return ss;
- }
-
- protected void secure(final SaslServer ss, final Connection conn, final byte[] response)
- {
- try
- {
- byte[] challenge = ss.evaluateResponse(response);
- if (ss.isComplete())
- {
- ss.dispose();
- tuneAuthorizedConnection(conn);
- }
- else
- {
- connectionAuthContinue(conn, challenge);
- }
- }
- catch (SaslException e)
- {
- connectionAuthFailed(conn, e);
- }
- }
-
- protected void connectionAuthFailed(final Connection conn, Exception e)
- {
- if (e != null)
- {
- conn.exception(e);
- }
- conn.connectionClose(ConnectionCloseCode.CONNECTION_FORCED, e == null ? "Authentication failed" : e.getMessage());
- }
-
- protected void connectionAuthContinue(final Connection conn, byte[] challenge)
- {
- conn.connectionSecure(challenge);
- }
-
- protected void tuneAuthorizedConnection(final Connection conn)
- {
- conn.connectionTune(getChannelMax(), getFrameMax(), 0, getHeartbeatMax());
- }
-
- protected int getFrameMax()
- {
- return org.apache.qpid.transport.network.ConnectionBinding.MAX_FRAME_SIZE;
- }
-
- protected void secure(final Connection conn, final byte[] response)
- {
- final SaslServer ss = conn.getSaslServer();
- secure(ss, conn, response);
- }
-
- protected int getHeartbeatMax()
- {
- return 0xFFFF;
- }
-
- protected int getChannelMax()
- {
- return 0xFFFF;
- }
-
- @Override
- public void connectionSecureOk(Connection conn, ConnectionSecureOk ok)
- {
- secure(conn, ok.getResponse());
- }
-
- @Override
- public void connectionTuneOk(Connection conn, ConnectionTuneOk ok)
- {
-
- }
-
- @Override
- public void connectionOpen(Connection conn, ConnectionOpen open)
- {
- conn.connectionOpenOk(Collections.emptyList());
-
- conn.setState(OPEN);
- }
-
- protected Session getSession(Connection conn, SessionDelegate delegate, SessionAttach atc)
- {
- return new Session(conn, delegate, new Binary(atc.getName()), 0);
- }
-
-
- public Session getSession(Connection conn, SessionAttach atc)
- {
- return new Session(conn, new Binary(atc.getName()), 0);
- }
-
- @Override
- public void sessionAttach(Connection conn, SessionAttach atc)
- {
- Session ssn = getSession(conn, atc);
- conn.map(ssn, atc.getChannel());
- conn.registerSession(ssn);
- ssn.sessionAttached(atc.getName());
- ssn.setState(Session.State.OPEN);
- }
-
- protected void setConnectionTuneOkChannelMax(final Connection conn, final int okChannelMax)
- {
- //0 means no implied limit, except available server resources
- //(or that forced by protocol limitations [0xFFFF])
- conn.setChannelMax(okChannelMax == 0 ? Connection.MAX_CHANNEL_MAX : okChannelMax);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Session.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Session.java
deleted file mode 100644
index 90288eedcc..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Session.java
+++ /dev/null
@@ -1,1215 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.transport.network.Frame;
-import org.apache.qpid.transport.util.Logger;
-import org.apache.qpid.transport.util.Waiter;
-import static org.apache.qpid.transport.Option.COMPLETED;
-import static org.apache.qpid.transport.Option.SYNC;
-import static org.apache.qpid.transport.Option.TIMELY_REPLY;
-import static org.apache.qpid.transport.Session.State.CLOSED;
-import static org.apache.qpid.transport.Session.State.CLOSING;
-import static org.apache.qpid.transport.Session.State.DETACHED;
-import static org.apache.qpid.transport.Session.State.NEW;
-import static org.apache.qpid.transport.Session.State.OPEN;
-import static org.apache.qpid.transport.Session.State.RESUMING;
-import static org.apache.qpid.util.Serial.ge;
-import static org.apache.qpid.util.Serial.gt;
-import static org.apache.qpid.util.Serial.le;
-import static org.apache.qpid.util.Serial.lt;
-import static org.apache.qpid.util.Serial.max;
-import static org.apache.qpid.util.Strings.toUTF8;
-
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Session
- *
- * @author Rafael H. Schloming
- */
-
-public class Session extends SessionInvoker
-{
- private static final Logger log = Logger.get(Session.class);
-
- public enum State { NEW, DETACHED, RESUMING, OPEN, CLOSING, CLOSED }
-
- static class DefaultSessionListener implements SessionListener
- {
-
- public void opened(Session ssn) {}
-
- public void resumed(Session ssn) {}
-
- public void message(Session ssn, MessageTransfer xfr)
- {
- log.info("message: %s", xfr);
- }
-
- public void exception(Session ssn, SessionException exc)
- {
- log.error(exc, "session exception");
- }
-
- public void closed(Session ssn) {}
- }
-
- public static final int UNLIMITED_CREDIT = 0xFFFFFFFF;
-
- private Connection connection;
- private Binary name;
- private long expiry;
- private boolean closing;
- private int channel;
- private SessionDelegate delegate;
- private SessionListener listener = new DefaultSessionListener();
- private final long timeout = Long.getLong(ClientProperties.QPID_SYNC_OP_TIMEOUT,
- Long.getLong(ClientProperties.AMQJ_DEFAULT_SYNCWRITE_TIMEOUT,
- ClientProperties.DEFAULT_SYNC_OPERATION_TIMEOUT));
- private final long blockedSendTimeout = Long.getLong(ClientProperties.QPID_FLOW_CONTROL_WAIT_FAILURE,
- ClientProperties.DEFAULT_FLOW_CONTROL_WAIT_FAILURE);
- private long blockedSendReportingPeriod = Long.getLong(ClientProperties.QPID_FLOW_CONTROL_WAIT_NOTIFY_PERIOD,
- ClientProperties.DEFAULT_FLOW_CONTROL_WAIT_NOTIFY_PERIOD);
-
- private boolean autoSync = false;
-
- private boolean incomingInit;
- // incoming command count
- private int commandsIn;
- // completed incoming commands
- private final Object processedLock = new Object();
- private RangeSet processed;
- private int maxProcessed;
- private int syncPoint;
-
- // outgoing command count
- private int commandsOut = 0;
- private final int commandLimit = Integer.getInteger("qpid.session.command_limit", 64 * 1024);
- private Map<Integer,Method> commands = new HashMap<Integer, Method>();
- private final Object commandsLock = new Object();
- private int commandBytes = 0;
- private int byteLimit = Integer.getInteger("qpid.session.byte_limit", 1024*1024);
- private int maxComplete = commandsOut - 1;
- private boolean needSync = false;
-
- private State state = NEW;
-
- // transfer flow control
- private volatile boolean flowControl = false;
- private Semaphore credit = new Semaphore(0);
-
- private Thread resumer = null;
- private boolean transacted = false;
- private SessionDetachCode detachCode;
- private final Object stateLock = new Object();
-
- private final AtomicBoolean _failoverRequired = new AtomicBoolean(false);
- private boolean _isNoReplay = false;
-
- protected Session(Connection connection, Binary name, long expiry)
- {
- this(connection, new SessionDelegate(), name, expiry);
- }
-
- protected Session(Connection connection, Binary name, long expiry, boolean noReplay)
- {
- this(connection, new SessionDelegate(), name, expiry, noReplay);
- }
-
- protected Session(Connection connection, SessionDelegate delegate, Binary name, long expiry)
- {
- this(connection, delegate, name, expiry,false);
- }
-
- protected Session(Connection connection, SessionDelegate delegate, Binary name, long expiry, boolean noReplay)
- {
- this.connection = connection;
- this.delegate = delegate;
- this.name = name;
- this.expiry = expiry;
- this.closing = false;
- this._isNoReplay = noReplay;
- initReceiver();
- }
-
- public Connection getConnection()
- {
- return connection;
- }
-
- public Binary getName()
- {
- return name;
- }
-
- void setExpiry(long expiry)
- {
- this.expiry = expiry;
- }
-
- protected void setClose(boolean close)
- {
- this.closing = close;
- }
-
- public int getChannel()
- {
- return channel;
- }
-
- void setChannel(int channel)
- {
- this.channel = channel;
- }
-
- public void setSessionListener(SessionListener listener)
- {
- if (listener == null)
- {
- this.listener = new DefaultSessionListener();
- }
- else
- {
- this.listener = listener;
- }
- }
-
- public SessionListener getSessionListener()
- {
- return listener;
- }
-
- public void setAutoSync(boolean value)
- {
- synchronized (commandsLock)
- {
- this.autoSync = value;
- }
- }
-
- protected void setState(State state)
- {
- synchronized (commandsLock)
- {
- this.state = state;
- commandsLock.notifyAll();
- }
- }
-
- protected State getState()
- {
- return this.state;
- }
-
- void setFlowControl(boolean value)
- {
- flowControl = value;
- }
-
- void addCredit(int value)
- {
- credit.release(value);
- }
-
- void drainCredit()
- {
- credit.drainPermits();
- }
-
- void acquireCredit()
- {
- if (flowControl)
- {
- try
- {
- long wait = blockedSendTimeout > blockedSendReportingPeriod ? blockedSendReportingPeriod :
- blockedSendTimeout;
- long totalWait = 1L;
- while(totalWait <= blockedSendTimeout && !credit.tryAcquire(wait, TimeUnit.MILLISECONDS))
- {
- totalWait+=wait;
- log.warn("Message send delayed by " + (totalWait)/1000 + "s due to broker enforced flow control");
-
-
- }
- if(totalWait > blockedSendTimeout)
- {
- log.error("Message send failed due to timeout waiting on broker enforced flow control");
- throw new SessionException
- ("timed out waiting for message credit");
- }
- }
- catch (InterruptedException e)
- {
- throw new SessionException
- ("interrupted while waiting for credit", null, e);
- }
- }
- }
-
- private void initReceiver()
- {
- synchronized (processedLock)
- {
- incomingInit = false;
- processed = RangeSetFactory.createRangeSet();
- }
- }
-
- void attach()
- {
- initReceiver();
- sessionAttach(name.getBytes());
- sessionRequestTimeout(0);//use expiry here only if/when session resume is supported
- }
-
- void resume()
- {
- _failoverRequired.set(false);
-
- synchronized (commandsLock)
- {
- attach();
-
- for (int i = maxComplete + 1; lt(i, commandsOut); i++)
- {
- Method m = getCommand(i);
- if (m == null)
- {
- m = new ExecutionSync();
- m.setId(i);
- }
- else if (m instanceof MessageTransfer)
- {
- MessageTransfer xfr = (MessageTransfer)m;
-
- Header header = xfr.getHeader();
-
- if (header != null)
- {
- if (header.getDeliveryProperties() != null)
- {
- header.getDeliveryProperties().setRedelivered(true);
- }
- else
- {
- DeliveryProperties deliveryProps = new DeliveryProperties();
- deliveryProps.setRedelivered(true);
-
- xfr.setHeader(new Header(deliveryProps, header.getMessageProperties(),
- header.getNonStandardProperties()));
- }
-
- }
- else
- {
- DeliveryProperties deliveryProps = new DeliveryProperties();
- deliveryProps.setRedelivered(true);
- xfr.setHeader(new Header(deliveryProps, null, null));
- }
- }
- sessionCommandPoint(m.getId(), 0);
- send(m);
- }
-
- sessionCommandPoint(commandsOut, 0);
-
- sessionFlush(COMPLETED);
- resumer = Thread.currentThread();
- state = RESUMING;
-
- if(isTransacted())
- {
- txSelect();
- }
-
- listener.resumed(this);
- resumer = null;
- }
- }
-
- private Method getCommand(int i)
- {
- return commands.get(i);
- }
-
- private void setCommand(int commandId, Method command)
- {
- commands.put(commandId, command);
- }
-
- private Method removeCommand(int id)
- {
- return commands.remove(id);
- }
-
- void dump()
- {
- synchronized (commandsLock)
- {
- TreeMap<Integer, Method> ordered = new TreeMap<Integer, Method>(commands);
- for (Method m : ordered.values())
- {
- if (m != null)
- {
- log.debug("%s", m);
- }
- }
- }
- }
-
- final void commandPoint(int id)
- {
- synchronized (processedLock)
- {
- this.commandsIn = id;
- if (!incomingInit)
- {
- incomingInit = true;
- maxProcessed = commandsIn - 1;
- syncPoint = maxProcessed;
- }
- }
- }
-
- public int getCommandsOut()
- {
- return commandsOut;
- }
-
- public int getCommandsIn()
- {
- return commandsIn;
- }
-
- public int nextCommandId()
- {
- return commandsIn++;
- }
-
- final void identify(Method cmd)
- {
- if (!incomingInit)
- {
- throw new IllegalStateException();
- }
-
- int id = nextCommandId();
- cmd.setId(id);
-
- if(log.isDebugEnabled())
- {
- log.debug("identify: ch=%s, commandId=%s", this.channel, id);
- }
-
- if ((id & 0xff) == 0)
- {
- flushProcessed(TIMELY_REPLY);
- }
- }
-
- public void processed(Method command)
- {
- processed(command.getId());
- }
-
- public void processed(int command)
- {
- processed(command, command);
- }
-
- public void processed(Range range)
- {
-
- processed(range.getLower(), range.getUpper());
- }
-
- public void processed(int lower, int upper)
- {
- if(log.isDebugEnabled())
- {
- log.debug("%s ch=%s processed([%d,%d]) %s %s", this, channel, lower, upper, syncPoint, maxProcessed);
- }
-
- boolean flush;
- synchronized (processedLock)
- {
- if(log.isDebugEnabled())
- {
- log.debug("%s processed: %s", this, processed);
- }
-
- if (ge(upper, commandsIn))
- {
- throw new IllegalArgumentException
- ("range exceeds max received command-id: " + Range.newInstance(lower, upper));
- }
-
- processed.add(lower, upper);
-
- Range first = processed.getFirst();
-
- int flower = first.getLower();
- int fupper = first.getUpper();
- int old = maxProcessed;
- if (le(flower, maxProcessed + 1))
- {
- maxProcessed = max(maxProcessed, fupper);
- }
- boolean synced = ge(maxProcessed, syncPoint);
- flush = lt(old, syncPoint) && synced;
- if (synced)
- {
- syncPoint = maxProcessed;
- }
- }
- if (flush)
- {
- flushProcessed();
- }
- }
-
- void flushExpected()
- {
- RangeSet rs = RangeSetFactory.createRangeSet();
- synchronized (processedLock)
- {
- if (incomingInit)
- {
- rs.add(commandsIn);
- }
- }
- sessionExpected(rs, null);
- }
-
- public void flushProcessed(Option ... options)
- {
- RangeSet copy;
- synchronized (processedLock)
- {
- copy = processed.copy();
- }
-
- synchronized (commandsLock)
- {
- if (state == DETACHED || state == CLOSING || state == CLOSED)
- {
- return;
- }
- if (copy.size() > 0)
- {
- sessionCompleted(copy, options);
- }
- }
- }
-
- void knownComplete(RangeSet kc)
- {
- if (kc.size() > 0)
- {
- synchronized (processedLock)
- {
- processed.subtract(kc) ;
- }
- }
- }
-
- void syncPoint()
- {
- int id = getCommandsIn() - 1;
- log.debug("%s synced to %d", this, id);
- boolean flush;
- synchronized (processedLock)
- {
- syncPoint = id;
- flush = ge(maxProcessed, syncPoint);
- }
- if (flush)
- {
- flushProcessed();
- }
- }
-
- protected boolean complete(int lower, int upper)
- {
- //avoid autoboxing
- if(log.isDebugEnabled())
- {
- log.debug("%s complete(%d, %d)", this, lower, upper);
- }
- synchronized (commandsLock)
- {
- int old = maxComplete;
- for (int id = max(maxComplete, lower); le(id, upper); id++)
- {
- Method m = removeCommand(id);
- if (m != null)
- {
- commandBytes -= m.getBodySize();
- m.complete();
- }
- }
- if (le(lower, maxComplete + 1))
- {
- maxComplete = max(maxComplete, upper);
- }
-
- if(log.isDebugEnabled())
- {
- log.debug("%s commands remaining: %s", this, commandsOut - maxComplete);
- }
-
- commandsLock.notifyAll();
- return gt(maxComplete, old);
- }
- }
-
- void received(Method m)
- {
- m.delegate(this, delegate);
- }
-
- private void send(Method m)
- {
- m.setChannel(channel);
- connection.send(m);
-
- if (!m.isBatch())
- {
- connection.flush();
- }
- }
-
- protected boolean isFull(int id)
- {
- return isCommandsFull(id) || isBytesFull();
- }
-
- protected boolean isBytesFull()
- {
- return commandBytes >= byteLimit;
- }
-
- protected boolean isCommandsFull(int id)
- {
- return id - maxComplete >= commandLimit;
- }
-
- public void invoke(Method m)
- {
- invoke(m,(Runnable)null);
- }
-
- public void invoke(Method m, Runnable postIdSettingAction)
- {
- if (m.getEncodedTrack() == Frame.L4)
- {
- if (m.hasPayload())
- {
- acquireCredit();
- }
-
- synchronized (commandsLock)
- {
- if (state == DETACHED && m.isUnreliable())
- {
- Thread current = Thread.currentThread();
- if (!current.equals(resumer))
- {
- return;
- }
- }
-
- if (state != OPEN && state != CLOSED && state != CLOSING)
- {
- Thread current = Thread.currentThread();
- if (!current.equals(resumer) )
- {
- Waiter w = new Waiter(commandsLock, timeout);
- while (w.hasTime() && (state != OPEN && state != CLOSED))
- {
- checkFailoverRequired("Command was interrupted because of failover, before being sent");
- w.await();
- }
- }
- }
-
- switch (state)
- {
- case OPEN:
- break;
- case RESUMING:
- Thread current = Thread.currentThread();
- if (!current.equals(resumer))
- {
- throw new SessionException
- ("timed out waiting for resume to finish");
- }
- break;
- case CLOSING:
- case CLOSED:
- ExecutionException exc = getException();
- if (exc != null)
- {
- throw new SessionException(exc);
- }
- else
- {
- throw new SessionClosedException();
- }
- default:
- throw new SessionException
- (String.format
- ("timed out waiting for session to become open " +
- "(state=%s)", state));
- }
-
- int next;
- next = commandsOut++;
- m.setId(next);
- if(postIdSettingAction != null)
- {
- postIdSettingAction.run();
- }
-
- if (isFull(next))
- {
- Waiter w = new Waiter(commandsLock, timeout);
- while (w.hasTime() && isFull(next) && state != CLOSED)
- {
- if (state == OPEN || state == RESUMING)
- {
- try
- {
- sessionFlush(COMPLETED);
- }
- catch (SenderException e)
- {
- if (!closing)
- {
- // if expiry is > 0 then this will
- // happen again on resume
- log.error(e, "error sending flush (full replay buffer)");
- }
- else
- {
- e.rethrow();
- }
- }
- }
- checkFailoverRequired("Command was interrupted because of failover, before being sent");
- w.await();
- }
- }
-
- if (state == CLOSED)
- {
- ExecutionException exc = getException();
- if (exc != null)
- {
- throw new SessionException(exc);
- }
- else
- {
- throw new SessionClosedException();
- }
- }
-
- if (isFull(next))
- {
- throw new SessionException("timed out waiting for completion");
- }
-
- if (next == 0)
- {
- sessionCommandPoint(0, 0);
- }
-
- boolean replayTransfer = !_isNoReplay && !closing && !transacted &&
- m instanceof MessageTransfer &&
- ! m.isUnreliable();
-
- if ((replayTransfer) || m.hasCompletionListener())
- {
- setCommand(next, m);
- commandBytes += m.getBodySize();
- }
- if (autoSync)
- {
- m.setSync(true);
- }
- needSync = !m.isSync();
-
- try
- {
- send(m);
- }
- catch (SenderException e)
- {
- if (!closing)
- {
- // if we are not closing then this will happen
- // again on resume
- log.error(e, "error sending command");
- }
- else
- {
- e.rethrow();
- }
- }
- if (autoSync)
- {
- sync();
- }
-
- // flush every 64K commands to avoid ambiguity on
- // wraparound
- if (shouldIssueFlush(next))
- {
- try
- {
- sessionFlush(COMPLETED);
- }
- catch (SenderException e)
- {
- if (!closing)
- {
- // if expiry is > 0 then this will happen
- // again on resume
- log.error(e, "error sending flush (periodic)");
- }
- else
- {
- e.rethrow();
- }
- }
- }
- }
- }
- else
- {
- send(m);
- }
- }
-
- private void checkFailoverRequired(String message)
- {
- if (_failoverRequired.get())
- {
- throw new SessionException(message);
- }
- }
-
- protected boolean shouldIssueFlush(int next)
- {
- return (next % 65536) == 0;
- }
-
- public void sync()
- {
- sync(timeout);
- }
-
- public void sync(long timeout)
- {
- log.debug("%s sync()", this);
- synchronized (commandsLock)
- {
- int point = commandsOut - 1;
-
- if (needSync && lt(maxComplete, point))
- {
- executionSync(SYNC);
- }
-
- Waiter w = new Waiter(commandsLock, timeout);
- while (w.hasTime() && state != CLOSED && lt(maxComplete, point))
- {
- checkFailoverRequired("Session sync was interrupted by failover.");
- if(log.isDebugEnabled())
- {
- log.debug("%s waiting for[%d]: %d, %s", this, point, maxComplete, commands);
- }
- w.await();
- }
-
- if (lt(maxComplete, point))
- {
- if (state != CLOSED)
- {
- throw new SessionException(
- String.format("timed out waiting for sync: complete = %s, point = %s",
- maxComplete, point));
- }
- else
- {
- ExecutionException ee = getException();
- if (ee != null)
- {
- throw new SessionException(ee);
- }
- }
- }
- }
- }
-
- private Map<Integer,ResultFuture<?>> results = new HashMap<Integer,ResultFuture<?>>();
- private ExecutionException exception = null;
-
- void result(int command, Struct result)
- {
- ResultFuture<?> future;
- synchronized (results)
- {
- future = results.remove(command);
- }
-
- if (future != null)
- {
- future.set(result);
- }
- else
- {
- log.warn("Received a response to a command" +
- " that's no longer valid on the client side." +
- " [ command id : %s , result : %s ]",command, result);
- }
- }
-
- void setException(ExecutionException exc)
- {
- synchronized (results)
- {
- if (exception != null)
- {
- throw new IllegalStateException(
- String.format("too many exceptions: %s, %s", exception, exc));
- }
- exception = exc;
- }
- }
-
- ExecutionException getException()
- {
- synchronized (results)
- {
- return exception;
- }
- }
-
- protected <T> Future<T> invoke(Method m, Class<T> klass)
- {
- synchronized (commandsLock)
- {
- int command = commandsOut;
- ResultFuture<T> future = new ResultFuture<T>(klass);
- synchronized (results)
- {
- results.put(command, future);
- }
- invoke(m);
- return future;
- }
- }
-
- private class ResultFuture<T> implements Future<T>
- {
-
- private final Class<T> klass;
- private T result;
-
- private ResultFuture(Class<T> klass)
- {
- this.klass = klass;
- }
-
- private void set(Struct result)
- {
- synchronized (this)
- {
- this.result = klass.cast(result);
- notifyAll();
- }
- }
-
- public T get(long timeout)
- {
- synchronized (this)
- {
- Waiter w = new Waiter(this, timeout);
- while (w.hasTime() && state != CLOSED && !isDone())
- {
- checkFailoverRequired("Operation was interrupted by failover.");
- log.debug("%s waiting for result: %s", Session.this, this);
- w.await();
- }
- }
-
- if (isDone())
- {
- return result;
- }
- else if (state == CLOSED)
- {
- ExecutionException ex = getException();
- if(ex == null)
- {
- throw new SessionClosedException();
- }
- throw new SessionException(ex);
- }
- else
- {
- throw new SessionException(
- String.format("%s timed out waiting for result: %s",
- Session.this, this));
- }
- }
-
- public T get()
- {
- return get(timeout);
- }
-
- public boolean isDone()
- {
- return result != null;
- }
-
- public String toString()
- {
- return String.format("Future(%s)", isDone() ? result : klass);
- }
-
- }
-
- public final void messageTransfer(String destination,
- MessageAcceptMode acceptMode,
- MessageAcquireMode acquireMode,
- Header header,
- byte[] body,
- Option ... _options) {
- messageTransfer(destination, acceptMode, acquireMode, header,
- ByteBuffer.wrap(body), _options);
- }
-
- public final void messageTransfer(String destination,
- MessageAcceptMode acceptMode,
- MessageAcquireMode acquireMode,
- Header header,
- String body,
- Option ... _options) {
- messageTransfer(destination, acceptMode, acquireMode, header,
- toUTF8(body), _options);
- }
-
- public void close()
- {
- if (log.isDebugEnabled())
- {
- log.debug("Closing [%s] in state [%s]", this, state);
- }
- synchronized (commandsLock)
- {
- switch(state)
- {
- case DETACHED:
- state = CLOSED;
- delegate.closed(this);
- connection.removeSession(this);
- listener.closed(this);
- break;
- case CLOSED:
- break;
- default:
- state = CLOSING;
- setClose(true);
- sessionRequestTimeout(0);
- sessionDetach(name.getBytes());
- awaitClose();
- }
- }
- }
-
- protected void awaitClose()
- {
- Waiter w = new Waiter(commandsLock, timeout);
- while (w.hasTime() && state != CLOSED)
- {
- checkFailoverRequired("close() was interrupted by failover.");
- w.await();
- }
-
- if (state != CLOSED)
- {
- throw new SessionException("close() timed out");
- }
- }
-
- public void exception(Throwable t)
- {
- log.error(t, "caught exception");
- }
-
- public void closed()
- {
- synchronized (commandsLock)
- {
- if (closing || getException() != null)
- {
- state = CLOSED;
- }
- else
- {
- state = DETACHED;
- }
-
- commandsLock.notifyAll();
-
- synchronized (results)
- {
- for (ResultFuture<?> result : results.values())
- {
- synchronized(result)
- {
- result.notifyAll();
- }
- }
- }
- if(state == CLOSED)
- {
- delegate.closed(this);
- }
- else
- {
- delegate.detached(this);
- }
- }
-
- if(state == CLOSED)
- {
- connection.removeSession(this);
- listener.closed(this);
- }
- }
-
- public boolean isClosing()
- {
- return state == CLOSED || state == CLOSING;
- }
-
- public String toString()
- {
- return String.format("ssn:%s", name);
- }
-
- public void setTransacted(boolean b) {
- this.transacted = b;
- }
-
- public boolean isTransacted(){
- return transacted;
- }
-
- public void setDetachCode(SessionDetachCode dtc)
- {
- this.detachCode = dtc;
- }
-
- public SessionDetachCode getDetachCode()
- {
- return this.detachCode;
- }
-
- public void awaitOpen()
- {
- switch (state)
- {
- case NEW:
- synchronized(stateLock)
- {
- Waiter w = new Waiter(stateLock, timeout);
- while (w.hasTime() && state == NEW)
- {
- checkFailoverRequired("Session opening was interrupted by failover.");
- w.await();
- }
- }
-
- if (state != OPEN)
- {
- throw new SessionException("Timed out waiting for Session to open");
- }
- break;
- case DETACHED:
- case CLOSING:
- case CLOSED:
- throw new SessionException("Session closed");
- default :
- break;
- }
- }
-
- public Object getStateLock()
- {
- return stateLock;
- }
-
- protected void notifyFailoverRequired()
- {
- //ensure any operations waiting are aborted to
- //prevent them waiting for timeout for 60 seconds
- //and possibly preventing failover proceeding
- _failoverRequired.set(true);
- synchronized (commandsLock)
- {
- commandsLock.notifyAll();
- }
- synchronized (results)
- {
- for (ResultFuture<?> result : results.values())
- {
- synchronized(result)
- {
- result.notifyAll();
- }
- }
- }
- }
-
- /**
- * An auxiliary method for test purposes only
- * @return true if flow is blocked
- */
- public boolean isFlowBlocked()
- {
- return flowControl && credit.availablePermits() == 0;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionAttach.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionAttach.java
deleted file mode 100644
index cc056c2157..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionAttach.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionAttach extends Method {
-
- public static final int TYPE = 513;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L2;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private byte[] name;
-
-
- public SessionAttach() {}
-
-
- public SessionAttach(byte[] name, Option ... _options) {
- if(name != null) {
- setName(name);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case FORCE: packing_flags |= 512; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionAttach(context, this);
- }
-
-
- public final boolean hasName() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionAttach clearName() {
- packing_flags &= ~256;
- this.name = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getName() {
- return name;
- }
-
- public final SessionAttach setName(byte[] value) {
- this.name = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionAttach name(byte[] value) {
- return setName(value);
- }
-
- public final boolean hasForce() {
- return (packing_flags & 512) != 0;
- }
-
- public final SessionAttach clearForce() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getForce() {
- return hasForce();
- }
-
- public final SessionAttach setForce(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final SessionAttach force(boolean value) {
- return setForce(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeVbin16(this.name);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.name = dec.readVbin16();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("name", getName());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("force", getForce());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionAttached.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionAttached.java
deleted file mode 100644
index edba391120..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionAttached.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionAttached extends Method {
-
- public static final int TYPE = 514;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L2;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private byte[] name;
-
-
- public SessionAttached() {}
-
-
- public SessionAttached(byte[] name, Option ... _options) {
- if(name != null) {
- setName(name);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionAttached(context, this);
- }
-
-
- public final boolean hasName() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionAttached clearName() {
- packing_flags &= ~256;
- this.name = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getName() {
- return name;
- }
-
- public final SessionAttached setName(byte[] value) {
- this.name = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionAttached name(byte[] value) {
- return setName(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeVbin16(this.name);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.name = dec.readVbin16();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("name", getName());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionClosedException.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionClosedException.java
deleted file mode 100644
index 01fe05c851..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionClosedException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-/**
- * SessionClosedException
- *
- */
-
-public class SessionClosedException extends SessionException
-{
-
- public SessionClosedException()
- {
- this(null);
- }
-
- public SessionClosedException(Throwable cause)
- {
- super("session closed", null, cause);
- }
-
- @Override public void rethrow()
- {
- throw new SessionClosedException(this);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCommandFragment.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCommandFragment.java
deleted file mode 100644
index 6ae2d45238..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCommandFragment.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class SessionCommandFragment extends Struct {
-
- public static final int TYPE = -2;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 0;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private int commandId;
- private RangeSet byteRanges;
-
-
- public SessionCommandFragment() {}
-
-
- public SessionCommandFragment(int commandId, RangeSet byteRanges) {
- setCommandId(commandId);
- if(byteRanges != null) {
- setByteRanges(byteRanges);
- }
-
- }
-
-
-
-
- public final int getCommandId() {
- return commandId;
- }
-
- public final SessionCommandFragment setCommandId(int value) {
- this.commandId = value;
-
- setDirty(true);
- return this;
- }
-
- public final SessionCommandFragment commandId(int value) {
- return setCommandId(value);
- }
-
- public final RangeSet getByteRanges() {
- return byteRanges;
- }
-
- public final SessionCommandFragment setByteRanges(RangeSet value) {
- this.byteRanges = value;
-
- setDirty(true);
- return this;
- }
-
- public final SessionCommandFragment byteRanges(RangeSet value) {
- return setByteRanges(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeSequenceNo(this.commandId);
- enc.writeByteRanges(this.byteRanges);
-
- }
-
- public void read(Decoder dec)
- {
- this.commandId = dec.readSequenceNo();
- this.byteRanges = dec.readByteRanges();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- result.put("commandId", getCommandId());
- result.put("byteRanges", getByteRanges());
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCommandPoint.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCommandPoint.java
deleted file mode 100644
index b0bb0559fe..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCommandPoint.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionCommandPoint extends Method {
-
- public static final int TYPE = 519;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private int commandId;
- private long commandOffset;
-
-
- public SessionCommandPoint() {}
-
-
- public SessionCommandPoint(int commandId, long commandOffset, Option ... _options) {
- setCommandId(commandId);
- setCommandOffset(commandOffset);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionCommandPoint(context, this);
- }
-
-
- public final boolean hasCommandId() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionCommandPoint clearCommandId() {
- packing_flags &= ~256;
- this.commandId = 0;
- setDirty(true);
- return this;
- }
-
- public final int getCommandId() {
- return commandId;
- }
-
- public final SessionCommandPoint setCommandId(int value) {
- this.commandId = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionCommandPoint commandId(int value) {
- return setCommandId(value);
- }
-
- public final boolean hasCommandOffset() {
- return (packing_flags & 512) != 0;
- }
-
- public final SessionCommandPoint clearCommandOffset() {
- packing_flags &= ~512;
- this.commandOffset = 0;
- setDirty(true);
- return this;
- }
-
- public final long getCommandOffset() {
- return commandOffset;
- }
-
- public final SessionCommandPoint setCommandOffset(long value) {
- this.commandOffset = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final SessionCommandPoint commandOffset(long value) {
- return setCommandOffset(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceNo(this.commandId);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint64(this.commandOffset);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.commandId = dec.readSequenceNo();
- }
- if ((packing_flags & 512) != 0)
- {
- this.commandOffset = dec.readUint64();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("commandId", getCommandId());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("commandOffset", getCommandOffset());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCompleted.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCompleted.java
deleted file mode 100644
index 2b30f376b2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionCompleted.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionCompleted extends Method {
-
- public static final int TYPE = 522;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet commands;
-
-
- public SessionCompleted() {}
-
-
- public SessionCompleted(RangeSet commands, Option ... _options) {
- if(commands != null) {
- setCommands(commands);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case TIMELY_REPLY: packing_flags |= 512; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionCompleted(context, this);
- }
-
-
- public final boolean hasCommands() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionCompleted clearCommands() {
- packing_flags &= ~256;
- this.commands = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getCommands() {
- return commands;
- }
-
- public final SessionCompleted setCommands(RangeSet value) {
- this.commands = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionCompleted commands(RangeSet value) {
- return setCommands(value);
- }
-
- public final boolean hasTimelyReply() {
- return (packing_flags & 512) != 0;
- }
-
- public final SessionCompleted clearTimelyReply() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getTimelyReply() {
- return hasTimelyReply();
- }
-
- public final SessionCompleted setTimelyReply(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final SessionCompleted timelyReply(boolean value) {
- return setTimelyReply(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.commands);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.commands = dec.readSequenceSet();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("commands", getCommands());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("timelyReply", getTimelyReply());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionConfirmed.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionConfirmed.java
deleted file mode 100644
index d162fb8e10..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionConfirmed.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionConfirmed extends Method {
-
- public static final int TYPE = 521;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet commands;
- private java.util.List<Object> fragments;
-
-
- public SessionConfirmed() {}
-
-
- public SessionConfirmed(RangeSet commands, java.util.List<Object> fragments, Option ... _options) {
- if(commands != null) {
- setCommands(commands);
- }
- if(fragments != null) {
- setFragments(fragments);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionConfirmed(context, this);
- }
-
-
- public final boolean hasCommands() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionConfirmed clearCommands() {
- packing_flags &= ~256;
- this.commands = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getCommands() {
- return commands;
- }
-
- public final SessionConfirmed setCommands(RangeSet value) {
- this.commands = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionConfirmed commands(RangeSet value) {
- return setCommands(value);
- }
-
- public final boolean hasFragments() {
- return (packing_flags & 512) != 0;
- }
-
- public final SessionConfirmed clearFragments() {
- packing_flags &= ~512;
- this.fragments = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.List<Object> getFragments() {
- return fragments;
- }
-
- public final SessionConfirmed setFragments(java.util.List<Object> value) {
- this.fragments = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final SessionConfirmed fragments(java.util.List<Object> value) {
- return setFragments(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.commands);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeArray(this.fragments);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.commands = dec.readSequenceSet();
- }
- if ((packing_flags & 512) != 0)
- {
- this.fragments = dec.readArray();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("commands", getCommands());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("fragments", getFragments());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDelegate.java
deleted file mode 100644
index cabff1cd13..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDelegate.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.transport.util.Logger;
-
-
-/**
- * SessionDelegate
- *
- * @author Rafael H. Schloming
- */
-
-public class SessionDelegate
- extends MethodDelegate<Session>
- implements ProtocolDelegate<Session>
-{
- protected static final Logger log = Logger.get(SessionDelegate.class);
-
- public void init(Session ssn, ProtocolHeader hdr)
- {
- log.warn("INIT: [%s] %s", ssn, hdr);
- }
-
- public void control(Session ssn, Method method)
- {
- method.dispatch(ssn, this);
- }
-
- public void command(Session ssn, Method method)
- {
- command(ssn, method, !method.hasPayload());
- }
- public void command(Session ssn, Method method, boolean processed)
- {
- ssn.identify(method);
- method.dispatch(ssn, this);
- if (processed)
- {
- ssn.processed(method);
- }
- }
-
- public void error(Session ssn, ProtocolError error)
- {
- log.warn("ERROR: [%s] %s", ssn, error);
- }
-
- public void handle(Session ssn, Method method)
- {
- log.warn("UNHANDLED: [%s] %s", ssn, method);
- }
-
- @Override public void sessionRequestTimeout(Session ssn, SessionRequestTimeout t)
- {
- if (t.getTimeout() == 0)
- {
- ssn.setClose(true);
- }
- ssn.sessionTimeout(0); // Always report back an expiry of 0 until it is implemented
- }
-
- @Override public void sessionAttached(Session ssn, SessionAttached atc)
- {
- ssn.setState(Session.State.OPEN);
- synchronized (ssn.getStateLock())
- {
- ssn.getStateLock().notifyAll();
- }
- }
-
- @Override public void sessionTimeout(Session ssn, SessionTimeout t)
- {
- // Setting of expiry is not implemented
- }
-
- @Override public void sessionCompleted(Session ssn, SessionCompleted cmp)
- {
- RangeSet ranges = cmp.getCommands();
- RangeSet known = null;
-
- if (ranges != null)
- {
- if(ranges.size() == 1)
- {
- Range range = ranges.getFirst();
- boolean advanced = ssn.complete(range.getLower(), range.getUpper());
-
- if(advanced && cmp.getTimelyReply())
- {
- known = range;
- }
- }
- else
- {
- if (cmp.getTimelyReply())
- {
- known = RangeSetFactory.createRangeSet();
- }
- for (Range range : ranges)
- {
- boolean advanced = ssn.complete(range.getLower(), range.getUpper());
- if (advanced && known != null)
- {
- known.add(range);
- }
- }
- }
- }
- else if (cmp.getTimelyReply())
- {
- known = RangeSetFactory.createRangeSet();
- }
-
- if (known != null)
- {
- ssn.sessionKnownCompleted(known);
- }
- }
-
- @Override public void sessionKnownCompleted(Session ssn, SessionKnownCompleted kcmp)
- {
- RangeSet kc = kcmp.getCommands();
- if (kc != null)
- {
- ssn.knownComplete(kc);
- }
- }
-
- @Override public void sessionFlush(Session ssn, SessionFlush flush)
- {
- if (flush.getCompleted())
- {
- ssn.flushProcessed();
- }
- if (flush.getConfirmed())
- {
- ssn.flushProcessed();
- }
- if (flush.getExpected())
- {
- ssn.flushExpected();
- }
- }
-
- @Override public void sessionCommandPoint(Session ssn, SessionCommandPoint scp)
- {
- ssn.commandPoint(scp.getCommandId());
- }
-
- @Override public void executionSync(Session ssn, ExecutionSync sync)
- {
- ssn.syncPoint();
- }
-
- @Override public void executionResult(Session ssn, ExecutionResult result)
- {
- ssn.result(result.getCommandId(), result.getValue());
- }
-
- @Override public void executionException(Session ssn, ExecutionException exc)
- {
- ssn.setException(exc);
- ssn.getSessionListener().exception(ssn, new SessionException(exc));
- ssn.closed();
- }
-
- @Override public void messageTransfer(Session ssn, MessageTransfer xfr)
- {
- ssn.getSessionListener().message(ssn, xfr);
- }
-
- @Override public void messageSetFlowMode(Session ssn, MessageSetFlowMode sfm)
- {
- if ("".equals(sfm.getDestination()) &&
- MessageFlowMode.CREDIT.equals(sfm.getFlowMode()))
- {
- ssn.setFlowControl(true);
- }
- else
- {
- super.messageSetFlowMode(ssn, sfm);
- }
- }
-
- @Override public void messageFlow(Session ssn, MessageFlow flow)
- {
- if ("".equals(flow.getDestination()) &&
- MessageCreditUnit.MESSAGE.equals(flow.getUnit()))
- {
- ssn.addCredit((int) flow.getValue());
- }
- else
- {
- super.messageFlow(ssn, flow);
- }
- }
-
- @Override public void messageStop(Session ssn, MessageStop stop)
- {
- if ("".equals(stop.getDestination()))
- {
- ssn.drainCredit();
- }
- else
- {
- super.messageStop(ssn, stop);
- }
- }
-
- public void closed(Session session)
- {
- log.debug("CLOSED: [%s]", session);
- synchronized (session.getStateLock())
- {
- session.getStateLock().notifyAll();
- }
- }
-
- public void detached(Session session)
- {
- log.debug("DETACHED: [%s]", session);
- synchronized (session.getStateLock())
- {
- session.getStateLock().notifyAll();
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetach.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetach.java
deleted file mode 100644
index c6f8e9bad4..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetach.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionDetach extends Method {
-
- public static final int TYPE = 515;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L2;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private byte[] name;
-
-
- public SessionDetach() {}
-
-
- public SessionDetach(byte[] name, Option ... _options) {
- if(name != null) {
- setName(name);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionDetach(context, this);
- }
-
-
- public final boolean hasName() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionDetach clearName() {
- packing_flags &= ~256;
- this.name = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getName() {
- return name;
- }
-
- public final SessionDetach setName(byte[] value) {
- this.name = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionDetach name(byte[] value) {
- return setName(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeVbin16(this.name);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.name = dec.readVbin16();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("name", getName());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetachCode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetachCode.java
deleted file mode 100644
index 892f0edc36..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetachCode.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum SessionDetachCode {
-
- NORMAL((short) 0),
- SESSION_BUSY((short) 1),
- TRANSPORT_BUSY((short) 2),
- NOT_ATTACHED((short) 3),
- UNKNOWN_IDS((short) 4);
-
- private final short value;
-
- SessionDetachCode(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static SessionDetachCode get(short value)
- {
- switch (value)
- {
- case (short) 0: return NORMAL;
- case (short) 1: return SESSION_BUSY;
- case (short) 2: return TRANSPORT_BUSY;
- case (short) 3: return NOT_ATTACHED;
- case (short) 4: return UNKNOWN_IDS;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetached.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetached.java
deleted file mode 100644
index d577d7c28a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionDetached.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionDetached extends Method {
-
- public static final int TYPE = 516;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L2;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private byte[] name;
- private SessionDetachCode code;
-
-
- public SessionDetached() {}
-
-
- public SessionDetached(byte[] name, SessionDetachCode code, Option ... _options) {
- if(name != null) {
- setName(name);
- }
- if(code != null) {
- setCode(code);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionDetached(context, this);
- }
-
-
- public final boolean hasName() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionDetached clearName() {
- packing_flags &= ~256;
- this.name = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getName() {
- return name;
- }
-
- public final SessionDetached setName(byte[] value) {
- this.name = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionDetached name(byte[] value) {
- return setName(value);
- }
-
- public final boolean hasCode() {
- return (packing_flags & 512) != 0;
- }
-
- public final SessionDetached clearCode() {
- packing_flags &= ~512;
- this.code = null;
- setDirty(true);
- return this;
- }
-
- public final SessionDetachCode getCode() {
- return code;
- }
-
- public final SessionDetached setCode(SessionDetachCode value) {
- this.code = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final SessionDetached code(SessionDetachCode value) {
- return setCode(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeVbin16(this.name);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeUint8(this.code.getValue());
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.name = dec.readVbin16();
- }
- if ((packing_flags & 512) != 0)
- {
- this.code = SessionDetachCode.get(dec.readUint8());
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("name", getName());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("code", getCode());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionException.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionException.java
deleted file mode 100644
index 6095b892f8..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-/**
- * SessionException
- *
- */
-
-public class SessionException extends TransportException
-{
-
- private ExecutionException exception;
-
- public SessionException(String message, ExecutionException exception, Throwable cause)
- {
- super(message, cause);
- this.exception = exception;
- }
-
- public SessionException(ExecutionException exception)
- {
- this(String.valueOf(exception), exception, null);
- }
-
- public SessionException(String message)
- {
- this(message, null, null);
- }
-
- public ExecutionException getException()
- {
- return exception;
- }
-
- @Override public void rethrow()
- {
- throw new SessionException(getMessage(), exception, this);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionExpected.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionExpected.java
deleted file mode 100644
index 324316f88c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionExpected.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionExpected extends Method {
-
- public static final int TYPE = 520;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet commands;
- private java.util.List<Object> fragments;
-
-
- public SessionExpected() {}
-
-
- public SessionExpected(RangeSet commands, java.util.List<Object> fragments, Option ... _options) {
- if(commands != null) {
- setCommands(commands);
- }
- if(fragments != null) {
- setFragments(fragments);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionExpected(context, this);
- }
-
-
- public final boolean hasCommands() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionExpected clearCommands() {
- packing_flags &= ~256;
- this.commands = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getCommands() {
- return commands;
- }
-
- public final SessionExpected setCommands(RangeSet value) {
- this.commands = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionExpected commands(RangeSet value) {
- return setCommands(value);
- }
-
- public final boolean hasFragments() {
- return (packing_flags & 512) != 0;
- }
-
- public final SessionExpected clearFragments() {
- packing_flags &= ~512;
- this.fragments = null;
- setDirty(true);
- return this;
- }
-
- public final java.util.List<Object> getFragments() {
- return fragments;
- }
-
- public final SessionExpected setFragments(java.util.List<Object> value) {
- this.fragments = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final SessionExpected fragments(java.util.List<Object> value) {
- return setFragments(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.commands);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeArray(this.fragments);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.commands = dec.readSequenceSet();
- }
- if ((packing_flags & 512) != 0)
- {
- this.fragments = dec.readArray();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("commands", getCommands());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("fragments", getFragments());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionFlush.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionFlush.java
deleted file mode 100644
index 193fe9b255..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionFlush.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionFlush extends Method {
-
- public static final int TYPE = 524;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
-
-
- public SessionFlush() {}
-
-
- public SessionFlush(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case EXPECTED: packing_flags |= 256; break;
- case CONFIRMED: packing_flags |= 512; break;
- case COMPLETED: packing_flags |= 1024; break;
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionFlush(context, this);
- }
-
-
- public final boolean hasExpected() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionFlush clearExpected() {
- packing_flags &= ~256;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getExpected() {
- return hasExpected();
- }
-
- public final SessionFlush setExpected(boolean value) {
-
- if (value)
- {
- packing_flags |= 256;
- }
- else
- {
- packing_flags &= ~256;
- }
-
- setDirty(true);
- return this;
- }
-
- public final SessionFlush expected(boolean value) {
- return setExpected(value);
- }
-
- public final boolean hasConfirmed() {
- return (packing_flags & 512) != 0;
- }
-
- public final SessionFlush clearConfirmed() {
- packing_flags &= ~512;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getConfirmed() {
- return hasConfirmed();
- }
-
- public final SessionFlush setConfirmed(boolean value) {
-
- if (value)
- {
- packing_flags |= 512;
- }
- else
- {
- packing_flags &= ~512;
- }
-
- setDirty(true);
- return this;
- }
-
- public final SessionFlush confirmed(boolean value) {
- return setConfirmed(value);
- }
-
- public final boolean hasCompleted() {
- return (packing_flags & 1024) != 0;
- }
-
- public final SessionFlush clearCompleted() {
- packing_flags &= ~1024;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getCompleted() {
- return hasCompleted();
- }
-
- public final SessionFlush setCompleted(boolean value) {
-
- if (value)
- {
- packing_flags |= 1024;
- }
- else
- {
- packing_flags &= ~1024;
- }
-
- setDirty(true);
- return this;
- }
-
- public final SessionFlush completed(boolean value) {
- return setCompleted(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("expected", getExpected());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("confirmed", getConfirmed());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("completed", getCompleted());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionGap.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionGap.java
deleted file mode 100644
index 62cf753df6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionGap.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionGap extends Method {
-
- public static final int TYPE = 525;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet commands;
-
-
- public SessionGap() {}
-
-
- public SessionGap(RangeSet commands, Option ... _options) {
- if(commands != null) {
- setCommands(commands);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionGap(context, this);
- }
-
-
- public final boolean hasCommands() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionGap clearCommands() {
- packing_flags &= ~256;
- this.commands = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getCommands() {
- return commands;
- }
-
- public final SessionGap setCommands(RangeSet value) {
- this.commands = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionGap commands(RangeSet value) {
- return setCommands(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.commands);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.commands = dec.readSequenceSet();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("commands", getCommands());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionHeader.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionHeader.java
deleted file mode 100644
index 9287d594b1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionHeader.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class SessionHeader extends Struct {
-
- public static final int TYPE = -1;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 1;
- }
-
- public final int getPackWidth() {
- return 1;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private byte packing_flags = 0;
-
-
- public SessionHeader() {}
-
-
- public SessionHeader(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: packing_flags |= 1; break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
-
-
-
- public final boolean hasSync() {
- return (packing_flags & 1) != 0;
- }
-
- public final SessionHeader clearSync() {
- packing_flags &= ~1;
-
- setDirty(true);
- return this;
- }
-
- public final boolean getSync() {
- return hasSync();
- }
-
- public final SessionHeader setSync(boolean value) {
-
- if (value)
- {
- packing_flags |= 1;
- }
- else
- {
- packing_flags &= ~1;
- }
-
- setDirty(true);
- return this;
- }
-
- public final SessionHeader sync(boolean value) {
- return setSync(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint8(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (byte) dec.readUint8();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 1) != 0)
- {
- result.put("sync", getSync());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionInvoker.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionInvoker.java
deleted file mode 100644
index 2d5c54d96c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionInvoker.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.Map;
-
-public abstract class SessionInvoker {
-
- final void sessionAttach(byte[] name, Option ... _options) {
- invoke(new SessionAttach(name, _options));
- }
-
- final void sessionAttached(byte[] name, Option ... _options) {
- invoke(new SessionAttached(name, _options));
- }
-
- final void sessionDetach(byte[] name, Option ... _options) {
- invoke(new SessionDetach(name, _options));
- }
-
- final void sessionDetached(byte[] name, SessionDetachCode code, Option ... _options) {
- invoke(new SessionDetached(name, code, _options));
- }
-
- final void sessionRequestTimeout(long timeout, Option ... _options) {
- invoke(new SessionRequestTimeout(timeout, _options));
- }
-
- final void sessionTimeout(long timeout, Option ... _options) {
- invoke(new SessionTimeout(timeout, _options));
- }
-
- final void sessionCommandPoint(int commandId, long commandOffset, Option ... _options) {
- invoke(new SessionCommandPoint(commandId, commandOffset, _options));
- }
-
- final void sessionExpected(RangeSet commands, java.util.List<Object> fragments, Option ... _options) {
- invoke(new SessionExpected(commands, fragments, _options));
- }
-
- final void sessionConfirmed(RangeSet commands, java.util.List<Object> fragments, Option ... _options) {
- invoke(new SessionConfirmed(commands, fragments, _options));
- }
-
- final void sessionCompleted(RangeSet commands, Option ... _options) {
- invoke(new SessionCompleted(commands, _options));
- }
-
- final void sessionKnownCompleted(RangeSet commands, Option ... _options) {
- invoke(new SessionKnownCompleted(commands, _options));
- }
-
- final void sessionFlush(Option ... _options) {
- invoke(new SessionFlush(_options));
- }
-
- final void sessionGap(RangeSet commands, Option ... _options) {
- invoke(new SessionGap(commands, _options));
- }
-
- public final void executionSync(Option ... _options) {
- invoke(new ExecutionSync(_options));
- }
-
- public final void executionResult(int commandId, Struct value, Option ... _options) {
- invoke(new ExecutionResult(commandId, value, _options));
- }
-
- public final void executionException(ExecutionErrorCode errorCode, int commandId, short classCode, short commandCode, short fieldIndex, String description, Map<String,Object> errorInfo, Option ... _options) {
- invoke(new ExecutionException(errorCode, commandId, classCode, commandCode, fieldIndex, description, errorInfo, _options));
- }
-
- public final void messageTransfer(String destination, MessageAcceptMode acceptMode, MessageAcquireMode acquireMode, Header header, java.nio.ByteBuffer body, Option ... _options) {
- invoke(new MessageTransfer(destination, acceptMode, acquireMode, header, body, _options));
- }
-
- public final void messageAccept(RangeSet transfers, Option ... _options) {
- invoke(new MessageAccept(transfers, _options));
- }
-
- public final void messageReject(RangeSet transfers, MessageRejectCode code, String text, Option ... _options) {
- invoke(new MessageReject(transfers, code, text, _options));
- }
-
- public final void messageRelease(RangeSet transfers, Option ... _options) {
- invoke(new MessageRelease(transfers, _options));
- }
-
- public final Future<Acquired> messageAcquire(RangeSet transfers, Option ... _options) {
- return invoke(new MessageAcquire(transfers, _options), Acquired.class);
- }
-
- public final Future<MessageResumeResult> messageResume(String destination, String resumeId, Option ... _options) {
- return invoke(new MessageResume(destination, resumeId, _options), MessageResumeResult.class);
- }
-
- public final void messageSubscribe(String queue, String destination, MessageAcceptMode acceptMode, MessageAcquireMode acquireMode, String resumeId, long resumeTtl, Map<String,Object> arguments, Option ... _options) {
- invoke(new MessageSubscribe(queue, destination, acceptMode, acquireMode, resumeId, resumeTtl, arguments, _options));
- }
-
- public final void messageCancel(String destination, Option ... _options) {
- invoke(new MessageCancel(destination, _options));
- }
-
- public final void messageSetFlowMode(String destination, MessageFlowMode flowMode, Option ... _options) {
- invoke(new MessageSetFlowMode(destination, flowMode, _options));
- }
-
- public final void messageFlow(String destination, MessageCreditUnit unit, long value, Option ... _options) {
- invoke(new MessageFlow(destination, unit, value, _options));
- }
-
- public final void messageFlush(String destination, Option ... _options) {
- invoke(new MessageFlush(destination, _options));
- }
-
- public final void messageStop(String destination, Option ... _options) {
- invoke(new MessageStop(destination, _options));
- }
-
- public final void txSelect(Option ... _options) {
- invoke(new TxSelect(_options));
- }
-
- public final void txCommit(Option ... _options) {
- invoke(new TxCommit(_options));
- }
-
- public final void txRollback(Option ... _options) {
- invoke(new TxRollback(_options));
- }
-
- public final void dtxSelect(Option ... _options) {
- invoke(new DtxSelect(_options));
- }
-
- public final Future<XaResult> dtxStart(Xid xid, Option ... _options) {
- return invoke(new DtxStart(xid, _options), XaResult.class);
- }
-
- public final Future<XaResult> dtxEnd(Xid xid, Option ... _options) {
- return invoke(new DtxEnd(xid, _options), XaResult.class);
- }
-
- public final Future<XaResult> dtxCommit(Xid xid, Option ... _options) {
- return invoke(new DtxCommit(xid, _options), XaResult.class);
- }
-
- public final void dtxForget(Xid xid, Option ... _options) {
- invoke(new DtxForget(xid, _options));
- }
-
- public final Future<GetTimeoutResult> dtxGetTimeout(Xid xid, Option ... _options) {
- return invoke(new DtxGetTimeout(xid, _options), GetTimeoutResult.class);
- }
-
- public final Future<XaResult> dtxPrepare(Xid xid, Option ... _options) {
- return invoke(new DtxPrepare(xid, _options), XaResult.class);
- }
-
- public final Future<RecoverResult> dtxRecover(Option ... _options) {
- return invoke(new DtxRecover(_options), RecoverResult.class);
- }
-
- public final Future<XaResult> dtxRollback(Xid xid, Option ... _options) {
- return invoke(new DtxRollback(xid, _options), XaResult.class);
- }
-
- public final void dtxSetTimeout(Xid xid, long timeout, Option ... _options) {
- invoke(new DtxSetTimeout(xid, timeout, _options));
- }
-
- public final void exchangeDeclare(String exchange, String type, String alternateExchange, Map<String,Object> arguments, Option ... _options) {
- invoke(new ExchangeDeclare(exchange, type, alternateExchange, arguments, _options));
- }
-
- public final void exchangeDelete(String exchange, Option ... _options) {
- invoke(new ExchangeDelete(exchange, _options));
- }
-
- public final Future<ExchangeQueryResult> exchangeQuery(String name, Option ... _options) {
- return invoke(new ExchangeQuery(name, _options), ExchangeQueryResult.class);
- }
-
- public final void exchangeBind(String queue, String exchange, String bindingKey, Map<String,Object> arguments, Option ... _options) {
- invoke(new ExchangeBind(queue, exchange, bindingKey, arguments, _options));
- }
-
- public final void exchangeUnbind(String queue, String exchange, String bindingKey, Option ... _options) {
- invoke(new ExchangeUnbind(queue, exchange, bindingKey, _options));
- }
-
- public final Future<ExchangeBoundResult> exchangeBound(String exchange, String queue, String bindingKey, Map<String,Object> arguments, Option ... _options) {
- return invoke(new ExchangeBound(exchange, queue, bindingKey, arguments, _options), ExchangeBoundResult.class);
- }
-
- public final void queueDeclare(String queue, String alternateExchange, Map<String,Object> arguments, Option ... _options) {
- invoke(new QueueDeclare(queue, alternateExchange, arguments, _options));
- }
-
- public final void queueDelete(String queue, Option ... _options) {
- invoke(new QueueDelete(queue, _options));
- }
-
- public final void queuePurge(String queue, Option ... _options) {
- invoke(new QueuePurge(queue, _options));
- }
-
- public final Future<QueueQueryResult> queueQuery(String queue, Option ... _options) {
- return invoke(new QueueQuery(queue, _options), QueueQueryResult.class);
- }
-
- protected abstract void invoke(Method method);
-
- protected abstract <T> Future<T> invoke(Method method, Class<T> resultClass);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionKnownCompleted.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionKnownCompleted.java
deleted file mode 100644
index 4f78724ee0..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionKnownCompleted.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionKnownCompleted extends Method {
-
- public static final int TYPE = 523;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private RangeSet commands;
-
-
- public SessionKnownCompleted() {}
-
-
- public SessionKnownCompleted(RangeSet commands, Option ... _options) {
- if(commands != null) {
- setCommands(commands);
- }
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionKnownCompleted(context, this);
- }
-
-
- public final boolean hasCommands() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionKnownCompleted clearCommands() {
- packing_flags &= ~256;
- this.commands = null;
- setDirty(true);
- return this;
- }
-
- public final RangeSet getCommands() {
- return commands;
- }
-
- public final SessionKnownCompleted setCommands(RangeSet value) {
- this.commands = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionKnownCompleted commands(RangeSet value) {
- return setCommands(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeSequenceSet(this.commands);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.commands = dec.readSequenceSet();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("commands", getCommands());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionListener.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionListener.java
deleted file mode 100644
index eb650eb9ed..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * SessionListener
- *
- */
-
-public interface SessionListener
-{
-
- void opened(Session session);
-
- void resumed(Session session);
-
- void message(Session ssn, MessageTransfer xfr);
-
- void exception(Session session, SessionException exception);
-
- void closed(Session session);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionRequestTimeout.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionRequestTimeout.java
deleted file mode 100644
index 7608c8e75e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionRequestTimeout.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionRequestTimeout extends Method {
-
- public static final int TYPE = 517;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private long timeout;
-
-
- public SessionRequestTimeout() {}
-
-
- public SessionRequestTimeout(long timeout, Option ... _options) {
- setTimeout(timeout);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionRequestTimeout(context, this);
- }
-
-
- public final boolean hasTimeout() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionRequestTimeout clearTimeout() {
- packing_flags &= ~256;
- this.timeout = 0;
- setDirty(true);
- return this;
- }
-
- public final long getTimeout() {
- return timeout;
- }
-
- public final SessionRequestTimeout setTimeout(long value) {
- this.timeout = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionRequestTimeout timeout(long value) {
- return setTimeout(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint32(this.timeout);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.timeout = dec.readUint32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("timeout", getTimeout());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionTimeout.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionTimeout.java
deleted file mode 100644
index cc5054ab28..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/SessionTimeout.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class SessionTimeout extends Method {
-
- public static final int TYPE = 518;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L3;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private long timeout;
-
-
- public SessionTimeout() {}
-
-
- public SessionTimeout(long timeout, Option ... _options) {
- setTimeout(timeout);
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.sessionTimeout(context, this);
- }
-
-
- public final boolean hasTimeout() {
- return (packing_flags & 256) != 0;
- }
-
- public final SessionTimeout clearTimeout() {
- packing_flags &= ~256;
- this.timeout = 0;
- setDirty(true);
- return this;
- }
-
- public final long getTimeout() {
- return timeout;
- }
-
- public final SessionTimeout setTimeout(long value) {
- this.timeout = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final SessionTimeout timeout(long value) {
- return setTimeout(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint32(this.timeout);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.timeout = dec.readUint32();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("timeout", getTimeout());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/StreamReturnCode.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/StreamReturnCode.java
deleted file mode 100644
index 7a4e8c083b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/StreamReturnCode.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum StreamReturnCode {
-
- CONTENT_TOO_LARGE((int) 311),
- NO_ROUTE((int) 312),
- NO_CONSUMERS((int) 313);
-
- private final int value;
-
- StreamReturnCode(int value)
- {
- this.value = value;
- }
-
- public int getValue()
- {
- return value;
- }
-
- public static StreamReturnCode get(int value)
- {
- switch (value)
- {
- case (int) 311: return CONTENT_TOO_LARGE;
- case (int) 312: return NO_ROUTE;
- case (int) 313: return NO_CONSUMERS;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Struct.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Struct.java
deleted file mode 100644
index 045939e415..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Struct.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encodable;
-import org.apache.qpid.transport.codec.Encoder;
-import org.apache.qpid.transport.util.Functions;
-
-import java.util.Arrays;
-import java.util.Map;
-
-
-/**
- * Struct
- *
- * @author Rafael H. Schloming
- */
-
-public abstract class Struct implements Encodable
-{
-
- public static Struct create(int type)
- {
- return StructFactory.create(type);
- }
-
- private boolean dirty = true;
-
- public boolean isDirty()
- {
- return dirty;
- }
-
- public void setDirty(boolean dirty)
- {
- this.dirty = dirty;
- }
-
- public abstract int getStructType();
-
- public abstract int getSizeWidth();
-
- public abstract int getPackWidth();
-
- public final int getEncodedType()
- {
- int type = getStructType();
- if (type < 0)
- {
- throw new UnsupportedOperationException();
- }
- return type;
- }
-
- private final boolean isBit(Field<?,?> f)
- {
- return f.getType().equals(Boolean.class);
- }
-
- private final boolean packed()
- {
- return getPackWidth() > 0;
- }
-
- private final boolean encoded(Field<?,?> f)
- {
- return !packed() || !isBit(f) && f.has(this);
- }
-
- private final int getFlagWidth()
- {
- return (getFields().size() + 7)/8;
- }
-
- private final int getPaddWidth()
- {
- int pw = getPackWidth() - getFlagWidth();
- assert pw > 0;
- return pw;
- }
-
- private final int getFlagCount()
- {
- return 8*getPackWidth();
- }
-
- private final int getReservedFlagCount()
- {
- return getFlagCount() - getFields().size();
- }
-
- public abstract void read(Decoder dec);
-
- public abstract void write(Encoder enc);
-
- public abstract Map<String,Object> getFields();
-
- public String toString()
- {
- StringBuilder str = new StringBuilder();
- str.append(getClass().getSimpleName());
-
- str.append("(");
- boolean first = true;
- for (Map.Entry<String,Object> me : getFields().entrySet())
- {
- if (first)
- {
- first = false;
- }
- else
- {
- str.append(", ");
- }
- str.append(me.getKey());
- str.append("=");
- str.append(formatValue(me.getValue()));
- }
- str.append(")");
-
- return str.toString();
- }
-
- private Object formatValue(Object value)
- {
- if(value instanceof byte[])
- {
- return Functions.str((byte[])value);
- }
- else if(value instanceof Object[])
- {
- return Arrays.asList((Object[])value);
- }
- return value;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/StructFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/StructFactory.java
deleted file mode 100644
index 4dcd02da9f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/StructFactory.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-class StructFactory {
-
- public static Struct create(int type)
- {
- switch (type)
- {
- case SessionHeader.TYPE:
- return new SessionHeader();
- case SessionCommandFragment.TYPE:
- return new SessionCommandFragment();
- case DeliveryProperties.TYPE:
- return new DeliveryProperties();
- case FragmentProperties.TYPE:
- return new FragmentProperties();
- case ReplyTo.TYPE:
- return new ReplyTo();
- case MessageProperties.TYPE:
- return new MessageProperties();
- case XaResult.TYPE:
- return new XaResult();
- case Xid.TYPE:
- return new Xid();
- case Acquired.TYPE:
- return new Acquired();
- case MessageResumeResult.TYPE:
- return new MessageResumeResult();
- case GetTimeoutResult.TYPE:
- return new GetTimeoutResult();
- case RecoverResult.TYPE:
- return new RecoverResult();
- case ExchangeQueryResult.TYPE:
- return new ExchangeQueryResult();
- case ExchangeBoundResult.TYPE:
- return new ExchangeBoundResult();
- case QueueQueryResult.TYPE:
- return new QueueQueryResult();
- default:
- throw new IllegalArgumentException("type: " + type);
- }
- }
-
- public static Struct createInstruction(int type)
- {
- switch (type)
- {
- case ConnectionStart.TYPE:
- return new ConnectionStart();
- case ConnectionStartOk.TYPE:
- return new ConnectionStartOk();
- case ConnectionSecure.TYPE:
- return new ConnectionSecure();
- case ConnectionSecureOk.TYPE:
- return new ConnectionSecureOk();
- case ConnectionTune.TYPE:
- return new ConnectionTune();
- case ConnectionTuneOk.TYPE:
- return new ConnectionTuneOk();
- case ConnectionOpen.TYPE:
- return new ConnectionOpen();
- case ConnectionOpenOk.TYPE:
- return new ConnectionOpenOk();
- case ConnectionRedirect.TYPE:
- return new ConnectionRedirect();
- case ConnectionHeartbeat.TYPE:
- return new ConnectionHeartbeat();
- case ConnectionClose.TYPE:
- return new ConnectionClose();
- case ConnectionCloseOk.TYPE:
- return new ConnectionCloseOk();
- case SessionAttach.TYPE:
- return new SessionAttach();
- case SessionAttached.TYPE:
- return new SessionAttached();
- case SessionDetach.TYPE:
- return new SessionDetach();
- case SessionDetached.TYPE:
- return new SessionDetached();
- case SessionRequestTimeout.TYPE:
- return new SessionRequestTimeout();
- case SessionTimeout.TYPE:
- return new SessionTimeout();
- case SessionCommandPoint.TYPE:
- return new SessionCommandPoint();
- case SessionExpected.TYPE:
- return new SessionExpected();
- case SessionConfirmed.TYPE:
- return new SessionConfirmed();
- case SessionCompleted.TYPE:
- return new SessionCompleted();
- case SessionKnownCompleted.TYPE:
- return new SessionKnownCompleted();
- case SessionFlush.TYPE:
- return new SessionFlush();
- case SessionGap.TYPE:
- return new SessionGap();
- case ExecutionSync.TYPE:
- return new ExecutionSync();
- case ExecutionResult.TYPE:
- return new ExecutionResult();
- case ExecutionException.TYPE:
- return new ExecutionException();
- case MessageTransfer.TYPE:
- return new MessageTransfer();
- case MessageAccept.TYPE:
- return new MessageAccept();
- case MessageReject.TYPE:
- return new MessageReject();
- case MessageRelease.TYPE:
- return new MessageRelease();
- case MessageAcquire.TYPE:
- return new MessageAcquire();
- case MessageResume.TYPE:
- return new MessageResume();
- case MessageSubscribe.TYPE:
- return new MessageSubscribe();
- case MessageCancel.TYPE:
- return new MessageCancel();
- case MessageSetFlowMode.TYPE:
- return new MessageSetFlowMode();
- case MessageFlow.TYPE:
- return new MessageFlow();
- case MessageFlush.TYPE:
- return new MessageFlush();
- case MessageStop.TYPE:
- return new MessageStop();
- case TxSelect.TYPE:
- return new TxSelect();
- case TxCommit.TYPE:
- return new TxCommit();
- case TxRollback.TYPE:
- return new TxRollback();
- case DtxSelect.TYPE:
- return new DtxSelect();
- case DtxStart.TYPE:
- return new DtxStart();
- case DtxEnd.TYPE:
- return new DtxEnd();
- case DtxCommit.TYPE:
- return new DtxCommit();
- case DtxForget.TYPE:
- return new DtxForget();
- case DtxGetTimeout.TYPE:
- return new DtxGetTimeout();
- case DtxPrepare.TYPE:
- return new DtxPrepare();
- case DtxRecover.TYPE:
- return new DtxRecover();
- case DtxRollback.TYPE:
- return new DtxRollback();
- case DtxSetTimeout.TYPE:
- return new DtxSetTimeout();
- case ExchangeDeclare.TYPE:
- return new ExchangeDeclare();
- case ExchangeDelete.TYPE:
- return new ExchangeDelete();
- case ExchangeQuery.TYPE:
- return new ExchangeQuery();
- case ExchangeBind.TYPE:
- return new ExchangeBind();
- case ExchangeUnbind.TYPE:
- return new ExchangeUnbind();
- case ExchangeBound.TYPE:
- return new ExchangeBound();
- case QueueDeclare.TYPE:
- return new QueueDeclare();
- case QueueDelete.TYPE:
- return new QueueDelete();
- case QueuePurge.TYPE:
- return new QueuePurge();
- case QueueQuery.TYPE:
- return new QueueQuery();
- default:
- throw new IllegalArgumentException("type: " + type);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Track.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Track.java
deleted file mode 100644
index 861a992a83..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Track.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-public enum Track {
-
- CONTROL((short) 0),
- COMMAND((short) 1);
-
- private final short value;
-
- Track(short value)
- {
- this.value = value;
- }
-
- public short getValue()
- {
- return value;
- }
-
- public static Track get(short value)
- {
- switch (value)
- {
- case (short) 0: return CONTROL;
- case (short) 1: return COMMAND;
- default: throw new IllegalArgumentException("no such value: " + value);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/TransportException.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/TransportException.java
deleted file mode 100644
index 0de190dfad..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/TransportException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-
-/**
- * TransportException
- */
-
-public class TransportException extends RuntimeException
-{
-
- public TransportException(String msg)
- {
- super(msg);
- }
-
- public TransportException(String msg, Throwable cause)
- {
- super(msg, cause);
- }
-
- public TransportException(Throwable cause)
- {
- super(cause);
- }
-
- public void rethrow()
- {
- throw new TransportException(getMessage(), this);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/TxCommit.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/TxCommit.java
deleted file mode 100644
index 837aa1e1d4..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/TxCommit.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class TxCommit extends Method {
-
- public static final int TYPE = 1282;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
-
-
-
-
- public TxCommit(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.txCommit(context, this);
- }
-
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/TxRollback.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/TxRollback.java
deleted file mode 100644
index f8b54f2e5c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/TxRollback.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class TxRollback extends Method {
-
- public static final int TYPE = 1283;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
-
-
-
-
- public TxRollback(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.txRollback(context, this);
- }
-
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/TxSelect.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/TxSelect.java
deleted file mode 100644
index 6fd886e94e..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/TxSelect.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-import org.apache.qpid.transport.network.Frame;
-
-
-public final class TxSelect extends Method {
-
- public static final int TYPE = 1281;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 0;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return Frame.L4;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
-
-
-
-
- public TxSelect(Option ... _options) {
-
- for (int i=0; i < _options.length; i++) {
- switch (_options[i]) {
- case SYNC: this.setSync(true); break;
- case BATCH: this.setBatch(true); break;
- case UNRELIABLE: this.setUnreliable(true); break;
- case NONE: break;
- default: throw new IllegalArgumentException("invalid option: " + _options[i]);
- }
- }
-
- }
-
- public <C> void dispatch(C context, MethodDelegate<C> delegate) {
- delegate.txSelect(context, this);
- }
-
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Type.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Type.java
deleted file mode 100644
index 05904f2995..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Type.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-
-
-public enum Type
-{
-
- BIN8((byte) 0x00, 1, true),
- INT8((byte) 0x01, 1, true),
- UINT8((byte) 0x02, 1, true),
- CHAR((byte) 0x04, 1, true),
- BOOLEAN((byte) 0x08, 1, true),
- BIN16((byte) 0x10, 2, true),
- INT16((byte) 0x11, 2, true),
- UINT16((byte) 0x12, 2, true),
- BIN32((byte) 0x20, 4, true),
- INT32((byte) 0x21, 4, true),
- UINT32((byte) 0x22, 4, true),
- FLOAT((byte) 0x23, 4, true),
- CHAR_UTF32((byte) 0x27, 4, true),
- BIN64((byte) 0x30, 8, true),
- INT64((byte) 0x31, 8, true),
- UINT64((byte) 0x32, 8, true),
- DOUBLE((byte) 0x33, 8, true),
- DATETIME((byte) 0x38, 8, true),
- BIN128((byte) 0x40, 16, true),
- UUID((byte) 0x48, 16, true),
- BIN256((byte) 0x50, 32, true),
- BIN512((byte) 0x60, 64, true),
- BIN1024((byte) 0x70, 128, true),
- VBIN8((byte) 0x80, 1, false),
- STR8_LATIN((byte) 0x84, 1, false),
- STR8((byte) 0x85, 1, false),
- STR8_UTF16((byte) 0x86, 1, false),
- VBIN16((byte) 0x90, 2, false),
- STR16_LATIN((byte) 0x94, 2, false),
- STR16((byte) 0x95, 2, false),
- STR16_UTF16((byte) 0x96, 2, false),
- VBIN32((byte) 0xa0, 4, false),
- MAP((byte) 0xa8, 4, false),
- LIST((byte) 0xa9, 4, false),
- ARRAY((byte) 0xaa, 4, false),
- STRUCT32((byte) 0xab, 4, false),
- BIN40((byte) 0xc0, 5, true),
- DEC32((byte) 0xc8, 5, true),
- BIN72((byte) 0xd0, 9, true),
- DEC64((byte) 0xd8, 9, true),
- VOID((byte) 0xf0, 0, true),
- BIT((byte) 0xf1, 0, true);
-
- private final byte code;
- private final int width;
- private final boolean fixed;
-
- Type(byte code, int width, boolean fixed)
- {
- this.code = code;
- this.width = width;
- this.fixed = fixed;
- }
-
- public byte getCode()
- {
- return code;
- }
-
- public int getWidth()
- {
- return width;
- }
-
- public boolean isFixed()
- {
- return fixed;
- }
-
- public static Type get(byte code)
- {
- switch (code)
- {
- case (byte) 0x00: return BIN8;
- case (byte) 0x01: return INT8;
- case (byte) 0x02: return UINT8;
- case (byte) 0x04: return CHAR;
- case (byte) 0x08: return BOOLEAN;
- case (byte) 0x10: return BIN16;
- case (byte) 0x11: return INT16;
- case (byte) 0x12: return UINT16;
- case (byte) 0x20: return BIN32;
- case (byte) 0x21: return INT32;
- case (byte) 0x22: return UINT32;
- case (byte) 0x23: return FLOAT;
- case (byte) 0x27: return CHAR_UTF32;
- case (byte) 0x30: return BIN64;
- case (byte) 0x31: return INT64;
- case (byte) 0x32: return UINT64;
- case (byte) 0x33: return DOUBLE;
- case (byte) 0x38: return DATETIME;
- case (byte) 0x40: return BIN128;
- case (byte) 0x48: return UUID;
- case (byte) 0x50: return BIN256;
- case (byte) 0x60: return BIN512;
- case (byte) 0x70: return BIN1024;
- case (byte) 0x80: return VBIN8;
- case (byte) 0x84: return STR8_LATIN;
- case (byte) 0x85: return STR8;
- case (byte) 0x86: return STR8_UTF16;
- case (byte) 0x90: return VBIN16;
- case (byte) 0x94: return STR16_LATIN;
- case (byte) 0x95: return STR16;
- case (byte) 0x96: return STR16_UTF16;
- case (byte) 0xa0: return VBIN32;
- case (byte) 0xa8: return MAP;
- case (byte) 0xa9: return LIST;
- case (byte) 0xaa: return ARRAY;
- case (byte) 0xab: return STRUCT32;
- case (byte) 0xc0: return BIN40;
- case (byte) 0xc8: return DEC32;
- case (byte) 0xd0: return BIN72;
- case (byte) 0xd8: return DEC64;
- case (byte) 0xf0: return VOID;
- case (byte) 0xf1: return BIT;
-
- default: return null;
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/XaResult.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/XaResult.java
deleted file mode 100644
index c9d502f7ea..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/XaResult.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class XaResult extends Struct {
-
- public static final int TYPE = 1537;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private DtxXaStatus status;
-
-
- public XaResult() {}
-
-
- public XaResult(DtxXaStatus status) {
- if(status != null) {
- setStatus(status);
- }
-
- }
-
-
-
-
- public final boolean hasStatus() {
- return (packing_flags & 256) != 0;
- }
-
- public final XaResult clearStatus() {
- packing_flags &= ~256;
- this.status = null;
- setDirty(true);
- return this;
- }
-
- public final DtxXaStatus getStatus() {
- return status;
- }
-
- public final XaResult setStatus(DtxXaStatus value) {
- this.status = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final XaResult status(DtxXaStatus value) {
- return setStatus(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint16(this.status.getValue());
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.status = DtxXaStatus.get(dec.readUint16());
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("status", getStatus());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Xid.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Xid.java
deleted file mode 100644
index 4e142079af..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Xid.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.apache.qpid.transport;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.qpid.transport.codec.Decoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-
-
-public final class Xid extends Struct {
-
- public static final int TYPE = 1540;
-
- public final int getStructType() {
- return TYPE;
- }
-
- public final int getSizeWidth() {
- return 4;
- }
-
- public final int getPackWidth() {
- return 2;
- }
-
- public final boolean hasPayload() {
- return false;
- }
-
- public final byte getEncodedTrack() {
- return -1;
- }
-
- public final boolean isConnectionControl()
- {
- return false;
- }
-
- private short packing_flags = 0;
- private long format;
- private byte[] globalId;
- private byte[] branchId;
-
-
- public Xid() {}
-
-
- public Xid(long format, byte[] globalId, byte[] branchId) {
- setFormat(format);
- if(globalId != null) {
- setGlobalId(globalId);
- }
- if(branchId != null) {
- setBranchId(branchId);
- }
-
- }
-
-
-
-
- public final boolean hasFormat() {
- return (packing_flags & 256) != 0;
- }
-
- public final Xid clearFormat() {
- packing_flags &= ~256;
- this.format = 0;
- setDirty(true);
- return this;
- }
-
- public final long getFormat() {
- return format;
- }
-
- public final Xid setFormat(long value) {
- this.format = value;
- packing_flags |= 256;
- setDirty(true);
- return this;
- }
-
- public final Xid format(long value) {
- return setFormat(value);
- }
-
- public final boolean hasGlobalId() {
- return (packing_flags & 512) != 0;
- }
-
- public final Xid clearGlobalId() {
- packing_flags &= ~512;
- this.globalId = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getGlobalId() {
- return globalId;
- }
-
- public final Xid setGlobalId(byte[] value) {
- this.globalId = value;
- packing_flags |= 512;
- setDirty(true);
- return this;
- }
-
- public final Xid globalId(byte[] value) {
- return setGlobalId(value);
- }
-
- public final boolean hasBranchId() {
- return (packing_flags & 1024) != 0;
- }
-
- public final Xid clearBranchId() {
- packing_flags &= ~1024;
- this.branchId = null;
- setDirty(true);
- return this;
- }
-
- public final byte[] getBranchId() {
- return branchId;
- }
-
- public final Xid setBranchId(byte[] value) {
- this.branchId = value;
- packing_flags |= 1024;
- setDirty(true);
- return this;
- }
-
- public final Xid branchId(byte[] value) {
- return setBranchId(value);
- }
-
-
-
-
- public void write(Encoder enc)
- {
- enc.writeUint16(packing_flags);
- if ((packing_flags & 256) != 0)
- {
- enc.writeUint32(this.format);
- }
- if ((packing_flags & 512) != 0)
- {
- enc.writeVbin8(this.globalId);
- }
- if ((packing_flags & 1024) != 0)
- {
- enc.writeVbin8(this.branchId);
- }
-
- }
-
- public void read(Decoder dec)
- {
- packing_flags = (short) dec.readUint16();
- if ((packing_flags & 256) != 0)
- {
- this.format = dec.readUint32();
- }
- if ((packing_flags & 512) != 0)
- {
- this.globalId = dec.readVbin8();
- }
- if ((packing_flags & 1024) != 0)
- {
- this.branchId = dec.readVbin8();
- }
-
- }
-
- public Map<String,Object> getFields()
- {
- Map<String,Object> result = new LinkedHashMap<String,Object>();
-
- if ((packing_flags & 256) != 0)
- {
- result.put("format", getFormat());
- }
- if ((packing_flags & 512) != 0)
- {
- result.put("globalId", getGlobalId());
- }
- if ((packing_flags & 1024) != 0)
- {
- result.put("branchId", getBranchId());
- }
-
-
- return result;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java
deleted file mode 100644
index 27fce6e167..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-import org.apache.qpid.transport.Binary;
-import org.apache.qpid.transport.Range;
-import org.apache.qpid.transport.RangeSet;
-import org.apache.qpid.transport.RangeSetFactory;
-import org.apache.qpid.transport.Struct;
-import org.apache.qpid.transport.Type;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-
-/**
- * AbstractDecoder
- *
- * @author Rafael H. Schloming
- */
-
-abstract class AbstractDecoder implements Decoder
-{
-
- private final Map<Binary,String> str8cache = new LinkedHashMap<Binary,String>()
- {
- @Override protected boolean removeEldestEntry(Map.Entry<Binary,String> me)
- {
- return size() > 4*1024;
- }
- };
-
- protected abstract byte doGet();
-
- protected abstract void doGet(byte[] bytes);
-
- protected byte get()
- {
- return doGet();
- }
-
- protected void get(byte[] bytes)
- {
- doGet(bytes);
- }
-
- protected Binary get(int size)
- {
- byte[] bytes = new byte[size];
- get(bytes);
- return new Binary(bytes);
- }
-
- protected short uget()
- {
- return (short) (0xFF & get());
- }
-
- public short readUint8()
- {
- return uget();
- }
-
- public int readUint16()
- {
- int i = uget() << 8;
- i |= uget();
- return i;
- }
-
- public long readUint32()
- {
- long l = uget() << 24;
- l |= uget() << 16;
- l |= uget() << 8;
- l |= uget();
- return l;
- }
-
- public int readSequenceNo()
- {
- return (int) readUint32();
- }
-
- public long readUint64()
- {
- long l = 0;
- for (int i = 0; i < 8; i++)
- {
- l |= ((long) (0xFF & get())) << (56 - i*8);
- }
- return l;
- }
-
- public long readDatetime()
- {
- return readUint64();
- }
-
- private static final String decode(byte[] bytes, int offset, int length, String charset)
- {
- try
- {
- return new String(bytes, offset, length, charset);
- }
- catch (UnsupportedEncodingException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private static final String decode(byte[] bytes, String charset)
- {
- return decode(bytes, 0, bytes.length, charset);
- }
-
- public String readStr8()
- {
- short size = readUint8();
- Binary bin = get(size);
- String str = str8cache.get(bin);
-
- if (str == null)
- {
- str = decode(bin.array(), bin.offset(), bin.size(), "UTF-8");
- if(bin.hasExcessCapacity())
- {
- str8cache.put(bin.copy(), str);
- }
- else
- {
- str8cache.put(bin, str);
- }
- }
- return str;
- }
-
- public String readStr16()
- {
- int size = readUint16();
- byte[] bytes = new byte[size];
- get(bytes);
- return decode(bytes, "UTF-8");
- }
-
- public byte[] readVbin8()
- {
- int size = readUint8();
- byte[] bytes = new byte[size];
- get(bytes);
- return bytes;
- }
-
- public byte[] readVbin16()
- {
- int size = readUint16();
- byte[] bytes = new byte[size];
- get(bytes);
- return bytes;
- }
-
- public byte[] readVbin32()
- {
- int size = (int) readUint32();
- byte[] bytes = new byte[size];
- get(bytes);
- return bytes;
- }
-
- public RangeSet readSequenceSet()
- {
- int count = readUint16()/8;
- switch(count)
- {
- case 0:
- return null;
- case 1:
- return Range.newInstance(readSequenceNo(), readSequenceNo());
- default:
- RangeSet ranges = RangeSetFactory.createRangeSet(count);
- for (int i = 0; i < count; i++)
- {
- ranges.add(readSequenceNo(), readSequenceNo());
- }
- return ranges;
- }
- }
-
- public RangeSet readByteRanges()
- {
- throw new Error("not implemented");
- }
-
- public UUID readUuid()
- {
- long msb = readUint64();
- long lsb = readUint64();
- return new UUID(msb, lsb);
- }
-
- public String readContent()
- {
- throw new Error("Deprecated");
- }
-
- public Struct readStruct(int type)
- {
- Struct st = Struct.create(type);
- int width = st.getSizeWidth();
- if (width > 0)
- {
- long size = readSize(width);
- if (size == 0)
- {
- return null;
- }
- }
- if (type > 0)
- {
- int code = readUint16();
- assert code == type;
- }
- st.read(this);
- return st;
- }
-
- public Struct readStruct32()
- {
- long size = readUint32();
- if (size == 0)
- {
- return null;
- }
- else
- {
- int type = readUint16();
- Struct result = Struct.create(type);
- result.read(this);
- return result;
- }
- }
-
- public Map<String,Object> readMap()
- {
- long size = readUint32();
-
- if (size == 0)
- {
- return null;
- }
-
- long count = readUint32();
-
- if (count == 0)
- {
- return Collections.EMPTY_MAP;
- }
-
- Map<String,Object> result = new LinkedHashMap();
- for (int i = 0; i < count; i++)
- {
- String key = readStr8();
- byte code = get();
- Type t = getType(code);
- Object value = read(t);
- result.put(key, value);
- }
-
- return result;
- }
-
- public List<Object> readList()
- {
- long size = readUint32();
-
- if (size == 0)
- {
- return null;
- }
-
- long count = readUint32();
-
- if (count == 0)
- {
- return Collections.EMPTY_LIST;
- }
-
- List<Object> result = new ArrayList();
- for (int i = 0; i < count; i++)
- {
- byte code = get();
- Type t = getType(code);
- Object value = read(t);
- result.add(value);
- }
- return result;
- }
-
- public List<Object> readArray()
- {
- long size = readUint32();
-
- if (size == 0)
- {
- return null;
- }
-
- byte code = get();
- Type t = getType(code);
- long count = readUint32();
-
- if (count == 0)
- {
- return Collections.EMPTY_LIST;
- }
-
- List<Object> result = new ArrayList<Object>();
- for (int i = 0; i < count; i++)
- {
- Object value = read(t);
- result.add(value);
- }
- return result;
- }
-
- private Type getType(byte code)
- {
- Type type = Type.get(code);
- if (type == null)
- {
- throw new IllegalArgumentException("unknown code: " + code);
- }
- else
- {
- return type;
- }
- }
-
- private long readSize(Type t)
- {
- if (t.isFixed())
- {
- return t.getWidth();
- }
- else
- {
- return readSize(t.getWidth());
- }
- }
-
- private long readSize(int width)
- {
- switch (width)
- {
- case 1:
- return readUint8();
- case 2:
- return readUint16();
- case 4:
- return readUint32();
- default:
- throw new IllegalStateException("illegal width: " + width);
- }
- }
-
- private byte[] readBytes(Type t)
- {
- long size = readSize(t);
- byte[] result = new byte[(int) size];
- get(result);
- return result;
- }
-
- private Object read(Type t)
- {
- switch (t)
- {
- case BIN8:
- case UINT8:
- return readUint8();
- case INT8:
- return get();
- case CHAR:
- return (char) get();
- case BOOLEAN:
- return get() > 0;
-
- case BIN16:
- case UINT16:
- return readUint16();
-
- case INT16:
- return (short) readUint16();
-
- case BIN32:
- case UINT32:
- return readUint32();
-
- case CHAR_UTF32:
- case INT32:
- return (int) readUint32();
-
- case FLOAT:
- return Float.intBitsToFloat((int) readUint32());
-
- case BIN64:
- case UINT64:
- case INT64:
- case DATETIME:
- return readUint64();
-
- case DOUBLE:
- return Double.longBitsToDouble(readUint64());
-
- case UUID:
- return readUuid();
-
- case STR8:
- return readStr8();
-
- case STR16:
- return readStr16();
-
- case STR8_LATIN:
- case STR8_UTF16:
- case STR16_LATIN:
- case STR16_UTF16:
- // XXX: need to do character conversion
- return new String(readBytes(t));
-
- case MAP:
- return readMap();
- case LIST:
- return readList();
- case ARRAY:
- return readArray();
- case STRUCT32:
- return readStruct32();
-
- case BIN40:
- case DEC32:
- case BIN72:
- case DEC64:
- // XXX: what types are we supposed to use here?
- return readBytes(t);
-
- case VOID:
- return null;
-
- default:
- return readBytes(t);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractEncoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractEncoder.java
deleted file mode 100644
index 070621db9b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractEncoder.java
+++ /dev/null
@@ -1,620 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-import static org.apache.qpid.transport.util.Functions.lsb;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.qpid.transport.Range;
-import org.apache.qpid.transport.RangeSet;
-import org.apache.qpid.transport.Struct;
-import org.apache.qpid.transport.Type;
-import org.apache.qpid.transport.Xid;
-
-
-/**
- * AbstractEncoder
- *
- * @author Rafael H. Schloming
- */
-
-public abstract class AbstractEncoder implements Encoder
-{
-
- private static Map<Class<?>,Type> ENCODINGS = new HashMap<Class<?>,Type>();
- static
- {
- ENCODINGS.put(Boolean.class, Type.BOOLEAN);
- ENCODINGS.put(String.class, Type.STR16);
- ENCODINGS.put(Long.class, Type.INT64);
- ENCODINGS.put(Integer.class, Type.INT32);
- ENCODINGS.put(Short.class, Type.INT16);
- ENCODINGS.put(Byte.class, Type.INT8);
- ENCODINGS.put(Map.class, Type.MAP);
- ENCODINGS.put(List.class, Type.LIST);
- ENCODINGS.put(Float.class, Type.FLOAT);
- ENCODINGS.put(Double.class, Type.DOUBLE);
- ENCODINGS.put(Character.class, Type.CHAR);
- ENCODINGS.put(byte[].class, Type.VBIN32);
- ENCODINGS.put(UUID.class, Type.UUID);
- ENCODINGS.put(Xid.class, Type.STRUCT32);
- }
-
- private final Map<String,byte[]> str8cache = new LinkedHashMap<String,byte[]>()
- {
- @Override protected boolean removeEldestEntry(Map.Entry<String,byte[]> me)
- {
- return size() > 4*1024;
- }
- };
-
- protected abstract void doPut(byte b);
-
- protected abstract void doPut(ByteBuffer src);
-
- protected void put(byte b)
- {
- doPut(b);
- }
-
- protected void put(ByteBuffer src)
- {
- doPut(src);
- }
-
- protected void put(byte[] bytes)
- {
- put(ByteBuffer.wrap(bytes));
- }
-
- protected abstract int beginSize8();
- protected abstract void endSize8(int pos);
-
- protected abstract int beginSize16();
- protected abstract void endSize16(int pos);
-
- protected abstract int beginSize32();
- protected abstract void endSize32(int pos);
-
- public void writeUint8(short b)
- {
- assert b < 0x100;
-
- put((byte) b);
- }
-
- public void writeUint16(int s)
- {
- assert s < 0x10000;
-
- put(lsb(s >>> 8));
- put(lsb(s));
- }
-
- public void writeUint32(long i)
- {
- assert i < 0x100000000L;
-
- put(lsb(i >>> 24));
- put(lsb(i >>> 16));
- put(lsb(i >>> 8));
- put(lsb(i));
- }
-
- public void writeSequenceNo(int i)
- {
- writeUint32(i);
- }
-
- public void writeUint64(long l)
- {
- for (int i = 0; i < 8; i++)
- {
- put(lsb(l >> (56 - i*8)));
- }
- }
-
-
- public void writeDatetime(long l)
- {
- writeUint64(l);
- }
-
- private static final byte[] encode(String s, String charset)
- {
- try
- {
- return s.getBytes(charset);
- }
- catch (UnsupportedEncodingException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public void writeStr8(String s)
- {
- if (s == null)
- {
- s = "";
- }
-
- byte[] bytes = str8cache.get(s);
- if (bytes == null)
- {
- bytes = encode(s, "UTF-8");
- str8cache.put(s, bytes);
- }
- writeUint8((short) bytes.length);
- put(bytes);
- }
-
- public void writeStr16(String s)
- {
- if (s == null)
- {
- s = "";
- }
-
- byte[] bytes = encode(s, "UTF-8");
- writeUint16(bytes.length);
- put(bytes);
- }
-
- public void writeVbin8(byte[] bytes)
- {
- if (bytes == null) { bytes = new byte[0]; }
- if (bytes.length > 255)
- {
- throw new IllegalArgumentException("array too long: " + bytes.length);
- }
- writeUint8((short) bytes.length);
- put(ByteBuffer.wrap(bytes));
- }
-
- public void writeVbin16(byte[] bytes)
- {
- if (bytes == null) { bytes = new byte[0]; }
- writeUint16(bytes.length);
- put(ByteBuffer.wrap(bytes));
- }
-
- public void writeVbin32(byte[] bytes)
- {
- if (bytes == null) { bytes = new byte[0]; }
- writeUint32(bytes.length);
- put(ByteBuffer.wrap(bytes));
- }
-
- public void writeSequenceSet(RangeSet ranges)
- {
- if (ranges == null)
- {
- writeUint16((short) 0);
- }
- else
- {
- writeUint16(ranges.size() * 8);
- for (Range range : ranges)
- {
- writeSequenceNo(range.getLower());
- writeSequenceNo(range.getUpper());
- }
- }
- }
-
- public void writeByteRanges(RangeSet ranges)
- {
- throw new Error("not implemented");
- }
-
- public void writeUuid(UUID uuid)
- {
- long msb = 0;
- long lsb = 0;
- if (uuid != null)
- {
- msb = uuid.getMostSignificantBits();
- lsb = uuid.getLeastSignificantBits();
- }
- writeUint64(msb);
- writeUint64(lsb);
- }
-
- public void writeStruct(int type, Struct s)
- {
- boolean empty = false;
- if (s == null)
- {
- s = Struct.create(type);
- empty = true;
- }
-
- int width = s.getSizeWidth();
- int pos = -1;
- if (width > 0)
- {
- pos = beginSize(width);
- }
-
- if (type > 0)
- {
- writeUint16(type);
- }
-
- s.write(this);
-
- if (width > 0)
- {
- endSize(width, pos);
- }
- }
-
- public void writeStruct32(Struct s)
- {
- if (s == null)
- {
- writeUint32(0);
- }
- else
- {
- int pos = beginSize32();
- writeUint16(s.getEncodedType());
- s.write(this);
- endSize32(pos);
- }
- }
-
- private Type encoding(Object value)
- {
- if (value == null)
- {
- return Type.VOID;
- }
-
- Class klass = value.getClass();
- Type type = resolve(klass);
-
- if (type == null)
- {
- throw new IllegalArgumentException
- ("unable to resolve type: " + klass + ", " + value);
- }
- else
- {
- return type;
- }
- }
-
- static final Type resolve(Class klass)
- {
- Type type = ENCODINGS.get(klass);
- if (type != null)
- {
- return type;
- }
-
- Class sup = klass.getSuperclass();
- if (sup != null)
- {
- type = resolve(klass.getSuperclass());
-
- if (type != null)
- {
- return type;
- }
- }
-
- for (Class iface : klass.getInterfaces())
- {
- type = resolve(iface);
- if (type != null)
- {
- return type;
- }
- }
-
- return null;
- }
-
- public void writeMap(Map<String,Object> map)
- {
- int pos = beginSize32();
- if (map != null)
- {
- writeUint32(map.size());
- writeMapEntries(map);
- }
- endSize32(pos);
- }
-
- protected void writeMapEntries(Map<String,Object> map)
- {
- for (Map.Entry<String,Object> entry : map.entrySet())
- {
- String key = entry.getKey();
- Object value = entry.getValue();
- Type type = encoding(value);
- writeStr8(key);
- put(type.getCode());
- write(type, value);
- }
- }
-
- public void writeList(List<Object> list)
- {
- int pos = beginSize32();
- if (list != null)
- {
- writeUint32(list.size());
- writeListEntries(list);
- }
- endSize32(pos);
- }
-
- protected void writeListEntries(List<Object> list)
- {
- for (Object value : list)
- {
- Type type = encoding(value);
- put(type.getCode());
- write(type, value);
- }
- }
-
- public void writeArray(List<Object> array)
- {
- int pos = beginSize32();
- if (array != null)
- {
- writeArrayEntries(array);
- }
- endSize32(pos);
- }
-
- protected void writeArrayEntries(List<Object> array)
- {
- Type type;
-
- if (array.isEmpty())
- {
- return;
- }
- else
- {
- type = encoding(array.get(0));
- }
-
- put(type.getCode());
-
- writeUint32(array.size());
-
- for (Object value : array)
- {
- write(type, value);
- }
- }
-
- private void writeSize(Type t, int size)
- {
- if (t.isFixed())
- {
- if (size != t.getWidth())
- {
- throw new IllegalArgumentException
- ("size does not match fixed width " + t.getWidth() + ": " +
- size);
- }
- }
- else
- {
- writeSize(t.getWidth(), size);
- }
- }
-
- private void writeSize(int width, int size)
- {
- // XXX: should check lengths
- switch (width)
- {
- case 1:
- writeUint8((short) size);
- break;
- case 2:
- writeUint16(size);
- break;
- case 4:
- writeUint32(size);
- break;
- default:
- throw new IllegalStateException("illegal width: " + width);
- }
- }
-
- private int beginSize(int width)
- {
- switch (width)
- {
- case 1:
- return beginSize8();
- case 2:
- return beginSize16();
- case 4:
- return beginSize32();
- default:
- throw new IllegalStateException("illegal width: " + width);
- }
- }
-
- private void endSize(int width, int pos)
- {
- switch (width)
- {
- case 1:
- endSize8(pos);
- break;
- case 2:
- endSize16(pos);
- break;
- case 4:
- endSize32(pos);
- break;
- default:
- throw new IllegalStateException("illegal width: " + width);
- }
- }
-
- private void writeBytes(Type t, byte[] bytes)
- {
- writeSize(t, bytes.length);
- put(bytes);
- }
-
- private <T> T coerce(Class<T> klass, Object value)
- {
- if (klass.isInstance(value))
- {
- return klass.cast(value);
- }
- else
- {
- throw new IllegalArgumentException("" + value);
- }
- }
-
- private void write(Type t, Object value)
- {
- switch (t)
- {
- case BIN8:
- case UINT8:
- writeUint8(coerce(Short.class, value));
- break;
- case INT8:
- put(coerce(Byte.class, value));
- break;
- case CHAR:
- put((byte) ((char)coerce(Character.class, value)));
- break;
- case BOOLEAN:
- if (coerce(Boolean.class, value))
- {
- put((byte) 1);
- }
- else
- {
- put((byte) 0);
- }
- break;
-
- case BIN16:
- case UINT16:
- writeUint16(coerce(Integer.class, value));
- break;
-
- case INT16:
- writeUint16(coerce(Short.class, value));
- break;
-
- case BIN32:
- case UINT32:
- writeUint32(coerce(Long.class, value));
- break;
-
- case CHAR_UTF32:
- case INT32:
- writeUint32(coerce(Integer.class, value));
- break;
-
- case FLOAT:
- writeUint32(Float.floatToIntBits(coerce(Float.class, value)));
- break;
-
- case BIN64:
- case UINT64:
- case INT64:
- case DATETIME:
- writeUint64(coerce(Long.class, value));
- break;
-
- case DOUBLE:
- long bits = Double.doubleToLongBits(coerce(Double.class, value));
- writeUint64(bits);
- break;
-
- case UUID:
- writeUuid(coerce(UUID.class, value));
- break;
-
- case STR8:
- writeStr8(coerce(String.class, value));
- break;
-
- case STR16:
- writeStr16(coerce(String.class, value));
- break;
-
- case STR8_LATIN:
- case STR8_UTF16:
- case STR16_LATIN:
- case STR16_UTF16:
- // XXX: need to do character conversion
- writeBytes(t, coerce(String.class, value).getBytes());
- break;
-
- case MAP:
- writeMap((Map<String,Object>) coerce(Map.class, value));
- break;
- case LIST:
- writeList(coerce(List.class, value));
- break;
- case ARRAY:
- writeArray(coerce(List.class, value));
- break;
- case STRUCT32:
- writeStruct32(coerce(Struct.class, value));
- break;
-
- case BIN40:
- case DEC32:
- case BIN72:
- case DEC64:
- // XXX: what types are we supposed to use here?
- writeBytes(t, coerce(byte[].class, value));
- break;
-
- case VOID:
- break;
-
- default:
- writeBytes(t, coerce(byte[].class, value));
- break;
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java
deleted file mode 100644
index a8ac44200f..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-import org.apache.qpid.transport.Binary;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Byte Buffer Decoder.
- * Decoder concrete implementor using a backing byte buffer for decoding data.
- *
- * @author Rafael H. Schloming
- */
-public final class BBDecoder extends AbstractDecoder
-{
- private ByteBuffer in;
-
- public void init(ByteBuffer in)
- {
- this.in = in;
- this.in.order(ByteOrder.BIG_ENDIAN);
- }
-
- public void releaseBuffer()
- {
- in = null;
- }
-
- protected byte doGet()
- {
- return in.get();
- }
-
- protected void doGet(byte[] bytes)
- {
- in.get(bytes);
- }
-
- protected Binary get(int size)
- {
- if (in.hasArray())
- {
- byte[] bytes = in.array();
- Binary bin = new Binary(bytes, in.arrayOffset() + in.position(), size);
- in.position(in.position() + size);
- return bin;
- }
- else
- {
- return super.get(size);
- }
- }
-
- public boolean hasRemaining()
- {
- return in.hasRemaining();
- }
-
- public short readUint8()
- {
- return (short) (0xFF & in.get());
- }
-
- public int readUint16()
- {
- return 0xFFFF & in.getShort();
- }
-
- public long readUint32()
- {
- return 0xFFFFFFFFL & in.getInt();
- }
-
- public long readUint64()
- {
- return in.getLong();
- }
-
- public byte[] readBin128()
- {
- byte[] result = new byte[16];
- get(result);
- return result;
- }
-
- public byte[] readBytes(int howManyBytes)
- {
- byte[] result = new byte[howManyBytes];
- get(result);
- return result;
- }
-
- public double readDouble()
- {
- return in.getDouble();
- }
-
- public float readFloat()
- {
- return in.getFloat();
- }
-
- public short readInt16()
- {
- return in.getShort();
- }
-
- public int readInt32()
- {
- return in.getInt();
- }
-
- public byte readInt8()
- {
- return in.get();
- }
-
- public byte[] readReaminingBytes()
- {
- byte[] result = new byte[in.limit() - in.position()];
- get(result);
- return result;
- }
-
- public long readInt64()
- {
- return in.getLong();
- }
-} \ No newline at end of file
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java
deleted file mode 100644
index 407df71824..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-import java.nio.BufferOverflowException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.UUID;
-
-
-/**
- * Byte Buffer Encoder.
- * Encoder concrete implementor using a backing byte buffer for encoding data.
- *
- * @author Rafael H. Schloming
- */
-public final class BBEncoder extends AbstractEncoder
-{
- private ByteBuffer out;
- private int segment;
-
- public BBEncoder(int capacity) {
- out = ByteBuffer.allocate(capacity);
- out.order(ByteOrder.BIG_ENDIAN);
- segment = 0;
- }
-
- public void init()
- {
- out.clear();
- segment = 0;
- }
-
- public ByteBuffer segment()
- {
- int pos = out.position();
- out.position(segment);
- ByteBuffer slice = out.slice();
- slice.limit(pos - segment);
- out.position(pos);
- segment = pos;
- return slice;
- }
-
- public ByteBuffer buffer()
- {
- int pos = out.position();
- out.position(segment);
- ByteBuffer slice = out.slice();
- slice.limit(pos - segment);
- out.position(pos);
- return slice;
- }
-
- public int position()
- {
- return out.position();
- }
-
- public ByteBuffer underlyingBuffer()
- {
- return out;
- }
-
- private void grow(int size)
- {
- ByteBuffer old = out;
- int capacity = old.capacity();
- out = ByteBuffer.allocate(Math.max(capacity + size, 2*capacity));
- out.order(ByteOrder.BIG_ENDIAN);
- old.flip();
- out.put(old);
- }
-
- protected void doPut(byte b)
- {
- try
- {
- out.put(b);
- }
- catch (BufferOverflowException e)
- {
- grow(1);
- out.put(b);
- }
- }
-
- protected void doPut(ByteBuffer src)
- {
- try
- {
- out.put(src);
- }
- catch (BufferOverflowException e)
- {
- grow(src.remaining());
- out.put(src);
- }
- }
-
- protected void put(byte[] bytes)
- {
- try
- {
- out.put(bytes);
- }
- catch (BufferOverflowException e)
- {
- grow(bytes.length);
- out.put(bytes);
- }
- }
-
- public void writeUint8(short b)
- {
- assert b < 0x100;
-
- try
- {
- out.put((byte) b);
- }
- catch (BufferOverflowException e)
- {
- grow(1);
- out.put((byte) b);
- }
- }
-
- public void writeUint16(int s)
- {
- assert s < 0x10000;
-
- try
- {
- out.putShort((short) s);
- }
- catch (BufferOverflowException e)
- {
- grow(2);
- out.putShort((short) s);
- }
- }
-
- public void writeUint32(long i)
- {
- assert i < 0x100000000L;
-
- try
- {
- out.putInt((int) i);
- }
- catch (BufferOverflowException e)
- {
- grow(4);
- out.putInt((int) i);
- }
- }
-
- public void writeUint64(long l)
- {
- try
- {
- out.putLong(l);
- }
- catch (BufferOverflowException e)
- {
- grow(8);
- out.putLong(l);
- }
- }
-
- public int beginSize8()
- {
- int pos = out.position();
- try
- {
- out.put((byte) 0);
- }
- catch (BufferOverflowException e)
- {
- grow(1);
- out.put((byte) 0);
- }
- return pos;
- }
-
- public void endSize8(int pos)
- {
- int cur = out.position();
- out.put(pos, (byte) (cur - pos - 1));
- }
-
- public int beginSize16()
- {
- int pos = out.position();
- try
- {
- out.putShort((short) 0);
- }
- catch (BufferOverflowException e)
- {
- grow(2);
- out.putShort((short) 0);
- }
- return pos;
- }
-
- public void endSize16(int pos)
- {
- int cur = out.position();
- out.putShort(pos, (short) (cur - pos - 2));
- }
-
- public int beginSize32()
- {
- int pos = out.position();
- try
- {
- out.putInt(0);
- }
- catch (BufferOverflowException e)
- {
- grow(4);
- out.putInt(0);
- }
- return pos;
- }
-
- public void endSize32(int pos)
- {
- int cur = out.position();
- out.putInt(pos, (cur - pos - 4));
- }
-
- public void writeDouble(double aDouble)
- {
- try
- {
- out.putDouble(aDouble);
- } catch(BufferOverflowException exception)
- {
- grow(8);
- out.putDouble(aDouble);
- }
- }
-
- public void writeInt16(short aShort)
- {
- try
- {
- out.putShort(aShort);
- } catch(BufferOverflowException exception)
- {
- grow(2);
- out.putShort(aShort);
- }
- }
-
- public void writeInt32(int anInt)
- {
- try
- {
- out.putInt(anInt);
- } catch(BufferOverflowException exception)
- {
- grow(4);
- out.putInt(anInt);
- }
- }
-
- public void writeInt64(long aLong)
- {
- try
- {
- out.putLong(aLong);
- } catch(BufferOverflowException exception)
- {
- grow(8);
- out.putLong(aLong);
- }
- }
-
- public void writeInt8(byte aByte)
- {
- try
- {
- out.put(aByte);
- } catch(BufferOverflowException exception)
- {
- grow(1);
- out.put(aByte);
- }
- }
-
- public void writeBin128(byte[] byteArray)
- {
- byteArray = (byteArray != null) ? byteArray : new byte [16];
-
- assert byteArray.length == 16;
-
- try
- {
- out.put(byteArray);
- } catch(BufferOverflowException exception)
- {
- grow(16);
- out.put(byteArray);
- }
- }
-
- public void writeBin128(UUID id)
- {
- byte[] data = new byte[16];
-
- long msb = id.getMostSignificantBits();
- long lsb = id.getLeastSignificantBits();
-
- assert data.length == 16;
- for (int i=7; i>=0; i--)
- {
- data[i] = (byte)(msb & 0xff);
- msb = msb >> 8;
- }
-
- for (int i=15; i>=8; i--)
- {
- data[i] = (byte)(lsb & 0xff);
- lsb = (lsb >> 8);
- }
- writeBin128(data);
- }
-
- public void writeFloat(float aFloat)
- {
- try
- {
- out.putFloat(aFloat);
- } catch(BufferOverflowException exception)
- {
- grow(4);
- out.putFloat(aFloat);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java
deleted file mode 100644
index 6c027adcad..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-import org.apache.qpid.transport.RangeSet;
-import org.apache.qpid.transport.Struct;
-
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-
-/**
- * Decoder interface.
- * Each concrete implementor must specify how to decode given values.
- *
- * @author Rafael H. Schloming
- */
-public interface Decoder
-{
- /**
- * Tells whether there are any remaining byte(s) to be read.
- *
- * @return true if there are remaining bytes, false otherwise.
- */
- boolean hasRemaining();
-
- /**
- * The uint8 type is an 8-bit unsigned integral value.
- *
- * @return an 8-bit unsigned integral value.
- */
- short readUint8();
-
- /**
- *The uint16 type is a 16-bit unsigned integral value encoded in network byte order.
- *
- * @return a 16-bit unsigned integral value encoded in network byte order.
- */
- int readUint16();
-
- /**
- *The uint32 type is a 32-bit unsigned integral value encoded in network byte order.
- *
- * @return a 32-bit unsigned integral value encoded in network byte order.
- */
- long readUint32();
-
- /**
- * The uint64 type is a 64-bit unsigned integral value encoded in network byte order.
- *
- * @return a 64-bit unsigned integral value encoded in network byte order.
- */
- long readUint64();
-
- /**
- * The datetime type encodes a date and time using the 64 bit POSIX time_t format.
- *
- * @return a date and time using the 64 bit POSIX time_t format.
- */
- long readDatetime();
-
- /**
- * The uuid type encodes a universally unique id as defined by RFC-4122.
- * The format and operations for this type can be found in section 4.1.2 of RFC-4122.
- *
- * @return a universally unique id as defined by RFC-4122.
- */
- UUID readUuid();
-
- /**
-// *The sequence-no type encodes, in network byte order, a serial number as defined in RFC-1982.
- *
- * @return a serial number as defined in RFC-1982.
- */
- int readSequenceNo();
-
- RangeSet readSequenceSet(); // XXX
- RangeSet readByteRanges(); // XXX
-
- /**
- * The str8 type encodes up to 255 octets worth of UTF-8 unicode.
- * The number of octets of unicode is first encoded as an 8-bit unsigned integral value.
- * This is followed by the actual UTF-8 unicode.
- * Note that the encoded size refers to the number of octets of unicode, not necessarily the number of characters since
- * the UTF-8 unicode may include multi-byte character sequences.
- *
- * @return a string.
- */
- String readStr8();
-
- /**
- * The str16 type encodes up to 65535 octets worth of UTF-8 unicode.
- * The number of octets is first encoded as a 16-bit unsigned integral value in network byte order.
- * This is followed by the actual UTF-8 unicode.
- * Note that the encoded size refers to the number of octets of unicode, not necessarily the number of unicode
- * characters since the UTF-8 unicode may include multi-byte character sequences.
- *
- * @return a string.
- */
- String readStr16();
-
- /**
- * The vbin8 type encodes up to 255 octets of opaque binary data.
- *
- * @return a byte array.
- */
- byte[] readVbin8();
-
- /**
- * The vbin16 type encodes up to 65535 octets of opaque binary data.
- *
- * @return the corresponding byte array.
- */
- byte[] readVbin16();
-
- /**
- * The vbin32 type encodes up to 4294967295 octets of opaque binary data.
- *
- * @return the corresponding byte array.
- */
- byte[] readVbin32();
-
- /**
- * The struct32 type describes any coded struct with a 32-bit (4 octet) size.
- * The type is restricted to be only coded structs with a 32-bit size, consequently the first six octets of any encoded
- * value for this type MUST always contain the size, class-code, and struct-code in that order.
- * The size is encoded as a 32-bit unsigned integral value in network byte order that is equal to the size of the
- * encoded field-data, packing-flags, class-code, and struct-code. The class-code is a single octet that may be set to any
- * valid class code.
- * The struct-code is a single octet that may be set to any valid struct code within the given class-code.
- * The first six octets are then followed by the packing flags and encoded field data.
- * The presence and quantity of packingflags, as well as the specific fields are determined by the struct definition
- * identified with the encoded class-code and struct-code.
- *
- * @return the decoded struct.
- */
- Struct readStruct32();
-
- /**
- * A map is a set of distinct keys where each key has an associated (type,value) pair.
- * The triple of the key, type, and value, form an entry within a map. Each entry within a given map MUST have a
- * distinct key.
- * A map is encoded as a size in octets, a count of the number of entries, followed by the encoded entries themselves.
- * An encoded map may contain up to (4294967295 - 4) octets worth of encoded entries.
- * The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth of
- * encoded entries plus 4. (The extra 4 octets is added for the entry count.)
- * The size is then followed by the number of entries encoded as a 32-bit unsigned integral value in network byte order.
- * Finally the entries are encoded sequentially.
- * An entry is encoded as the key, followed by the type, and then the value. The key is always a string encoded as a str8.
- * The type is a single octet that may contain any valid AMQP type code.
- * The value is encoded according to the rules defined by the type code for that entry.
- *
- * @return the decoded map.
- */
- Map<String,Object> readMap();
-
- /**
- * A list is an ordered sequence of (type, value) pairs. The (type, value) pair forms an item within the list.
- * The list may contain items of many distinct types. A list is encoded as a size in octets, followed by a count of the
- * number of items, followed by the items themselves encoded in their defined order.
- * An encoded list may contain up to (4294967295 - 4) octets worth of encoded items.
- * The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth
- * of encoded items plus 4. (The extra4 octets is added for the item count.)
- * The size is then followed by the number of items encoded as a 32-bit unsigned integral value in network byte order.
- * Finally the items are encoded sequentially in their defined order.
- * An item is encoded as the type followed by the value. The type is a single octet that may contain any valid AMQP type
- * code.
- * The value is encoded according to the rules defined by the type code for that item.
- *
- * @return the decoded list.
- */
- List<Object> readList();
-
- /**
- * An array is an ordered sequence of values of the same type.
- * The array is encoded in as a size in octets, followed by a type code, then a count of the number values in the array,
- * and finally the values encoded in their defined order.
- * An encoded array may contain up to (4294967295 - 5) octets worth of encoded values.
- * The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth of
- * encoded values plus 5. (The extra 5 octets consist of 4 octets for the count of the number of values, and one octet to
- * hold the type code for the items inthe array.)
- * The size is then followed by a single octet that may contain any valid AMQP type code.
- * The type code is then followed by the number of values encoded as a 32-bit unsigned integral value in network byte
- * order.
- * Finally the values are encoded sequentially in their defined order according to the rules defined by the type code for
- * the array.
- *
- * @return the decoded array.
- */
- List<Object> readArray();
-
- /**
- *
- * @param type the type of the struct.
- * @return the decoded struct.
- */
- Struct readStruct(int type);
-
- /**
- * The float type encodes a single precision 32-bit floating point number.
- * The format and operations are defined by the IEEE 754 standard for 32-bit single precision floating point numbers.
- *
- * @return the decoded float.
- */
- float readFloat();
-
- /**
- * The double type encodes a double precision 64-bit floating point number.
- * The format and operations are defined by the IEEE 754 standard for 64-bit double precision floating point numbers.
- *
- * @return the decoded double
- */
- double readDouble();
-
- /**
- * The int8 type is a signed integral value encoded using an 8-bit two's complement representation.
- *
- * @return the decoded integer.
- */
- byte readInt8();
-
- /**
- * The int16 type is a signed integral value encoded using a 16-bit two's complement representation in network byte order.
- *
- * @return the decoded integer.
- */
- short readInt16();
-
- /**
- * The int32 type is a signed integral value encoded using a 32-bit two's complement representation in network byte order.
- *
- * @return the decoded integer.
- */
- int readInt32();
-
- /**
- * The int64 type is a signed integral value encoded using a 64-bit two's complement representation in network byte order.
- *
- * @return the decoded integer (as long).
- */
- long readInt64();
-
- /**
- * The bin128 type consists of 16 consecutive octets of opaque binary data.
- *
- * @return the decoded byte array.
- */
- byte [] readBin128();
-
- /**
- * Reads the remaining bytes on the underlying buffer.
- *
- * @return the remaining bytes on the underlying buffer.
- */
- byte[] readReaminingBytes ();
-
- /**
- * Reads the given number of bytes.
- *
- * @param howManyBytes how many bytes need to be read?
- * @return a byte array containing the requested data.
- */
- byte[] readBytes (int howManyBytes);
-} \ No newline at end of file
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java
deleted file mode 100644
index 37ce8a5cb7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-
-/**
- * Encodable
- *
- * @author Rafael H. Schloming
- */
-public interface Encodable
-{
- /**
- * Encodes this encodable using the given encoder.
- *
- * @param encoder the encoder.
- */
- void write(Encoder encoder);
-
- /**
- * Decodes this encodable using the given decoder.
- *
- * @param decoder the decoder.
- */
- void read(Decoder decoder);
-} \ No newline at end of file
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java
deleted file mode 100644
index b5ab29cdcf..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-import java.nio.ByteBuffer;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.qpid.transport.RangeSet;
-import org.apache.qpid.transport.Struct;
-
-
-/**
- * Encoder interface.
- * Each concrete implementor must specify how to encode given values.
- *
- * @author Rafael H. Schloming
- */
-public interface Encoder
-{
- /**
- * The uint8 type is an 8-bit unsigned integral value.
- *
- * @param b the unsigned integer to be encoded.
- */
- void writeUint8(short b);
-
- /**
- *The uint16 type is a 16-bit unsigned integral value encoded in network byte order.
- *
- * @param s the unsigned integer to be encoded.
- */
- void writeUint16(int s);
-
- /**
- *The uint32 type is a 32-bit unsigned integral value encoded in network byte order.
- *
- * @param i the unsigned integer to be encoded.
- */
- void writeUint32(long i);
-
- /**
- * The uint64 type is a 64-bit unsigned integral value encoded in network byte order.
- *
- * @param l the unsigned integer to be encoded.
- */
- void writeUint64(long l);
-
- /**
- * The datetime type encodes a date and time using the 64 bit POSIX time_t format.
- *
- * @param l the datetime (as long) to be encoded.
- */
- void writeDatetime(long l);
-
- /**
- * The uuid type encodes a universally unique id as defined by RFC-4122.
- * The format and operations for this type can be found in section 4.1.2 of RFC-4122.
- *
- * @param uuid the uuid to be encoded.
- */
- void writeUuid(UUID uuid);
-
- /**
- *The sequence-no type encodes, in network byte order, a serial number as defined in RFC-1982.
- *
- * @param s the sequence number to be encoded.
- */
- void writeSequenceNo(int s);
-
- void writeSequenceSet(RangeSet ranges); // XXX
- void writeByteRanges(RangeSet ranges); // XXX
-
- /**
- * The str8 type encodes up to 255 octets worth of UTF-8 unicode.
- * The number of octets of unicode is first encoded as an 8-bit unsigned integral value.
- * This is followed by the actual UTF-8 unicode.
- * Note that the encoded size refers to the number of octets of unicode, not necessarily the number of characters since
- * the UTF-8 unicode may include multi-byte character sequences.
- *
- * @param s the string to be encoded.
- */
- void writeStr8(String s);
-
- /**
- * The str16 type encodes up to 65535 octets worth of UTF-8 unicode.
- * The number of octets is first encoded as a 16-bit unsigned integral value in network byte order.
- * This is followed by the actual UTF-8 unicode.
- * Note that the encoded size refers to the number of octets of unicode, not necessarily the number of unicode
- * characters since the UTF-8 unicode may include multi-byte character sequences.
- *
- * @param s the string to be encoded.
- */
- void writeStr16(String s);
-
- /**
- * The vbin8 type encodes up to 255 octets of opaque binary data.
- * The number of octets is first encoded as an 8-bit unsigned integral value.
- * This is followed by the actual data.
- *
- * @param bytes the byte array to be encoded.
- */
- void writeVbin8(byte[] bytes);
-
- /**
- * The vbin16 type encodes up to 65535 octets of opaque binary data.
- * The number of octets is first encoded as a 16-bit unsigned integral value in network byte order.
- * This is followed by the actual data.
- *
- * @param bytes the byte array to be encoded.
- */
- void writeVbin16(byte[] bytes);
-
- /**
- * The vbin32 type encodes up to 4294967295 octets of opaque binary data.
- * The number of octets is first encoded as a 32-bit unsigned integral value in network byte order.
- * This is followed by the actual data.
- *
- * @param bytes the byte array to be encoded.
- */
- void writeVbin32(byte[] bytes);
-
- /**
- * The struct32 type describes any coded struct with a 32-bit (4 octet) size.
- * The type is restricted to be only coded structs with a 32-bit size, consequently the first six octets of any encoded
- * value for this type MUST always contain the size, class-code, and struct-code in that order.
- * The size is encoded as a 32-bit unsigned integral value in network byte order that is equal to the size of the
- * encoded field-data, packing-flags, class-code, and struct-code. The class-code is a single octet that may be set to any
- * valid class code.
- * The struct-code is a single octet that may be set to any valid struct code within the given class-code.
- * The first six octets are then followed by the packing flags and encoded field data.
- * The presence and quantity of packingflags, as well as the specific fields are determined by the struct definition
- * identified with the encoded class-code and struct-code.
- *
- * @param struct the struct to be encoded.
- */
- void writeStruct32(Struct struct);
-
- /**
- * A map is a set of distinct keys where each key has an associated (type,value) pair.
- * The triple of the key, type, and value, form an entry within a map. Each entry within a given map MUST have a
- * distinct key.
- * A map is encoded as a size in octets, a count of the number of entries, followed by the encoded entries themselves.
- * An encoded map may contain up to (4294967295 - 4) octets worth of encoded entries.
- * The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth of
- * encoded entries plus 4. (The extra 4 octets is added for the entry count.)
- * The size is then followed by the number of entries encoded as a 32-bit unsigned integral value in network byte order.
- * Finally the entries are encoded sequentially.
- * An entry is encoded as the key, followed by the type, and then the value. The key is always a string encoded as a str8.
- * The type is a single octet that may contain any valid AMQP type code.
- * The value is encoded according to the rules defined by the type code for that entry.
- *
- * @param map the map to be encoded.
- */
- void writeMap(Map<String,Object> map);
-
- /**
- * A list is an ordered sequence of (type, value) pairs. The (type, value) pair forms an item within the list.
- * The list may contain items of many distinct types. A list is encoded as a size in octets, followed by a count of the
- * number of items, followed by the items themselves encoded in their defined order.
- * An encoded list may contain up to (4294967295 - 4) octets worth of encoded items.
- * The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth
- * of encoded items plus 4. (The extra4 octets is added for the item count.)
- * The size is then followed by the number of items encoded as a 32-bit unsigned integral value in network byte order.
- * Finally the items are encoded sequentially in their defined order.
- * An item is encoded as the type followed by the value. The type is a single octet that may contain any valid AMQP type
- * code.
- * The value is encoded according to the rules defined by the type code for that item.
- *
- * @param list the list to be encoded.
- */
- void writeList(List<Object> list);
-
- /**
- * An array is an ordered sequence of values of the same type.
- * The array is encoded in as a size in octets, followed by a type code, then a count of the number values in the array,
- * and finally the values encoded in their defined order.
- * An encoded array may contain up to (4294967295 - 5) octets worth of encoded values.
- * The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth of
- * encoded values plus 5. (The extra 5 octets consist of 4 octets for the count of the number of values, and one octet to
- * hold the type code for the items inthe array.)
- * The size is then followed by a single octet that may contain any valid AMQP type code.
- * The type code is then followed by the number of values encoded as a 32-bit unsigned integral value in network byte
- * order.
- * Finally the values are encoded sequentially in their defined order according to the rules defined by the type code for
- * the array.
- *
- * @param array the array to be encoded.
- */
- void writeArray(List<Object> array);
-
- /**
- * The struct32 type describes any coded struct with a 32-bit (4 octet) size.
- * The type is restricted to be only coded structs with a 32-bit size, consequently the first six octets of any encoded
- * value for this type MUST always contain the size, class-code, and struct-code in that order.
- * The size is encoded as a 32-bit unsigned integral value in network byte order that is equal to the size of the
- * encoded field-data, packing-flags, class-code, and struct-code. The class-code is a single octet that may be set to any
- * valid class code.
- * The struct-code is a single octet that may be set to any valid struct code within the given class-code.
- * The first six octets are then followed by the packing flags and encoded field data.
- * The presence and quantity of packingflags, as well as the specific fields are determined by the struct definition
- * identified with the encoded class-code and struct-code.
- *
- * @param type the type of the struct.
- * @param struct the struct to be encoded.
- */
- void writeStruct(int type, Struct struct);
-
- /**
- * The float type encodes a single precision 32-bit floating point number.
- * The format and operations are defined by the IEEE 754 standard for 32-bit single precision floating point numbers.
- *
- * @param aFloat the float to be encoded.
- */
- void writeFloat(float aFloat);
-
- /**
- * The double type encodes a double precision 64-bit floating point number.
- * The format and operations are defined by the IEEE 754 standard for 64-bit double precision floating point numbers.
- *
- * @param aDouble the double to be encoded.
- */
- void writeDouble(double aDouble);
-
- /**
- * The int8 type is a signed integral value encoded using an 8-bit two's complement representation.
- *
- * @param aByte the integer to be encoded.
- */
- void writeInt8(byte aByte);
-
- /**
- * The int16 type is a signed integral value encoded using a 16-bit two's complement representation in network byte order.
- *
- * @param aShort the integer to be encoded.
- */
- void writeInt16(short aShort);
-
- /**
- * The int32 type is a signed integral value encoded using a 32-bit two's complement representation in network byte order.
- *
- * @param anInt the integer to be encoded.
- */
- void writeInt32(int anInt);
-
- /**
- * The int64 type is a signed integral value encoded using a 64-bit two's complement representation in network byte order.
- *
- * @param aLong the integer to be encoded.
- */
- void writeInt64(long aLong);
-
- /**
- * The bin128 type consists of 16 consecutive octets of opaque binary data.
- *
- * @param bytes the bytes array to be encoded.
- */
- void writeBin128(byte [] bytes);
-
- int position();
-
- ByteBuffer underlyingBuffer();
-
- void init();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Assembler.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Assembler.java
deleted file mode 100644
index a7e96167c2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Assembler.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.MessageProperties;
-import org.apache.qpid.transport.Method;
-import org.apache.qpid.transport.NetworkEventReceiver;
-import org.apache.qpid.transport.ProtocolError;
-import org.apache.qpid.transport.ProtocolEvent;
-import org.apache.qpid.transport.ProtocolEventReceiver;
-import org.apache.qpid.transport.ProtocolHeader;
-import org.apache.qpid.transport.Struct;
-import org.apache.qpid.transport.codec.BBDecoder;
-
-/**
- * Assembler
- *
- */
-public class Assembler implements NetworkEventReceiver, NetworkDelegate
-{
- // Use a small array to store incomplete Methods for low-value channels, instead of allocating a huge
- // array or always boxing the channelId and looking it up in the map. This value must be of the form 2^X - 1.
- private static final int ARRAY_SIZE = 0xFF;
- private final Method[] _incompleteMethodArray = new Method[ARRAY_SIZE + 1];
- private final Map<Integer, Method> _incompleteMethodMap = new HashMap<Integer, Method>();
-
- private final ProtocolEventReceiver receiver;
- private final Map<Integer,List<Frame>> segments;
- private static final ThreadLocal<BBDecoder> _decoder = new ThreadLocal<BBDecoder>()
- {
- public BBDecoder initialValue()
- {
- return new BBDecoder();
- }
- };
-
- public Assembler(ProtocolEventReceiver receiver)
- {
- this.receiver = receiver;
- segments = new HashMap<Integer,List<Frame>>();
- }
-
- private int segmentKey(Frame frame)
- {
- return (frame.getTrack() + 1) * frame.getChannel();
- }
-
- private List<Frame> getSegment(Frame frame)
- {
- return segments.get(segmentKey(frame));
- }
-
- private void setSegment(Frame frame, List<Frame> segment)
- {
- int key = segmentKey(frame);
- if (segments.containsKey(key))
- {
- error(new ProtocolError(Frame.L2, "segment in progress: %s",
- frame));
- }
- segments.put(segmentKey(frame), segment);
- }
-
- private void clearSegment(Frame frame)
- {
- segments.remove(segmentKey(frame));
- }
-
- private void emit(int channel, ProtocolEvent event)
- {
- event.setChannel(channel);
- receiver.received(event);
- }
-
- public void received(NetworkEvent event)
- {
- event.delegate(this);
- }
-
- public void exception(Throwable t)
- {
- this.receiver.exception(t);
- }
-
- public void closed()
- {
- this.receiver.closed();
- }
-
- public void init(ProtocolHeader header)
- {
- emit(0, header);
- }
-
- public void error(ProtocolError error)
- {
- emit(0, error);
- }
-
- public void frame(Frame frame)
- {
- ByteBuffer segment;
- if (frame.isFirstFrame() && frame.isLastFrame())
- {
- segment = frame.getBody();
- assemble(frame, segment);
- }
- else
- {
- List<Frame> frames;
- if (frame.isFirstFrame())
- {
- frames = new ArrayList<Frame>();
- setSegment(frame, frames);
- }
- else
- {
- frames = getSegment(frame);
- }
-
- frames.add(frame);
-
- if (frame.isLastFrame())
- {
- clearSegment(frame);
-
- int size = 0;
- for (Frame f : frames)
- {
- size += f.getSize();
- }
- segment = ByteBuffer.allocate(size);
- for (Frame f : frames)
- {
- segment.put(f.getBody());
- }
- segment.flip();
- assemble(frame, segment);
- }
- }
-
- }
-
- private void assemble(Frame frame, ByteBuffer segment)
- {
- BBDecoder dec = _decoder.get();
- dec.init(segment);
-
- int channel = frame.getChannel();
- Method command;
-
- switch (frame.getType())
- {
- case CONTROL:
- int controlType = dec.readUint16();
- Method control = Method.create(controlType);
- control.read(dec);
- emit(channel, control);
- break;
- case COMMAND:
- int commandType = dec.readUint16();
- // read in the session header, right now we don't use it
- int hdr = dec.readUint16();
- command = Method.create(commandType);
- command.setSync((0x0001 & hdr) != 0);
- command.read(dec);
- if (command.hasPayload() && !frame.isLastSegment())
- {
- setIncompleteCommand(channel, command);
- }
- else
- {
- emit(channel, command);
- }
- break;
- case HEADER:
- command = getIncompleteCommand(channel);
- List<Struct> structs = null;
- DeliveryProperties deliveryProps = null;
- MessageProperties messageProps = null;
-
- while (dec.hasRemaining())
- {
- Struct struct = dec.readStruct32();
- if(struct instanceof DeliveryProperties && deliveryProps == null)
- {
- deliveryProps = (DeliveryProperties) struct;
- }
- else if(struct instanceof MessageProperties && messageProps == null)
- {
- messageProps = (MessageProperties) struct;
- }
- else
- {
- if(structs == null)
- {
- structs = new ArrayList<Struct>(2);
- }
- structs.add(struct);
- }
-
- }
- command.setHeader(new Header(deliveryProps,messageProps,structs));
-
- if (frame.isLastSegment())
- {
- setIncompleteCommand(channel, null);
- emit(channel, command);
- }
- break;
- case BODY:
- command = getIncompleteCommand(channel);
- command.setBody(segment);
- setIncompleteCommand(channel, null);
- emit(channel, command);
- break;
- default:
- throw new IllegalStateException("unknown frame type: " + frame.getType());
- }
-
- dec.releaseBuffer();
- }
-
- private void setIncompleteCommand(int channelId, Method incomplete)
- {
- if ((channelId & ARRAY_SIZE) == channelId)
- {
- _incompleteMethodArray[channelId] = incomplete;
- }
- else
- {
- if(incomplete != null)
- {
- _incompleteMethodMap.put(channelId, incomplete);
- }
- else
- {
- _incompleteMethodMap.remove(channelId);
- }
- }
- }
-
- private Method getIncompleteCommand(int channelId)
- {
- if ((channelId & ARRAY_SIZE) == channelId)
- {
- return _incompleteMethodArray[channelId];
- }
- else
- {
- return _incompleteMethodMap.get(channelId);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ConnectionBinding.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ConnectionBinding.java
deleted file mode 100644
index 5463cd2587..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ConnectionBinding.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import org.apache.qpid.transport.Binding;
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.Connection;
-import org.apache.qpid.transport.ConnectionDelegate;
-import org.apache.qpid.transport.ConnectionListener;
-import org.apache.qpid.transport.Constant;
-import org.apache.qpid.transport.network.security.sasl.SASLReceiver;
-import org.apache.qpid.transport.network.security.sasl.SASLSender;
-
-/**
- * ConnectionBinding
- *
- */
-
-public abstract class ConnectionBinding
- implements Binding<Connection>
-{
-
- public static Binding<Connection> get(final Connection connection)
- {
- return new ConnectionBinding()
- {
- public Connection connection()
- {
- return connection;
- }
- };
- }
-
- public static Binding<Connection> get(final ConnectionDelegate delegate)
- {
- return new ConnectionBinding()
- {
- public Connection connection()
- {
- Connection conn = new Connection();
- conn.setConnectionDelegate(delegate);
- return conn;
- }
- };
- }
-
- public static final int MAX_FRAME_SIZE = 64 * 1024 - 1;
-
- public abstract Connection connection();
-
- public Connection endpoint(ByteBufferSender sender)
- {
- Connection conn = connection();
-
- if (conn.getConnectionSettings() != null &&
- conn.getConnectionSettings().isUseSASLEncryption())
- {
- sender = new SASLSender(sender);
- conn.addConnectionListener((ConnectionListener)sender);
- }
-
- // XXX: hardcoded max-frame
- Disassembler dis = new Disassembler(sender, Constant.MIN_MAX_FRAME_SIZE);
- conn.addFrameSizeObserver(dis);
- conn.setSender(dis);
- return conn;
- }
-
- public ByteBufferReceiver receiver(Connection conn)
- {
- final InputHandler inputHandler = new InputHandler(new Assembler(conn));
- conn.addFrameSizeObserver(inputHandler);
- if (conn.getConnectionSettings() != null &&
- conn.getConnectionSettings().isUseSASLEncryption())
- {
- SASLReceiver receiver = new SASLReceiver(inputHandler);
- conn.addConnectionListener(receiver);
- return receiver;
- }
- else
- {
- return inputHandler;
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
deleted file mode 100644
index c45b2049a1..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import static java.lang.Math.min;
-import static org.apache.qpid.transport.network.Frame.FIRST_FRAME;
-import static org.apache.qpid.transport.network.Frame.FIRST_SEG;
-import static org.apache.qpid.transport.network.Frame.HEADER_SIZE;
-import static org.apache.qpid.transport.network.Frame.LAST_FRAME;
-import static org.apache.qpid.transport.network.Frame.LAST_SEG;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.FrameSizeObserver;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.Method;
-import org.apache.qpid.transport.ProtocolDelegate;
-import org.apache.qpid.transport.ProtocolError;
-import org.apache.qpid.transport.ProtocolEvent;
-import org.apache.qpid.transport.ProtocolEventSender;
-import org.apache.qpid.transport.ProtocolHeader;
-import org.apache.qpid.transport.SegmentType;
-import org.apache.qpid.transport.Struct;
-import org.apache.qpid.transport.codec.BBEncoder;
-import org.apache.qpid.transport.codec.Encoder;
-
-/**
- * Disassembler
- */
-public final class Disassembler implements ProtocolEventSender, ProtocolDelegate<Void>, FrameSizeObserver
-{
- private final ByteBufferSender sender;
- private int maxPayload;
- private final Object sendlock = new Object();
- private final static ThreadLocal<Encoder> _encoder = new ThreadLocal<Encoder>()
- {
- public BBEncoder initialValue()
- {
- return new BBEncoder(4*1024);
- }
- };
-
- public Disassembler(ByteBufferSender sender, int maxFrame)
- {
- this.sender = sender;
- if (maxFrame <= HEADER_SIZE || maxFrame >= 64*1024)
- {
- throw new IllegalArgumentException("maxFrame must be > HEADER_SIZE and < 64K: " + maxFrame);
- }
- this.maxPayload = maxFrame - HEADER_SIZE;
- }
-
- public void send(ProtocolEvent event)
- {
- event.delegate(null, this);
- }
-
- public void flush()
- {
- synchronized (sendlock)
- {
- sender.flush();
- }
- }
-
- public void close()
- {
- synchronized (sendlock)
- {
- sender.close();
- }
- }
-
- private final ByteBuffer _frameHeader = ByteBuffer.allocate(HEADER_SIZE);
-
- {
- _frameHeader.order(ByteOrder.BIG_ENDIAN);
- }
-
- private void frame(byte flags, byte type, byte track, int channel, int size, ByteBuffer buf)
- {
- synchronized (sendlock)
- {
- ByteBuffer data = _frameHeader;
- _frameHeader.rewind();
-
-
- data.put(0, flags);
- data.put(1, type);
- data.putShort(2, (short) (size + HEADER_SIZE));
- data.put(5, track);
- data.putShort(6, (short) channel);
-
-
- int limit = buf.limit();
- buf.limit(buf.position() + size);
-
- data.rewind();
- sender.send(data);
- sender.send(buf);
- buf.limit(limit);
-
- }
- }
-
- private void fragment(byte flags, SegmentType type, ProtocolEvent event, ByteBuffer buf)
- {
- byte typeb = (byte) type.getValue();
- byte track = event.getEncodedTrack() == Frame.L4 ? (byte) 1 : (byte) 0;
-
- int remaining = buf.remaining();
- boolean first = true;
- while (true)
- {
- int size = min(maxPayload, remaining);
- remaining -= size;
-
- byte newflags = flags;
- if (first)
- {
- newflags |= FIRST_FRAME;
- first = false;
- }
- if (remaining == 0)
- {
- newflags |= LAST_FRAME;
- }
-
- frame(newflags, typeb, track, event.getChannel(), size, buf);
-
- if (remaining == 0)
- {
- break;
- }
- }
- }
-
- public void init(Void v, ProtocolHeader header)
- {
- synchronized (sendlock)
- {
- sender.send(header.toByteBuffer());
- sender.flush();
- }
- }
-
- public void control(Void v, Method method)
- {
- method(method, SegmentType.CONTROL);
- }
-
- public void command(Void v, Method method)
- {
- method(method, SegmentType.COMMAND);
- }
-
- private void method(Method method, SegmentType type)
- {
- Encoder enc = _encoder.get();
- enc.init();
- enc.writeUint16(method.getEncodedType());
- if (type == SegmentType.COMMAND)
- {
- if (method.isSync())
- {
- enc.writeUint16(0x0101);
- }
- else
- {
- enc.writeUint16(0x0100);
- }
- }
- method.write(enc);
- int methodLimit = enc.position();
-
- byte flags = FIRST_SEG;
-
- boolean payload = method.hasPayload();
- if (!payload)
- {
- flags |= LAST_SEG;
- }
-
- int headerLimit = -1;
- if (payload)
- {
- final Header hdr = method.getHeader();
- if (hdr != null)
- {
- if(hdr.getDeliveryProperties() != null)
- {
- enc.writeStruct32(hdr.getDeliveryProperties());
- }
- if(hdr.getMessageProperties() != null)
- {
- enc.writeStruct32(hdr.getMessageProperties());
- }
- if(hdr.getNonStandardProperties() != null)
- {
- for (Struct st : hdr.getNonStandardProperties())
- {
- enc.writeStruct32(st);
- }
- }
- }
- headerLimit = enc.position();
- }
-
- synchronized (sendlock)
- {
- ByteBuffer buf = enc.underlyingBuffer();
- buf.position(0);
- buf.limit(methodLimit);
-
- fragment(flags, type, method, buf);
- if (payload)
- {
- ByteBuffer body = method.getBody();
- buf.limit(headerLimit);
- buf.position(methodLimit);
- fragment(body == null ? LAST_SEG : 0x0, SegmentType.HEADER, method, buf);
- if (body != null)
- {
- fragment(LAST_SEG, SegmentType.BODY, method, body);
- }
-
- }
- }
- }
-
- public void error(Void v, ProtocolError error)
- {
- throw new IllegalArgumentException(String.valueOf(error));
- }
-
- @Override
- public void setMaxFrameSize(final int maxFrame)
- {
- if (maxFrame <= HEADER_SIZE || maxFrame >= 64*1024)
- {
- throw new IllegalArgumentException("maxFrame must be > HEADER_SIZE and < 64K: " + maxFrame);
- }
- this.maxPayload = maxFrame - HEADER_SIZE;
-
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Frame.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Frame.java
deleted file mode 100644
index e810d9e8ae..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Frame.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import static org.apache.qpid.transport.util.Functions.str;
-
-import java.nio.ByteBuffer;
-
-import org.apache.qpid.transport.SegmentType;
-
-
-/**
- * Frame
- *
- * @author Rafael H. Schloming
- */
-
-public final class Frame implements NetworkEvent
-{
- public static final int HEADER_SIZE = 12;
-
- // XXX: enums?
- public static final byte L1 = 0;
- public static final byte L2 = 1;
- public static final byte L3 = 2;
- public static final byte L4 = 3;
-
- public static final byte RESERVED = 0x0;
-
- public static final byte VERSION = 0x0;
-
- public static final byte FIRST_SEG = 0x8;
- public static final byte LAST_SEG = 0x4;
- public static final byte FIRST_FRAME = 0x2;
- public static final byte LAST_FRAME = 0x1;
-
- final private byte flags;
- final private SegmentType type;
- final private byte track;
- final private int channel;
- final private ByteBuffer body;
-
- public Frame(byte flags, SegmentType type, byte track, int channel,
- ByteBuffer body)
- {
- this.flags = flags;
- this.type = type;
- this.track = track;
- this.channel = channel;
- this.body = body;
- }
-
- public ByteBuffer getBody()
- {
- return body.slice();
- }
-
- public byte getFlags()
- {
- return flags;
- }
-
- public int getChannel()
- {
- return channel;
- }
-
- public int getSize()
- {
- return body.remaining();
- }
-
- public SegmentType getType()
- {
- return type;
- }
-
- public byte getTrack()
- {
- return track;
- }
-
- private boolean flag(byte mask)
- {
- return (flags & mask) != 0;
- }
-
- public boolean isFirstSegment()
- {
- return flag(FIRST_SEG);
- }
-
- public boolean isLastSegment()
- {
- return flag(LAST_SEG);
- }
-
- public boolean isFirstFrame()
- {
- return flag(FIRST_FRAME);
- }
-
- public boolean isLastFrame()
- {
- return flag(LAST_FRAME);
- }
-
- public void delegate(NetworkDelegate delegate)
- {
- delegate.frame(this);
- }
-
- public String toString()
- {
- StringBuilder str = new StringBuilder();
-
- str.append(String.format
- ("[%05d %05d %1d %s %d%d%d%d] ", getChannel(), getSize(),
- getTrack(), getType(),
- isFirstSegment() ? 1 : 0, isLastSegment() ? 1 : 0,
- isFirstFrame() ? 1 : 0, isLastFrame() ? 1 : 0));
-
- str.append(str(body));
-
- return str.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/IncomingNetworkTransport.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/IncomingNetworkTransport.java
deleted file mode 100644
index f378c54026..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/IncomingNetworkTransport.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import java.util.Set;
-
-import javax.net.ssl.SSLContext;
-
-import org.apache.qpid.protocol.ProtocolEngineFactory;
-import org.apache.qpid.transport.NetworkTransportConfiguration;
-
-public interface IncomingNetworkTransport extends NetworkTransport
-{
- public void accept(NetworkTransportConfiguration config,
- ProtocolEngineFactory factory,
- SSLContext sslContext,
- final Set<TransportEncryption> encryptionSet);
-
- public int getAcceptingPort();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java
deleted file mode 100644
index a58bed5877..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import static org.apache.qpid.transport.network.InputHandler.State.ERROR;
-import static org.apache.qpid.transport.network.InputHandler.State.FRAME_BODY;
-import static org.apache.qpid.transport.network.InputHandler.State.FRAME_HDR;
-import static org.apache.qpid.transport.network.InputHandler.State.PROTO_HDR;
-import static org.apache.qpid.transport.util.Functions.str;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.Constant;
-import org.apache.qpid.transport.FrameSizeObserver;
-import org.apache.qpid.transport.NetworkEventReceiver;
-import org.apache.qpid.transport.ProtocolError;
-import org.apache.qpid.transport.ProtocolHeader;
-import org.apache.qpid.transport.SegmentType;
-
-
-/**
- * InputHandler
- *
- * @author Rafael H. Schloming
- */
-
-public class InputHandler implements ByteBufferReceiver, FrameSizeObserver
-{
-
- private int _maxFrameSize = Constant.MIN_MAX_FRAME_SIZE;
-
- public enum State
- {
- PROTO_HDR,
- FRAME_HDR,
- FRAME_BODY,
- ERROR
- }
-
- private final NetworkEventReceiver receiver;
- private State state;
- private ByteBuffer input = null;
- private int needed;
-
- private byte flags;
- private SegmentType type;
- private byte track;
- private int channel;
-
- public InputHandler(NetworkEventReceiver receiver, State state)
- {
- this.receiver = receiver;
- this.state = state;
-
- switch (state)
- {
- case PROTO_HDR:
- needed = 8;
- break;
- case FRAME_HDR:
- needed = Frame.HEADER_SIZE;
- break;
- }
- }
-
- public InputHandler(NetworkEventReceiver receiver)
- {
- this(receiver, PROTO_HDR);
- }
-
- public void setMaxFrameSize(final int maxFrameSize)
- {
- _maxFrameSize = maxFrameSize;
- }
-
- private void error(String fmt, Object ... args)
- {
- receiver.received(new ProtocolError(Frame.L1, fmt, args));
- }
-
- public void received(ByteBuffer buf)
- {
- int limit = buf.limit();
- int remaining = buf.remaining();
- while (remaining > 0)
- {
- if (remaining >= needed)
- {
- int consumed = needed;
- int pos = buf.position();
- if (input == null)
- {
- buf.limit(pos + needed);
- input = buf;
- state = next(pos);
- buf.limit(limit);
- buf.position(pos + consumed);
- }
- else
- {
- buf.limit(pos + needed);
- input.put(buf);
- buf.limit(limit);
- input.flip();
- state = next(0);
- }
-
- remaining -= consumed;
- input = null;
- }
- else
- {
- if (input == null)
- {
- input = ByteBuffer.allocate(needed);
- }
- input.put(buf);
- needed -= remaining;
- remaining = 0;
- }
- }
- }
-
- private State next(int pos)
- {
- input.order(ByteOrder.BIG_ENDIAN);
-
- switch (state) {
- case PROTO_HDR:
- if (input.get(pos) != 'A' &&
- input.get(pos + 1) != 'M' &&
- input.get(pos + 2) != 'Q' &&
- input.get(pos + 3) != 'P')
- {
- error("bad protocol header: %s", str(input));
- return ERROR;
- }
-
- byte protoClass = input.get(pos + 4);
- byte instance = input.get(pos + 5);
- byte major = input.get(pos + 6);
- byte minor = input.get(pos + 7);
- receiver.received(new ProtocolHeader(protoClass, instance, major, minor));
- needed = Frame.HEADER_SIZE;
- return FRAME_HDR;
- case FRAME_HDR:
- flags = input.get(pos);
- type = SegmentType.get(input.get(pos + 1));
- int size = (0xFFFF & input.getShort(pos + 2));
- size -= Frame.HEADER_SIZE;
- _maxFrameSize = 64 * 1024;
- if (size < 0 || size > (_maxFrameSize - 12))
- {
- error("bad frame size: %d", size);
- return ERROR;
- }
- byte b = input.get(pos + 5);
- if ((b & 0xF0) != 0) {
- error("non-zero reserved bits in upper nibble of " +
- "frame header byte 5: '%x'", b);
- return ERROR;
- } else {
- track = (byte) (b & 0xF);
- }
- channel = (0xFFFF & input.getShort(pos + 6));
- if (size == 0)
- {
- Frame frame = new Frame(flags, type, track, channel, ByteBuffer.allocate(0));
- receiver.received(frame);
- needed = Frame.HEADER_SIZE;
- return FRAME_HDR;
- }
- else
- {
- needed = size;
- return FRAME_BODY;
- }
- case FRAME_BODY:
- Frame frame = new Frame(flags, type, track, channel, input.slice());
- receiver.received(frame);
- needed = Frame.HEADER_SIZE;
- return FRAME_HDR;
- default:
- throw new IllegalStateException();
- }
- }
-
- public void exception(Throwable t)
- {
- receiver.exception(t);
- }
-
- public void closed()
- {
- receiver.closed();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkConnection.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkConnection.java
deleted file mode 100644
index bef266f214..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkConnection.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import java.net.SocketAddress;
-import java.security.Principal;
-
-import org.apache.qpid.transport.ByteBufferSender;
-
-public interface NetworkConnection
-{
- ByteBufferSender getSender();
-
- void start();
-
- void close();
-
- /**
- * @return the remote address of the underlying socket.
- */
- SocketAddress getRemoteAddress();
-
- /**
- * @return the local address of the underlying socket.
- */
- SocketAddress getLocalAddress();
-
- void setMaxWriteIdle(int sec);
-
- void setMaxReadIdle(int sec);
-
- Principal getPeerPrincipal();
-
- int getMaxReadIdle();
-
- int getMaxWriteIdle();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkDelegate.java
deleted file mode 100644
index fbdfe6e84c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import org.apache.qpid.transport.ProtocolError;
-import org.apache.qpid.transport.ProtocolHeader;
-
-
-/**
- * NetworkDelegate
- *
- * @author Rafael H. Schloming
- */
-
-public interface NetworkDelegate
-{
-
- void init(ProtocolHeader header);
-
- void frame(Frame frame);
-
- void error(ProtocolError error);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkEvent.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkEvent.java
deleted file mode 100644
index 91314cd4ad..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-
-/**
- * NetworkEvent
- *
- */
-
-public interface NetworkEvent
-{
-
- void delegate(NetworkDelegate delegate);
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkTransport.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkTransport.java
deleted file mode 100644
index f71d39c381..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/NetworkTransport.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-/**
- * A network transport is responsible for the establishment of network connections.
- * NetworkTransport implementations are pluggable via the {@link Transport} class.
- */
-public interface NetworkTransport
-{
- public void close();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/OutgoingNetworkTransport.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/OutgoingNetworkTransport.java
deleted file mode 100644
index f2735f1800..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/OutgoingNetworkTransport.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.ConnectionSettings;
-
-public interface OutgoingNetworkTransport extends NetworkTransport
-{
- public NetworkConnection getConnection();
-
- public NetworkConnection connect(ConnectionSettings settings,
- ByteBufferReceiver delegate,
- TransportActivity transportActivity);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Ticker.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Ticker.java
deleted file mode 100644
index 210b014a57..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Ticker.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.transport.network;
-
-public interface Ticker
-{
- int getTimeToNextTick(long currentTime);
-
- int tick(long currentTime);
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Transport.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Transport.java
deleted file mode 100644
index 55ba95ad75..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Transport.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.transport.TransportException;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public class Transport
-{
- public static final String QPID_TRANSPORT_PROPNAME = "qpid.transport";
- public static final String QPID_TRANSPORT_V0_8_PROPNAME = "qpid.transport.v0_8";
- public static final String QPID_TRANSPORT_V0_9_PROPNAME = "qpid.transport.v0_9";
- public static final String QPID_TRANSPORT_V0_9_1_PROPNAME = "qpid.transport.v0_9_1";
- public static final String QPID_TRANSPORT_V0_10_PROPNAME = "qpid.transport.v0_10";
- public static final String QPID_BROKER_TRANSPORT_PROPNAME = "qpid.broker.transport";
-
- // Can't reference the class directly here, as this would preclude the ability to bundle transports separately.
- private static final String IO_TRANSPORT_CLASSNAME = "org.apache.qpid.transport.network.io.IoNetworkTransport";
-
- public static final String TCP = "tcp";
-
- private final static Map<ProtocolVersion,String> OUTGOING_PROTOCOL_TO_IMPLDEFAULTS_MAP;
-
- static
- {
- final Map<ProtocolVersion,String> map = new HashMap<ProtocolVersion, String>();
- map.put(ProtocolVersion.v8_0, IO_TRANSPORT_CLASSNAME);
- map.put(ProtocolVersion.v0_9, IO_TRANSPORT_CLASSNAME);
- map.put(ProtocolVersion.v0_91, IO_TRANSPORT_CLASSNAME);
- map.put(ProtocolVersion.v0_10, IO_TRANSPORT_CLASSNAME);
-
- OUTGOING_PROTOCOL_TO_IMPLDEFAULTS_MAP = Collections.unmodifiableMap(map);
- }
-
- private Transport()
- {
- }
-
- public static IncomingNetworkTransport getIncomingTransportInstance()
- {
- return (IncomingNetworkTransport) loadTransportClass(
- System.getProperty(QPID_BROKER_TRANSPORT_PROPNAME, IO_TRANSPORT_CLASSNAME));
- }
-
- public static OutgoingNetworkTransport getOutgoingTransportInstance(
- final ProtocolVersion protocolVersion)
- {
-
- final String overrride = getOverrideClassNameFromSystemProperty(protocolVersion);
- final String networkTransportClassName;
- if (overrride != null)
- {
- networkTransportClassName = overrride;
- }
- else
- {
- networkTransportClassName = OUTGOING_PROTOCOL_TO_IMPLDEFAULTS_MAP.get(protocolVersion);
- }
-
- return (OutgoingNetworkTransport) loadTransportClass(networkTransportClassName);
- }
-
- private static NetworkTransport loadTransportClass(final String networkTransportClassName)
- {
- if (networkTransportClassName == null)
- {
- throw new IllegalArgumentException("transport class name must not be null");
- }
-
- try
- {
- final Class<?> clazz = Class.forName(networkTransportClassName);
- return (NetworkTransport) clazz.newInstance();
- }
- catch (InstantiationException e)
- {
- throw new TransportException("Unable to instantiate transport class " + networkTransportClassName, e);
- }
- catch (IllegalAccessException e)
- {
- throw new TransportException("Access exception " + networkTransportClassName, e);
- }
- catch (ClassNotFoundException e)
- {
- throw new TransportException("Unable to load transport class " + networkTransportClassName, e);
- }
- }
-
- private static String getOverrideClassNameFromSystemProperty(final ProtocolVersion protocolVersion)
- {
- final String protocolSpecificSystemProperty;
-
- if (ProtocolVersion.v0_10.equals(protocolVersion))
- {
- protocolSpecificSystemProperty = QPID_TRANSPORT_V0_10_PROPNAME;
- }
- else if (ProtocolVersion.v0_91.equals(protocolVersion))
- {
- protocolSpecificSystemProperty = QPID_TRANSPORT_V0_9_1_PROPNAME;
- }
- else if (ProtocolVersion.v0_9.equals(protocolVersion))
- {
- protocolSpecificSystemProperty = QPID_TRANSPORT_V0_9_PROPNAME;
- }
- else if (ProtocolVersion.v8_0.equals(protocolVersion))
- {
- protocolSpecificSystemProperty = QPID_TRANSPORT_V0_8_PROPNAME;
- }
- else
- {
- throw new IllegalArgumentException("Unknown ProtocolVersion " + protocolVersion);
- }
-
- return System.getProperty(protocolSpecificSystemProperty, System.getProperty(QPID_TRANSPORT_PROPNAME));
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/TransportActivity.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/TransportActivity.java
deleted file mode 100644
index 2ee336d9b2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/TransportActivity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.transport.network;
-
-public interface TransportActivity
-{
- long getLastReadTime();
-
- long getLastWriteTime();
-
- void writerIdle();
-
- void readerIdle();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/TransportEncryption.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/TransportEncryption.java
deleted file mode 100644
index b3f1f1c7dd..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/TransportEncryption.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-public enum TransportEncryption
-{
- NONE, TLS
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/AbstractNetworkTransport.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/AbstractNetworkTransport.java
deleted file mode 100644
index 8d19c5a2ce..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/AbstractNetworkTransport.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.io;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketException;
-import java.util.Set;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLServerSocket;
-import javax.net.ssl.SSLServerSocketFactory;
-
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.configuration.CommonProperties;
-import org.apache.qpid.protocol.ProtocolEngine;
-import org.apache.qpid.protocol.ProtocolEngineFactory;
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.ConnectionSettings;
-import org.apache.qpid.transport.NetworkTransportConfiguration;
-import org.apache.qpid.transport.TransportException;
-import org.apache.qpid.transport.network.IncomingNetworkTransport;
-import org.apache.qpid.transport.network.NetworkConnection;
-import org.apache.qpid.transport.network.OutgoingNetworkTransport;
-import org.apache.qpid.transport.network.TransportActivity;
-import org.apache.qpid.transport.network.TransportEncryption;
-import org.apache.qpid.transport.network.security.ssl.SSLUtil;
-
-// TODO we are no longer using the IncomingNetworkTransport
-public abstract class AbstractNetworkTransport implements OutgoingNetworkTransport, IncomingNetworkTransport
-{
- private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(AbstractNetworkTransport.class);
- private static final int TIMEOUT = Integer.getInteger(CommonProperties.IO_NETWORK_TRANSPORT_TIMEOUT_PROP_NAME,
- CommonProperties.IO_NETWORK_TRANSPORT_TIMEOUT_DEFAULT);
- private static final int HANSHAKE_TIMEOUT = Integer.getInteger(CommonProperties.HANDSHAKE_TIMEOUT_PROP_NAME ,
- CommonProperties.HANDSHAKE_TIMEOUT_DEFAULT);
- private Socket _socket;
- private NetworkConnection _connection;
- private AcceptingThread _acceptor;
-
- public NetworkConnection connect(ConnectionSettings settings,
- ByteBufferReceiver delegate,
- TransportActivity transportActivity)
- {
- int sendBufferSize = settings.getWriteBufferSize();
- int receiveBufferSize = settings.getReadBufferSize();
-
- try
- {
- _socket = new Socket();
- _socket.setReuseAddress(true);
- _socket.setTcpNoDelay(settings.isTcpNodelay());
- _socket.setSendBufferSize(sendBufferSize);
- _socket.setReceiveBufferSize(receiveBufferSize);
-
- if(LOGGER.isDebugEnabled())
- {
- LOGGER.debug("SO_RCVBUF : " + _socket.getReceiveBufferSize());
- LOGGER.debug("SO_SNDBUF : " + _socket.getSendBufferSize());
- LOGGER.debug("TCP_NODELAY : " + _socket.getTcpNoDelay());
- }
-
- InetAddress address = InetAddress.getByName(settings.getHost());
-
- _socket.connect(new InetSocketAddress(address, settings.getPort()), settings.getConnectTimeout());
- }
- catch (SocketException e)
- {
- throw new TransportException("Error connecting to broker", e);
- }
- catch (IOException e)
- {
- throw new TransportException("Error connecting to broker", e);
- }
-
- try
- {
- IdleTimeoutTicker ticker = new IdleTimeoutTicker(transportActivity, TIMEOUT);
- _connection = createNetworkConnection(_socket, delegate, sendBufferSize, receiveBufferSize, TIMEOUT, ticker);
- ticker.setConnection(_connection);
- _connection.start();
- }
- catch(Exception e)
- {
- try
- {
- _socket.close();
- }
- catch(IOException ioe)
- {
- //ignored, throw based on original exception
- }
-
- throw new TransportException("Error creating network connection", e);
- }
-
- return _connection;
- }
-
- public void close()
- {
- if(_connection != null)
- {
- _connection.close();
- }
- if(_acceptor != null)
- {
- _acceptor.close();
- }
- }
-
- public NetworkConnection getConnection()
- {
- return _connection;
- }
-
- public void accept(NetworkTransportConfiguration config,
- ProtocolEngineFactory factory,
- SSLContext sslContext, final Set<TransportEncryption> encryptionSet)
- {
- try
- {
- _acceptor = new AcceptingThread(config, factory, sslContext);
- _acceptor.setDaemon(false);
- _acceptor.start();
- }
- catch (IOException e)
- {
- throw new TransportException("Failed to start AMQP on port : " + config, e);
- }
- }
-
- public int getAcceptingPort()
- {
- return _acceptor == null ? -1 : _acceptor.getPort();
- }
-
- protected abstract NetworkConnection createNetworkConnection(Socket socket,
- ByteBufferReceiver engine,
- Integer sendBufferSize,
- Integer receiveBufferSize,
- int timeout,
- IdleTimeoutTicker ticker);
-
- private class AcceptingThread extends Thread
- {
- private volatile boolean _closed = false;
- private NetworkTransportConfiguration _config;
- private ProtocolEngineFactory _factory;
- private SSLContext _sslContext;
- private ServerSocket _serverSocket;
- private int _timeout;
-
- private AcceptingThread(NetworkTransportConfiguration config,
- ProtocolEngineFactory factory,
- SSLContext sslContext) throws IOException
- {
- _config = config;
- _factory = factory;
- _sslContext = sslContext;
- _timeout = TIMEOUT;
-
- InetSocketAddress address = config.getAddress();
-
- if(sslContext == null)
- {
- _serverSocket = new ServerSocket();
- }
- else
- {
- SSLServerSocketFactory socketFactory = _sslContext.getServerSocketFactory();
- _serverSocket = socketFactory.createServerSocket();
-
- SSLServerSocket sslServerSocket = (SSLServerSocket) _serverSocket;
-
- SSLUtil.removeSSLv3Support(sslServerSocket);
-
- if(config.needClientAuth())
- {
- sslServerSocket.setNeedClientAuth(true);
- }
- else if(config.wantClientAuth())
- {
- sslServerSocket.setWantClientAuth(true);
- }
-
- }
-
- _serverSocket.setReuseAddress(true);
- _serverSocket.bind(address);
- }
-
-
- /**
- Close the underlying ServerSocket if it has not already been closed.
- */
- public void close()
- {
- LOGGER.debug("Shutting down the Acceptor");
- _closed = true;
-
- if (!_serverSocket.isClosed())
- {
- try
- {
- _serverSocket.close();
- }
- catch (IOException e)
- {
- throw new TransportException(e);
- }
- }
- }
-
- private int getPort()
- {
- return _serverSocket.getLocalPort();
- }
-
- @Override
- public void run()
- {
- try
- {
- while (!_closed)
- {
- Socket socket = null;
- try
- {
- socket = _serverSocket.accept();
-
- ProtocolEngine engine = _factory.newProtocolEngine(socket.getRemoteSocketAddress());
-
- if(engine != null)
- {
- socket.setTcpNoDelay(_config.getTcpNoDelay());
- socket.setSoTimeout(1000 * HANSHAKE_TIMEOUT);
-
- final Integer sendBufferSize = _config.getSendBufferSize();
- final Integer receiveBufferSize = _config.getReceiveBufferSize();
-
- socket.setSendBufferSize(sendBufferSize);
- socket.setReceiveBufferSize(receiveBufferSize);
-
-
- final IdleTimeoutTicker ticker = new IdleTimeoutTicker(engine, TIMEOUT);
-
- NetworkConnection connection =
- createNetworkConnection(socket,
- engine,
- sendBufferSize,
- receiveBufferSize,
- _timeout,
- ticker);
-
- connection.setMaxReadIdle(HANSHAKE_TIMEOUT);
-
- ticker.setConnection(connection);
-
- engine.setNetworkConnection(connection, connection.getSender());
-
- connection.start();
- }
- else
- {
- socket.close();
- }
- }
- catch(RuntimeException e)
- {
- LOGGER.error("Error in Acceptor thread on address " + _config.getAddress(), e);
- closeSocketIfNecessary(socket);
- }
- catch(IOException e)
- {
- if(!_closed)
- {
- LOGGER.error("Error in Acceptor thread on address " + _config.getAddress(), e);
- closeSocketIfNecessary(socket);
- try
- {
- //Delay to avoid tight spinning the loop during issues such as too many open files
- Thread.sleep(1000);
- }
- catch (InterruptedException ie)
- {
- LOGGER.debug("Stopping acceptor due to interrupt request");
- _closed = true;
- }
- }
- }
- }
- }
- finally
- {
- if(LOGGER.isDebugEnabled())
- {
- LOGGER.debug("Acceptor exiting, no new connections will be accepted on address "
- + _config.getAddress());
- }
- }
- }
-
- private void closeSocketIfNecessary(final Socket socket)
- {
- if(socket != null)
- {
- try
- {
- socket.close();
- }
- catch (IOException e)
- {
- LOGGER.debug("Exception while closing socket", e);
- }
- }
- }
-
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IdleTimeoutTicker.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IdleTimeoutTicker.java
deleted file mode 100644
index 71704fca3a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IdleTimeoutTicker.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.transport.network.io;
-
-import org.apache.qpid.transport.network.NetworkConnection;
-import org.apache.qpid.transport.network.Ticker;
-import org.apache.qpid.transport.network.TransportActivity;
-
-public class IdleTimeoutTicker implements Ticker
-{
- private final TransportActivity _transport;
- private final int _defaultTimeout;
- private NetworkConnection _connection;
-
- public IdleTimeoutTicker(TransportActivity transport, int defaultTimeout)
- {
- _transport = transport;
- _defaultTimeout = defaultTimeout;
- }
-
- @Override
- public int getTimeToNextTick(long currentTime)
- {
- long nextTime = -1;
- final long maxReadIdle = 1000l * _connection.getMaxReadIdle();
-
- if(maxReadIdle > 0)
- {
- nextTime = _transport.getLastReadTime() + maxReadIdle;
- }
-
- long maxWriteIdle = 1000l * _connection.getMaxWriteIdle();
-
- if(maxWriteIdle > 0)
- {
- long writeTime = _transport.getLastWriteTime() + maxWriteIdle;
- if(nextTime == -1l || writeTime < nextTime)
- {
- nextTime = writeTime;
- }
- }
- return nextTime == -1 ? _defaultTimeout : (int) (nextTime - currentTime);
- }
-
- @Override
- public int tick(long currentTime)
- {
- // writer Idle
- long maxWriteIdle = 1000l * _connection.getMaxWriteIdle();
- if(maxWriteIdle > 0 && maxWriteIdle+ _transport.getLastWriteTime() <= currentTime)
- {
- _transport.writerIdle();
- }
- // reader Idle
- final long maxReadIdle = 1000l * _connection.getMaxReadIdle();
- if(maxReadIdle > 0 && maxReadIdle+ _transport.getLastReadTime() <= currentTime)
- {
-
- _transport.readerIdle();
- }
- return getTimeToNextTick(currentTime);
- }
-
- public void setConnection(NetworkConnection connection)
- {
- _connection = connection;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkConnection.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkConnection.java
deleted file mode 100644
index 5008849ef3..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkConnection.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.io;
-
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.security.Principal;
-
-import javax.net.ssl.SSLPeerUnverifiedException;
-import javax.net.ssl.SSLSocket;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.network.NetworkConnection;
-import org.apache.qpid.transport.network.Ticker;
-
-public class IoNetworkConnection implements NetworkConnection
-{
- private static final Logger LOGGER = LoggerFactory.getLogger(IoNetworkConnection.class);
- private final Socket _socket;
- private final long _timeout;
- private final IoSender _ioSender;
- private final IoReceiver _ioReceiver;
- private int _maxReadIdle;
- private int _maxWriteIdle;
- private Principal _principal;
- private boolean _principalChecked;
- private final Object _lock = new Object();
-
- public IoNetworkConnection(Socket socket, ByteBufferReceiver delegate,
- int sendBufferSize, int receiveBufferSize, long timeout, Ticker ticker)
- {
- _socket = socket;
- _timeout = timeout;
-
- _ioReceiver = new IoReceiver(_socket, delegate, receiveBufferSize,_timeout);
- _ioReceiver.setTicker(ticker);
-
- _ioSender = new IoSender(_socket, 2 * sendBufferSize, _timeout);
-
- _ioSender.setReceiver(_ioReceiver);
-
- }
-
- public void start()
- {
- _ioSender.initiate();
- _ioReceiver.initiate();
- }
-
- public ByteBufferSender getSender()
- {
- return _ioSender;
- }
-
- public void close()
- {
- try
- {
- _ioSender.close();
- }
- finally
- {
- _ioReceiver.close(false);
- }
- }
-
- public SocketAddress getRemoteAddress()
- {
- return _socket.getRemoteSocketAddress();
- }
-
- public SocketAddress getLocalAddress()
- {
- return _socket.getLocalSocketAddress();
- }
-
- public void setMaxWriteIdle(int sec)
- {
- _maxWriteIdle = sec;
- }
-
- public void setMaxReadIdle(int sec)
- {
- _maxReadIdle = sec;
- }
-
- @Override
- public Principal getPeerPrincipal()
- {
- synchronized (_lock)
- {
- if(!_principalChecked)
- {
- if(_socket instanceof SSLSocket)
- {
- try
- {
- _principal = ((SSLSocket) _socket).getSession().getPeerPrincipal();
- }
- catch(SSLPeerUnverifiedException e)
- {
- _principal = null;
- }
- }
-
- _principalChecked = true;
- }
-
- return _principal;
- }
- }
-
- @Override
- public int getMaxReadIdle()
- {
- return _maxReadIdle;
- }
-
- @Override
- public int getMaxWriteIdle()
- {
- return _maxWriteIdle;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java
deleted file mode 100644
index ccab1d93cf..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.io;
-
-import java.net.Socket;
-
-import org.apache.qpid.transport.ByteBufferReceiver;
-
-public class IoNetworkTransport extends AbstractNetworkTransport
-{
-
-
- @Override
- protected IoNetworkConnection createNetworkConnection(final Socket socket,
- final ByteBufferReceiver engine,
- final Integer sendBufferSize,
- final Integer receiveBufferSize,
- final int timeout,
- final IdleTimeoutTicker ticker)
- {
- return new IoNetworkConnection(socket, engine, sendBufferSize, receiveBufferSize, timeout,
- ticker);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoReceiver.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoReceiver.java
deleted file mode 100644
index 790583e92b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoReceiver.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.io;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.Socket;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
-import java.nio.ByteBuffer;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.net.ssl.SSLSocket;
-
-import org.apache.qpid.thread.Threading;
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.TransportException;
-import org.apache.qpid.transport.network.Ticker;
-import org.apache.qpid.transport.util.Logger;
-import org.apache.qpid.util.SystemUtils;
-
-/**
- * IoReceiver
- *
- */
-
-final class IoReceiver implements Runnable
-{
-
- private static final Logger log = Logger.get(IoReceiver.class);
-
- private final ByteBufferReceiver receiver;
- private final int bufferSize;
- private final Socket socket;
- private final long timeout;
- private final AtomicBoolean closed = new AtomicBoolean(false);
- private final Thread receiverThread;
- private static final boolean shutdownBroken;
-
- private Ticker _ticker;
- static
- {
- shutdownBroken = SystemUtils.isWindows();
- }
-
- public IoReceiver(Socket socket, ByteBufferReceiver receiver, int bufferSize, long timeout)
- {
- this.receiver = receiver;
- this.bufferSize = bufferSize;
- this.socket = socket;
- this.timeout = timeout;
-
- try
- {
- //Create but deliberately don't start the thread.
- receiverThread = Threading.getThreadFactory().createThread(this);
- }
- catch(Exception e)
- {
- throw new RuntimeException("Error creating IOReceiver thread",e);
- }
- receiverThread.setDaemon(true);
- receiverThread.setName(String.format("IoReceiver-%s", socket.getRemoteSocketAddress()));
- }
-
- public void initiate()
- {
- receiverThread.start();
- }
-
- public void close()
- {
- close(false);
- }
-
- void close(boolean block)
- {
- if (!closed.getAndSet(true))
- {
- try
- {
- try
- {
- if (shutdownBroken || socket instanceof SSLSocket)
- {
- socket.close();
- }
- else
- {
- socket.shutdownInput();
- }
- }
- catch(SocketException se)
- {
- if(!socket.isClosed() && !socket.isInputShutdown())
- {
- throw se;
- }
- }
- if (block && Thread.currentThread() != receiverThread)
- {
- receiverThread.join(timeout);
- if (receiverThread.isAlive())
- {
- throw new TransportException("join timed out");
- }
- }
- }
- catch (InterruptedException e)
- {
- throw new TransportException(e);
- }
- catch (IOException e)
- {
- throw new TransportException(e);
- }
-
- }
- }
-
- public void run()
- {
- final int threshold = bufferSize / 2;
-
- // I set the read buffer size similar to SO_RCVBUF
- // Haven't tested with a lower value to see if it's better or worse
- byte[] buffer = new byte[bufferSize];
- try
- {
- InputStream in = socket.getInputStream();
- int read = 0;
- int offset = 0;
- long currentTime;
- while(read != -1)
- {
- try
- {
- while ((read = in.read(buffer, offset, bufferSize-offset)) != -1)
- {
- if (read > 0)
- {
- ByteBuffer b = ByteBuffer.wrap(buffer,offset,read);
- receiver.received(b);
- offset+=read;
- if (offset > threshold)
- {
- offset = 0;
- buffer = new byte[bufferSize];
- }
- }
- currentTime = System.currentTimeMillis();
-
- if(_ticker != null)
- {
- int tick = _ticker.getTimeToNextTick(currentTime);
- if(tick <= 0)
- {
- tick = _ticker.tick(currentTime);
- }
- try
- {
- if(!socket.isClosed())
- {
- socket.setSoTimeout(tick <= 0 ? 1 : tick);
- }
- }
- catch(SocketException e)
- {
- // ignore - closed socket
- }
- }
- }
- }
- catch (SocketTimeoutException e)
- {
- currentTime = System.currentTimeMillis();
- if(_ticker != null)
- {
- final int tick = _ticker.tick(currentTime);
- if(!socket.isClosed())
- {
- try
- {
- socket.setSoTimeout(tick <= 0 ? 1 : tick );
- }
- catch(SocketException ex)
- {
- // ignore - closed socket
- }
- }
- }
- }
- }
- }
- catch (Exception t)
- {
- if (shouldReport(t))
- {
- receiver.exception(t);
- }
- }
- finally
- {
- receiver.closed();
- try
- {
- socket.close();
- }
- catch(Exception e)
- {
- log.warn(e, "Error closing socket");
- }
- }
- }
-
- private boolean shouldReport(Throwable t)
- {
- boolean brokenClose = closed.get() &&
- shutdownBroken &&
- t instanceof SocketException &&
- "socket closed".equalsIgnoreCase(t.getMessage());
-
- boolean sslSocketClosed = closed.get() &&
- socket instanceof SSLSocket &&
- t instanceof SocketException &&
- "Socket is closed".equalsIgnoreCase(t.getMessage());
-
- boolean recvFailed = closed.get() &&
- shutdownBroken &&
- t instanceof SocketException &&
- "Socket operation on nonsocket: recv failed".equalsIgnoreCase(t.getMessage());
-
- return !brokenClose && !sslSocketClosed && !recvFailed;
- }
-
- public Ticker getTicker()
- {
- return _ticker;
- }
-
- public void setTicker(Ticker ticker)
- {
- _ticker = ticker;
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoSender.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoSender.java
deleted file mode 100644
index cd01cddb05..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/io/IoSender.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpid.transport.network.io;
-
-import static org.apache.qpid.transport.util.Functions.mod;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.nio.ByteBuffer;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.net.ssl.SSLSocket;
-
-import org.apache.qpid.thread.Threading;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.SenderClosedException;
-import org.apache.qpid.transport.SenderException;
-import org.apache.qpid.transport.TransportException;
-import org.apache.qpid.transport.util.Logger;
-import org.apache.qpid.util.SystemUtils;
-
-
-public final class IoSender implements Runnable, ByteBufferSender
-{
-
- private static final Logger log = Logger.get(IoSender.class);
-
- // by starting here, we ensure that we always test the wraparound
- // case, we should probably make this configurable somehow so that
- // we can test other cases as well
- private final static int START = Integer.MAX_VALUE - 10;
-
- private final long timeout;
- private final Socket socket;
- private final OutputStream out;
-
- private final byte[] buffer;
- private volatile int head = START;
- private volatile int tail = START;
- private volatile boolean idle = true;
- private final Object notFull = new Object();
- private final Object notEmpty = new Object();
- private final AtomicBoolean closed = new AtomicBoolean(false);
- private final Thread senderThread;
- private IoReceiver _receiver;
- private final String _remoteSocketAddress;
- private static final boolean shutdownBroken;
-
- static
- {
- shutdownBroken = SystemUtils.isWindows();
- }
-
- private volatile Throwable exception = null;
-
- public IoSender(Socket socket, int bufferSize, long timeout)
- {
- this.socket = socket;
- this.buffer = new byte[pof2(bufferSize)]; // buffer size must be a power of 2
- this.timeout = timeout;
- _remoteSocketAddress = socket.getRemoteSocketAddress().toString();
-
- try
- {
- out = socket.getOutputStream();
- }
- catch (IOException e)
- {
- throw new TransportException("Error getting output stream for socket", e);
- }
-
- try
- {
- //Create but deliberately don't start the thread.
- senderThread = Threading.getThreadFactory().createThread(this);
- }
- catch(Exception e)
- {
- throw new Error("Error creating IOSender thread",e);
- }
-
- senderThread.setDaemon(true);
- senderThread.setName(String.format("IoSender-%s", _remoteSocketAddress));
- }
-
- public void initiate()
- {
- senderThread.start();
- }
-
- private static final int pof2(int n)
- {
- int result = 1;
- while (result < n)
- {
- result *= 2;
- }
- return result;
- }
-
- public void send(ByteBuffer buf)
- {
- checkNotAlreadyClosed();
-
- if(!senderThread.isAlive())
- {
- throw new SenderException(String.format("sender thread for socket %s is not alive", _remoteSocketAddress));
- }
-
- final int size = buffer.length;
- int remaining = buf.remaining();
-
- while (remaining > 0)
- {
- final int hd = head;
- final int tl = tail;
-
- if (hd - tl >= size)
- {
- flush();
- synchronized (notFull)
- {
- final long start = System.currentTimeMillis();
- long elapsed = 0;
- while (!closed.get() && head - tail >= size && elapsed < timeout)
- {
- try
- {
- notFull.wait(timeout - elapsed);
- }
- catch (InterruptedException e)
- {
- // pass
- }
- elapsed = System.currentTimeMillis() - start;
- }
-
- checkNotAlreadyClosed();
-
- if (head - tail >= size)
- {
- try
- {
- log.error("write timed out for socket %s: head %d, tail %d", _remoteSocketAddress, head, tail);
- throw new SenderException(String.format("write timed out for socket %s: head %d, tail %d", _remoteSocketAddress, head, tail));
- }
- finally
- {
- close(false, false);
- }
- }
- }
- continue;
- }
-
- final int hd_idx = mod(hd, size);
- final int tl_idx = mod(tl, size);
- final int length;
-
- if (tl_idx > hd_idx)
- {
- length = Math.min(tl_idx - hd_idx, remaining);
- }
- else
- {
- length = Math.min(size - hd_idx, remaining);
- }
-
- buf.get(buffer, hd_idx, length);
- head += length;
- remaining -= length;
- }
- }
-
- public void flush()
- {
- if (idle)
- {
- synchronized (notEmpty)
- {
- notEmpty.notify();
- }
- }
- }
-
- public void close()
- {
- close(true, true);
- }
-
- private void close(boolean awaitSenderBeforeClose, boolean reportException)
- {
- if (!closed.getAndSet(true))
- {
- synchronized (notFull)
- {
- notFull.notify();
- }
-
- synchronized (notEmpty)
- {
- notEmpty.notify();
- }
-
- try
- {
- if (awaitSenderBeforeClose)
- {
- awaitSenderThreadShutdown();
- }
- }
- finally
- {
- closeReceiver();
- }
- if (reportException && exception != null)
- {
- throw new SenderException(exception);
- }
- }
- }
-
- private void closeReceiver()
- {
- if(_receiver != null)
- {
- try
- {
- _receiver.close();
- }
- catch(RuntimeException e)
- {
- log.error(e, "Exception closing receiver for socket %s", _remoteSocketAddress);
- throw new SenderException(e.getMessage(), e);
- }
- }
- }
-
- public void run()
- {
- final int size = buffer.length;
- while (true)
- {
- final int hd = head;
- final int tl = tail;
-
- if (hd == tl)
- {
- if (closed.get())
- {
- break;
- }
-
- idle = true;
-
- synchronized (notEmpty)
- {
- while (head == tail && !closed.get())
- {
- try
- {
- notEmpty.wait();
- }
- catch (InterruptedException e)
- {
- // pass
- }
- }
- }
-
- idle = false;
-
- continue;
- }
-
- final int hd_idx = mod(hd, size);
- final int tl_idx = mod(tl, size);
-
- final int length;
- if (tl_idx < hd_idx)
- {
- length = hd_idx - tl_idx;
- }
- else
- {
- length = size - tl_idx;
- }
-
- try
- {
- out.write(buffer, tl_idx, length);
- }
- catch (IOException e)
- {
- log.info("Exception in thread sending to '" + _remoteSocketAddress + "': " + e);
- exception = e;
- close(false, false);
- break;
- }
- tail += length;
- if (head - tl >= size)
- {
- synchronized (notFull)
- {
- notFull.notify();
- }
- }
- }
-
- if (!shutdownBroken && !(socket instanceof SSLSocket))
- {
- try
- {
- socket.shutdownOutput();
- }
- catch (IOException e)
- {
- //pass
- }
- }
- }
-
- public void setReceiver(IoReceiver receiver)
- {
- _receiver = receiver;
- }
-
- private void awaitSenderThreadShutdown()
- {
- if (Thread.currentThread() != senderThread)
- {
- try
- {
- senderThread.join(timeout);
- if (senderThread.isAlive())
- {
- log.error("join timed out for socket %s to stop", _remoteSocketAddress);
- throw new SenderException(String.format("join timed out for socket %s to stop", _remoteSocketAddress));
- }
- }
- catch (InterruptedException e)
- {
- log.error("interrupted whilst waiting for sender thread for socket %s to stop", _remoteSocketAddress);
- throw new SenderException(e);
- }
- }
- }
-
- private void checkNotAlreadyClosed()
- {
- if (closed.get())
- {
- throw new SenderClosedException(String.format("sender for socket %s is closed", _remoteSocketAddress), exception);
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SSLStatus.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SSLStatus.java
deleted file mode 100644
index 9db7dd557a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SSLStatus.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.transport.network.security;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class SSLStatus
-{
- private final Object _sslLock = new Object();
- private final AtomicBoolean _sslErrorFlag = new AtomicBoolean(false);
-
- /**
- * Lock used to coordinate the SSL sender with the SSL receiver.
- *
- * @return lock
- */
- public Object getSslLock()
- {
- return _sslLock;
- }
-
- public boolean getSslErrorFlag()
- {
- return _sslErrorFlag.get();
- }
-
- public void setSslErrorFlag()
- {
- _sslErrorFlag.set(true);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayer.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayer.java
deleted file mode 100644
index 271135f411..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security;
-
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.ByteBufferSender;
-
-public interface SecurityLayer
-{
-
- public ByteBufferSender sender(ByteBufferSender delegate);
- public ByteBufferReceiver receiver(ByteBufferReceiver delegate);
- public String getUserID();
-
-}
-
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java
deleted file mode 100644
index d25e97ffe4..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-
-import org.apache.qpid.ssl.SSLContextFactory;
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.ConnectionSettings;
-import org.apache.qpid.transport.TransportException;
-import org.apache.qpid.transport.network.security.sasl.SASLReceiver;
-import org.apache.qpid.transport.network.security.sasl.SASLSender;
-import org.apache.qpid.transport.network.security.ssl.SSLReceiver;
-import org.apache.qpid.transport.network.security.ssl.SSLSender;
-import org.apache.qpid.transport.network.security.ssl.SSLUtil;
-
-public class SecurityLayerFactory
-{
- private SecurityLayerFactory()
- {
- }
-
- public static SecurityLayer newInstance(ConnectionSettings settings)
- {
-
- SecurityLayer layer = NullSecurityLayer.getInstance();
-
- if (settings.isUseSSL())
- {
- layer = new SSLSecurityLayer(settings, layer);
- }
- if (settings.isUseSASLEncryption())
- {
- layer = new SASLSecurityLayer(layer);
- }
-
- return layer;
-
- }
-
- static class SSLSecurityLayer implements SecurityLayer
- {
-
- private final SSLEngine _engine;
- private final SSLStatus _sslStatus = new SSLStatus();
- private String _hostname;
- private SecurityLayer _layer;
-
-
- public SSLSecurityLayer(ConnectionSettings settings, SecurityLayer layer)
- {
-
- SSLContext sslCtx;
- _layer = layer;
- try
- {
- sslCtx = SSLContextFactory
- .buildClientContext(settings.getTrustStorePath(),
- settings.getTrustStorePassword(),
- settings.getTrustStoreType(),
- settings.getTrustManagerFactoryAlgorithm(),
- settings.getKeyStorePath(),
- settings.getKeyStorePassword(),
- settings.getKeyStoreType(),
- settings.getKeyManagerFactoryAlgorithm(),
- settings.getCertAlias());
- }
- catch (Exception e)
- {
- throw new TransportException("Error creating SSL Context", e);
- }
-
- if(settings.isVerifyHostname())
- {
- _hostname = settings.getHost();
- }
-
- try
- {
- _engine = sslCtx.createSSLEngine();
- _engine.setUseClientMode(true);
- SSLUtil.removeSSLv3Support(_engine);
- }
- catch(Exception e)
- {
- throw new TransportException("Error creating SSL Engine", e);
- }
-
- }
-
- public ByteBufferSender sender(ByteBufferSender delegate)
- {
- SSLSender sender = new SSLSender(_engine, _layer.sender(delegate), _sslStatus);
- sender.setHostname(_hostname);
- return sender;
- }
-
- public ByteBufferReceiver receiver(ByteBufferReceiver delegate)
- {
- SSLReceiver receiver = new SSLReceiver(_engine, _layer.receiver(delegate), _sslStatus);
- receiver.setHostname(_hostname);
- return receiver;
- }
-
- public String getUserID()
- {
- return SSLUtil.retrieveIdentity(_engine);
- }
- }
-
-
- static class SASLSecurityLayer implements SecurityLayer
- {
-
- private SecurityLayer _layer;
-
- SASLSecurityLayer(SecurityLayer layer)
- {
- _layer = layer;
- }
-
- public SASLSender sender(ByteBufferSender delegate)
- {
- SASLSender sender = new SASLSender(_layer.sender(delegate));
- return sender;
- }
-
- public SASLReceiver receiver(ByteBufferReceiver delegate)
- {
- SASLReceiver receiver = new SASLReceiver(_layer.receiver(delegate));
- return receiver;
- }
-
- public String getUserID()
- {
- return _layer.getUserID();
- }
- }
-
-
- static class NullSecurityLayer implements SecurityLayer
- {
-
- private static final NullSecurityLayer INSTANCE = new NullSecurityLayer();
-
- private NullSecurityLayer()
- {
- }
-
- public ByteBufferSender sender(ByteBufferSender delegate)
- {
- return delegate;
- }
-
- public ByteBufferReceiver receiver(ByteBufferReceiver delegate)
- {
- return delegate;
- }
-
- public String getUserID()
- {
- return null;
- }
-
- public static NullSecurityLayer getInstance()
- {
- return INSTANCE;
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLEncryptor.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLEncryptor.java
deleted file mode 100644
index 5ef94b7d13..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLEncryptor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security.sasl;
-
-
-import java.util.List;
-
-import javax.security.sasl.Sasl;
-import javax.security.sasl.SaslClient;
-
-import org.apache.qpid.transport.Connection;
-import org.apache.qpid.transport.ConnectionException;
-import org.apache.qpid.transport.ConnectionListener;
-
-public abstract class SASLEncryptor implements ConnectionListener
-{
- private SaslClient saslClient;
- private boolean securityLayerEstablished = false;
- private int sendBuffSize;
- private int recvBuffSize;
-
- public boolean isSecurityLayerEstablished()
- {
- return securityLayerEstablished;
- }
-
- public void opened(Connection conn)
- {
- if (conn.getSaslClient() != null)
- {
- saslClient = conn.getSaslClient();
- if (saslClient.isComplete() && "auth-conf".equals(saslClient.getNegotiatedProperty(Sasl.QOP)))
- {
- sendBuffSize = Integer.parseInt(
- (String)saslClient.getNegotiatedProperty(Sasl.RAW_SEND_SIZE));
- recvBuffSize = Integer.parseInt(
- (String)saslClient.getNegotiatedProperty(Sasl.MAX_BUFFER));
- securityLayerEstablished();
- securityLayerEstablished = true;
- }
- }
- }
-
- @Override
- public boolean redirect(final String host, final List<Object> knownHosts)
- {
- return false;
- }
-
- public void exception(Connection conn, ConnectionException exception){}
- public void closed(Connection conn) {}
-
- public abstract void securityLayerEstablished();
-
- public SaslClient getSaslClient()
- {
- return saslClient;
- }
-
- public int getSendBuffSize()
- {
- return sendBuffSize;
- }
-
- public int getRecvBuffSize()
- {
- return recvBuffSize;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java
deleted file mode 100644
index 983e3bdf90..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security.sasl;
-
-
-import java.nio.ByteBuffer;
-
-import javax.security.sasl.SaslException;
-
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.SenderException;
-import org.apache.qpid.transport.util.Logger;
-
-public class SASLReceiver extends SASLEncryptor implements ByteBufferReceiver {
-
- private ByteBufferReceiver delegate;
- private byte[] netData;
- private static final Logger log = Logger.get(SASLReceiver.class);
-
- public SASLReceiver(ByteBufferReceiver delegate)
- {
- this.delegate = delegate;
- }
-
- public void closed()
- {
- delegate.closed();
- }
-
-
- public void exception(Throwable t)
- {
- delegate.exception(t);
- }
-
- public void received(ByteBuffer buf)
- {
- if (isSecurityLayerEstablished())
- {
- while (buf.hasRemaining())
- {
- int length = Math.min(buf.remaining(), getRecvBuffSize());
- buf.get(netData, 0, length);
- try
- {
- byte[] out = getSaslClient().unwrap(netData, 0, length);
- delegate.received(ByteBuffer.wrap(out));
- }
- catch (SaslException e)
- {
- throw new SenderException("SASL Sender, Error occurred while encrypting data",e);
- }
- }
- }
- else
- {
- delegate.received(buf);
- }
- }
-
- public void securityLayerEstablished()
- {
- netData = new byte[getRecvBuffSize()];
- log.debug("SASL Security Layer Established");
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLSender.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLSender.java
deleted file mode 100644
index 335f8992ca..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLSender.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security.sasl;
-
-
-import java.nio.ByteBuffer;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.security.sasl.SaslException;
-
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.SenderException;
-import org.apache.qpid.transport.util.Logger;
-
-public class SASLSender extends SASLEncryptor implements ByteBufferSender
-{
-
- private ByteBufferSender delegate;
- private byte[] appData;
- private final AtomicBoolean closed = new AtomicBoolean(false);
- private static final Logger log = Logger.get(SASLSender.class);
-
- public SASLSender(ByteBufferSender delegate)
- {
- this.delegate = delegate;
- log.debug("SASL Sender enabled");
- }
-
- public void close()
- {
-
- if (!closed.getAndSet(true))
- {
- delegate.close();
- if (isSecurityLayerEstablished())
- {
- try
- {
- getSaslClient().dispose();
- }
- catch (SaslException e)
- {
- throw new SenderException("Error closing SASL Sender",e);
- }
- }
- }
- }
-
- public void flush()
- {
- delegate.flush();
- }
-
- public void send(ByteBuffer buf)
- {
- if (closed.get())
- {
- throw new SenderException("SSL Sender is closed");
- }
-
- if (isSecurityLayerEstablished())
- {
- while (buf.hasRemaining())
- {
- int length = Math.min(buf.remaining(), getSendBuffSize());
- log.debug("sendBuffSize %s", getSendBuffSize());
- log.debug("buf.remaining() %s", buf.remaining());
-
- buf.get(appData, 0, length);
- try
- {
- byte[] out = getSaslClient().wrap(appData, 0, length);
- log.debug("out.length %s", out.length);
-
- delegate.send(ByteBuffer.wrap(out));
- }
- catch (SaslException e)
- {
- log.error("Exception while encrypting data.",e);
- throw new SenderException("SASL Sender, Error occurred while encrypting data",e);
- }
- }
- }
- else
- {
- delegate.send(buf);
- }
- }
-
- public void securityLayerEstablished()
- {
- appData = new byte[getSendBuffSize()];
- log.debug("SASL Security Layer Established");
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java
deleted file mode 100644
index c61684e2bb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security.ssl;
-
-import org.apache.qpid.transport.util.Logger;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.X509ExtendedKeyManager;
-import java.io.IOException;
-import java.net.Socket;
-import java.net.URL;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.Principal;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
-
-public class QpidClientX509KeyManager extends X509ExtendedKeyManager
-{
- private static final Logger log = Logger.get(QpidClientX509KeyManager.class);
-
- private X509ExtendedKeyManager delegate;
- private String alias;
-
- public QpidClientX509KeyManager(String alias, String keyStorePath, String keyStoreType,
- String keyStorePassword, String keyManagerFactoryAlgorithmName) throws GeneralSecurityException, IOException
- {
- this.alias = alias;
- KeyStore ks = SSLUtil.getInitializedKeyStore(keyStorePath,keyStorePassword,keyStoreType);
- KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyManagerFactoryAlgorithmName);
- kmf.init(ks, keyStorePassword.toCharArray());
- this.delegate = (X509ExtendedKeyManager)kmf.getKeyManagers()[0];
- }
-
- public QpidClientX509KeyManager(String alias, URL keyStoreUrl, String keyStoreType,
- String keyStorePassword, String keyManagerFactoryAlgorithmName) throws GeneralSecurityException, IOException
- {
- this.alias = alias;
- KeyStore ks = SSLUtil.getInitializedKeyStore(keyStoreUrl,keyStorePassword,keyStoreType);
- KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyManagerFactoryAlgorithmName);
- kmf.init(ks, keyStorePassword.toCharArray());
- this.delegate = (X509ExtendedKeyManager)kmf.getKeyManagers()[0];
- }
-
- public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)
- {
- log.debug("chooseClientAlias:Returning alias " + alias);
- return alias;
- }
-
- public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
- {
- return delegate.chooseServerAlias(keyType, issuers, socket);
- }
-
- public X509Certificate[] getCertificateChain(String alias)
- {
- return delegate.getCertificateChain(alias);
- }
-
- public String[] getClientAliases(String keyType, Principal[] issuers)
- {
- log.debug("getClientAliases:Returning alias " + alias);
- return new String[]{alias};
- }
-
- public PrivateKey getPrivateKey(String alias)
- {
- return delegate.getPrivateKey(alias);
- }
-
- public String[] getServerAliases(String keyType, Principal[] issuers)
- {
- return delegate.getServerAliases(keyType, issuers);
- }
-
- public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine)
- {
- log.debug("chooseEngineClientAlias:Returning alias " + alias);
- return alias;
- }
-
- public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine)
- {
- return delegate.chooseEngineServerAlias(keyType, issuers, engine);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidMultipleTrustManager.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidMultipleTrustManager.java
deleted file mode 100644
index 0705f31fcb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidMultipleTrustManager.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-package org.apache.qpid.transport.network.security.ssl;
-
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import javax.net.ssl.X509TrustManager;
-
-/**
- * Supports multiple X509TrustManager(s). Check succeeds if any of the
- * underlying managers succeeds.
- */
-public class QpidMultipleTrustManager implements X509TrustManager {
-
- private List<X509TrustManager> trustManagers;
-
- public QpidMultipleTrustManager() {
- this.trustManagers = new ArrayList<X509TrustManager>();
- }
-
- public boolean isEmpty()
- {
- return trustManagers.isEmpty();
- }
-
- public void addTrustManager(final X509TrustManager trustManager)
- {
- this.trustManagers.add(trustManager);
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- for (X509TrustManager trustManager : this.trustManagers)
- {
- try
- {
- trustManager.checkClientTrusted(chain, authType);
- // this trustManager check succeeded, no need to check another one
- return;
- }
- catch(CertificateException ex)
- {
- // do nothing, try another one in a loop
- }
- }
- // no trustManager call succeeded, throw an exception
- throw new CertificateException();
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- for (X509TrustManager trustManager : this.trustManagers)
- {
- try
- {
- trustManager.checkServerTrusted(chain, authType);
- // this trustManager check succeeded, no need to check another one
- return;
- }
- catch(CertificateException ex)
- {
- // do nothing, try another one in a loop
- }
- }
- // no trustManager call succeeded, throw an exception
- throw new CertificateException();
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- final Collection<X509Certificate> accIssuersCol = new ArrayList<X509Certificate>();
- for (X509TrustManager trustManager : this.trustManagers)
- {
- accIssuersCol.addAll(Arrays.asList(trustManager.getAcceptedIssuers()));
- }
- return accIssuersCol.toArray(new X509Certificate[accIssuersCol.size()]);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidPeersOnlyTrustManager.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidPeersOnlyTrustManager.java
deleted file mode 100644
index c988ff8d69..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidPeersOnlyTrustManager.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-package org.apache.qpid.transport.network.security.ssl;
-
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.net.ssl.X509TrustManager;
-
-/**
- * TrustManager implementation which accepts the client certificate
- * only if the underlying check by the delegate pass through and
- * the certificate is physically saved in the truststore.
- */
-public class QpidPeersOnlyTrustManager implements X509TrustManager {
-
- final private KeyStore ts;
- final private X509TrustManager delegate;
- final List<Certificate> trustedCerts = new ArrayList<Certificate>();
-
- public QpidPeersOnlyTrustManager(KeyStore ts, X509TrustManager trustManager) throws KeyStoreException {
- this.ts = ts;
- this.delegate = trustManager;
- Enumeration<String> aliases = this.ts.aliases();
- while (aliases.hasMoreElements())
- {
- trustedCerts.add(ts.getCertificate(aliases.nextElement()));
- }
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- this.delegate.checkClientTrusted(chain, authType);
- for (Certificate serverTrustedCert : this.trustedCerts)
- {
- // first position in the chain contains the peer's own certificate
- if (chain[0].equals(serverTrustedCert))
- return; // peer's certificate found in the store
- }
- // peer's certificate was not found in the store, do not trust the client
- throw new CertificateException();
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- this.delegate.checkServerTrusted(chain, authType);
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- // return empty array since this implementation of TrustManager doesn't
- // rely on certification authorities
- return new X509Certificate[0];
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLBufferingSender.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLBufferingSender.java
deleted file mode 100644
index e69de29bb2..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLBufferingSender.java
+++ /dev/null
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLReceiver.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLReceiver.java
deleted file mode 100644
index 49e4ad631a..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLReceiver.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security.ssl;
-
-import java.nio.ByteBuffer;
-
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLEngineResult;
-import javax.net.ssl.SSLEngineResult.HandshakeStatus;
-import javax.net.ssl.SSLEngineResult.Status;
-import javax.net.ssl.SSLException;
-
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.TransportException;
-import org.apache.qpid.transport.network.security.SSLStatus;
-import org.apache.qpid.transport.util.Logger;
-
-public class SSLReceiver implements ByteBufferReceiver
-{
- private static final Logger log = Logger.get(SSLReceiver.class);
-
- private final ByteBufferReceiver delegate;
- private final SSLEngine engine;
- private final int sslBufSize;
- private final ByteBuffer localBuffer;
- private final SSLStatus _sslStatus;
- private ByteBuffer appData;
- private boolean dataCached = false;
-
- private String _hostname;
-
- public SSLReceiver(final SSLEngine engine, final ByteBufferReceiver delegate, final SSLStatus sslStatus)
- {
- this.engine = engine;
- this.delegate = delegate;
- this.sslBufSize = engine.getSession().getApplicationBufferSize();
- appData = ByteBuffer.allocate(sslBufSize);
- localBuffer = ByteBuffer.allocate(sslBufSize);
- _sslStatus = sslStatus;
- }
-
- public void setHostname(String hostname)
- {
- _hostname = hostname;
- }
-
- public void closed()
- {
- delegate.closed();
- }
-
- public void exception(Throwable t)
- {
- delegate.exception(t);
- }
-
- private ByteBuffer addPreviouslyUnreadData(ByteBuffer buf)
- {
- if (dataCached)
- {
- ByteBuffer b = ByteBuffer.allocate(localBuffer.remaining() + buf.remaining());
- b.put(localBuffer);
- b.put(buf);
- b.flip();
- dataCached = false;
- return b;
- }
- else
- {
- return buf;
- }
- }
-
- public void received(ByteBuffer buf)
- {
- ByteBuffer netData = addPreviouslyUnreadData(buf);
-
- HandshakeStatus handshakeStatus;
- Status status;
-
- while (netData.hasRemaining())
- {
- try
- {
- SSLEngineResult result = engine.unwrap(netData, appData);
- synchronized (_sslStatus.getSslLock())
- {
- _sslStatus.getSslLock().notifyAll();
- }
-
- int read = result.bytesProduced();
- status = result.getStatus();
- handshakeStatus = result.getHandshakeStatus();
-
- if (read > 0)
- {
- int limit = appData.limit();
- appData.limit(appData.position());
- appData.position(appData.position() - read);
-
- ByteBuffer data = appData.slice();
-
- appData.limit(limit);
- appData.position(appData.position() + read);
-
- delegate.received(data);
- }
-
-
- switch(status)
- {
- case CLOSED:
- synchronized(_sslStatus.getSslLock())
- {
- _sslStatus.getSslLock().notifyAll();
- }
- return;
-
- case BUFFER_OVERFLOW:
- appData = ByteBuffer.allocate(sslBufSize);
- continue;
-
- case BUFFER_UNDERFLOW:
- localBuffer.clear();
- localBuffer.put(netData);
- localBuffer.flip();
- dataCached = true;
- break;
-
- case OK:
- break; // do nothing
-
- default:
- throw new IllegalStateException("SSLReceiver: Invalid State " + status);
- }
-
- switch (handshakeStatus)
- {
- case NEED_UNWRAP:
- if (netData.hasRemaining())
- {
- continue;
- }
- break;
-
- case NEED_TASK:
- doTasks();
- handshakeStatus = engine.getHandshakeStatus();
-
- case FINISHED:
- if (_hostname != null)
- {
- SSLUtil.verifyHostname(engine, _hostname);
- }
-
- case NEED_WRAP:
- case NOT_HANDSHAKING:
- synchronized(_sslStatus.getSslLock())
- {
- _sslStatus.getSslLock().notifyAll();
- }
- break;
-
- default:
- throw new IllegalStateException("SSLReceiver: Invalid State " + status);
- }
-
-
- }
- catch(SSLException e)
- {
- if (log.isDebugEnabled())
- {
- log.debug(e, "Error caught in SSLReceiver");
- }
- _sslStatus.setSslErrorFlag();
- synchronized(_sslStatus.getSslLock())
- {
- _sslStatus.getSslLock().notifyAll();
- }
- exception(new TransportException("Error in SSLReceiver: " + e.getMessage(),e));
- }
-
- }
- }
-
- private void doTasks()
- {
- Runnable runnable;
- while ((runnable = engine.getDelegatedTask()) != null) {
- runnable.run();
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLSender.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLSender.java
deleted file mode 100644
index 3d133cb9b7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLSender.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security.ssl;
-
-import java.nio.ByteBuffer;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLEngineResult;
-import javax.net.ssl.SSLEngineResult.HandshakeStatus;
-import javax.net.ssl.SSLEngineResult.Status;
-import javax.net.ssl.SSLException;
-
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.SenderException;
-import org.apache.qpid.transport.network.security.SSLStatus;
-import org.apache.qpid.transport.util.Logger;
-
-public class SSLSender implements ByteBufferSender
-{
- private static final Logger log = Logger.get(SSLSender.class);
-
- private final ByteBufferSender delegate;
- private final SSLEngine engine;
- private final int sslBufSize;
- private final ByteBuffer netData;
- private final long timeout;
- private final SSLStatus _sslStatus;
-
- private String _hostname;
-
- private final AtomicBoolean closed = new AtomicBoolean(false);
-
-
- public SSLSender(SSLEngine engine, ByteBufferSender delegate, SSLStatus sslStatus)
- {
- this.engine = engine;
- this.delegate = delegate;
- sslBufSize = engine.getSession().getPacketBufferSize();
- netData = ByteBuffer.allocate(sslBufSize);
- timeout = Long.getLong("qpid.ssl_timeout", 60000);
- _sslStatus = sslStatus;
- }
-
- public void setHostname(String hostname)
- {
- _hostname = hostname;
- }
-
- public void close()
- {
- if (!closed.getAndSet(true))
- {
- if (engine.isOutboundDone())
- {
- return;
- }
- log.debug("Closing SSL connection");
-
- engine.closeOutbound();
- try
- {
- tearDownSSLConnection();
- }
- catch(Exception e)
- {
- throw new SenderException("Error closing SSL connection",e);
- }
-
-
- synchronized(_sslStatus.getSslLock())
- {
- while (!engine.isOutboundDone())
- {
- try
- {
- _sslStatus.getSslLock().wait();
- }
- catch(InterruptedException e)
- {
- // pass
- }
-
- }
- }
- delegate.close();
- }
- }
-
- private void tearDownSSLConnection() throws Exception
- {
- SSLEngineResult result = engine.wrap(ByteBuffer.allocate(0), netData);
- Status status = result.getStatus();
- int read = result.bytesProduced();
- while (status != Status.CLOSED)
- {
- if (status == Status.BUFFER_OVERFLOW)
- {
- netData.clear();
- }
- if(read > 0)
- {
- int limit = netData.limit();
- netData.limit(netData.position());
- netData.position(netData.position() - read);
-
- ByteBuffer data = netData.slice();
-
- netData.limit(limit);
- netData.position(netData.position() + read);
-
- delegate.send(data);
- flush();
- }
- result = engine.wrap(ByteBuffer.allocate(0), netData);
- status = result.getStatus();
- read = result.bytesProduced();
- }
- }
-
- public void flush()
- {
- delegate.flush();
- }
-
- public void send(ByteBuffer appData)
- {
- if (closed.get() && !_sslStatus.getSslErrorFlag())
- {
- throw new SenderException("SSL Sender is closed");
- }
-
- HandshakeStatus handshakeStatus;
- Status status;
-
- while(appData.hasRemaining() && !_sslStatus.getSslErrorFlag())
- {
- int read = 0;
- try
- {
- SSLEngineResult result = engine.wrap(appData, netData);
- read = result.bytesProduced();
- status = result.getStatus();
- handshakeStatus = result.getHandshakeStatus();
- }
- catch(SSLException e)
- {
- // Should this set _sslError??
- throw new SenderException("SSL, Error occurred while encrypting data",e);
- }
-
- if(read > 0)
- {
- int limit = netData.limit();
- netData.limit(netData.position());
- netData.position(netData.position() - read);
-
- ByteBuffer data = netData.slice();
-
- netData.limit(limit);
- netData.position(netData.position() + read);
-
- delegate.send(data);
- }
-
- switch(status)
- {
- case CLOSED:
- throw new SenderException("SSLEngine is closed");
-
- case BUFFER_OVERFLOW:
- netData.clear();
- continue;
-
- case OK:
- break; // do nothing
-
- default:
- throw new IllegalStateException("SSLReceiver: Invalid State " + status);
- }
-
- switch (handshakeStatus)
- {
- case NEED_WRAP:
- if (netData.hasRemaining())
- {
- continue;
- }
-
- case NEED_TASK:
- doTasks();
- break;
-
- case NEED_UNWRAP:
- flush();
- synchronized(_sslStatus.getSslLock())
- {
- if (_sslStatus.getSslErrorFlag())
- {
- break;
- }
-
- switch (engine.getHandshakeStatus())
- {
- case NEED_UNWRAP:
- final long start = System.currentTimeMillis();
- try
- {
- _sslStatus.getSslLock().wait(timeout);
- }
- catch(InterruptedException e)
- {
- // pass
- }
-
- if (!_sslStatus.getSslErrorFlag() && System.currentTimeMillis() - start >= timeout)
- {
- throw new SenderException(
- "SSL Engine timed out after waiting " + timeout + "ms. for a response." +
- "To get more info,run with -Djavax.net.debug=ssl");
- }
- break;
- }
- }
- break;
-
- case FINISHED:
- if (_hostname != null)
- {
- SSLUtil.verifyHostname(engine, _hostname);
- }
-
- case NOT_HANDSHAKING:
- break; //do nothing
-
- default:
- throw new IllegalStateException("SSLSender: Invalid State " + status);
- }
-
- }
- }
-
- private void doTasks()
- {
- Runnable runnable;
- while ((runnable = engine.getDelegatedTask()) != null) {
- runnable.run();
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java
deleted file mode 100644
index 67dde84440..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security.ssl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.net.URL;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.Principal;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateParsingException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import javax.naming.InvalidNameException;
-import javax.naming.ldap.LdapName;
-import javax.naming.ldap.Rdn;
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLPeerUnverifiedException;
-import javax.net.ssl.SSLServerSocket;
-import javax.net.ssl.SSLSocket;
-
-import org.apache.qpid.transport.TransportException;
-import org.apache.qpid.transport.util.Logger;
-
-public class SSLUtil
-{
- private static final Logger log = Logger.get(SSLUtil.class);
- private static final Integer DNS_NAME_TYPE = 2;
- public static final String SSLV3_PROTOCOL = "SSLv3";
-
- private SSLUtil()
- {
- }
-
- public static void verifyHostname(SSLEngine engine,String hostnameExpected)
- {
- try
- {
- Certificate cert = engine.getSession().getPeerCertificates()[0];
- verifyHostname(hostnameExpected, (X509Certificate) cert);
- }
- catch(SSLPeerUnverifiedException e)
- {
- log.warn("Exception received while trying to verify hostname",e);
- // For some reason the SSL engine sets the handshake status to FINISH twice
- // in succession. The first time the peer certificate
- // info is not available. The second time it works !
- // Therefore have no choice but to ignore the exception here.
- }
- }
-
- public static void verifyHostname(final String hostnameExpected, final X509Certificate cert)
- {
- Principal p = cert.getSubjectDN();
-
- SortedSet<String> names = new TreeSet<>();
- String dn = p.getName();
- try
- {
- LdapName ldapName = new LdapName(dn);
- for (Rdn part : ldapName.getRdns())
- {
- if (part.getType().equalsIgnoreCase("CN"))
- {
- names.add(part.getValue().toString());
- break;
- }
- }
-
- if(cert.getSubjectAlternativeNames() != null)
- {
- for (List<?> entry : cert.getSubjectAlternativeNames())
- {
- if (DNS_NAME_TYPE.equals(entry.get(0)))
- {
- names.add((String) entry.get(1));
- }
- }
- }
-
- if (names.isEmpty())
- {
- throw new TransportException("SSL hostname verification failed. Certificate for did not contain CN or DNS subjectAlt");
- }
-
- boolean match = false;
-
- final String hostName = hostnameExpected.trim().toLowerCase();
- for (String cn : names)
- {
-
- boolean doWildcard = cn.startsWith("*.") &&
- cn.lastIndexOf('.') >= 3 &&
- !cn.matches("\\*\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
-
-
- match = doWildcard
- ? hostName.endsWith(cn.substring(1)) && hostName.indexOf(".") == (1 + hostName.length() - cn.length())
- : hostName.equals(cn);
-
- if (match)
- {
- break;
- }
-
- }
- if (!match)
- {
- throw new TransportException("SSL hostname verification failed." +
- " Expected : " + hostnameExpected +
- " Found in cert : " + names);
- }
-
- }
- catch (InvalidNameException e)
- {
- throw new TransportException("SSL hostname verification failed. Could not parse name " + dn, e);
- }
- catch (CertificateParsingException e)
- {
- throw new TransportException("SSL hostname verification failed. Could not parse certificate: " + e.getMessage(), e);
- }
- }
-
- public static String getIdFromSubjectDN(String dn)
- {
- String cnStr = null;
- String dcStr = null;
- if(dn == null)
- {
- return "";
- }
- else
- {
- try
- {
- LdapName ln = new LdapName(dn);
- for(Rdn rdn : ln.getRdns())
- {
- if("CN".equalsIgnoreCase(rdn.getType()))
- {
- cnStr = rdn.getValue().toString();
- }
- else if("DC".equalsIgnoreCase(rdn.getType()))
- {
- if(dcStr == null)
- {
- dcStr = rdn.getValue().toString();
- }
- else
- {
- dcStr = rdn.getValue().toString() + '.' + dcStr;
- }
- }
- }
- return cnStr == null || cnStr.length()==0 ? "" : dcStr == null ? cnStr : cnStr + '@' + dcStr;
- }
- catch (InvalidNameException e)
- {
- log.warn("Invalid name: '"+dn+"'. ");
- return "";
- }
- }
- }
-
-
- public static String retrieveIdentity(SSLEngine engine)
- {
- String id = "";
- Certificate cert = engine.getSession().getLocalCertificates()[0];
- Principal p = ((X509Certificate)cert).getSubjectDN();
- String dn = p.getName();
- try
- {
- id = SSLUtil.getIdFromSubjectDN(dn);
- }
- catch (Exception e)
- {
- log.info("Exception received while trying to retrieve client identity from SSL cert", e);
- }
- log.debug("Extracted Identity from client certificate : " + id);
- return id;
- }
-
- public static KeyStore getInitializedKeyStore(String storePath, String storePassword, String keyStoreType) throws GeneralSecurityException, IOException
- {
- KeyStore ks = KeyStore.getInstance(keyStoreType);
- InputStream in = null;
- try
- {
- File f = new File(storePath);
- if (f.exists())
- {
- in = new FileInputStream(f);
- }
- else
- {
- in = Thread.currentThread().getContextClassLoader().getResourceAsStream(storePath);
- }
- if (in == null && !"PKCS11".equalsIgnoreCase(keyStoreType)) // PKCS11 will not require an explicit path
- {
- throw new IOException("Unable to load keystore resource: " + storePath);
- }
-
- char[] storeCharPassword = storePassword == null ? null : storePassword.toCharArray();
-
- ks.load(in, storeCharPassword);
- }
- finally
- {
- if (in != null)
- {
- //noinspection EmptyCatchBlock
- try
- {
- in.close();
- }
- catch (IOException ignored)
- {
- }
- }
- }
- return ks;
- }
-
- public static KeyStore getInitializedKeyStore(URL storePath, String storePassword, String keyStoreType) throws GeneralSecurityException, IOException
- {
- KeyStore ks = KeyStore.getInstance(keyStoreType);
- try(InputStream in = storePath.openStream())
- {
- if (in == null && !"PKCS11".equalsIgnoreCase(keyStoreType)) // PKCS11 will not require an explicit path
- {
- throw new IOException("Unable to load keystore resource: " + storePath);
- }
-
- char[] storeCharPassword = storePassword == null ? null : storePassword.toCharArray();
-
- ks.load(in, storeCharPassword);
- }
- return ks;
- }
-
- private static interface SSLEntity
- {
- String[] getEnabledCipherSuites();
-
- void setEnabledCipherSuites(String[] strings);
-
- String[] getEnabledProtocols();
-
- void setEnabledProtocols(String[] protocols);
-
- String[] getSupportedCipherSuites();
-
- String[] getSupportedProtocols();
- }
-
- private static SSLEntity asSSLEntity(final Object object, final Class<?> clazz)
- {
- return (SSLEntity) Proxy.newProxyInstance(SSLEntity.class.getClassLoader(), new Class[] { SSLEntity.class }, new InvocationHandler()
- {
- @Override
- public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable
- {
- Method delegateMethod = clazz.getMethod(method.getName(), method.getParameterTypes());
- return delegateMethod.invoke(object, args);
- }
- }) ;
- }
-
- private static void removeSSLv3Support(final SSLEntity engine)
- {
- List<String> enabledProtocols = Arrays.asList(engine.getEnabledProtocols());
- if(enabledProtocols.contains(SSLV3_PROTOCOL))
- {
- List<String> allowedProtocols = new ArrayList<>(enabledProtocols);
- allowedProtocols.remove(SSLV3_PROTOCOL);
- engine.setEnabledProtocols(allowedProtocols.toArray(new String[allowedProtocols.size()]));
- }
- }
-
- public static void removeSSLv3Support(final SSLEngine engine)
- {
- removeSSLv3Support(asSSLEntity(engine, SSLEngine.class));
- }
-
- public static void removeSSLv3Support(final SSLSocket socket)
- {
- removeSSLv3Support(asSSLEntity(socket, SSLSocket.class));
- }
-
- public static void removeSSLv3Support(final SSLServerSocket socket)
- {
- removeSSLv3Support(asSSLEntity(socket, SSLServerSocket.class));
- }
-
- private static void updateEnabledCipherSuites(final SSLEntity entity,
- final Collection<String> enabledCipherSuites,
- final Collection<String> disabledCipherSuites)
- {
- if(enabledCipherSuites != null && !enabledCipherSuites.isEmpty())
- {
- final Set<String> supportedSuites =
- new HashSet<>(Arrays.asList(entity.getSupportedCipherSuites()));
- supportedSuites.retainAll(enabledCipherSuites);
- entity.setEnabledCipherSuites(supportedSuites.toArray(new String[supportedSuites.size()]));
- }
-
- if(disabledCipherSuites != null && !disabledCipherSuites.isEmpty())
- {
- final Set<String> enabledSuites = new HashSet<>(Arrays.asList(entity.getEnabledCipherSuites()));
- enabledSuites.removeAll(disabledCipherSuites);
- entity.setEnabledCipherSuites(enabledSuites.toArray(new String[enabledSuites.size()]));
- }
-
- }
-
-
- public static void updateEnabledCipherSuites(final SSLEngine engine,
- final Collection<String> enabledCipherSuites,
- final Collection<String> disabledCipherSuites)
- {
- updateEnabledCipherSuites(asSSLEntity(engine, SSLEngine.class), enabledCipherSuites, disabledCipherSuites);
- }
-
- public static void updateEnabledCipherSuites(final SSLServerSocket socket,
- final Collection<String> enabledCipherSuites,
- final Collection<String> disabledCipherSuites)
- {
- updateEnabledCipherSuites(asSSLEntity(socket, SSLServerSocket.class), enabledCipherSuites, disabledCipherSuites);
- }
-
- public static void updateEnabledCipherSuites(final SSLSocket socket,
- final Collection<String> enabledCipherSuites,
- final Collection<String> disabledCipherSuites)
- {
- updateEnabledCipherSuites(asSSLEntity(socket, SSLSocket.class), enabledCipherSuites, disabledCipherSuites);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java
deleted file mode 100644
index 61d5f0629c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.util;
-
-import static java.lang.Math.min;
-
-import java.nio.ByteBuffer;
-
-
-/**
- * Functions
- *
- * @author Rafael H. Schloming
- */
-
-public final class Functions
-{
- private static final char[] HEX_CHARACTERS =
- {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-
- private Functions()
- {
- }
-
- public static final int mod(int n, int m)
- {
- int r = n % m;
- return r < 0 ? m + r : r;
- }
-
- public static final byte lsb(int i)
- {
- return (byte) (0xFF & i);
- }
-
- public static final byte lsb(long l)
- {
- return (byte) (0xFF & l);
- }
-
- public static final String str(ByteBuffer buf)
- {
- return str(buf, buf.remaining());
- }
-
- public static final String str(ByteBuffer buf, int limit)
- {
- return str(buf, limit,buf.position());
- }
-
- public static final String str(ByteBuffer buf, int limit,int start)
- {
- StringBuilder str = new StringBuilder();
- str.append('"');
-
- for (int i = start; i < min(buf.limit(), limit); i++)
- {
- byte c = buf.get(i);
-
- if (c > 31 && c < 127 && c != '\\')
- {
- str.append((char)c);
- }
- else
- {
- str.append(String.format("\\x%02x", c));
- }
- }
-
- str.append('"');
-
- if (limit < buf.remaining())
- {
- str.append("...");
- }
-
- return str.toString();
- }
-
- public static final String str(byte[] bytes)
- {
- return str(ByteBuffer.wrap(bytes));
- }
-
- public static final String str(byte[] bytes, int limit)
- {
- return str(ByteBuffer.wrap(bytes), limit);
- }
-
- public static String hex(byte[] bytes, int limit)
- {
- limit = Math.min(limit, bytes == null ? 0 : bytes.length);
- StringBuilder sb = new StringBuilder(3 + limit*2);
- for(int i = 0; i < limit; i++)
- {
- sb.append(HEX_CHARACTERS[(((int)bytes[i]) & 0xf0)>>4]);
- sb.append(HEX_CHARACTERS[(((int)bytes[i]) & 0x0f)]);
-
- }
- if(bytes != null && bytes.length>limit)
- {
- sb.append("...");
- }
- return sb.toString();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Logger.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Logger.java
deleted file mode 100644
index 8c4818df92..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Logger.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.util;
-
-import org.slf4j.LoggerFactory;
-
-/**
- * Logger
- *
- */
-
-public final class Logger
-{
-
- public static final Logger get(Class<?> klass)
- {
- return new Logger(LoggerFactory.getLogger(klass));
- }
-
- private final org.slf4j.Logger log;
-
- private Logger(org.slf4j.Logger log)
- {
- this.log = log;
- }
-
- public boolean isDebugEnabled()
- {
- return log.isDebugEnabled();
- }
-
- public void debug(String message, Object ... args)
- {
- if (log.isDebugEnabled())
- {
- log.debug(String.format(message, args));
- }
- }
-
- public void debug(Throwable t, String message, Object ... args)
- {
- if (log.isDebugEnabled())
- {
- log.debug(String.format(message, args), t);
- }
- }
-
- public void error(String message, Object ... args)
- {
- if (log.isErrorEnabled())
- {
- log.error(String.format(message, args));
- }
- }
-
- public void error(Throwable t, String message, Object ... args)
- {
- if (log.isErrorEnabled())
- {
- log.error(String.format(message, args), t);
- }
- }
-
- public void warn(String message, Object ... args)
- {
- if (log.isWarnEnabled())
- {
- log.warn(String.format(message, args));
- }
- }
-
- public void warn(Throwable t, String message, Object ... args)
- {
- if (log.isWarnEnabled())
- {
- log.warn(String.format(message, args), t);
- }
- }
-
- public void info(String message, Object ... args)
- {
- if (log.isInfoEnabled())
- {
- log.info(String.format(message, args));
- }
- }
-
- public void info(Throwable t, String message, Object ... args)
- {
- if (log.isInfoEnabled())
- {
- log.info(String.format(message, args), t);
- }
- }
-
- public void trace(String message, Object ... args)
- {
- if (log.isTraceEnabled())
- {
- log.trace(String.format(message, args));
- }
- }
-
- public void trace(Throwable t, String message, Object ... args)
- {
- if (log.isTraceEnabled())
- {
- log.trace(String.format(message, args), t);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Waiter.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Waiter.java
deleted file mode 100644
index e034d779ca..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Waiter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.util;
-
-
-/**
- * Waiter
- *
- */
-
-public final class Waiter
-{
-
- private final Object lock;
- private final long timeout;
- private final long start;
- private long elapsed;
-
- public Waiter(Object lock, long timeout)
- {
- this.lock = lock;
- this.timeout = timeout;
- this.start = System.currentTimeMillis();
- this.elapsed = 0;
- }
-
- public boolean hasTime()
- {
- return elapsed < timeout;
- }
-
- public void await()
- {
- try
- {
- lock.wait(timeout - elapsed);
- }
- catch (InterruptedException e)
- {
- // pass
- }
- elapsed = System.currentTimeMillis() - start;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesCodes.java b/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesCodes.java
deleted file mode 100644
index 0e12ac65d8..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesCodes.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.typedmessage;
-
-public interface TypedBytesCodes
-{
- static final byte BOOLEAN_TYPE = (byte) 1;
-
- static final byte BYTE_TYPE = (byte) 2;
-
- static final byte BYTEARRAY_TYPE = (byte) 3;
-
- static final byte SHORT_TYPE = (byte) 4;
-
- static final byte CHAR_TYPE = (byte) 5;
-
- static final byte INT_TYPE = (byte) 6;
-
- static final byte LONG_TYPE = (byte) 7;
-
- static final byte FLOAT_TYPE = (byte) 8;
-
- static final byte DOUBLE_TYPE = (byte) 9;
-
- static final byte STRING_TYPE = (byte) 10;
-
- static final byte NULL_STRING_TYPE = (byte) 11;
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesContentReader.java b/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesContentReader.java
deleted file mode 100644
index 674a0e9468..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesContentReader.java
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.typedmessage;
-
-
-import java.io.EOFException;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-
-public class TypedBytesContentReader implements TypedBytesCodes
-{
-
- private final ByteBuffer _data;
- private final int _position;
- private final int _limit;
-
-
- private static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
-
- private final CharsetDecoder _charsetDecoder = UTF8_CHARSET.newDecoder();
-
- private int _byteArrayRemaining = -1;
-
-
- public TypedBytesContentReader(final ByteBuffer data)
- {
- _data = data.duplicate();
- _position = _data.position();
- _limit = _data.limit();
- }
-
- /**
- * Check that there is at least a certain number of bytes available to read
- *
- * @param len the number of bytes
- * @throws EOFException if there are less than len bytes available to read
- */
- public void checkAvailable(int len) throws EOFException
- {
- if (_data.remaining() < len)
- {
- throw new EOFException("Unable to read " + len + " bytes");
- }
- }
-
- public byte readWireType() throws TypedBytesFormatException, EOFException
- {
- checkAvailable(1);
- return _data.get();
- }
-
- public boolean readBoolean() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- boolean result;
- try
- {
- switch (wireType)
- {
- case BOOLEAN_TYPE:
- checkAvailable(1);
- result = readBooleanImpl();
- break;
- case STRING_TYPE:
- checkAvailable(1);
- result = Boolean.parseBoolean(readStringImpl());
- break;
- default:
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a boolean");
- }
- return result;
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- }
-
- public boolean readBooleanImpl()
- {
- return _data.get() != 0;
- }
-
- public byte readByte() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- byte result;
- try
- {
- switch (wireType)
- {
- case BYTE_TYPE:
- checkAvailable(1);
- result = readByteImpl();
- break;
- case STRING_TYPE:
- checkAvailable(1);
- result = Byte.parseByte(readStringImpl());
- break;
- default:
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a byte");
- }
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- return result;
- }
-
- public byte readByteImpl()
- {
- return _data.get();
- }
-
- public short readShort() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- short result;
- try
- {
- switch (wireType)
- {
- case SHORT_TYPE:
- checkAvailable(2);
- result = readShortImpl();
- break;
- case STRING_TYPE:
- checkAvailable(1);
- result = Short.parseShort(readStringImpl());
- break;
- case BYTE_TYPE:
- checkAvailable(1);
- result = readByteImpl();
- break;
- default:
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a short");
- }
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- return result;
- }
-
- public short readShortImpl()
- {
- return _data.getShort();
- }
-
- /**
- * Note that this method reads a unicode character as two bytes from the stream
- *
- * @return the character read from the stream
- * @throws EOFException if there are less than the required bytes available to read
- * @throws TypedBytesFormatException if the current write type is not compatible
- */
- public char readChar() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- try
- {
- if (wireType == NULL_STRING_TYPE)
- {
- throw new NullPointerException();
- }
-
- if (wireType != CHAR_TYPE)
- {
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a char");
- }
- else
- {
- checkAvailable(2);
- return readCharImpl();
- }
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- }
-
- public char readCharImpl()
- {
- return _data.getChar();
- }
-
- public int readInt() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- int result;
- try
- {
- switch (wireType)
- {
- case INT_TYPE:
- checkAvailable(4);
- result = readIntImpl();
- break;
- case SHORT_TYPE:
- checkAvailable(2);
- result = readShortImpl();
- break;
- case STRING_TYPE:
- checkAvailable(1);
- result = Integer.parseInt(readStringImpl());
- break;
- case BYTE_TYPE:
- checkAvailable(1);
- result = readByteImpl();
- break;
- default:
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to an int");
- }
- return result;
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- }
-
- public int readIntImpl()
- {
- return _data.getInt();
- }
-
- public long readLong() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- long result;
- try
- {
- switch (wireType)
- {
- case LONG_TYPE:
- checkAvailable(8);
- result = readLongImpl();
- break;
- case INT_TYPE:
- checkAvailable(4);
- result = readIntImpl();
- break;
- case SHORT_TYPE:
- checkAvailable(2);
- result = readShortImpl();
- break;
- case STRING_TYPE:
- checkAvailable(1);
- result = Long.parseLong(readStringImpl());
- break;
- case BYTE_TYPE:
- checkAvailable(1);
- result = readByteImpl();
- break;
- default:
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a long");
- }
- return result;
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- }
-
- public long readLongImpl()
- {
- return _data.getLong();
- }
-
- public float readFloat() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- float result;
- try
- {
- switch (wireType)
- {
- case FLOAT_TYPE:
- checkAvailable(4);
- result = readFloatImpl();
- break;
- case STRING_TYPE:
- checkAvailable(1);
- result = Float.parseFloat(readStringImpl());
- break;
- default:
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a float");
- }
- return result;
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- }
-
- public float readFloatImpl()
- {
- return _data.getFloat();
- }
-
- public double readDouble() throws TypedBytesFormatException, EOFException
- {
- int position = _data.position();
- byte wireType = readWireType();
- double result;
- try
- {
- switch (wireType)
- {
- case DOUBLE_TYPE:
- checkAvailable(8);
- result = readDoubleImpl();
- break;
- case FLOAT_TYPE:
- checkAvailable(4);
- result = readFloatImpl();
- break;
- case STRING_TYPE:
- checkAvailable(1);
- result = Double.parseDouble(readStringImpl());
- break;
- default:
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a double");
- }
- return result;
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- }
-
- public double readDoubleImpl()
- {
- return _data.getDouble();
- }
-
- public String readString() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- String result;
- try
- {
- switch (wireType)
- {
- case STRING_TYPE:
- checkAvailable(1);
- result = readStringImpl();
- break;
- case NULL_STRING_TYPE:
- result = null;
- throw new NullPointerException("data is null");
- case BOOLEAN_TYPE:
- checkAvailable(1);
- result = String.valueOf(readBooleanImpl());
- break;
- case LONG_TYPE:
- checkAvailable(8);
- result = String.valueOf(readLongImpl());
- break;
- case INT_TYPE:
- checkAvailable(4);
- result = String.valueOf(readIntImpl());
- break;
- case SHORT_TYPE:
- checkAvailable(2);
- result = String.valueOf(readShortImpl());
- break;
- case BYTE_TYPE:
- checkAvailable(1);
- result = String.valueOf(readByteImpl());
- break;
- case FLOAT_TYPE:
- checkAvailable(4);
- result = String.valueOf(readFloatImpl());
- break;
- case DOUBLE_TYPE:
- checkAvailable(8);
- result = String.valueOf(readDoubleImpl());
- break;
- case CHAR_TYPE:
- checkAvailable(2);
- result = String.valueOf(readCharImpl());
- break;
- default:
- _data.position(position);
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a String");
- }
- return result;
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- }
-
- public String readStringImpl() throws TypedBytesFormatException
- {
- try
- {
- _charsetDecoder.reset();
- ByteBuffer dup = _data.duplicate();
- int pos = _data.position();
- byte b;
- while((b = _data.get()) != 0) {};
- dup.limit(_data.position()-1);
- return _charsetDecoder.decode(dup).toString();
-
- }
- catch (CharacterCodingException e)
- {
- TypedBytesFormatException jmse = new TypedBytesFormatException("Error decoding byte stream as a UTF8 string: " + e);
- jmse.initCause(e);
- throw jmse;
- }
- }
-
- public int readBytes(byte[] bytes) throws EOFException, TypedBytesFormatException
- {
- if (bytes == null)
- {
- throw new IllegalArgumentException("byte array must not be null");
- }
- // first call
- if (_byteArrayRemaining == -1)
- {
- // type discriminator checked separately so you get a MessageFormatException rather than
- // an EOF even in the case where both would be applicable
- checkAvailable(1);
- byte wireType = readWireType();
- if (wireType != BYTEARRAY_TYPE)
- {
- throw new TypedBytesFormatException("Unable to convert " + wireType + " to a byte array");
- }
- checkAvailable(4);
- int size = _data.getInt();
- // length of -1 indicates null
- if (size == -1)
- {
- return -1;
- }
- else
- {
- if (size > _data.remaining())
- {
- throw new EOFException("Byte array has stated length "
- + size
- + " but message only contains "
- +
- _data.remaining()
- + " bytes");
- }
- else
- {
- _byteArrayRemaining = size;
- }
- }
- }
- else if (_byteArrayRemaining == 0)
- {
- _byteArrayRemaining = -1;
- return -1;
- }
-
- int returnedSize = readBytesImpl(bytes);
- if (returnedSize < bytes.length)
- {
- _byteArrayRemaining = -1;
- }
- return returnedSize;
- }
-
- private int readBytesImpl(byte[] bytes)
- {
- int count = (_byteArrayRemaining >= bytes.length ? bytes.length : _byteArrayRemaining);
- _byteArrayRemaining -= count;
-
- if (count == 0)
- {
- return 0;
- }
- else
- {
- _data.get(bytes, 0, count);
- return count;
- }
- }
-
- public Object readObject() throws EOFException, TypedBytesFormatException
- {
- int position = _data.position();
- byte wireType = readWireType();
- Object result = null;
- try
- {
- switch (wireType)
- {
- case BOOLEAN_TYPE:
- checkAvailable(1);
- result = readBooleanImpl();
- break;
- case BYTE_TYPE:
- checkAvailable(1);
- result = readByteImpl();
- break;
- case BYTEARRAY_TYPE:
- checkAvailable(4);
- int size = _data.getInt();
- if (size == -1)
- {
- result = null;
- }
- else
- {
- _byteArrayRemaining = size;
- byte[] bytesResult = new byte[size];
- readBytesImpl(bytesResult);
- result = bytesResult;
- }
- break;
- case SHORT_TYPE:
- checkAvailable(2);
- result = readShortImpl();
- break;
- case CHAR_TYPE:
- checkAvailable(2);
- result = readCharImpl();
- break;
- case INT_TYPE:
- checkAvailable(4);
- result = readIntImpl();
- break;
- case LONG_TYPE:
- checkAvailable(8);
- result = readLongImpl();
- break;
- case FLOAT_TYPE:
- checkAvailable(4);
- result = readFloatImpl();
- break;
- case DOUBLE_TYPE:
- checkAvailable(8);
- result = readDoubleImpl();
- break;
- case NULL_STRING_TYPE:
- result = null;
- break;
- case STRING_TYPE:
- checkAvailable(1);
- result = readStringImpl();
- break;
- }
- return result;
- }
- catch (RuntimeException e)
- {
- _data.position(position);
- throw e;
- }
- }
-
- public void reset()
- {
- _byteArrayRemaining = -1;
- _data.position(_position);
- _data.limit(_limit);
- }
-
- public ByteBuffer getData()
- {
- ByteBuffer buf = _data.duplicate();
- buf.position(_position);
- buf.limit(_limit);
- return buf;
- }
-
- public long size()
- {
- return _limit - _position;
- }
-
- public int remaining()
- {
- return _data.remaining();
- }
-
- public void readRawBytes(final byte[] bytes, final int offset, final int count)
- {
- _data.get(bytes, offset, count);
- }
-
- public String readLengthPrefixedUTF() throws TypedBytesFormatException
- {
- try
- {
- short length = readShortImpl();
- if(length == 0)
- {
- return "";
- }
- else
- {
- _charsetDecoder.reset();
- ByteBuffer encodedString = _data.slice();
- encodedString.limit(length);
- _data.position(_data.position()+length);
- CharBuffer string = _charsetDecoder.decode(encodedString);
-
- return string.toString();
- }
- }
- catch(CharacterCodingException e)
- {
- TypedBytesFormatException jmse = new TypedBytesFormatException("Error decoding byte stream as a UTF8 string: " + e);
- jmse.initCause(e);
- throw jmse;
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesContentWriter.java b/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesContentWriter.java
deleted file mode 100644
index c7ca2d7df7..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesContentWriter.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.typedmessage;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
-
-public class TypedBytesContentWriter implements TypedBytesCodes
-{
- private final ByteArrayOutputStream _baos = new ByteArrayOutputStream();
- private final DataOutputStream _data = new DataOutputStream(_baos);
- private static final Charset UTF8 = Charset.forName("UTF-8");
-
- protected void writeTypeDiscriminator(byte type)
- {
- try
- {
- _data.writeByte(type);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- private RuntimeException handle(final IOException e)
- {
- RuntimeException jmsEx = new RuntimeException("Unable to write value: " + e.getMessage());
- return jmsEx;
- }
-
-
- public void writeBoolean(boolean b)
- {
- writeTypeDiscriminator(BOOLEAN_TYPE);
- writeBooleanImpl(b);
- }
-
- public void writeBooleanImpl(final boolean b)
- {
- try
- {
- _data.writeByte(b ? (byte) 1 : (byte) 0);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeByte(byte b)
- {
- writeTypeDiscriminator(BYTE_TYPE);
- writeByteImpl(b);
- }
-
- public void writeByteImpl(final byte b)
- {
- try
- {
- _data.writeByte(b);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeShort(short i)
- {
- writeTypeDiscriminator(SHORT_TYPE);
- writeShortImpl(i);
- }
-
- public void writeShortImpl(final short i)
- {
- try
- {
- _data.writeShort(i);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeChar(char c)
- {
- writeTypeDiscriminator(CHAR_TYPE);
- writeCharImpl(c);
- }
-
- public void writeCharImpl(final char c)
- {
- try
- {
- _data.writeChar(c);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeInt(int i)
- {
- writeTypeDiscriminator(INT_TYPE);
- writeIntImpl(i);
- }
-
- public void writeIntImpl(int i)
- {
- try
- {
- _data.writeInt(i);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeLong(long l)
- {
- writeTypeDiscriminator(LONG_TYPE);
- writeLongImpl(l);
- }
-
- public void writeLongImpl(final long l)
- {
- try
- {
- _data.writeLong(l);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeFloat(float v)
- {
- writeTypeDiscriminator(FLOAT_TYPE);
- writeFloatImpl(v);
- }
-
- public void writeFloatImpl(final float v)
- {
- try
- {
- _data.writeFloat(v);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeDouble(double v)
- {
- writeTypeDiscriminator(DOUBLE_TYPE);
- writeDoubleImpl(v);
- }
-
- public void writeDoubleImpl(final double v)
- {
- try
- {
- _data.writeDouble(v);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeString(String string)
- {
- if (string == null)
- {
- writeTypeDiscriminator(NULL_STRING_TYPE);
- }
- else
- {
- writeTypeDiscriminator(STRING_TYPE);
- writeNullTerminatedStringImpl(string);
- }
- }
-
- public void writeNullTerminatedStringImpl(String string)
-
- {
- try
- {
- _data.write(string.getBytes(UTF8));
- _data.writeByte((byte) 0);
- }
- catch (IOException e)
- {
- throw handle(e);
- }
-
- }
-
- public void writeBytes(byte[] bytes)
- {
- writeBytes(bytes, 0, bytes == null ? 0 : bytes.length);
- }
-
- public void writeBytes(byte[] bytes, int offset, int length)
- {
- writeTypeDiscriminator(BYTEARRAY_TYPE);
- writeBytesImpl(bytes, offset, length);
- }
-
- public void writeBytesImpl(final byte[] bytes, final int offset, final int length)
- {
- try
- {
- if (bytes == null)
- {
- _data.writeInt(-1);
- }
- else
- {
- _data.writeInt(length);
- _data.write(bytes, offset, length);
- }
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
- public void writeBytesRaw(final byte[] bytes, final int offset, final int length)
- {
- try
- {
- if (bytes != null)
- {
- _data.write(bytes, offset, length);
- }
- }
- catch (IOException e)
- {
- throw handle(e);
- }
- }
-
-
- public void writeObject(Object object) throws TypedBytesFormatException
- {
- Class clazz;
-
- if (object == null)
- {
- // string handles the output of null values
- clazz = String.class;
- }
- else
- {
- clazz = object.getClass();
- }
-
- if (clazz == Byte.class)
- {
- writeByte((Byte) object);
- }
- else if (clazz == Boolean.class)
- {
- writeBoolean((Boolean) object);
- }
- else if (clazz == byte[].class)
- {
- writeBytes((byte[]) object);
- }
- else if (clazz == Short.class)
- {
- writeShort((Short) object);
- }
- else if (clazz == Character.class)
- {
- writeChar((Character) object);
- }
- else if (clazz == Integer.class)
- {
- writeInt((Integer) object);
- }
- else if (clazz == Long.class)
- {
- writeLong((Long) object);
- }
- else if (clazz == Float.class)
- {
- writeFloat((Float) object);
- }
- else if (clazz == Double.class)
- {
- writeDouble((Double) object);
- }
- else if (clazz == String.class)
- {
- writeString((String) object);
- }
- else
- {
- throw new TypedBytesFormatException("Only primitives plus byte arrays and String are valid types");
- }
- }
-
- public ByteBuffer getData()
- {
- return ByteBuffer.wrap(_baos.toByteArray());
- }
-
- public void writeLengthPrefixedUTF(final String string) throws TypedBytesFormatException
- {
- try
- {
- CharsetEncoder encoder = UTF8.newEncoder();
- java.nio.ByteBuffer encodedString = encoder.encode(CharBuffer.wrap(string));
-
- writeShortImpl((short) encodedString.limit());
- while(encodedString.hasRemaining())
- {
- _data.writeByte(encodedString.get());
- }
- }
- catch (CharacterCodingException e)
- {
- TypedBytesFormatException jmse = new TypedBytesFormatException("Unable to encode string: " + e);
- jmse.initCause(e);
- throw jmse;
- }
- catch (IOException e)
- {
- throw handle(e);
- }
-
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesFormatException.java b/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesFormatException.java
deleted file mode 100644
index 24fdbcfde5..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/typedmessage/TypedBytesFormatException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.typedmessage;
-
-public class TypedBytesFormatException extends Exception
-{
- public TypedBytesFormatException(String s)
- {
- super(s);
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java b/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java
deleted file mode 100644
index 3ea99ce4ab..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.url;
-
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-
-public class AMQBindingURL implements BindingURL
-{
- private static final Logger _logger = LoggerFactory.getLogger(AMQBindingURL.class);
-
- private String _url;
- private AMQShortString _exchangeClass = AMQShortString.valueOf(ExchangeDefaults.DIRECT_EXCHANGE_CLASS);
- private AMQShortString _exchangeName = new AMQShortString("");
- private AMQShortString _destinationName = new AMQShortString("");
- private AMQShortString _queueName = new AMQShortString("");
- private AMQShortString[] _bindingKeys = new AMQShortString[0];
- private HashMap<String, String> _options;
-
- public AMQBindingURL(String url) throws URISyntaxException
- {
- // format:
- // <exch_class>://<exch_name>/[<destination>]/[<queue>]?<option>='<value>'[,<option>='<value>']*
- _logger.debug("Parsing URL: " + url);
- _url = url;
- _options = new HashMap<String, String>();
-
- parseBindingURL();
- }
-
- private void parseBindingURL() throws URISyntaxException
- {
- BindingURLParser parser = new BindingURLParser();
- parser.parse(_url,this);
- _logger.debug("URL Parsed: " + this);
- }
-
- public void setExchangeClass(String exchangeClass)
- {
- setExchangeClass(new AMQShortString(exchangeClass));
- }
-
- public void setQueueName(String name)
- {
- setQueueName(new AMQShortString(name));
- }
-
- public void setDestinationName(String name)
- {
- setDestinationName(new AMQShortString(name));
- }
-
- public void setExchangeName(String exchangeName)
- {
- setExchangeName(new AMQShortString(exchangeName));
- }
-
- public String getURL()
- {
- return _url;
- }
-
- public AMQShortString getExchangeClass()
- {
- return _exchangeClass;
- }
-
- private void setExchangeClass(AMQShortString exchangeClass)
- {
-
- _exchangeClass = exchangeClass;
- if (exchangeClass.equals(AMQShortString.valueOf(ExchangeDefaults.TOPIC_EXCHANGE_CLASS)))
- {
- setOption(BindingURL.OPTION_EXCLUSIVE, "true");
- }
-
- }
-
- public AMQShortString getExchangeName()
- {
- return _exchangeName;
- }
-
- private void setExchangeName(AMQShortString name)
- {
- _exchangeName = name;
- }
-
- public AMQShortString getDestinationName()
- {
- return _destinationName;
- }
-
- private void setDestinationName(AMQShortString name)
- {
- _destinationName = name;
- }
-
- public AMQShortString getQueueName()
- {
- return _queueName;
- }
-
- public void setQueueName(AMQShortString name)
- {
- _queueName = name;
- }
-
- public String getOption(String key)
- {
- return _options.get(key);
- }
-
- @Override
- public Map<String,Object> getConsumerOptions()
- {
- Map<String,Object> options = new HashMap<>();
- for(Map.Entry<String,String> option : _options.entrySet())
- {
- if(!NON_CONSUMER_OPTIONS.contains(option.getKey()))
- {
- options.put(option.getKey(), option.getValue());
- }
- }
- return options;
- }
-
- public void setOption(String key, String value)
- {
- _options.put(key, value);
- }
-
- public boolean containsOption(String key)
- {
- return _options.containsKey(key);
- }
-
- public AMQShortString getRoutingKey()
- {
- if (_exchangeClass.equals(AMQShortString.valueOf(ExchangeDefaults.DIRECT_EXCHANGE_CLASS)))
- {
- if (containsOption(BindingURL.OPTION_ROUTING_KEY))
- {
- return new AMQShortString(getOption(OPTION_ROUTING_KEY));
- }
- else
- {
- return getQueueName();
- }
- }
-
- if (containsOption(BindingURL.OPTION_ROUTING_KEY))
- {
- return new AMQShortString(getOption(OPTION_ROUTING_KEY));
- }
-
- return getDestinationName();
- }
-
- public AMQShortString[] getBindingKeys()
- {
- if (_bindingKeys != null && _bindingKeys.length>0)
- {
- return _bindingKeys;
- }
- else
- {
- return new AMQShortString[]{getRoutingKey()};
- }
- }
-
- public void setBindingKeys(AMQShortString[] keys)
- {
- _bindingKeys = keys;
- }
-
- public void setRoutingKey(AMQShortString key)
- {
- setOption(OPTION_ROUTING_KEY, key.toString());
- }
-
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append(_exchangeClass);
- sb.append("://");
- sb.append(_exchangeName);
- sb.append('/');
- sb.append(_destinationName);
- sb.append('/');
- sb.append(_queueName);
-
- sb.append(URLHelper.printOptions(_options));
-
- // temp hack
- if (getRoutingKey() == null || getRoutingKey().toString().equals(""))
- {
-
- if (!sb.toString().contains("?"))
- {
- sb.append("?");
- }
- else
- {
- sb.append("&");
- }
-
- for (AMQShortString key :_bindingKeys)
- {
- sb.append(BindingURL.OPTION_BINDING_KEY).append("='").append(key.toString()).append("'&");
- }
-
- return sb.toString().substring(0,sb.toString().length()-1);
- }
- else
- {
- return sb.toString();
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURL.java b/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURL.java
deleted file mode 100644
index 91f80ff88c..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURL.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.url;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.qpid.framing.AMQShortString;
-
-/*
- Binding URL format:
- <exch_class>://<exch_name>/[<destination>]/[<queue>]?<option>='<value>'[,<option>='<value>']*
-*/
-public interface BindingURL
-{
- public static final String OPTION_EXCLUSIVE = "exclusive";
- public static final String OPTION_AUTODELETE = "autodelete";
- public static final String OPTION_DURABLE = "durable";
- public static final String OPTION_BROWSE = "browse";
- public static final String OPTION_ROUTING_KEY = "routingkey";
- public static final String OPTION_BINDING_KEY = "bindingkey";
- public static final String OPTION_EXCHANGE_AUTODELETE = "exchangeautodelete";
- public static final String OPTION_EXCHANGE_DURABLE = "exchangedurable";
- public static final String OPTION_EXCHANGE_INTERNAL = "exchangeinternal";
-
- /**
- * This option is only applicable for 0-8/0-9/0-9-1 protocols connection
- * <p>
- * It tells the client to delegate the requeue/DLQ decision to the
- * server .If this option is not specified, the messages won't be moved to
- * the DLQ (or dropped) when delivery count exceeds the maximum.
- */
- public static final String OPTION_REJECT_BEHAVIOUR = "rejectbehaviour";
-
- public static final Set<String> NON_CONSUMER_OPTIONS =
- Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(OPTION_EXCLUSIVE,
- OPTION_AUTODELETE,
- OPTION_DURABLE,
- OPTION_BROWSE,
- OPTION_ROUTING_KEY,
- OPTION_BINDING_KEY,
- OPTION_EXCHANGE_AUTODELETE,
- OPTION_EXCHANGE_DURABLE,
- OPTION_EXCHANGE_DURABLE,
- OPTION_REJECT_BEHAVIOUR)));
-
-
- String getURL();
-
- AMQShortString getExchangeClass();
-
- AMQShortString getExchangeName();
-
- AMQShortString getDestinationName();
-
- AMQShortString getQueueName();
-
- String getOption(String key);
-
- Map<String,Object> getConsumerOptions();
-
-
- boolean containsOption(String key);
-
- AMQShortString getRoutingKey();
-
- AMQShortString[] getBindingKeys();
-
- String toString();
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java b/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java
deleted file mode 100644
index 8e93a907d6..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.url;
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class BindingURLParser
-{
- private static final char PROPERTY_EQUALS_CHAR = '=';
- private static final char PROPERTY_SEPARATOR_CHAR = '&';
- private static final char ALTERNATIVE_PROPERTY_SEPARATOR_CHAR = ',';
- private static final char FORWARD_SLASH_CHAR = '/';
- private static final char QUESTION_MARK_CHAR = '?';
- private static final char SINGLE_QUOTE_CHAR = '\'';
- private static final char COLON_CHAR = ':';
- private static final char END_OF_URL_MARKER_CHAR = '%';
-
- private static final Logger _logger = LoggerFactory.getLogger(BindingURLParser.class);
-
- private char[] _url;
- private AMQBindingURL _bindingURL;
- private BindingURLParserState _currentParserState;
- private String _error;
- private int _index = 0;
- private String _currentPropName;
- private Map<String,Object> _options;
-
-
- public BindingURLParser()
- {
- }
-
- //<exch_class>://<exch_name>/[<destination>]/[<queue>]?<option>='<value>'[,<option>='<value>']*
- public synchronized void
- parse(String url,AMQBindingURL bindingURL) throws URISyntaxException
- {
- _url = (url + END_OF_URL_MARKER_CHAR).toCharArray();
- _bindingURL = bindingURL;
- _currentParserState = BindingURLParserState.BINDING_URL_START;
- BindingURLParserState prevState = _currentParserState;
- _index = 0;
- _currentPropName = null;
- _error = null;
- _options = new HashMap<String,Object>();
-
- try
- {
- while (_currentParserState != BindingURLParserState.ERROR && _currentParserState != BindingURLParserState.BINDING_URL_END)
- {
- prevState = _currentParserState;
- _currentParserState = next();
- }
-
- if (_currentParserState == BindingURLParserState.ERROR)
- {
- _error =
- "Invalid URL format [current_state = " + prevState + ", details parsed so far " + _bindingURL + " ] error at (" + _index + ") due to " + _error;
- _logger.debug(_error);
- URISyntaxException ex;
- ex = new URISyntaxException(markErrorLocation(),"Error occured while parsing URL",_index);
- throw ex;
- }
-
- processOptions();
- }
- catch (ArrayIndexOutOfBoundsException e)
- {
- _error = "Invalid URL format [current_state = " + prevState + ", details parsed so far " + _bindingURL + " ] error at (" + _index + ")";
- URISyntaxException ex = new URISyntaxException(markErrorLocation(),"Error occured while parsing URL",_index);
- ex.initCause(e);
- throw ex;
- }
- }
-
- enum BindingURLParserState
- {
- BINDING_URL_START,
- EXCHANGE_CLASS,
- COLON_CHAR,
- DOUBLE_SEP,
- EXCHANGE_NAME,
- EXCHANGE_SEPERATOR_CHAR,
- DESTINATION,
- DESTINATION_SEPERATOR_CHAR,
- QUEUE_NAME,
- QUESTION_MARK_CHAR,
- PROPERTY_NAME,
- PROPERTY_EQUALS,
- START_PROPERTY_VALUE,
- PROPERTY_VALUE,
- END_PROPERTY_VALUE,
- PROPERTY_SEPARATOR,
- BINDING_URL_END,
- ERROR
- }
-
- /**
- * I am fully ware that there are few optimizations
- * that can speed up things a wee bit. But I have opted
- * for readability and maintainability at the expense of
- * speed, as speed is not a critical factor here.
- *
- * One can understand the full parse logic by just looking at this method.
- */
- private BindingURLParserState next()
- {
- switch (_currentParserState)
- {
- case BINDING_URL_START:
- return extractExchangeClass();
- case COLON_CHAR:
- _index++; //skip ":"
- return BindingURLParserState.DOUBLE_SEP;
- case DOUBLE_SEP:
- _index = _index + 2; //skip "//"
- return BindingURLParserState.EXCHANGE_NAME;
- case EXCHANGE_NAME:
- return extractExchangeName();
- case EXCHANGE_SEPERATOR_CHAR:
- _index++; // skip '/'
- return BindingURLParserState.DESTINATION;
- case DESTINATION:
- return extractDestination();
- case DESTINATION_SEPERATOR_CHAR:
- _index++; // skip '/'
- return BindingURLParserState.QUEUE_NAME;
- case QUEUE_NAME:
- return extractQueueName();
- case QUESTION_MARK_CHAR:
- _index++; // skip '?'
- return BindingURLParserState.PROPERTY_NAME;
- case PROPERTY_NAME:
- return extractPropertyName();
- case PROPERTY_EQUALS:
- _index++; // skip the equal sign
- return BindingURLParserState.START_PROPERTY_VALUE;
- case START_PROPERTY_VALUE:
- _index++; // skip the '\''
- return BindingURLParserState.PROPERTY_VALUE;
- case PROPERTY_VALUE:
- return extractPropertyValue();
- case END_PROPERTY_VALUE:
- _index ++;
- return checkEndOfURL();
- case PROPERTY_SEPARATOR:
- _index++; // skip '&'
- return BindingURLParserState.PROPERTY_NAME;
- default:
- return BindingURLParserState.ERROR;
- }
- }
-
- private BindingURLParserState extractExchangeClass()
- {
- char nextChar = _url[_index];
-
- // check for the following special cases.
- // "myQueue?durable='true'" or just "myQueue"
-
- StringBuilder builder = new StringBuilder();
- while (nextChar != COLON_CHAR && nextChar != QUESTION_MARK_CHAR && nextChar != END_OF_URL_MARKER_CHAR)
- {
- builder.append(nextChar);
- _index++;
- nextChar = _url[_index];
- }
-
- // normal use case
- if (nextChar == COLON_CHAR)
- {
- _bindingURL.setExchangeClass(builder.toString());
- return BindingURLParserState.COLON_CHAR;
- }
- // "myQueue?durable='true'" use case
- else if (nextChar == QUESTION_MARK_CHAR)
- {
- _bindingURL.setExchangeClass(ExchangeDefaults.DIRECT_EXCHANGE_CLASS);
- _bindingURL.setExchangeName("");
- _bindingURL.setQueueName(builder.toString());
- return BindingURLParserState.QUESTION_MARK_CHAR;
- }
- else
- {
- _bindingURL.setExchangeClass(ExchangeDefaults.DIRECT_EXCHANGE_CLASS);
- _bindingURL.setExchangeName("");
- _bindingURL.setQueueName(builder.toString());
- return BindingURLParserState.BINDING_URL_END;
- }
- }
-
- private BindingURLParserState extractExchangeName()
- {
- char nextChar = _url[_index];
- StringBuilder builder = new StringBuilder();
- while (nextChar != FORWARD_SLASH_CHAR)
- {
- builder.append(nextChar);
- _index++;
- nextChar = _url[_index];
- }
-
- _bindingURL.setExchangeName(builder.toString());
- return BindingURLParserState.EXCHANGE_SEPERATOR_CHAR;
- }
-
- private BindingURLParserState extractDestination()
- {
- char nextChar = _url[_index];
-
- //The destination is and queue name are both optional
- // This is checking for the case where both are not specified.
- if (nextChar == QUESTION_MARK_CHAR)
- {
- return BindingURLParserState.QUESTION_MARK_CHAR;
- }
-
- StringBuilder builder = new StringBuilder();
- while (nextChar != FORWARD_SLASH_CHAR && nextChar != QUESTION_MARK_CHAR)
- {
- builder.append(nextChar);
- _index++;
- nextChar = _url[_index];
- }
-
- // This is the case where the destination is explictily stated.
- // ex direct://amq.direct/myDest/myQueue?option1='1' ... OR
- // direct://amq.direct//myQueue?option1='1' ...
- if (nextChar == FORWARD_SLASH_CHAR)
- {
- _bindingURL.setDestinationName(builder.toString());
- return BindingURLParserState.DESTINATION_SEPERATOR_CHAR;
- }
- // This is the case where destination is not explictly stated.
- // ex direct://amq.direct/myQueue?option1='1' ...
- else
- {
- _bindingURL.setQueueName(builder.toString());
- return BindingURLParserState.QUESTION_MARK_CHAR;
- }
- }
-
- private BindingURLParserState extractQueueName()
- {
- char nextChar = _url[_index];
- StringBuilder builder = new StringBuilder();
- while (nextChar != QUESTION_MARK_CHAR && nextChar != END_OF_URL_MARKER_CHAR)
- {
- builder.append(nextChar);
- nextChar = _url[++_index];
- }
- _bindingURL.setQueueName(builder.toString());
-
- if(nextChar == QUESTION_MARK_CHAR)
- {
- return BindingURLParserState.QUESTION_MARK_CHAR;
- }
- else
- {
- return BindingURLParserState.BINDING_URL_END;
- }
- }
-
- private BindingURLParserState extractPropertyName()
- {
- StringBuilder builder = new StringBuilder();
- char next = _url[_index];
- while (next != PROPERTY_EQUALS_CHAR)
- {
- builder.append(next);
- next = _url[++_index];
- }
- _currentPropName = builder.toString();
-
- if (_currentPropName.trim().equals(""))
- {
- _error = "Property name cannot be empty";
- return BindingURLParserState.ERROR;
- }
-
- return BindingURLParserState.PROPERTY_EQUALS;
- }
-
- private BindingURLParserState extractPropertyValue()
- {
- StringBuilder builder = new StringBuilder();
- char next = _url[_index];
- while (next != SINGLE_QUOTE_CHAR)
- {
- builder.append(next);
- next = _url[++_index];
- }
- String propValue = builder.toString();
-
- if (propValue.trim().equals(""))
- {
- _error = "Property values cannot be empty";
- return BindingURLParserState.ERROR;
- }
- else
- {
- if (_options.containsKey(_currentPropName))
- {
- Object obj = _options.get(_currentPropName);
- if (obj instanceof List)
- {
- List list = (List)obj;
- list.add(propValue);
- }
- else // it has to be a string
- {
- List<String> list = new ArrayList();
- list.add((String)obj);
- list.add(propValue);
- _options.put(_currentPropName, list);
- }
- }
- else
- {
- _options.put(_currentPropName, propValue);
- }
-
-
- return BindingURLParserState.END_PROPERTY_VALUE;
- }
- }
-
- private BindingURLParserState checkEndOfURL()
- {
- char nextChar = _url[_index];
- if ( nextChar == END_OF_URL_MARKER_CHAR)
- {
- return BindingURLParserState.BINDING_URL_END;
- }
- else if (nextChar == PROPERTY_SEPARATOR_CHAR || nextChar == ALTERNATIVE_PROPERTY_SEPARATOR_CHAR)
- {
- return BindingURLParserState.PROPERTY_SEPARATOR;
- }
- else
- {
- return BindingURLParserState.ERROR;
- }
- }
-
- private String markErrorLocation()
- {
- String tmp = String.valueOf(_url);
- // length -1 to remove ENDOF URL marker
- return tmp.substring(0,_index) + "^" + tmp.substring(_index+1> tmp.length()-1?tmp.length()-1:_index+1,tmp.length()-1);
- }
-
- private void processOptions() throws URISyntaxException
- {
-// check for bindingKey
- if (_options.containsKey(BindingURL.OPTION_BINDING_KEY) && _options.get(BindingURL.OPTION_BINDING_KEY) != null)
- {
- Object obj = _options.get(BindingURL.OPTION_BINDING_KEY);
-
- if (obj instanceof String)
- {
- AMQShortString[] bindingKeys = new AMQShortString[]{new AMQShortString((String)obj)};
- _bindingURL.setBindingKeys(bindingKeys);
- }
- else // it would be a list
- {
- List list = (List)obj;
- AMQShortString[] bindingKeys = new AMQShortString[list.size()];
- int i=0;
- for (Iterator it = list.iterator(); it.hasNext();)
- {
- bindingKeys[i] = new AMQShortString((String)it.next());
- i++;
- }
- _bindingURL.setBindingKeys(bindingKeys);
- }
-
- }
- for (String key: _options.keySet())
- {
- // We want to skip the bindingKey list
- if (_options.get(key) instanceof String)
- {
- _bindingURL.setOption(key, (String)_options.get(key));
- }
- }
-
-
- // check if both a binding key and a routing key is specified.
- if (_options.containsKey(BindingURL.OPTION_BINDING_KEY) && _options.containsKey(BindingURL.OPTION_ROUTING_KEY))
- {
- throw new URISyntaxException(String.valueOf(_url),"It is illegal to specify both a routingKey and a bindingKey in the same URL",-1);
- }
- }
-
- public static void main(String[] args)
- {
-
- String[] urls = new String[]
- {
- "topic://amq.topic//myTopic?routingkey='stocks.#'",
- "topic://amq.topic/message_queue?bindingkey='usa.*'&bindingkey='control',exclusive='true'",
- "topic://amq.topic//?bindingKey='usa.*',bindingkey='control',exclusive='true'",
- "direct://amq.direct/dummyDest/myQueue?routingkey='abc.*'",
- "exchange.Class://exchangeName/Destination/Queue",
- "exchangeClass://exchangeName/Destination/?option='value',option2='value2'",
- "IBMPerfQueue1?durable='true'",
- "exchangeClass://exchangeName/Destination/?bindingkey='key1',bindingkey='key2'",
- "exchangeClass://exchangeName/Destination/?bindingkey='key1'&routingkey='key2'"
- };
-
- try
- {
- BindingURLParser parser = new BindingURLParser();
-
- for (String url: urls)
- {
- _logger.info("URL " + url);
- AMQBindingURL bindingURL = new AMQBindingURL(url);
- parser.parse(url,bindingURL);
- _logger.info("\nX " + bindingURL.toString() + " \n");
-
- }
-
- }
- catch(Exception e)
- {
- _logger.error("Error with binding urls", e);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/URLHelper.java b/qpid/java/common/src/main/java/org/apache/qpid/url/URLHelper.java
deleted file mode 100644
index c7fea15576..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/url/URLHelper.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.url;
-
-import java.util.Map;
-
-public class URLHelper
-{
- public static final char DEFAULT_OPTION_SEPERATOR = '&';
- public static final char ALTERNATIVE_OPTION_SEPARATOR = ',';
- public static final char BROKER_SEPARATOR = ';';
-
- private URLHelper()
- {
- }
-
- public static void parseOptions(Map<String, String> optionMap, String options) throws URLSyntaxException
- {
- if ((options == null) || (options.indexOf('=') == -1))
- {
- return;
- }
-
- int optionIndex = options.indexOf('=');
-
- String option = options.substring(0, optionIndex);
-
- int length = options.length();
-
- int nestedQuotes = 0;
-
- // to store index of final "'"
- int valueIndex = optionIndex;
-
- // Walk remainder of url.
- while ((nestedQuotes > 0) || (valueIndex < length))
- {
- valueIndex++;
-
- if (valueIndex >= length)
- {
- break;
- }
-
- if (options.charAt(valueIndex) == '\'')
- {
- if ((valueIndex + 1) < options.length())
- {
- if ((options.charAt(valueIndex + 1) == DEFAULT_OPTION_SEPERATOR)
- || (options.charAt(valueIndex + 1) == ALTERNATIVE_OPTION_SEPARATOR)
- || (options.charAt(valueIndex + 1) == BROKER_SEPARATOR)
- || (options.charAt(valueIndex + 1) == '\''))
- {
- nestedQuotes--;
-
- if (nestedQuotes == 0)
- {
- // We've found the value of an option
- break;
- }
- }
- else
- {
- nestedQuotes++;
- }
- }
- else
- {
- // We are at the end of the string
- // Check to see if we are corectly closing quotes
- if (options.charAt(valueIndex) == '\'')
- {
- nestedQuotes--;
- }
-
- break;
- }
- }
- }
-
- if ((nestedQuotes != 0) || (valueIndex < (optionIndex + 2)))
- {
- int sepIndex = 0;
-
- // Try and identify illegal separator character
- if (nestedQuotes > 1)
- {
- for (int i = 0; i < nestedQuotes; i++)
- {
- sepIndex = options.indexOf('\'', sepIndex);
- sepIndex++;
- }
- }
-
- if ((sepIndex >= options.length()) || (sepIndex == 0))
- {
- throw parseError(valueIndex, "Unterminated option", options);
- }
- else
- {
- throw parseError(sepIndex, "Unterminated option. Possible illegal option separator:'"
- + options.charAt(sepIndex) + "'", options);
- }
- }
-
- // optionIndex +2 to skip "='"
- String value = options.substring(optionIndex + 2, valueIndex);
-
- optionMap.put(option, value);
-
- if (valueIndex < (options.length() - 1))
- {
- // Recurse to get remaining options
- parseOptions(optionMap, options.substring(valueIndex + 2));
- }
- }
-
- public static URLSyntaxException parseError(int index, String error, String url)
- {
- return parseError(index, 1, error, url);
- }
-
- public static URLSyntaxException parseError(int index, int length, String error, String url)
- {
- return new URLSyntaxException(url, error, index, length);
- }
-
- public static String printOptions(Map<String, String> options)
- {
- if (options.isEmpty())
- {
- return "";
- }
- else
- {
- StringBuilder sb = new StringBuilder();
- sb.append('?');
- for (Map.Entry<String,String> entry : options.entrySet())
- {
- sb.append(entry.getKey());
-
- sb.append("='");
-
- sb.append(entry.getValue());
-
- sb.append("'");
- sb.append(DEFAULT_OPTION_SEPERATOR);
- }
-
- sb.deleteCharAt(sb.length() - 1);
-
- return sb.toString();
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/URLSyntaxException.java b/qpid/java/common/src/main/java/org/apache/qpid/url/URLSyntaxException.java
deleted file mode 100644
index 3ff7195794..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/url/URLSyntaxException.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.url;
-
-import java.net.URISyntaxException;
-
-public class URLSyntaxException extends URISyntaxException
-{
- private int _length;
-
- public URLSyntaxException(String url, String error, int index, int length)
- {
- super(url, error, index);
-
- _length = length;
- }
-
- private static String getPositionString(int index, int length)
- {
- StringBuffer sb = new StringBuffer(index + 1);
-
- for (int i = 0; i < index; i++)
- {
- sb.append(" ");
- }
-
- if (length > -1)
- {
- for (int i = 0; i < length; i++)
- {
- sb.append('^');
- }
- }
-
- return sb.toString();
- }
-
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
-
- sb.append(getReason());
-
- if (getIndex() > -1)
- {
- if (_length != -1)
- {
- sb.append(" between indicies ");
- sb.append(getIndex());
- sb.append(" and ");
- sb.append(_length);
- }
- else
- {
- sb.append(" at index ");
- sb.append(getIndex());
- }
- }
-
- sb.append(" ");
- if (getIndex() != -1)
- {
- sb.append("\n");
- }
-
- sb.append(getInput());
-
- if (getIndex() != -1)
- {
- sb.append("\n");
- sb.append(getPositionString(getIndex(), _length));
- }
-
- return sb.toString();
- }
-
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/ByteBufferInputStream.java b/qpid/java/common/src/main/java/org/apache/qpid/util/ByteBufferInputStream.java
deleted file mode 100644
index 14b804f8c0..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/ByteBufferInputStream.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-
-/**
- * Wraps @link {@link ByteBuffer} into {@link InputStream}
- */
-public class ByteBufferInputStream extends InputStream
-{
- private final ByteBuffer _buffer;
-
- public ByteBufferInputStream(ByteBuffer buffer)
- {
- _buffer = buffer;
- }
-
- @Override
- public int read() throws IOException
- {
- if (_buffer.hasRemaining())
- {
- return _buffer.get() & 0xFF;
- }
- return -1;
- }
-
- @Override
- public int read(byte[] b, int off, int len) throws IOException
- {
- if (!_buffer.hasRemaining())
- {
- return -1;
- }
- if(_buffer.remaining() < len)
- {
- len = _buffer.remaining();
- }
- _buffer.get(b, off, len);
-
- return len;
- }
-
- @Override
- public void mark(int readlimit)
- {
- _buffer.mark();
- }
-
- @Override
- public void reset() throws IOException
- {
- _buffer.reset();
- }
-
- @Override
- public boolean markSupported()
- {
- return true;
- }
-
- @Override
- public long skip(long n) throws IOException
- {
- _buffer.position(_buffer.position()+(int)n);
- return n;
- }
-
- @Override
- public int available() throws IOException
- {
- return _buffer.remaining();
- }
-
- @Override
- public void close()
- {
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/BytesDataOutput.java b/qpid/java/common/src/main/java/org/apache/qpid/util/BytesDataOutput.java
deleted file mode 100644
index 7fca54a9ee..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/BytesDataOutput.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.io.DataOutput;
-
-public class BytesDataOutput implements DataOutput
-{
- private int _pos = 0;
- private byte[] _buf;
-
- public BytesDataOutput(byte[] buf)
- {
- _buf = buf;
- }
-
- public void setBuffer(byte[] buf)
- {
- _buf = buf;
- _pos = 0;
- }
-
- public void reset()
- {
- _pos = 0;
- }
-
- public int length()
- {
- return _pos;
- }
-
- public void write(int b)
- {
- _buf[_pos++] = (byte) b;
- }
-
- public void write(byte[] b)
- {
- System.arraycopy(b, 0, _buf, _pos, b.length);
- _pos+=b.length;
- }
-
-
- public void write(byte[] b, int off, int len)
- {
- System.arraycopy(b, off, _buf, _pos, len);
- _pos+=len;
-
- }
-
- public void writeBoolean(boolean v)
- {
- _buf[_pos++] = v ? (byte) 1 : (byte) 0;
- }
-
- public void writeByte(int v)
- {
- _buf[_pos++] = (byte) v;
- }
-
- public void writeShort(int v)
- {
- _buf[_pos++] = (byte) (v >>> 8);
- _buf[_pos++] = (byte) v;
- }
-
- public void writeChar(int v)
- {
- _buf[_pos++] = (byte) (v >>> 8);
- _buf[_pos++] = (byte) v;
- }
-
- public void writeInt(int v)
- {
- _buf[_pos++] = (byte) (v >>> 24);
- _buf[_pos++] = (byte) (v >>> 16);
- _buf[_pos++] = (byte) (v >>> 8);
- _buf[_pos++] = (byte) v;
- }
-
- public void writeLong(long v)
- {
- _buf[_pos++] = (byte) (v >>> 56);
- _buf[_pos++] = (byte) (v >>> 48);
- _buf[_pos++] = (byte) (v >>> 40);
- _buf[_pos++] = (byte) (v >>> 32);
- _buf[_pos++] = (byte) (v >>> 24);
- _buf[_pos++] = (byte) (v >>> 16);
- _buf[_pos++] = (byte) (v >>> 8);
- _buf[_pos++] = (byte)v;
- }
-
- public void writeFloat(float v)
- {
- writeInt(Float.floatToIntBits(v));
- }
-
- public void writeDouble(double v)
- {
- writeLong(Double.doubleToLongBits(v));
- }
-
- public void writeBytes(String s)
- {
- int len = s.length();
- for (int i = 0 ; i < len ; i++)
- {
- _buf[_pos++] = ((byte)s.charAt(i));
- }
- }
-
- public void writeChars(String s)
- {
- int len = s.length();
- for (int i = 0 ; i < len ; i++)
- {
- int v = s.charAt(i);
- _buf[_pos++] = (byte) (v >>> 8);
- _buf[_pos++] = (byte) v;
- }
- }
-
- public void writeUTF(String s)
- {
- int strlen = s.length();
-
- int pos = _pos;
- _pos+=2;
-
-
- for (int i = 0; i < strlen; i++)
- {
- int c = s.charAt(i);
- if ((c >= 0x0001) && (c <= 0x007F))
- {
- c = s.charAt(i);
- _buf[_pos++] = (byte) c;
-
- }
- else if (c > 0x07FF)
- {
- _buf[_pos++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
- _buf[_pos++] = (byte) (0x80 | ((c >> 6) & 0x3F));
- _buf[_pos++] = (byte) (0x80 | (c & 0x3F));
- }
- else
- {
- _buf[_pos++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
- _buf[_pos++] = (byte) (0x80 | (c & 0x3F));
- }
- }
-
- int len = _pos - (pos + 2);
-
- _buf[pos++] = (byte) (len >>> 8);
- _buf[pos] = (byte) len;
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java b/qpid/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java
deleted file mode 100644
index 0482ac7878..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java
+++ /dev/null
@@ -1,680 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * CommandLineParser provides a utility for specifying the format of a command line and parsing command lines to ensure
- * that they fit their specified format. A command line is made up of flags and options, both may be referred to as
- * options. A flag is an option that does not take an argument (specifying it means it has the value 'true' and not
- * specifying it means it has the value 'false'). Options must take arguments but they can be set up with defaults so
- * that they take a default value when not set. Options may be mandatory in which case it is an error not to specify
- * them on the command line. Flags are never mandatory because they are implicitly set to false when not specified.
- *
- * <p>Some example command lines are:
- *
- * <ul>
- * <li>This one has two options that expect arguments:
- * <pre>
- * cruisecontrol -configfile cruisecontrol.xml -port 9000
- * </pre>
- * <li>This has one no-arg flag and two 'free' arguments:
- * <pre>
- * zip -r project.zip project/*
- * </pre>
- * <li>This one concatenates multiple flags into a single block with only one '-':
- * <pre>
- * jar -tvf mytar.tar
- * </pre>
- * </ul>
- *
- * <p>The parsing rules are:
- *
- * <ol>
- * <li>Flags may be combined after a single '-' because they never take arguments. Normally such flags are single letter
- * flags but this is only a convention and not enforced. Flags of more than one letter are usually specified on their own.
- * <li>Options expecting arguments must always be on their own.
- * <li>The argument to an option may be separated from it by whitespace or appended directly onto the option.
- * <li>The argument to an option may never begin with a '-' character.
- * <li>All other arguments not beginning with a '-' character are free arguments that do not belong to any option.
- * <li>The second or later of a set of duplicate or repeated flags are ignored.
- * <li>Options are matched up to the shortest matching option. This is because of the possibility of having no space
- * between an option and its argument. This rules out the possibility of using two options where one is an opening
- * substring of the other. For example, the options "foo" and "foobar" cannot be used on the same command line because
- * it is not possible to distinguish the argument "-foobar" from being the "foobar" option or the "foo" option with
- * the "bar" argument.
- * </ol>
- *
- * <p>By default, unknown options are simply ignored if specified on the command line. This behaviour may be changed
- * so that the parser reports all unknowns as errors by using the {@link #setErrorsOnUnknowns} method.
- */
-public class CommandLineParser
-{
- /** Holds a mapping from command line option names to detailed information about those options. */
- private Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>();
-
- /** Holds a list of parsing errors. */
- private List<String> parsingErrors = new ArrayList<String>();
-
- /** Holds the regular expression matcher to match command line options with. */
- private Matcher optionMatcher = null;
-
- /** Holds the parsed command line properties after parsing. */
- private Properties parsedProperties = null;
-
- /** Flag used to indicate that errors should be created for unknown options. False by default. */
- private boolean errorsOnUnknowns = false;
-
- /**
- * Creates a command line options parser from a command line specification. This is passed to this constructor
- * as an array of arrays of strings. Each array of strings specifies the command line for a single option. A static
- * array may therefore easily be used to configure the command line parser in a single method call with an easily
- * readable format.
- *
- * <p>Each array of strings must be 2, 3, 4 or 5 elements long. If any of the last three elements are missing they
- * are assumed to be null. The elements specify the following parameters:
- * <ol>
- * <li>The name of the option without the leading '-'. For example, "file". To specify the format of the 'free'
- * arguments use the option names "1", "2", ... and so on.
- * <li>The option comment. A line of text describing the usage of the option. For example, "The file to be processed."
- * <li>The options argument. This is a very short description of the argument to the option, often a single word
- * or a reminder as to the arguments format. When this element is null the option is a flag and does not
- * accept any arguments. For example, "filename" or "(unix | windows)" or null. The actual text specified
- * is only used to print in the usage message to remind the user of the usage of the option.
- * <li>The mandatory flag. When set to "true" an option must always be specified. Any other value, including null,
- * means that the option is mandatory. Flags are always mandatory (see class javadoc for explanation of why) so
- * this is ignored for flags.
- * <li>A regular expression describing the format that the argument must take. Ignored if null.
- * </ol>
- * <p>An example call to this constructor is:
- *
- * <pre>
- * CommandLineParser commandLine = new CommandLineParser(
- * new String[][] {{"file", "The file to be processed. ", "filename", "true"},
- * {"dir", "Directory to store results in. Current dir used if not set.", "out dir"},
- * {"os", "Operating system EOL format to use.", "(windows | unix)", null, "windows\|unix"},
- * {"v", "Verbose mode. Prints information about the processing as it goes."},
- * {"1", "The processing command to run.", "command", "true", "add\|remove\|list"}});
- * </pre>
- *
- * @param config The configuration as an array of arrays of strings.
- */
- public CommandLineParser(String[][] config)
- {
- // Loop through all the command line option specifications creating details for each in the options map.
- for (int i = 0; i < config.length; i++)
- {
- String[] nextOptionSpec = config[i];
-
- addOption(nextOptionSpec[0], nextOptionSpec[1], (nextOptionSpec.length > 2) ? nextOptionSpec[2] : null,
- (nextOptionSpec.length > 3) ? ("true".equals(nextOptionSpec[3]) ? true : false) : false,
- (nextOptionSpec.length > 4) ? nextOptionSpec[4] : null);
- }
- }
-
- /**
- * Lists all the parsing errors from the most recent parsing in a string.
- *
- * @return All the parsing errors from the most recent parsing.
- */
- public String getErrors()
- {
- // Return the empty string if there are no errors.
- if (parsingErrors.isEmpty())
- {
- return "";
- }
-
- // Concatenate all the parsing errors together.
- StringBuilder result = new StringBuilder();
-
- for (String s : parsingErrors)
- {
- result.append(s);
- }
-
- return result.toString();
- }
-
- /**
- * Lists the properties set from the most recent parsing or an empty string if no parsing has been done yet.
- *
- * @return The properties set from the most recent parsing or an empty string if no parsing has been done yet.
- */
- public String getOptionsInForce()
- {
- // Check if there are no properties to report and return and empty string if so.
- if (parsedProperties == null)
- {
- return "";
- }
-
- // List all the properties.
- StringBuilder result = new StringBuilder("Options in force:\n");
-
- for (Map.Entry<Object, Object> property : parsedProperties.entrySet())
- {
- result.append(property.getKey())
- .append(" = ")
- .append(property.getValue())
- .append('\n');
- }
-
- return result.toString();
- }
-
- /**
- * Generates a usage string consisting of the name of each option and each options argument description and
- * comment.
- *
- * @return A usage string for all the options.
- */
- public String getUsage()
- {
- String result = "Options:\n";
-
- // Print usage on each of the command line options.
- for (CommandLineOption optionInfo : optionMap.values())
- {
- result +=
- "-" + optionInfo.option + " " + ((optionInfo.argument != null) ? (optionInfo.argument + " ") : "")
- + optionInfo.comment + "\n";
- }
-
- return result;
- }
-
- /**
- * Control the behaviour of the errors on unkowns reporting. When turned on this reports all unkowns options
- * as errors. When turned off, all unknowns are simply ignored.
- *
- * @param errors The setting of the errors on unkown flag. True to turn it on.
- */
- public void setErrorsOnUnknowns(boolean errors)
- {
- errorsOnUnknowns = errors;
- }
-
- /**
- * Parses a set of command line arguments into a set of properties, keyed by the argument flag. The free arguments
- * are keyed by integers as strings starting at "1" and then "2", ... and so on.
- *
- * <p>See the class level comment for a description of the parsing rules.
- *
- * @param args The command line arguments.
- *
- * @return The arguments as a set of properties.
- *
- * @throws IllegalArgumentException If the command line cannot be parsed against its specification. If this exception
- * is thrown a call to {@link #getErrors} will provide a diagnostic of the command
- * line errors.
- */
- public Properties parseCommandLine(String[] args) throws IllegalArgumentException
- {
- Properties options = new Properties();
-
- // Used to keep count of the current 'free' argument.
- int free = 1;
-
- // Used to indicate that the most recently parsed option is expecting arguments.
- boolean expectingArgs = false;
-
- // The option that is expecting arguments from the next element of the command line.
- String optionExpectingArgs = null;
-
- // Used to indicate that the most recently parsed option is a duplicate and should be ignored.
- boolean ignore = false;
-
- // Create the regular expression matcher for the command line options.
- StringBuilder regexp = new StringBuilder("^(");
- int optionsAdded = 0;
-
- for (Iterator<String> i = optionMap.keySet().iterator(); i.hasNext();)
- {
- String nextOption = i.next();
-
- // Check that the option is not a free argument definition.
- boolean notFree = false;
-
- try
- {
- Integer.parseInt(nextOption);
- }
- catch (NumberFormatException e)
- {
- notFree = true;
- }
-
- // Add the option to the regular expression matcher if it is not a free argument definition.
- if (notFree)
- {
- regexp.append(nextOption)
- .append(i.hasNext() ? "|" : "");
- optionsAdded++;
- }
- }
-
- // There has to be more that one option in the regular expression or else the compiler complains that the close
- // cannot be nullable if the '?' token is used to make the matched option string optional.
- regexp.append(')')
- .append(((optionsAdded > 0) ? "?" : ""))
- .append("(.*)");
- Pattern pattern = Pattern.compile(regexp.toString());
-
- // Loop through all the command line arguments.
- for (int i = 0; i < args.length; i++)
- {
- // Check if the next command line argument begins with a '-' character and is therefore the start of
- // an option.
- if (args[i].startsWith("-"))
- {
- // Extract the value of the option without the leading '-'.
- String arg = args[i].substring(1);
-
- // Match up to the longest matching option.
- optionMatcher = pattern.matcher(arg);
- optionMatcher.matches();
-
- String matchedOption = optionMatcher.group(1);
-
- // Match any argument directly appended onto the longest matching option.
- String matchedArg = optionMatcher.group(2);
-
- // Check that a known option was matched.
- if ((matchedOption != null) && !"".equals(matchedOption))
- {
- // Get the command line option information for the matched option.
- CommandLineOption optionInfo = optionMap.get(matchedOption);
-
- // Check if this option is expecting arguments.
- if (optionInfo.expectsArgs)
- {
- // The option is expecting arguments so swallow the next command line argument as an
- // argument to this option.
- expectingArgs = true;
- optionExpectingArgs = matchedOption;
-
- }
-
- // Check if the option was matched on its own and is a flag in which case set that flag.
- if ("".equals(matchedArg) && !optionInfo.expectsArgs)
- {
- options.put(matchedOption, "true");
- }
- // The option was matched as a substring with its argument appended to it or is a flag that is
- // condensed together with other flags.
- else if (!"".equals(matchedArg))
- {
- // Check if the option is a flag and therefore is allowed to be condensed together
- // with other flags.
- if (!optionInfo.expectsArgs)
- {
- // Set the first matched flag.
- options.put(matchedOption, "true");
-
- // Repeat the longest matching process on the remainder but ensure that the remainder
- // consists only of flags as only flags may be condensed together in this fashion.
- do
- {
- // Match the remainder against the options.
- optionMatcher = pattern.matcher(matchedArg);
- optionMatcher.matches();
-
- matchedOption = optionMatcher.group(1);
- matchedArg = optionMatcher.group(2);
-
- // Check that an option was matched.
- if (matchedOption != null)
- {
- // Get the command line option information for the next matched option.
- optionInfo = optionMap.get(matchedOption);
-
- // Ensure that the next option is a flag or raise an error if not.
- if (optionInfo.expectsArgs == true)
- {
- parsingErrors.add("Option " + matchedOption + " cannot be combined with flags.\n");
- }
-
- options.put(matchedOption, "true");
- }
- // The remainder could not be matched against a flag it is either an unknown flag
- // or an illegal argument to a flag.
- else
- {
- parsingErrors.add("Illegal argument to a flag in the option " + arg + "\n");
-
- break;
- }
- }
- // Continue until the remainder of the argument has all been matched with flags.
- while (!"".equals(matchedArg));
- }
- // The option is expecting an argument, so store the unmatched portion against it
- // as its argument.
- else
- {
- // Check the arguments format is correct against any specified format.
- checkArgumentFormat(optionInfo, matchedArg);
-
- // Store the argument against its option (regardless of its format).
- options.put(matchedOption, matchedArg);
-
- // The argument to this flag has already been supplied to it. Do not swallow the
- // next command line argument as an argument to this flag.
- expectingArgs = false;
- }
- }
- }
- else // No matching option was found.
- {
- // Add this to the list of parsing errors if errors on unkowns is being used.
- if (errorsOnUnknowns)
- {
- parsingErrors.add("Option " + matchedOption + " is not a recognized option.\n");
- }
- }
- }
- // The command line argument did not being with a '-' so it is an argument to the previous flag or it
- // is a free argument.
- else
- {
- // Check if a previous flag is expecting to swallow this next argument as its argument.
- if (expectingArgs)
- {
- // Get the option info for the option waiting for arguments.
- CommandLineOption optionInfo = optionMap.get(optionExpectingArgs);
-
- // Check the arguments format is correct against any specified format.
- checkArgumentFormat(optionInfo, args[i]);
-
- // Store the argument against its option (regardless of its format).
- options.put(optionExpectingArgs, args[i]);
-
- // Clear the expecting args flag now that the argument has been swallowed.
- expectingArgs = false;
- optionExpectingArgs = null;
- }
- // This command line option is not an argument to any option. Add it to the set of 'free' options.
- else
- {
- // Get the option info for the free option, if there is any.
- CommandLineOption optionInfo = optionMap.get(Integer.toString(free));
-
- if (optionInfo != null)
- {
- // Check the arguments format is correct against any specified format.
- checkArgumentFormat(optionInfo, args[i]);
- }
-
- // Add to the list of free options.
- options.put(Integer.toString(free), args[i]);
-
- // Move on to the next free argument.
- free++;
- }
- }
- }
-
- // Scan through all the specified options to check that all mandatory options have been set and that all flags
- // that were not set are set to false in the set of properties.
- for (CommandLineOption optionInfo : optionMap.values())
- {
- // Check if this is a flag.
- if (!optionInfo.expectsArgs)
- {
- // Check if the flag is not set in the properties and set it to false if so.
- if (!options.containsKey(optionInfo.option))
- {
- options.put(optionInfo.option, "false");
- }
- }
- // Check if this is a mandatory option and was not set.
- else if (optionInfo.mandatory && !options.containsKey(optionInfo.option))
- {
- // Create an error for the missing option.
- parsingErrors.add("Option -" + optionInfo.option + " is mandatory but not was not specified.\n");
- }
- }
-
- // Check if there were any errors.
- if (!parsingErrors.isEmpty())
- {
- // Throw an illegal argument exception to signify that there were parsing errors.
- throw new IllegalArgumentException();
- }
-
- // Convert any name/value pairs in the free arguments into properties in the parsed options.
- options = takeFreeArgsAsProperties(options, 1);
-
- parsedProperties = options;
-
- return options;
- }
-
- /**
- * If a command line has been parsed, calling this method sets all of its parsed options into the specified properties.
- * @param properties properties
- */
- public void addCommandLineToProperties(Properties properties)
- {
- if (parsedProperties != null)
- {
- for (Object propKey : parsedProperties.keySet())
- {
- String name = (String) propKey;
- String value = parsedProperties.getProperty(name);
-
- properties.setProperty(name, value);
- }
- }
- }
-
- /**
- * Resets this command line parser after it has been used to parse a command line. This method will only need
- * to be called to use this parser a second time which is not likely seeing as a command line is usually only
- * specified once. However, it is exposed as a public method for the rare case where this may be done.
- *
- * <p>Cleans the internal state of this parser, removing all stored errors and information about the options in
- * force.
- */
- public void reset()
- {
- parsingErrors = new ArrayList<String>();
- parsedProperties = null;
- }
-
- /**
- * Adds the option to list of available command line options.
- *
- * @param option The option to add as an available command line option.
- * @param comment A comment for the option.
- * @param argument The text that appears after the option in the usage string.
- * @param mandatory When true, indicates that this option is mandatory.
- * @param formatRegexp The format that the argument must take, defined as a regular expression.
- */
- protected void addOption(String option, String comment, String argument, boolean mandatory, String formatRegexp)
- {
- // Check if usage text has been set in which case this option is expecting arguments.
- boolean expectsArgs = ((argument == null) || argument.equals("")) ? false : true;
-
- // Add the option to the map of command line options.
- CommandLineOption opt = new CommandLineOption(option, expectsArgs, comment, argument, mandatory, formatRegexp);
- optionMap.put(option, opt);
- }
-
- /**
- * Converts the free arguments into property declarations. After parsing the command line the free arguments
- * are numbered from 1, such that the parsed properties contain values for the keys "1", "2", ... This method
- * converts any free arguments declared using the 'name=value' syntax into properties with key 'name', value
- * 'value'.
- *
- * <p/>For example the comand line:
- * <pre>
- * ... debug=true
- * </pre>
- *
- * <p/>After parsing has properties:
- * <pre>[[1, debug=true]]</pre>
- *
- * <p/>After applying this method the properties are:
- * <pre>[[1, debug=true], [debug, true]]</pre>
- *
- * @param properties The parsed command line properties.
- * @param from The free argument index to convert to properties from.
- *
- * @return The parsed command line properties, with free argument name value pairs too.
- */
- private Properties takeFreeArgsAsProperties(Properties properties, int from)
- {
- for (int i = from; true; i++)
- {
- String nextFreeArg = properties.getProperty(Integer.toString(i));
-
- // Terminate the loop once all free arguments have been consumed.
- if (nextFreeArg == null)
- {
- break;
- }
-
- // Split it on the =, strip any whitespace and set it as a system property.
- String[] nameValuePair = nextFreeArg.split("=");
-
- if (nameValuePair.length == 2)
- {
- properties.setProperty(nameValuePair[0], nameValuePair[1]);
- }
- }
-
- return properties;
- }
-
- /**
- * Checks the format of an argument to an option against its specified regular expression format if one has
- * been set. Any errors are added to the list of parsing errors.
- *
- * @param optionInfo The command line option information for the option which is havings its argument checked.
- * @param matchedArg The string argument to the option.
- */
- private void checkArgumentFormat(CommandLineOption optionInfo, String matchedArg)
- {
- // Check if this option enforces a format for its argument.
- if (optionInfo.argumentFormatRegexp != null)
- {
- Pattern pattern = Pattern.compile(optionInfo.argumentFormatRegexp);
- Matcher argumentMatcher = pattern.matcher(matchedArg);
-
- // Check if the argument does not meet its required format.
- if (!argumentMatcher.matches())
- {
- // Create an error for this badly formed argument.
- parsingErrors.add("The argument to option -" + optionInfo.option + " does not meet its required format.\n");
- }
- }
- }
-
- /**
- * Extracts all name=value pairs from the command line, sets them all as system properties and also returns
- * a map of properties containing them.
- *
- * @param args The command line.
- * @param commandLine The command line parser.
- * @param properties The properties object to inject all parsed properties into (optional may be <tt>null</tt>).
- *
- * @return A set of properties containing all name=value pairs from the command line.
- */
- public static Properties processCommandLine(String[] args, CommandLineParser commandLine, Properties properties)
- {
- // Capture the command line arguments or display errors and correct usage and then exit.
- Properties options = null;
-
- try
- {
- options = commandLine.parseCommandLine(args);
-
- // Add all the trailing command line options (name=value pairs) to system properties. They may be picked up
- // from there.
- commandLine.addCommandLineToProperties(properties);
- }
- catch (IllegalArgumentException e)
- {
- System.out.println(commandLine.getErrors());
- System.out.println(commandLine.getUsage());
- System.exit(1);
- }
-
- return options;
- }
-
- /**
- * Holds information about a command line options. This includes what its name is, whether or not it is a flag,
- * whether or not it is mandatory, what its user comment is, what its argument reminder text is and what its
- * regular expression format is.
- */
- protected static class CommandLineOption
- {
- /** Holds the text for the flag to match this argument with. */
- private String option = null;
-
- /** Holds a string describing how to use this command line argument. */
- private String argument = null;
-
- /** Flag that determines whether or not this command line argument can take arguments. */
- private boolean expectsArgs = false;
-
- /** Holds a short comment describing what this command line argument is for. */
- private String comment = null;
-
- /** Flag that determines whether or not this is an mandatory command line argument. */
- private boolean mandatory = false;
-
- /** A regular expression describing what format the argument to this option muist have. */
- private String argumentFormatRegexp = null;
-
- /**
- * Create a command line option object that holds specific information about a command line option.
- *
- * @param option The text that matches the option.
- * @param expectsArgs Whether or not the option expects arguments. It is a flag if this is false.
- * @param comment A comment explaining how to use this option.
- * @param argument A short reminder of the format of the argument to this option/
- * @param mandatory Set to true if this option is mandatory.
- * @param formatRegexp The regular expression that the argument to this option must meet to be valid.
- */
- public CommandLineOption(String option, boolean expectsArgs, String comment, String argument, boolean mandatory,
- String formatRegexp)
- {
- this.option = option;
- this.expectsArgs = expectsArgs;
- this.comment = comment;
- this.argument = argument;
- this.mandatory = mandatory;
- this.argumentFormatRegexp = formatRegexp;
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/DataUrlUtils.java b/qpid/java/common/src/main/java/org/apache/qpid/util/DataUrlUtils.java
deleted file mode 100644
index 16c5012d88..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/DataUrlUtils.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.qpid.util;
-
-import javax.xml.bind.DatatypeConverter;
-
-public class DataUrlUtils
-{
- public static String getDataUrlForBytes(final byte[] bytes)
- {
- StringBuilder inlineURL = new StringBuilder("data:;base64,");
- inlineURL.append(DatatypeConverter.printBase64Binary(bytes));
- return inlineURL.toString();
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java b/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java
deleted file mode 100644
index 70607f49db..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * FileUtils provides some simple helper methods for working with files. It follows the convention of wrapping all
- * checked exceptions as runtimes, so code using these methods is free of try-catch blocks but does not expect to
- * recover from errors.
- */
-public class FileUtils
-{
- private FileUtils()
- {
- }
-
- /**
- * Reads a text file as a string.
- *
- * @param filename The name of the file.
- *
- * @return The contents of the file.
- */
- public static byte[] readFileAsBytes(String filename)
- {
-
- try(BufferedInputStream is = new BufferedInputStream(new FileInputStream(filename)))
- {
- return readStreamAsString(is);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
-
- /**
- * Reads a text file as a string.
- *
- * @param filename The name of the file.
- *
- * @return The contents of the file.
- */
- public static String readFileAsString(String filename)
- {
- return new String(readFileAsBytes(filename));
- }
-
- /**
- * Reads a text file as a string.
- *
- * @param file The file.
- *
- * @return The contents of the file.
- */
- public static String readFileAsString(File file)
- {
- try(BufferedInputStream is = new BufferedInputStream(new FileInputStream(file)))
- {
-
- return new String(readStreamAsString(is));
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Reads the contents of a reader, one line at a time until the end of stream is encountered, and returns all
- * together as a string.
- *
- * @param is The reader.
- *
- * @return The contents of the reader.
- */
- private static byte[] readStreamAsString(BufferedInputStream is)
- {
- try(ByteArrayOutputStream inBuffer = new ByteArrayOutputStream())
- {
- byte[] data = new byte[4096];
-
- int read;
-
- while ((read = is.read(data)) != -1)
- {
- inBuffer.write(data, 0, read);
- }
-
- return inBuffer.toByteArray();
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Either opens the specified filename as an input stream or either the filesystem or classpath,
- * or uses the default resource loaded using the specified class loader, if opening the file fails
- * or no file name is specified.
- *
- * @param filename The name of the file to open.
- * @param defaultResource The name of the default resource on the classpath if the file cannot be opened.
- * @param cl The classloader to load the default resource with.
- *
- * @return An input stream for the file or resource, or null if one could not be opened.
- */
- @SuppressWarnings("resource")
- public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl)
- {
- InputStream is = null;
-
- // Try to open the file if one was specified.
- if (filename != null)
- {
- // try on filesystem
- try
- {
- is = new BufferedInputStream(new FileInputStream(new File(filename)));
- }
- catch (FileNotFoundException e)
- {
- is = null;
- }
- if (is == null)
- {
- // failed on filesystem, so try on classpath
- is = cl.getResourceAsStream(filename);
- }
- }
-
- // Load the default resource if a file was not specified, or if opening the file failed.
- if (is == null)
- {
- is = cl.getResourceAsStream(defaultResource);
- }
-
- return is;
- }
-
- /**
- * Copies the specified source file to the specified destintaion file. If the destinationst file does not exist,
- * it is created.
- *
- * @param src The source file name.
- * @param dst The destination file name.
- */
- public static void copy(File src, File dst)
- {
- try
- {
- copyCheckedEx(src, dst);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Copies the specified source file to the specified destination file. If the destination file does not exist,
- * it is created.
- *
- * @param src The source file name.
- * @param dst The destination file name.
- * @throws IOException if there is an issue copying the file
- */
- public static void copyCheckedEx(File src, File dst) throws IOException
- {
- InputStream in = new FileInputStream(src);
- copy(in, dst);
- }
-
- /**
- * Copies the specified InputStream to the specified destination file. If the destination file does not exist,
- * it is created.
- *
- * @param in The InputStream
- * @param dst The destination file name.
- * @throws IOException if there is an issue copying the stream
- */
- public static void copy(InputStream in, File dst) throws IOException
- {
- try
- {
- if (!dst.exists())
- {
- dst.createNewFile();
- }
-
- OutputStream out = new FileOutputStream(dst);
-
- try
- {
- // Transfer bytes from in to out
- byte[] buf = new byte[1024];
- int len;
- while ((len = in.read(buf)) > 0)
- {
- out.write(buf, 0, len);
- }
- }
- finally
- {
- out.close();
- }
- }
- finally
- {
- in.close();
- }
- }
-
- /*
- * Deletes a given file
- */
- public static boolean deleteFile(String filePath)
- {
- return delete(new File(filePath), false);
- }
-
- /*
- * Deletes a given empty directory
- */
- public static boolean deleteDirectory(String directoryPath)
- {
- File directory = new File(directoryPath);
-
- if (directory.isDirectory())
- {
- if (directory.listFiles().length == 0)
- {
- return delete(directory, true);
- }
- }
-
- return false;
- }
-
- /**
- * Delete a given file/directory,
- * A directory will always require the recursive flag to be set.
- * if a directory is specified and recursive set then delete the whole tree
- *
- * @param file the File object to start at
- * @param recursive boolean to recurse if a directory is specified.
- *
- * @return <code>true</code> if and only if the file or directory is
- * successfully deleted; <code>false</code> otherwise
- */
- public static boolean delete(File file, boolean recursive)
- {
- boolean success = true;
-
- if (file.isDirectory())
- {
- if (recursive)
- {
- File[] files = file.listFiles();
-
- // This can occur if the file is deleted outside the JVM
- if (files == null)
- {
- return false;
- }
-
- for (int i = 0; i < files.length; i++)
- {
- success = delete(files[i], true) && success;
- }
-
- return success && file.delete();
- }
-
- return false;
- }
-
- return file.delete();
- }
-
- public static class UnableToCopyException extends Exception
- {
- private static final long serialVersionUID = 956249157141857044L;
-
- UnableToCopyException(String msg)
- {
- super(msg);
- }
- }
-
- public static void copyRecursive(File source, File dst) throws FileNotFoundException, UnableToCopyException
- {
-
- if (!source.exists())
- {
- throw new FileNotFoundException("Unable to copy '" + source.toString() + "' as it does not exist.");
- }
-
- if (dst.exists() && !dst.isDirectory())
- {
- throw new IllegalArgumentException("Unable to copy '" + source.toString() + "' to '" + dst + "' a file with same name exists.");
- }
-
- if (source.isFile())
- {
- copy(source, dst);
- }
-
- //else we have a source directory
- if (!dst.isDirectory() && !dst.mkdirs())
- {
- throw new UnableToCopyException("Unable to create destination directory");
- }
-
- for (File file : source.listFiles())
- {
- if (file.isFile())
- {
- copy(file, new File(dst.toString() + File.separator + file.getName()));
- }
- else
- {
- copyRecursive(file, new File(dst + File.separator + file.getName()));
- }
- }
-
- }
-
- /**
- * Checks the specified file for instances of the search string.
- *
- * @param file the file to search
- * @param search the search String
- *
- * @throws java.io.IOException if there is an issue searching the file
- * @return the list of matching entries
- */
- public static List<String> searchFile(File file, String search)
- throws IOException
- {
-
- List<String> results = new LinkedList<String>();
-
- BufferedReader reader = new BufferedReader(new FileReader(file));
- try
- {
- while (reader.ready())
- {
- String line = reader.readLine();
- if (line.contains(search))
- {
- results.add(line);
- }
- }
- }
- finally
- {
- reader.close();
- }
-
- return results;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/GZIPUtils.java b/qpid/java/common/src/main/java/org/apache/qpid/util/GZIPUtils.java
deleted file mode 100644
index b5ba0b29af..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/GZIPUtils.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GZIPUtils
-{
- private static final Logger LOGGER = LoggerFactory.getLogger(GZIPUtils.class);
-
- public static final String GZIP_CONTENT_ENCODING = "gzip";
-
-
- /**
- * Return a new byte array with the compressed contents of the input buffer
- *
- * @param input byte buffer to compress
- * @return a byte array containing the compressed data, or null if the input was null or there was an unexpected
- * IOException while compressing
- */
- public static byte[] compressBufferToArray(ByteBuffer input)
- {
- if(input != null)
- {
- try (ByteArrayOutputStream compressedBuffer = new ByteArrayOutputStream())
- {
- try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(compressedBuffer))
- {
- if (input.hasArray())
- {
- gzipOutputStream.write(input.array(),
- input.arrayOffset() + input.position(),
- input.remaining());
- }
- else
- {
-
- byte[] data = new byte[input.remaining()];
-
- input.duplicate().get(data);
-
- gzipOutputStream.write(data);
- }
- }
- return compressedBuffer.toByteArray();
- }
- catch (IOException e)
- {
- LOGGER.warn("Unexpected IOException when attempting to compress with gzip", e);
- }
- }
- return null;
- }
-
- public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer)
- {
- if(contentBuffer != null)
- {
- try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer))
- {
- return uncompressStreamToArray(input);
- }
- }
- else
- {
- return null;
- }
- }
-
- public static byte[] uncompressStreamToArray(InputStream stream)
- {
- if(stream != null)
- {
- try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream))
- {
- ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream();
- int read;
- byte[] buf = new byte[4096];
- while ((read = gzipInputStream.read(buf)) != -1)
- {
- inflatedContent.write(buf, 0, read);
- }
- return inflatedContent.toByteArray();
- }
- catch (IOException e)
- {
-
- LOGGER.warn("Unexpected IOException when attempting to uncompress with gzip", e);
- }
- }
- return null;
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/NameUUIDGen.java b/qpid/java/common/src/main/java/org/apache/qpid/util/NameUUIDGen.java
deleted file mode 100644
index e764c8536b..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/NameUUIDGen.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.nio.ByteBuffer;
-import java.util.UUID;
-
-
-/**
- * NameUUIDGen
- *
- */
-
-public final class NameUUIDGen implements UUIDGen
-{
-
- private static final int WIDTH = 8;
-
- final private byte[] seed;
- final private ByteBuffer seedBuf;
- private long counter;
-
- public NameUUIDGen()
- {
- String namespace = UUID.randomUUID().toString();
- this.seed = new byte[namespace.length() + WIDTH];
- for (int i = WIDTH; i < seed.length; i++)
- {
- seed[i] = (byte) namespace.charAt(i - WIDTH);
- }
- this.seedBuf = ByteBuffer.wrap(seed);
- this.counter = 0;
- }
-
- public UUID generate()
- {
- seedBuf.putLong(0, counter++);
- return UUID.nameUUIDFromBytes(seed);
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/RandomUUIDGen.java b/qpid/java/common/src/main/java/org/apache/qpid/util/RandomUUIDGen.java
deleted file mode 100644
index 60b402a105..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/RandomUUIDGen.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.util.UUID;
-
-
-/**
- * RandomUUIDGen
- *
- */
-
-public final class RandomUUIDGen implements UUIDGen
-{
-
- public UUID generate()
- {
- return UUID.randomUUID();
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/Serial.java b/qpid/java/common/src/main/java/org/apache/qpid/util/Serial.java
deleted file mode 100644
index 287c094b88..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/Serial.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-
-import java.util.Comparator;
-
-/**
- * This class provides basic serial number comparisons as defined in
- * RFC 1982.
- */
-
-public class Serial
-{
- private Serial()
- {
- }
-
- public static final Comparator<Integer> COMPARATOR = new Comparator<Integer>()
- {
- public int compare(Integer s1, Integer s2)
- {
- return Serial.compare(s1, s2);
- }
- };
-
- /**
- * Compares two numbers using serial arithmetic.
- *
- * @param s1 the first serial number
- * @param s2 the second serial number
- *
- * @return a negative integer, zero, or a positive integer as the
- * first argument is less than, equal to, or greater than the
- * second
- */
- public static final int compare(int s1, int s2)
- {
- return s1 - s2;
- }
-
- public static final boolean lt(int s1, int s2)
- {
- return compare(s1, s2) < 0;
- }
-
- public static final boolean le(int s1, int s2)
- {
- return compare(s1, s2) <= 0;
- }
-
- public static final boolean gt(int s1, int s2)
- {
- return compare(s1, s2) > 0;
- }
-
- public static final boolean ge(int s1, int s2)
- {
- return compare(s1, s2) >= 0;
- }
-
- public static final boolean eq(int s1, int s2)
- {
- return s1 == s2;
- }
-
- public static final int min(int s1, int s2)
- {
- if (lt(s1, s2))
- {
- return s1;
- }
- else
- {
- return s2;
- }
- }
-
- public static final int max(int s1, int s2)
- {
- if (gt(s1, s2))
- {
- return s1;
- }
- else
- {
- return s2;
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/Strings.java b/qpid/java/common/src/main/java/org/apache/qpid/util/Strings.java
deleted file mode 100644
index 6dd6a989cb..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/Strings.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Stack;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-
-/**
- * Strings
- *
- */
-
-public final class Strings
-{
- private Strings()
- {
- }
-
- private static final byte[] EMPTY = new byte[0];
-
- private static final ThreadLocal<char[]> charbuf = new ThreadLocal<char[]>()
- {
- public char[] initialValue()
- {
- return new char[4096];
- }
- };
-
- public static final byte[] toUTF8(String str)
- {
- if (str == null)
- {
- return EMPTY;
- }
- else
- {
- final int size = str.length();
- char[] chars = charbuf.get();
- if (size > chars.length)
- {
- chars = new char[Math.max(size, 2*chars.length)];
- charbuf.set(chars);
- }
-
- str.getChars(0, size, chars, 0);
- final byte[] bytes = new byte[size];
- for (int i = 0; i < size; i++)
- {
- if (chars[i] > 127)
- {
- try
- {
- return str.getBytes("UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- bytes[i] = (byte) chars[i];
- }
- return bytes;
- }
- }
-
- public static final String fromUTF8(byte[] bytes)
- {
- try
- {
- return new String(bytes, "UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private static final Pattern VAR = Pattern.compile("(?:\\$\\{([^\\}]*)\\})|(?:\\$(\\$))");
-
- public static Resolver chain(Resolver... resolvers)
- {
- Resolver resolver;
- if(resolvers.length == 0)
- {
- resolver = NULL_RESOLVER;
- }
- else
- {
- resolver = resolvers[resolvers.length - 1];
- for (int i = resolvers.length - 2; i >= 0; i--)
- {
- resolver = new ChainedResolver(resolvers[i], resolver);
- }
- }
- return resolver;
- }
-
- public static interface Resolver
- {
- String resolve(String variable, final Resolver resolver);
- }
-
- private static final Resolver NULL_RESOLVER =
- new Resolver()
- {
- @Override
- public String resolve(final String variable, final Resolver resolver)
- {
- return null;
- }
- };
-
- public static class MapResolver implements Resolver
- {
-
- private final Map<String,String> map;
-
- public MapResolver(Map<String,String> map)
- {
- this.map = map;
- }
-
- public String resolve(String variable, final Resolver resolver)
- {
- return map.get(variable);
- }
- }
-
- public static class PropertiesResolver implements Resolver
- {
-
- private final Properties properties;
-
- public PropertiesResolver(Properties properties)
- {
- this.properties = properties;
- }
-
- public String resolve(String variable, final Resolver resolver)
- {
- return properties.getProperty(variable);
- }
- }
-
- public static class ChainedResolver implements Resolver
- {
- private final Resolver primary;
- private final Resolver secondary;
-
- public ChainedResolver(Resolver primary, Resolver secondary)
- {
- this.primary = primary;
- this.secondary = secondary;
- }
-
- public String resolve(String variable, final Resolver resolver)
- {
- String result = primary.resolve(variable, resolver);
- if (result == null)
- {
- result = secondary.resolve(variable, resolver);
- }
- return result;
- }
- }
-
- public static final Resolver ENV_VARS_RESOLVER = new Resolver()
- {
- @Override
- public String resolve(final String variable, final Resolver resolver)
- {
- return System.getenv(variable);
- }
- };
-
-
- public static final Resolver JAVA_SYS_PROPS_RESOLVER = new Resolver()
- {
- @Override
- public String resolve(final String variable, final Resolver resolver)
- {
- return System.getProperty(variable);
- }
- };
-
-
- public static final Resolver SYSTEM_RESOLVER = chain(JAVA_SYS_PROPS_RESOLVER, ENV_VARS_RESOLVER);
-
- public static final String expand(String input)
- {
- return expand(input, SYSTEM_RESOLVER);
- }
-
- public static final String expand(String input, Resolver resolver)
- {
- return expand(input, resolver, new Stack<String>(),true);
- }
- public static final String expand(String input, boolean failOnUnresolved, Resolver... resolvers)
- {
- return expand(input, chain(resolvers), new Stack<String>(), failOnUnresolved);
- }
-
- private static final String expand(String input, Resolver resolver, Stack<String> stack, boolean failOnUnresolved)
- {
- if (input == null)
- {
- throw new IllegalArgumentException("Expansion input cannot be null");
- }
- Matcher m = VAR.matcher(input);
- StringBuffer result = new StringBuffer();
- while (m.find())
- {
- String var = m.group(1);
- if (var == null)
- {
- String esc = m.group(2);
- if ("$".equals(esc))
- {
- m.appendReplacement(result, Matcher.quoteReplacement("$"));
- }
- else
- {
- throw new IllegalArgumentException(esc);
- }
- }
- else
- {
- m.appendReplacement(result, Matcher.quoteReplacement(resolve(var, resolver, stack, failOnUnresolved)));
- }
- }
- m.appendTail(result);
- return result.toString();
- }
-
- private static final String resolve(String var,
- Resolver resolver,
- Stack<String> stack,
- final boolean failOnUnresolved)
- {
- if (stack.contains(var))
- {
- throw new IllegalArgumentException
- (String.format("recursively defined variable: %s stack=%s", var,
- stack));
- }
-
- String result = resolver.resolve(var, resolver);
- if (result == null)
- {
- if(failOnUnresolved)
- {
- throw new IllegalArgumentException("no such variable: " + var);
- }
- else
- {
- return "${"+var+"}";
- }
- }
-
- stack.push(var);
- try
- {
- return expand(result, resolver, stack, failOnUnresolved);
- }
- finally
- {
- stack.pop();
- }
- }
-
- public static final String join(String sep, Iterable items)
- {
- StringBuilder result = new StringBuilder();
-
- for (Object o : items)
- {
- if (result.length() > 0)
- {
- result.append(sep);
- }
- result.append(o.toString());
- }
-
- return result.toString();
- }
-
- public static final String join(String sep, Object[] items)
- {
- return join(sep, Arrays.asList(items));
- }
-
- public static String printMap(Map<String,Object> map)
- {
- StringBuilder sb = new StringBuilder();
- sb.append("<");
- if (map != null)
- {
- for(Map.Entry<String,Object> entry : map.entrySet())
- {
- sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append(" ");
- }
- }
- sb.append(">");
- return sb.toString();
- }
-
-
- public static Resolver createSubstitutionResolver(String prefix, LinkedHashMap<String,String> substitutions)
- {
- return new StringSubstitutionResolver(prefix, substitutions);
- }
-
- private static class StringSubstitutionResolver implements Resolver
- {
-
- private final ThreadLocal<Set<String>> _stack = new ThreadLocal<>();
-
- private final LinkedHashMap<String, String> _substitutions;
- private final String _prefix;
-
- private StringSubstitutionResolver(String prefix, LinkedHashMap<String, String> substitutions)
- {
- _prefix = prefix;
- _substitutions = substitutions;
- }
-
- @Override
- public String resolve(final String variable, final Resolver resolver)
- {
- boolean clearStack = false;
- Set<String> currentStack = _stack.get();
- if(currentStack == null)
- {
- currentStack = new HashSet<>();
- _stack.set(currentStack);
- clearStack = true;
- }
-
- try
- {
- if(currentStack.contains(variable))
- {
- throw new IllegalArgumentException("The value of attribute " + variable + " is defined recursively");
-
- }
-
-
- if (variable.startsWith(_prefix))
- {
- currentStack.add(variable);
- String expanded = resolver.resolve(variable.substring(_prefix.length()), resolver);
- currentStack.remove(variable);
- if(expanded != null)
- {
- for(Map.Entry<String,String> entry : _substitutions.entrySet())
- {
- expanded = expanded.replace(entry.getKey(), entry.getValue());
- }
- }
- return expanded;
- }
- else
- {
- return null;
- }
-
- }
- finally
- {
-
- if(clearStack)
- {
- _stack.remove();
- }
- }
- }
- }
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/SystemUtils.java b/qpid/java/common/src/main/java/org/apache/qpid/util/SystemUtils.java
deleted file mode 100644
index 5825276760..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/SystemUtils.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-
-/**
- * SystemUtils provides some simple helper methods for working with the current
- * Operating System.
- *
- * It follows the convention of wrapping all checked exceptions as runtimes, so
- * code using these methods is free of try-catch blocks but does not expect to
- * recover from errors.
- */
-public class SystemUtils
-{
-
- public static final String UNKNOWN_OS = "unknown";
- public static final String UNKNOWN_VERSION = "na";
- public static final String UNKNOWN_ARCH = "unknown";
-
- private static final String _osName = System.getProperty("os.name", UNKNOWN_OS);
- private static final String _osVersion = System.getProperty("os.version", UNKNOWN_VERSION);
- private static final String _osArch = System.getProperty("os.arch", UNKNOWN_ARCH);
- private static final boolean _isWindows = _osName.toLowerCase().contains("windows");
-
- /** Process identifier of underlying process or null if it cannot be determined */
- private static final String _osPid;
- private static int _osPidInt;
-
- static
- {
- RuntimeMXBean rtb = ManagementFactory.getRuntimeMXBean();
- String processName = rtb.getName();
- int atIndex;
- if(processName != null && (atIndex = processName.indexOf('@')) > 0)
- {
- _osPid = processName.substring(0, atIndex);
- _osPidInt = parseInt(_osPid, -1);
- }
- else
- {
- _osPid = null;
- }
- }
-
-
- private SystemUtils()
- {
- }
-
- public final static String getOSName()
- {
- return _osName;
- }
-
- public final static String getOSVersion()
- {
- return _osVersion;
- }
-
- public final static String getOSArch()
- {
- return _osArch;
- }
-
- public final static String getProcessPid()
- {
- return _osPid;
- }
-
- public final static int getProcessPidAsInt()
- {
- return _osPidInt;
- }
-
- public final static boolean isWindows()
- {
- return _isWindows;
- }
-
- public final static String getOSConfigSuffix()
- {
- if (_osName.contains(" "))
- {
- return _osName.substring(0, _osName.indexOf(' ')).toLowerCase();
- }
- return _osName;
- }
-
- public final static String getOSString()
- {
- return _osName + " " + _osVersion + " " + _osArch;
- }
-
- private static int parseInt(String str, int defaultVal)
- {
- try
- {
- return Integer.parseInt(str);
- }
- catch(NumberFormatException e)
- {
- return defaultVal;
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/UUIDGen.java b/qpid/java/common/src/main/java/org/apache/qpid/util/UUIDGen.java
deleted file mode 100644
index 3cfe5afdac..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/UUIDGen.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-
-import java.util.UUID;
-
-/**
- * UUIDGen
- *
- */
-
-public interface UUIDGen
-{
-
- public UUID generate();
-
-}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/UUIDs.java b/qpid/java/common/src/main/java/org/apache/qpid/util/UUIDs.java
deleted file mode 100644
index d9b2dd8413..0000000000
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/UUIDs.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-
-/**
- * UUIDs
- *
- */
-
-public final class UUIDs
-{
- private UUIDs()
- {
- }
-
- public static final UUIDGen newGenerator()
- {
- return newGenerator(System.getProperty("qpid.uuid.generator",
- NameUUIDGen.class.getName()));
- }
-
- public static UUIDGen newGenerator(String name)
- {
- try
- {
- Class cls = Class.forName(name);
- return (UUIDGen) cls.newInstance();
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/qpid/java/common/src/main/resources/qpidversion.properties b/qpid/java/common/src/main/resources/qpidversion.properties
deleted file mode 100644
index 1fc575368a..0000000000
--- a/qpid/java/common/src/main/resources/qpidversion.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-qpid.name=${qpid.name}
-qpid.version=${qpid.version}
-qpid.version.suffix=${qpid.version.suffix}
-qpid.svnversion=${buildNumber} \ No newline at end of file
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java b/qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java
deleted file mode 100644
index 9fceef337c..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid;
-
-import junit.framework.TestCase;
-
-import org.apache.qpid.framing.AMQFrameDecodingException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.protocol.AMQConstant;
-
-/**
- * This test is to ensure that when an AMQException is rethrown that the specified exception is correctly wrapped up.
- *
- * There are three cases:
- * Re-throwing an AMQException
- * Re-throwing a Subclass of AMQException
- * Re-throwing a Subclass of AMQException that does not have the default AMQException constructor which will force the
- * creation of an AMQException.
- */
-public class AMQExceptionTest extends TestCase
-{
- /**
- * Test that an AMQException will be correctly created and rethrown.
- */
- public void testRethrowGeneric()
- {
- AMQException test = new AMQException(AMQConstant.ACCESS_REFUSED, "refused", new RuntimeException());
-
- AMQException e = reThrowException(test);
-
- assertEquals("Exception not of correct class", AMQException.class, e.getClass());
-
- }
-
- /**
- * Test that a subclass of AMQException that has the default constructor will be correctly created and rethrown.
- */
- public void testRethrowAMQESubclass()
- {
- AMQFrameDecodingException test = new AMQFrameDecodingException(AMQConstant.INTERNAL_ERROR,
- "Error",
- new Exception());
- AMQException e = reThrowException(test);
-
- assertEquals("Exception not of correct class", AMQFrameDecodingException.class, e.getClass());
- }
-
- /**
- * Test that a subclass of AMQException that doesnot have the default constructor will be correctly rethrown as an
- * AMQException
- */
- public void testRethrowAMQESubclassNoConstructor()
- {
- AMQExceptionSubclass test = new AMQExceptionSubclass("Invalid Argument Exception");
-
- AMQException e = reThrowException(test);
-
- assertEquals("Exception not of correct class", AMQException.class, e.getClass());
- }
-
- /**
- * Private method to rethrown and validate the basic values of the rethrown
- * @param test Exception to rethrow
- * @throws AMQException the rethrown exception
- */
- private AMQException reThrowException(AMQException test)
- {
- AMQException amqe = test.cloneForCurrentThread();
-
- assertEquals("Error code does not match.", test.getErrorCode(), amqe.getErrorCode());
- assertTrue("Exception message does not start as expected.", amqe.getMessage().startsWith(test.getMessage()));
- assertEquals("Test Exception is not set as the cause", test, amqe.getCause());
- assertEquals("Cause is not correct", test.getCause(), amqe.getCause().getCause());
-
- return amqe;
- }
-
- public void testGetMessageAsString()
- {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < 25; i++)
- {
- sb.append("message [" + i + "]");
- }
- AMQException e = new AMQException(AMQConstant.INTERNAL_ERROR, sb.toString(), null);
- AMQShortString message = AMQShortString.validValueOf(e.getMessage());
- assertEquals(sb.substring(0, AMQShortString.MAX_LENGTH - 3) + "...", message.toString());
- }
-
- /**
- * Private class that extends AMQException but does not have a default exception.
- */
- private class AMQExceptionSubclass extends AMQException
- {
-
- public AMQExceptionSubclass(String msg)
- {
- super(null, msg, null);
- }
- }
-}
-
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java b/qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java
deleted file mode 100644
index e597192766..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.codec;
-
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-import org.apache.qpid.framing.AMQBody;
-import org.apache.qpid.framing.AMQDataBlock;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.AMQFrameDecodingException;
-import org.apache.qpid.framing.AMQProtocolVersionException;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.FrameCreatingMethodProcessor;
-import org.apache.qpid.framing.HeartbeatBody;
-import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.util.BytesDataOutput;
-
-public class AMQDecoderTest extends TestCase
-{
-
- private AMQDecoder _decoder;
- private FrameCreatingMethodProcessor _methodProcessor;
-
-
- public void setUp()
- {
- _methodProcessor = new FrameCreatingMethodProcessor(ProtocolVersion.v0_91);
- _decoder = new ClientDecoder(_methodProcessor);
- }
-
-
- private ByteBuffer getHeartbeatBodyBuffer() throws IOException
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- HeartbeatBody.FRAME.writePayload(new DataOutputStream(baos));
- return ByteBuffer.wrap(baos.toByteArray());
- }
-
- public void testSingleFrameDecode() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException
- {
- ByteBuffer msg = getHeartbeatBodyBuffer();
- _decoder.decodeBuffer(msg);
- List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods();
- if (frames.get(0) instanceof AMQFrame)
- {
- assertEquals(HeartbeatBody.FRAME.getBodyFrame().getFrameType(), ((AMQFrame) frames.get(0)).getBodyFrame().getFrameType());
- }
- else
- {
- fail("decode was not a frame");
- }
- }
-
-
- public void testDecodeWithManyBuffers() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException
- {
- Random random = new Random();
- final byte[] payload = new byte[2048];
- random.nextBytes(payload);
- final AMQBody body = new ContentBody(payload);
- AMQFrame frame = new AMQFrame(1, body);
- byte[] outputBuf = new byte[4096];
- BytesDataOutput dataOutput = new BytesDataOutput(outputBuf);
- frame.writePayload(dataOutput);
- for(int i = 0 ; i < dataOutput.length(); i++)
- {
- _decoder.decodeBuffer(ByteBuffer.wrap(outputBuf, i, 1));
-
- }
- List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods();
- if (frames.get(0) instanceof AMQFrame)
- {
- assertEquals(ContentBody.TYPE, ((AMQFrame) frames.get(0)).getBodyFrame().getFrameType());
- ContentBody decodedBody = (ContentBody) ((AMQFrame) frames.get(0)).getBodyFrame();
- assertTrue("Body was corrupted", Arrays.equals(payload, decodedBody.getPayload()));
- }
- else
- {
- fail("decode was not a frame");
- }
- }
-
- public void testPartialFrameDecode() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException
- {
- ByteBuffer msg = getHeartbeatBodyBuffer();
- ByteBuffer msgA = msg.slice();
- int msgbPos = msg.remaining() / 2;
- int msgaLimit = msg.remaining() - msgbPos;
- msgA.limit(msgaLimit);
- msg.position(msgbPos);
- ByteBuffer msgB = msg.slice();
-
- _decoder.decodeBuffer(msgA);
- List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods();
- assertEquals(0, frames.size());
-
- _decoder.decodeBuffer(msgB);
- assertEquals(1, frames.size());
- if (frames.get(0) instanceof AMQFrame)
- {
- assertEquals(HeartbeatBody.FRAME.getBodyFrame().getFrameType(), ((AMQFrame) frames.get(0)).getBodyFrame().getFrameType());
- }
- else
- {
- fail("decode was not a frame");
- }
- }
-
- public void testMultipleFrameDecode() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException
- {
- ByteBuffer msgA = getHeartbeatBodyBuffer();
- ByteBuffer msgB = getHeartbeatBodyBuffer();
- ByteBuffer msg = ByteBuffer.allocate(msgA.remaining() + msgB.remaining());
- msg.put(msgA);
- msg.put(msgB);
- msg.flip();
- _decoder.decodeBuffer(msg);
- List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods();
- assertEquals(2, frames.size());
- for (AMQDataBlock frame : frames)
- {
- if (frame instanceof AMQFrame)
- {
- assertEquals(HeartbeatBody.FRAME.getBodyFrame().getFrameType(), ((AMQFrame) frame).getBodyFrame().getFrameType());
- }
- else
- {
- fail("decode was not a frame");
- }
- }
- }
-
- public void testMultiplePartialFrameDecode() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException
- {
- ByteBuffer msgA = getHeartbeatBodyBuffer();
- ByteBuffer msgB = getHeartbeatBodyBuffer();
- ByteBuffer msgC = getHeartbeatBodyBuffer();
-
- ByteBuffer sliceA = ByteBuffer.allocate(msgA.remaining() + msgB.remaining() / 2);
- sliceA.put(msgA);
- int limit = msgB.limit();
- int pos = msgB.remaining() / 2;
- msgB.limit(pos);
- sliceA.put(msgB);
- sliceA.flip();
- msgB.limit(limit);
- msgB.position(pos);
-
- ByteBuffer sliceB = ByteBuffer.allocate(msgB.remaining() + pos);
- sliceB.put(msgB);
- msgC.limit(pos);
- sliceB.put(msgC);
- sliceB.flip();
- msgC.limit(limit);
-
- _decoder.decodeBuffer(sliceA);
- List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods();
- assertEquals(1, frames.size());
- frames.clear();
- _decoder.decodeBuffer(sliceB);
- assertEquals(1, frames.size());
- frames.clear();
- _decoder.decodeBuffer(msgC);
- assertEquals(1, frames.size());
- for (AMQDataBlock frame : frames)
- {
- if (frame instanceof AMQFrame)
- {
- assertEquals(HeartbeatBody.FRAME.getBodyFrame().getFrameType(), ((AMQFrame) frame).getBodyFrame().getFrameType());
- }
- else
- {
- fail("decode was not a frame");
- }
- }
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java b/qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java
deleted file mode 100644
index 335270264c..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpid.configuration;
-
-import org.apache.qpid.test.utils.QpidTestCase;
-
-public class QpidPropertyTest extends QpidTestCase
-{
- private static final String TEST_VALUE1 = "TEST_VALUE1";
- private static final String TEST_VALUE2 = "TEST_VALUE2";
- private static final String DEFAULT_VALUE = "DEFAULT_VALUE";
-
- private String _systemPropertyName;
- private String _deprecatedSystemPropertyName;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- _systemPropertyName = getName() + ".current";
- _deprecatedSystemPropertyName = getName() + ".deprecated";
- }
-
- public void testValueReadFromSystemProperty() throws Exception
- {
- setTestSystemProperty(_systemPropertyName, TEST_VALUE1);
- assertSystemPropertiesSet(_systemPropertyName);
-
- String propertyValue = QpidProperty.stringProperty(DEFAULT_VALUE, _systemPropertyName).get();
- assertEquals(TEST_VALUE1, propertyValue);
- }
-
- public void testValueReadFromSecondChoiceSystemPropertyWhenFirstChoiceNotSet() throws Exception
- {
- setTestSystemProperty(_deprecatedSystemPropertyName, TEST_VALUE2);
- assertSystemPropertiesSet(_deprecatedSystemPropertyName);
- assertSystemPropertiesNotSet(_systemPropertyName);
-
- String propertyValue = QpidProperty.stringProperty("default", _systemPropertyName, _deprecatedSystemPropertyName).get();
- assertEquals(TEST_VALUE2, propertyValue);
- }
-
- public void testValueReadFromFirstChoiceSystemPropertyWhenBothFirstAndSecondChoiceSet() throws Exception
- {
- setTestSystemProperty(_systemPropertyName, TEST_VALUE1);
- setTestSystemProperty(_deprecatedSystemPropertyName, TEST_VALUE2);
- assertSystemPropertiesSet(_systemPropertyName, _deprecatedSystemPropertyName);
-
- String propertyValue = QpidProperty.stringProperty("default", _systemPropertyName, _deprecatedSystemPropertyName).get();
- assertEquals(TEST_VALUE1, propertyValue);
- }
-
- public void testValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
- {
- assertSystemPropertiesNotSet(_systemPropertyName);
-
- String propertyValue = QpidProperty.stringProperty(DEFAULT_VALUE, _systemPropertyName).get();
- assertEquals(DEFAULT_VALUE, propertyValue);
- }
-
- public void testValueIsDefaultWhenTwoSystemPropertiesAreNotSet() throws Exception
- {
- assertSystemPropertiesNotSet(_systemPropertyName, _deprecatedSystemPropertyName);
-
- String propertyValue = QpidProperty.stringProperty(DEFAULT_VALUE, _systemPropertyName).get();
- assertEquals(DEFAULT_VALUE, propertyValue);
- }
-
- public void testValueIsNullWhenNoDefaultAndNoSystemPropertiesAreSet() throws Exception
- {
- assertSystemPropertiesNotSet(_systemPropertyName, _deprecatedSystemPropertyName);
-
- String nullString = null;
- String propertyValue = QpidProperty.stringProperty(nullString, _systemPropertyName).get();
- assertNull(propertyValue);
- }
-
- public void testBooleanValueReadFromSystemProperty() throws Exception
- {
- setTestSystemProperty(_systemPropertyName, Boolean.FALSE.toString());
- assertSystemPropertiesSet(_systemPropertyName);
-
- boolean propertyValue = QpidProperty.booleanProperty(Boolean.TRUE, _systemPropertyName).get();
- assertFalse(propertyValue);
- }
-
- public void testBooleanValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
- {
- assertSystemPropertiesNotSet(_systemPropertyName);
-
- Boolean propertyValue = QpidProperty.booleanProperty(Boolean.TRUE, _systemPropertyName).get();
- assertTrue(propertyValue);
- }
-
- public void testIntegerValueReadFromSystemProperty() throws Exception
- {
- int expectedValue = 15;
- setTestSystemProperty(_systemPropertyName, Integer.valueOf(expectedValue).toString());
- assertSystemPropertiesSet(_systemPropertyName);
-
- int propertyValue = QpidProperty.intProperty(14, _systemPropertyName).get();
- assertEquals(expectedValue, propertyValue);
- }
-
- public void testIntegerValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
- {
- int expectedValue = 15;
- assertSystemPropertiesNotSet(_systemPropertyName);
-
- int propertyValue = QpidProperty.intProperty(expectedValue, _systemPropertyName).get();
- assertEquals(expectedValue, propertyValue);
- }
-
- public void testLongValueReadFromSystemProperty() throws Exception
- {
- long expectedValue = 15;
- setTestSystemProperty(_systemPropertyName, Long.valueOf(expectedValue).toString());
- assertSystemPropertiesSet(_systemPropertyName);
-
- long propertyValue = QpidProperty.longProperty(14l, _systemPropertyName).get();
- assertEquals(expectedValue, propertyValue);
- }
-
- public void testLongValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
- {
- long expectedValue = 15;
- assertSystemPropertiesNotSet(_systemPropertyName);
-
- long propertyValue = QpidProperty.longProperty(expectedValue, _systemPropertyName).get();
- assertEquals(expectedValue, propertyValue);
- }
-
- public void testFloatValueReadFromSystemProperty() throws Exception
- {
- float expectedValue = 1.5f;
- setTestSystemProperty(_systemPropertyName, Float.valueOf(expectedValue).toString());
- assertSystemPropertiesSet(_systemPropertyName);
-
- float propertyValue = QpidProperty.floatProperty(1.5f, _systemPropertyName).get();
- assertEquals(expectedValue, propertyValue, 0.1);
- }
-
- public void testFloatValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
- {
- float expectedValue = 1.5f;
- assertSystemPropertiesNotSet(_systemPropertyName);
-
- float propertyValue = QpidProperty.floatProperty(expectedValue, _systemPropertyName).get();
- assertEquals(expectedValue, propertyValue, 0.1);
- }
-
- private void assertSystemPropertiesSet(String... systemPropertyNames)
- {
- for (String systemPropertyName : systemPropertyNames)
- {
- assertTrue("System property " + systemPropertyName + " should be set",
- System.getProperties().containsKey(systemPropertyName));
- }
- }
-
- private void assertSystemPropertiesNotSet(String... systemPropertyNames)
- {
- for (String systemPropertyName : systemPropertyNames)
- {
- assertFalse("System property " + systemPropertyName + " should not be set",
- System.getProperties().containsKey(systemPropertyName));
- }
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java
deleted file mode 100644
index 61ac04213e..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.framing;
-
-import junit.framework.TestCase;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-public class AMQShortStringTest extends TestCase
-{
-
- public static final AMQShortString HELLO = new AMQShortString("Hello");
- public static final AMQShortString HELL = new AMQShortString("Hell");
- public static final AMQShortString GOODBYE = new AMQShortString("Goodbye");
- public static final AMQShortString GOOD = new AMQShortString("Good");
- public static final AMQShortString BYE = new AMQShortString("BYE");
-
- public void testStartsWith()
- {
- assertTrue(HELLO.startsWith(HELL));
-
- assertFalse(HELL.startsWith(HELLO));
-
- assertTrue(GOODBYE.startsWith(GOOD));
-
- assertFalse(GOOD.startsWith(GOODBYE));
- }
-
- public void testEndWith()
- {
- assertFalse(HELL.endsWith(HELLO));
-
- assertTrue(GOODBYE.endsWith(new AMQShortString("bye")));
-
- assertFalse(GOODBYE.endsWith(BYE));
- }
-
-
- public void testTokenize()
- {
- AMQShortString dotSeparatedWords = new AMQShortString("this.is.a.test.with.1.2.3.-numbers-and-then--dashes-");
- AMQShortStringTokenizer dotTokenizer = dotSeparatedWords.tokenize((byte) '.');
-
- assertTrue(dotTokenizer.hasMoreTokens());
- assertEquals(new AMQShortString("this"),(dotTokenizer.nextToken()));
- assertTrue(dotTokenizer.hasMoreTokens());
- assertEquals(new AMQShortString("is"),(dotTokenizer.nextToken()));
- assertTrue(dotTokenizer.hasMoreTokens());
- assertEquals(new AMQShortString("a"),(dotTokenizer.nextToken()));
- assertTrue(dotTokenizer.hasMoreTokens());
- assertEquals(new AMQShortString("test"),(dotTokenizer.nextToken()));
- assertTrue(dotTokenizer.hasMoreTokens());
- assertEquals(new AMQShortString("with"),(dotTokenizer.nextToken()));
- assertTrue(dotTokenizer.hasMoreTokens());
- assertEquals(dotTokenizer.nextToken().toIntValue() , 1);
- assertTrue(dotTokenizer.hasMoreTokens());
- assertEquals(dotTokenizer.nextToken().toIntValue() , 2);
- assertTrue(dotTokenizer.hasMoreTokens());
- assertEquals(dotTokenizer.nextToken().toIntValue() , 3);
- assertTrue(dotTokenizer.hasMoreTokens());
- AMQShortString dashString = dotTokenizer.nextToken();
- assertEquals(new AMQShortString("-numbers-and-then--dashes-"),(dashString));
-
- AMQShortStringTokenizer dashTokenizer = dashString.tokenize((byte)'-');
- assertEquals(dashTokenizer.countTokens(), 7);
-
- AMQShortString[] expectedResults = new AMQShortString[]
- { AMQShortString.EMPTY_STRING,
- new AMQShortString("numbers"),
- new AMQShortString("and"),
- new AMQShortString("then"),
- AMQShortString.EMPTY_STRING,
- new AMQShortString("dashes"),
- AMQShortString.EMPTY_STRING };
-
- for(int i = 0; i < 7; i++)
- {
- assertTrue(dashTokenizer.hasMoreTokens());
- assertEquals(dashTokenizer.nextToken(), expectedResults[i]);
- }
-
- assertFalse(dotTokenizer.hasMoreTokens());
- }
-
-
- public void testEquals()
- {
- assertEquals(GOODBYE, new AMQShortString("Goodbye"));
- assertEquals(new AMQShortString("A"), new AMQShortString("A"));
- assertFalse(new AMQShortString("A").equals(new AMQShortString("a")));
- }
-
- /**
- * Test method for
- * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(byte[])}.
- */
- public void testCreateAMQShortStringByteArray()
- {
- byte[] bytes = null;
- try
- {
- bytes = "test".getBytes("UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- fail("UTF-8 encoding is not supported anymore by JVM:" + e.getMessage());
- }
- AMQShortString string = new AMQShortString(bytes);
- assertEquals("constructed amq short string length differs from expected", 4, string.length());
- assertTrue("constructed amq short string differs from expected", string.equalsCharSequence("test"));
- }
-
- /**
- * Test method for
- * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(java.lang.String)}
- * <p>
- * Tests short string construction from string with length less than 255.
- */
- public void testCreateAMQShortStringString()
- {
- AMQShortString string = new AMQShortString("test");
- assertEquals("constructed amq short string length differs from expected", 4, string.length());
- assertTrue("constructed amq short string differs from expected", string.equalsCharSequence("test"));
- }
-
- /**
- * Test method for
- * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(char[])}.
- * <p>
- * Tests short string construction from char array with length less than 255.
- */
- public void testCreateAMQShortStringCharArray()
- {
- char[] chars = "test".toCharArray();
- AMQShortString string = new AMQShortString(chars);
- assertEquals("constructed amq short string length differs from expected", 4, string.length());
- assertTrue("constructed amq short string differs from expected", string.equalsCharSequence("test"));
- }
-
- /**
- * Test method for
- * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(java.lang.CharSequence)}
- * <p>
- * Tests short string construction from char sequence with length less than 255.
- */
- public void testCreateAMQShortStringCharSequence()
- {
- AMQShortString string = new AMQShortString((CharSequence) "test");
- assertEquals("constructed amq short string length differs from expected", 4, string.length());
- assertTrue("constructed amq short string differs from expected", string.equalsCharSequence("test"));
- }
-
- /**
- * Test method for
- * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(byte[])}.
- * <p>
- * Tests an attempt to create an AMQP short string from byte array with length over 255.
- */
- public void testCreateAMQShortStringByteArrayOver255()
- {
- String test = buildString('a', 256);
- byte[] bytes = null;
- try
- {
- bytes = test.getBytes("UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- fail("UTF-8 encoding is not supported anymore by JVM:" + e.getMessage());
- }
- try
- {
- new AMQShortString(bytes);
- fail("It should not be possible to create AMQShortString with length over 255");
- }
- catch (IllegalArgumentException e)
- {
- assertEquals("Exception message differs from expected",
- "Cannot create AMQShortString with number of octets over 255!", e.getMessage());
- }
- }
-
- /**
- * Test method for
- * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(java.lang.String)}
- * <p>
- * Tests an attempt to create an AMQP short string from string with length over 255
- */
- public void testCreateAMQShortStringStringOver255()
- {
- String test = buildString('a', 256);
- try
- {
- new AMQShortString(test);
- fail("It should not be possible to create AMQShortString with length over 255");
- }
- catch (IllegalArgumentException e)
- {
- assertEquals("Exception message differs from expected",
- "Cannot create AMQShortString with number of octets over 255!", e.getMessage());
- }
- }
-
- /**
- * Test method for
- * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(char[])}.
- * <p>
- * Tests an attempt to create an AMQP short string from char array with length over 255.
- */
- public void testCreateAMQShortStringCharArrayOver255()
- {
- String test = buildString('a', 256);
- char[] chars = test.toCharArray();
- try
- {
- new AMQShortString(chars);
- fail("It should not be possible to create AMQShortString with length over 255");
- }
- catch (IllegalArgumentException e)
- {
- assertEquals("Exception message differs from expected",
- "Cannot create AMQShortString with number of octets over 255!", e.getMessage());
- }
- }
-
- /**
- * Test method for
- * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(java.lang.CharSequence)}
- * <p>
- * Tests an attempt to create an AMQP short string from char sequence with length over 255.
- */
- public void testCreateAMQShortStringCharSequenceOver255()
- {
- String test = buildString('a', 256);
- try
- {
- new AMQShortString((CharSequence) test);
- fail("It should not be possible to create AMQShortString with length over 255");
- }
- catch (IllegalArgumentException e)
- {
- assertEquals("Exception message differs from expected",
- "Cannot create AMQShortString with number of octets over 255!", e.getMessage());
- }
- }
-
- /**
- * Tests joining of short strings into a short string with length over 255.
- */
- public void testJoinOverflow()
- {
- List<AMQShortString> data = new ArrayList<AMQShortString>();
- for (int i = 0; i < 25; i++)
- {
- data.add(new AMQShortString("test data!"));
- }
- try
- {
- AMQShortString.join(data, new AMQShortString(" "));
- fail("It should not be possible to create AMQShortString with length over 255");
- }
- catch (IllegalArgumentException e)
- {
- assertEquals("Exception message differs from expected",
- "Cannot create AMQShortString with number of octets over 255!", e.getMessage());
- }
- }
-
- /**
- * Tests joining of short strings into a short string with length less than 255.
- */
- public void testJoin()
- {
- StringBuilder expected = new StringBuilder();
- List<AMQShortString> data = new ArrayList<AMQShortString>();
- data.add(new AMQShortString("test data 1"));
- expected.append("test data 1");
- data.add(new AMQShortString("test data 2"));
- expected.append(" test data 2");
- AMQShortString result = AMQShortString.join(data, new AMQShortString(" "));
- assertEquals("join result differs from expected", expected.toString(), result.asString());
- }
-
- public void testValueOf()
- {
- String string = buildString('a', 255);
- AMQShortString shortString = AMQShortString.valueOf(string, true, true);
- assertEquals("Unexpected string from valueOf", string, shortString.asString());
- }
-
- public void testValueOfTruncated()
- {
- String string = buildString('a', 256);
- AMQShortString shortString = AMQShortString.valueOf(string, true, true);
- assertEquals("Unexpected truncated string from valueOf", string.substring(0, AMQShortString.MAX_LENGTH -3) + "...", shortString.asString());
- }
-
- public void testValueOfNulAsEmptyString()
- {
- AMQShortString shortString = AMQShortString.valueOf(null, true, true);
- assertEquals("Unexpected empty string from valueOf", AMQShortString.EMPTY_STRING, shortString);
- }
-
- public void testValueOfNullAsNull()
- {
- AMQShortString shortString = AMQShortString.valueOf(null, true, false);
- assertEquals("Unexpected null string from valueOf", null, shortString);
- }
-
- /**
- * A helper method to generate a string with given length containing given
- * character
- *
- * @param ch
- * char to build string with
- * @param length
- * target string length
- * @return string
- */
- private String buildString(char ch, int length)
- {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++)
- {
- sb.append(ch);
- }
- return sb.toString();
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java
deleted file mode 100644
index 4902e8ad64..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-
-public class BasicContentHeaderPropertiesTest extends TestCase
-{
-
- private BasicContentHeaderProperties _testProperties;
- private FieldTable _testTable;
- private String _testString = "This is a test string";
- private int _testint = 666;
-
- /**
- * Currently only test setting/getting String, int and boolean props
- */
- public BasicContentHeaderPropertiesTest()
- {
- _testProperties = new BasicContentHeaderProperties();
- }
-
- public void setUp()
- {
- _testTable = new FieldTable();
- _testTable.setString("TestString", _testString);
- _testTable.setInteger("Testint", _testint);
- _testProperties = new BasicContentHeaderProperties();
- _testProperties.setHeaders(_testTable);
- }
-
- public void testGetPropertyListSize()
- {
- //needs a better test but at least we're exercising the code !
- // FT length is encoded in an int
- int expectedSize = EncodingUtils.encodedIntegerLength();
-
- expectedSize += EncodingUtils.encodedShortStringLength("TestInt");
- // 1 is for the Encoding Letter. here an 'i'
- expectedSize += 1 + EncodingUtils.encodedIntegerLength();
-
- expectedSize += EncodingUtils.encodedShortStringLength("TestString");
- // 1 is for the Encoding Letter. here an 'S'
- expectedSize += 1 + EncodingUtils.encodedLongStringLength(_testString);
-
-
- int size = _testProperties.getPropertyListSize();
-
- assertEquals(expectedSize, size);
- }
-
- public void testGetSetPropertyFlags()
- {
- _testProperties.setPropertyFlags(99);
- assertEquals(99, _testProperties.getPropertyFlags());
- }
-
- public void testWritePropertyListPayload() throws IOException
- {
- _testProperties.writePropertyListPayload(new DataOutputStream(new ByteArrayOutputStream(300)));
- }
-
- public void testPopulatePropertiesFromBuffer() throws Exception
- {
- DataInputStream buf = new DataInputStream(new ByteArrayInputStream(new byte[300]));
- _testProperties.populatePropertiesFromBuffer(buf, 99, 99);
- }
-
- public void testSetGetContentType()
- {
- String contentType = "contentType";
- _testProperties.setContentType(contentType);
- assertEquals(contentType, _testProperties.getContentTypeAsString());
- }
-
- public void testSetGetEncoding()
- {
- String encoding = "encoding";
- _testProperties.setEncoding(encoding);
- assertEquals(encoding, _testProperties.getEncodingAsString());
- }
-
- public void testSetGetHeaders()
- {
- _testProperties.setHeaders(_testTable);
- assertEquals(_testTable, _testProperties.getHeaders());
- }
-
- public void testSetGetDeliveryMode()
- {
- byte deliveryMode = 1;
- _testProperties.setDeliveryMode(deliveryMode);
- assertEquals(deliveryMode, _testProperties.getDeliveryMode());
- }
-
- public void testSetGetPriority()
- {
- byte priority = 1;
- _testProperties.setPriority(priority);
- assertEquals(priority, _testProperties.getPriority());
- }
-
- public void testSetGetCorrelationId()
- {
- String correlationId = "correlationId";
- _testProperties.setCorrelationId(correlationId);
- assertEquals(correlationId, _testProperties.getCorrelationIdAsString());
- }
-
- public void testSetGetReplyTo()
- {
- String replyTo = "replyTo";
- _testProperties.setReplyTo(replyTo);
- assertEquals(replyTo, _testProperties.getReplyToAsString());
- }
-
- public void testSetGetExpiration()
- {
- long expiration = 999999999;
- _testProperties.setExpiration(expiration);
- assertEquals(expiration, _testProperties.getExpiration());
- expiration = 0l;
- _testProperties.setExpiration(expiration);
- assertEquals(expiration, _testProperties.getExpiration());
- }
-
- public void testSetGetMessageId()
- {
- String messageId = "messageId";
- _testProperties.setMessageId(messageId);
- assertEquals(messageId, _testProperties.getMessageIdAsString());
- }
-
- public void testSetGetTimestamp()
- {
- long timestamp = System.currentTimeMillis();
- _testProperties.setTimestamp(timestamp);
- assertEquals(timestamp, _testProperties.getTimestamp());
- }
-
- public void testSetGetType()
- {
- String type = "type";
- _testProperties.setType(type);
- assertEquals(type, _testProperties.getTypeAsString());
- }
-
- public void testSetGetUserId()
- {
- String userId = "userId";
- _testProperties.setUserId(userId);
- assertEquals(userId, _testProperties.getUserIdAsString());
- }
-
- public void testSetGetAppId()
- {
- String appId = "appId";
- _testProperties.setAppId(appId);
- assertEquals(appId, _testProperties.getAppIdAsString());
- }
-
- public void testSetGetClusterId()
- {
- String clusterId = "clusterId";
- _testProperties.setClusterId(clusterId);
- assertEquals(clusterId, _testProperties.getClusterIdAsString());
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/FieldTableTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/FieldTableTest.java
deleted file mode 100644
index 5c05adf997..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/FieldTableTest.java
+++ /dev/null
@@ -1,949 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-import org.junit.Assert;
-
-import org.apache.qpid.AMQPInvalidClassException;
-
-public class FieldTableTest extends TestCase
-{
- /**
- * Test that setting a similar named value replaces any previous value set on that name
- */
- public void testReplacement()
- {
- FieldTable table1 = new FieldTable();
- // Set a boolean value
- table1.setBoolean("value", true);
- // Check length of table is correct (<Value length> + <type> + <Boolean length>)
- int size = EncodingUtils.encodedShortStringLength("value") + 1 + EncodingUtils.encodedBooleanLength();
- Assert.assertEquals(size, table1.getEncodedSize());
-
- // reset value to an integer
- table1.setInteger("value", Integer.MAX_VALUE);
-
- // Check the length has changed accordingly (<Value length> + <type> + <Integer length>)
- size = EncodingUtils.encodedShortStringLength("value") + 1 + EncodingUtils.encodedIntegerLength();
- Assert.assertEquals(size, table1.getEncodedSize());
-
- // Check boolean value is null
- Assert.assertEquals(null, table1.getBoolean("value"));
- // ... and integer value is good
- Assert.assertEquals((Integer) Integer.MAX_VALUE, table1.getInteger("value"));
- }
-
- /**
- * Set a boolean and check that we can only get it back as a boolean and a string
- * Check that attempting to lookup a non existent value returns null
- */
- public void testBoolean()
- {
- FieldTable table1 = new FieldTable();
- table1.setBoolean("value", true);
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Test Getting right value back
- Assert.assertEquals((Boolean) true, table1.getBoolean("value"));
-
- // Check we don't get anything back for other gets
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
-
- // except value as a string
- Assert.assertEquals("true", table1.getString("value"));
-
- table1.remove("value");
-
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getBoolean("Rubbish"));
- }
-
- /**
- * Set a byte and check that we can only get it back as a byte and a string
- * Check that attempting to lookup a non existent value returns null
- */
- public void testByte()
- {
- FieldTable table1 = new FieldTable();
- table1.setByte("value", Byte.MAX_VALUE);
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Tests lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(Byte.valueOf(Byte.MAX_VALUE), table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
-
- // ... and a the string value of it.
- Assert.assertEquals("" + Byte.MAX_VALUE, table1.getString("value"));
-
- table1.remove("value");
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getByte("Rubbish"));
- }
-
- /**
- * Set a short and check that we can only get it back as a short and a string
- * Check that attempting to lookup a non existent value returns null
- */
- public void testShort()
- {
- FieldTable table1 = new FieldTable();
- table1.setShort("value", Short.MAX_VALUE);
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Tests lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(Short.valueOf(Short.MAX_VALUE), table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
-
- // ... and a the string value of it.
- Assert.assertEquals("" + Short.MAX_VALUE, table1.getString("value"));
-
- table1.remove("value");
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getShort("Rubbish"));
- }
-
- /**
- * Set a char and check that we can only get it back as a char
- * Check that attempting to lookup a non existent value returns null
- */
- public void testChar()
- {
- FieldTable table1 = new FieldTable();
- table1.setChar("value", 'c');
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Tests lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(Character.valueOf('c'), table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
-
- // ... and a the string value of it.
- Assert.assertEquals("c", table1.getString("value"));
-
- table1.remove("value");
-
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getCharacter("Rubbish"));
- }
-
- /**
- * Set a double and check that we can only get it back as a double
- * Check that attempting to lookup a non existent value returns null
- */
- public void testDouble()
- {
- FieldTable table1 = new FieldTable();
- table1.setDouble("value", Double.MAX_VALUE);
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Tests lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
-
- // ... and a the string value of it.
- Assert.assertEquals("" + Double.MAX_VALUE, table1.getString("value"));
- table1.remove("value");
- // but after a removeKey it doesn't
- Assert.assertFalse(table1.containsKey("value"));
-
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getDouble("Rubbish"));
- }
-
- /**
- * Set a float and check that we can only get it back as a float
- * Check that attempting to lookup a non existent value returns null
- */
- public void testFloat()
- {
- FieldTable table1 = new FieldTable();
- table1.setFloat("value", Float.MAX_VALUE);
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Tests lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(Float.valueOf(Float.MAX_VALUE), table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
-
- // ... and a the string value of it.
- Assert.assertEquals("" + Float.MAX_VALUE, table1.getString("value"));
-
- table1.remove("value");
- // but after a removeKey it doesn't
- Assert.assertFalse(table1.containsKey("value"));
-
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getFloat("Rubbish"));
- }
-
- /**
- * Set an int and check that we can only get it back as an int
- * Check that attempting to lookup a non existent value returns null
- */
- public void testInt()
- {
- FieldTable table1 = new FieldTable();
- table1.setInteger("value", Integer.MAX_VALUE);
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Tets lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
-
- // ... and a the string value of it.
- Assert.assertEquals("" + Integer.MAX_VALUE, table1.getString("value"));
-
- table1.remove("value");
- // but after a removeKey it doesn't
- Assert.assertFalse(table1.containsKey("value"));
-
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getInteger("Rubbish"));
- }
-
- /**
- * Set a long and check that we can only get it back as a long
- * Check that attempting to lookup a non existent value returns null
- */
- public void testLong()
- {
- FieldTable table1 = new FieldTable();
- table1.setLong("value", Long.MAX_VALUE);
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Tets lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
-
- // ... and a the string value of it.
- Assert.assertEquals("" + Long.MAX_VALUE, table1.getString("value"));
-
- table1.remove("value");
- // but after a removeKey it doesn't
- Assert.assertFalse(table1.containsKey("value"));
-
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getLong("Rubbish"));
- }
-
- /**
- * Set a double and check that we can only get it back as a double
- * Check that attempting to lookup a non existent value returns null
- */
- public void testBytes()
- {
- byte[] bytes = { 99, 98, 97, 96, 95 };
-
- FieldTable table1 = new FieldTable();
- table1.setBytes("value", bytes);
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Tets lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- assertBytesEqual(bytes, table1.getBytes("value"));
-
- // ... and a the string value of it is null
- Assert.assertEquals(null, table1.getString("value"));
-
- table1.remove("value");
- // but after a removeKey it doesn't
- Assert.assertFalse(table1.containsKey("value"));
-
- // Table should now have zero length for encoding
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getBytes("Rubbish"));
- }
-
- /**
- * Calls all methods that can be used to check the table is empty
- * - getEncodedSize
- * - isEmpty
- * - length
- *
- * @param table to check is empty
- */
- private void checkEmpty(FieldTable table)
- {
- Assert.assertEquals(0, table.getEncodedSize());
- Assert.assertTrue(table.isEmpty());
- Assert.assertEquals(0, table.size());
-
- Assert.assertEquals(0, table.keySet().size());
- }
-
- /**
- * Set a String and check that we can only get it back as a String
- * Check that attempting to lookup a non existent value returns null
- */
- public void testString()
- {
- FieldTable table1 = new FieldTable();
- table1.setString("value", "Hello");
- Assert.assertTrue(table1.propertyExists("value"));
-
- // Test lookups we shouldn't get anything back for other gets
- // we should get right value back for this type ....
- Assert.assertEquals(null, table1.getBoolean("value"));
- Assert.assertEquals(null, table1.getByte("value"));
- Assert.assertEquals(null, table1.getShort("value"));
- Assert.assertEquals(null, table1.getCharacter("value"));
- Assert.assertEquals(null, table1.getDouble("value"));
- Assert.assertEquals(null, table1.getFloat("value"));
- Assert.assertEquals(null, table1.getInteger("value"));
- Assert.assertEquals(null, table1.getLong("value"));
- Assert.assertEquals(null, table1.getBytes("value"));
- Assert.assertEquals("Hello", table1.getString("value"));
-
- // Try setting a null value and read it back
- table1.setString("value", null);
-
- Assert.assertEquals(null, table1.getString("value"));
-
- // but still contains the value
- Assert.assertTrue(table1.containsKey("value"));
-
- table1.remove("value");
- // but after a removeKey it doesn't
- Assert.assertFalse(table1.containsKey("value"));
-
- checkEmpty(table1);
-
- // Looking up an invalid value returns null
- Assert.assertEquals(null, table1.getString("Rubbish"));
-
- // Additional Test that haven't been covered for string
- table1.setObject("value", "Hello");
- // Check that it was set correctly
- Assert.assertEquals("Hello", table1.getString("value"));
- }
-
- /** Check that a nested field table parameter correctly encodes and decodes to a byte buffer. */
- public void testNestedFieldTable() throws IOException
- {
- byte[] testBytes = new byte[] { 0, 1, 2, 3, 4, 5 };
-
- FieldTable outerTable = new FieldTable();
- FieldTable innerTable = new FieldTable();
-
- // Put some stuff in the inner table.
- innerTable.setBoolean("bool", true);
- innerTable.setByte("byte", Byte.MAX_VALUE);
- innerTable.setBytes("bytes", testBytes);
- innerTable.setChar("char", 'c');
- innerTable.setDouble("double", Double.MAX_VALUE);
- innerTable.setFloat("float", Float.MAX_VALUE);
- innerTable.setInteger("int", Integer.MAX_VALUE);
- innerTable.setLong("long", Long.MAX_VALUE);
- innerTable.setShort("short", Short.MAX_VALUE);
- innerTable.setString("string", "hello");
- innerTable.setString("null-string", null);
- innerTable.setFieldArray("field-array",Arrays.asList("hello",Integer.valueOf(42), Collections.emptyList()));
-
- // Put the inner table in the outer one.
- outerTable.setFieldTable("innerTable", innerTable);
-
- // Write the outer table into the buffer.
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- outerTable.writeToBuffer(new DataOutputStream(baos));
-
- byte[] data = baos.toByteArray();
-
- // Extract the table back from the buffer again.
- try
- {
- FieldTable extractedOuterTable = EncodingUtils.readFieldTable(new DataInputStream(new ByteArrayInputStream(data)));
-
- FieldTable extractedTable = extractedOuterTable.getFieldTable("innerTable");
-
- Assert.assertEquals(Boolean.TRUE, extractedTable.getBoolean("bool"));
- Assert.assertEquals(Byte.valueOf(Byte.MAX_VALUE), extractedTable.getByte("byte"));
- assertBytesEqual(testBytes, extractedTable.getBytes("bytes"));
- Assert.assertEquals(Character.valueOf('c'), extractedTable.getCharacter("char"));
- Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), extractedTable.getDouble("double"));
- Assert.assertEquals(Float.valueOf(Float.MAX_VALUE), extractedTable.getFloat("float"));
- Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), extractedTable.getInteger("int"));
- Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), extractedTable.getLong("long"));
- Assert.assertEquals(Short.valueOf(Short.MAX_VALUE), extractedTable.getShort("short"));
- Assert.assertEquals("hello", extractedTable.getString("string"));
- Assert.assertNull(extractedTable.getString("null-string"));
- Collection fieldArray = (Collection) extractedTable.get("field-array");
- Assert.assertEquals(3, fieldArray.size());
- Iterator iter = fieldArray.iterator();
- assertEquals("hello",iter.next());
- assertEquals(Integer.valueOf(42), iter.next());
- assertTrue(((Collection)iter.next()).isEmpty());
- }
- catch (AMQFrameDecodingException e)
- {
- fail("Failed to decode field table with nested inner table.");
- }
- }
-
- public void testValues()
- {
- FieldTable table = new FieldTable();
- table.setBoolean("bool", true);
- table.setByte("byte", Byte.MAX_VALUE);
- byte[] bytes = { 99, 98, 97, 96, 95 };
- table.setBytes("bytes", bytes);
- table.setChar("char", 'c');
- table.setDouble("double", Double.MAX_VALUE);
- table.setFloat("float", Float.MAX_VALUE);
- table.setInteger("int", Integer.MAX_VALUE);
- table.setLong("long", Long.MAX_VALUE);
- table.setShort("short", Short.MAX_VALUE);
- table.setString("string", "Hello");
- table.setString("null-string", null);
-
- table.setObject("object-bool", true);
- table.setObject("object-byte", Byte.MAX_VALUE);
- table.setObject("object-bytes", bytes);
- table.setObject("object-char", 'c');
- table.setObject("object-double", Double.MAX_VALUE);
- table.setObject("object-float", Float.MAX_VALUE);
- table.setObject("object-int", Integer.MAX_VALUE);
- table.setObject("object-long", Long.MAX_VALUE);
- table.setObject("object-short", Short.MAX_VALUE);
- table.setObject("object-string", "Hello");
-
- try
- {
- table.setObject("Null-object", null);
- fail("null values are not allowed");
- }
- catch (AMQPInvalidClassException aice)
- {
- assertEquals("Null values are not allowed to be set",
- AMQPInvalidClassException.INVALID_OBJECT_MSG + "null", aice.getMessage());
- }
-
- try
- {
- table.setObject("Unsupported-object", new Exception());
- fail("Non primitive values are not allowed");
- }
- catch (AMQPInvalidClassException aice)
- {
- assertEquals("Non primitive values are not allowed to be set",
- AMQPInvalidClassException.INVALID_OBJECT_MSG + Exception.class, aice.getMessage());
- }
-
- Assert.assertEquals(Boolean.TRUE, table.getBoolean("bool"));
- Assert.assertEquals(Byte.valueOf(Byte.MAX_VALUE), table.getByte("byte"));
- assertBytesEqual(bytes, table.getBytes("bytes"));
- Assert.assertEquals(Character.valueOf('c'), table.getCharacter("char"));
- Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), table.getDouble("double"));
- Assert.assertEquals(Float.valueOf(Float.MAX_VALUE), table.getFloat("float"));
- Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), table.getInteger("int"));
- Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), table.getLong("long"));
- Assert.assertEquals(Short.valueOf(Short.MAX_VALUE), table.getShort("short"));
- Assert.assertEquals("Hello", table.getString("string"));
- Assert.assertNull(table.getString("null-string"));
-
- Assert.assertEquals(true, table.getObject("object-bool"));
- Assert.assertEquals(Byte.MAX_VALUE, table.getObject("object-byte"));
- assertBytesEqual(bytes, (byte[]) table.getObject("object-bytes"));
- Assert.assertEquals('c', table.getObject("object-char"));
- Assert.assertEquals(Double.MAX_VALUE, table.getObject("object-double"));
- Assert.assertEquals(Float.MAX_VALUE, table.getObject("object-float"));
- Assert.assertEquals(Integer.MAX_VALUE, table.getObject("object-int"));
- Assert.assertEquals(Long.MAX_VALUE, table.getObject("object-long"));
- Assert.assertEquals(Short.MAX_VALUE, table.getObject("object-short"));
- Assert.assertEquals("Hello", table.getObject("object-string"));
- }
-
- public void testWriteBuffer() throws IOException
- {
- byte[] bytes = { 99, 98, 97, 96, 95 };
-
- FieldTable table = new FieldTable();
- table.setBoolean("bool", true);
- table.setByte("byte", Byte.MAX_VALUE);
-
- table.setBytes("bytes", bytes);
- table.setChar("char", 'c');
- table.setInteger("int", Integer.MAX_VALUE);
- table.setLong("long", Long.MAX_VALUE);
- table.setDouble("double", Double.MAX_VALUE);
- table.setFloat("float", Float.MAX_VALUE);
- table.setShort("short", Short.MAX_VALUE);
- table.setString("string", "hello");
- table.setString("null-string", null);
-
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream((int) table.getEncodedSize() + 4);
- table.writeToBuffer(new DataOutputStream(baos));
-
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- DataInputStream dis = new DataInputStream(bais);
-
-
- long length = dis.readInt() & 0xFFFFFFFFL;
-
- FieldTable table2 = new FieldTable(dis, length);
-
- Assert.assertEquals((Boolean) true, table2.getBoolean("bool"));
- Assert.assertEquals((Byte) Byte.MAX_VALUE, table2.getByte("byte"));
- assertBytesEqual(bytes, table2.getBytes("bytes"));
- Assert.assertEquals((Character) 'c', table2.getCharacter("char"));
- Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), table2.getDouble("double"));
- Assert.assertEquals(Float.valueOf(Float.MAX_VALUE), table2.getFloat("float"));
- Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), table2.getInteger("int"));
- Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), table2.getLong("long"));
- Assert.assertEquals(Short.valueOf(Short.MAX_VALUE), table2.getShort("short"));
- Assert.assertEquals("hello", table2.getString("string"));
- Assert.assertNull(table2.getString("null-string"));
- }
-
- public void testEncodingSize()
- {
- FieldTable result = new FieldTable();
- int size = 0;
-
- result.setBoolean("boolean", true);
- size += 1 + EncodingUtils.encodedShortStringLength("boolean") + EncodingUtils.encodedBooleanLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setByte("byte", (byte) Byte.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("byte") + EncodingUtils.encodedByteLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- byte[] _bytes = { 99, 98, 97, 96, 95 };
-
- result.setBytes("bytes", _bytes);
- size += 1 + EncodingUtils.encodedShortStringLength("bytes") + 4 + _bytes.length;
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setChar("char", (char) 'c');
- size += 1 + EncodingUtils.encodedShortStringLength("char") + EncodingUtils.encodedCharLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setDouble("double", (double) Double.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("double") + EncodingUtils.encodedDoubleLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setFloat("float", (float) Float.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("float") + EncodingUtils.encodedFloatLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setInteger("int", (int) Integer.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("int") + EncodingUtils.encodedIntegerLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setLong("long", (long) Long.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("long") + EncodingUtils.encodedLongLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setShort("short", (short) Short.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("short") + EncodingUtils.encodedShortLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setString("result", "Hello");
- size += 1 + EncodingUtils.encodedShortStringLength("result") + EncodingUtils.encodedLongStringLength("Hello");
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-bool", true);
- size += 1 + EncodingUtils.encodedShortStringLength("object-bool") + EncodingUtils.encodedBooleanLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-byte", Byte.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("object-byte") + EncodingUtils.encodedByteLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-bytes", _bytes);
- size += 1 + EncodingUtils.encodedShortStringLength("object-bytes") + 4 + _bytes.length;
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-char", 'c');
- size += 1 + EncodingUtils.encodedShortStringLength("object-char") + EncodingUtils.encodedCharLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-double", Double.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("object-double") + EncodingUtils.encodedDoubleLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-float", Float.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("object-float") + EncodingUtils.encodedFloatLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-int", Integer.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("object-int") + EncodingUtils.encodedIntegerLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-long", Long.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("object-long") + EncodingUtils.encodedLongLength();
- Assert.assertEquals(size, result.getEncodedSize());
-
- result.setObject("object-short", Short.MAX_VALUE);
- size += 1 + EncodingUtils.encodedShortStringLength("object-short") + EncodingUtils.encodedShortLength();
- Assert.assertEquals(size, result.getEncodedSize());
- }
-
- /**
- * Additional test for setObject
- */
- public void testSetObject()
- {
- FieldTable table = new FieldTable();
-
- // Try setting a non primative object
-
- try
- {
- table.setObject("value", this);
- fail("Only primative values allowed in setObject");
- }
- catch (AMQPInvalidClassException iae)
- {
- // normal path
- }
- // so length should be zero
- Assert.assertEquals(0, table.getEncodedSize());
- }
-
- /**
- * Additional test checkPropertyName doesn't accept Null
- */
- public void testCheckPropertyNameasNull()
- {
- FieldTable table = new FieldTable();
-
- try
- {
- table.setObject((String) null, "String");
- fail("Null property name is not allowed");
- }
- catch (IllegalArgumentException iae)
- {
- // normal path
- }
- // so length should be zero
- Assert.assertEquals(0, table.getEncodedSize());
- }
-
- /**
- * Additional test checkPropertyName doesn't accept an empty String
- */
- public void testCheckPropertyNameasEmptyString()
- {
- FieldTable table = new FieldTable();
-
- try
- {
- table.setObject("", "String");
- fail("empty property name is not allowed");
- }
- catch (IllegalArgumentException iae)
- {
- // normal path
- }
- // so length should be zero
- Assert.assertEquals(0, table.getEncodedSize());
- }
-
- /**
- * Additional test checkPropertyName doesn't accept an empty String
- */
- public void testCheckPropertyNamehasMaxLength()
- {
- FieldTable table = new FieldTable(true);
-
- StringBuffer longPropertyName = new StringBuffer(129);
-
- for (int i = 0; i < 129; i++)
- {
- longPropertyName.append("x");
- }
-
- try
- {
- table.setObject(longPropertyName.toString(), "String");
- fail("property name must be < 128 characters");
- }
- catch (IllegalArgumentException iae)
- {
- // normal path
- }
- // so length should be zero
- Assert.assertEquals(0, table.getEncodedSize());
- }
-
- /**
- * Additional test checkPropertyName starts with a letter
- */
- public void testCheckPropertyNameStartCharacterIsLetter()
- {
- FieldTable table = new FieldTable(true);
-
- // Try a name that starts with a number
- try
- {
- table.setObject("1", "String");
- fail("property name must start with a letter");
- }
- catch (IllegalArgumentException iae)
- {
- // normal path
- }
- // so length should be zero
- Assert.assertEquals(0, table.getEncodedSize());
- }
-
- /**
- * Additional test checkPropertyName starts with a hash or a dollar
- */
- public void testCheckPropertyNameStartCharacterIsHashorDollar()
- {
- FieldTable table = new FieldTable(true);
-
- // Try a name that starts with a number
- try
- {
- table.setObject("#", "String");
- table.setObject("$", "String");
- }
- catch (IllegalArgumentException iae)
- {
- fail("property name are allowed to start with # and $s");
- }
- }
-
- /**
- * Additional test to test the contents of the table
- */
- public void testContents()
- {
- FieldTable table = new FieldTable();
-
- table.setObject("StringProperty", "String");
-
- Assert.assertEquals("String", table.getString("StringProperty"));
-
- // Test Clear
-
- table.clear();
-
- checkEmpty(table);
- }
-
- /**
- * Test the contents of the sets
- */
- public void testSets()
- {
-
- FieldTable table = new FieldTable();
-
- table.setObject("n1", "1");
- table.setObject("n2", "2");
- table.setObject("n3", "3");
-
- Assert.assertEquals("1", table.getObject("n1"));
- Assert.assertEquals("2", table.getObject("n2"));
- Assert.assertEquals("3", table.getObject("n3"));
- }
-
- public void testAddAll()
- {
- final FieldTable table1 = new FieldTable();
- table1.setInteger("int1", 1);
- table1.setInteger("int2", 2);
- assertEquals("Unexpected number of entries in table1", 2, table1.size());
-
- final FieldTable table2 = new FieldTable();
- table2.setInteger("int3", 3);
- table2.setInteger("int4", 4);
- assertEquals("Unexpected number of entries in table2", 2, table2.size());
-
- table1.addAll(table2);
- assertEquals("Unexpected number of entries in table1 after addAll", 4, table1.size());
- assertEquals(Integer.valueOf(3), table1.getInteger("int3"));
- }
-
- public void testAddAllWithEmptyFieldTable()
- {
- final FieldTable table1 = new FieldTable();
- table1.setInteger("int1", 1);
- table1.setInteger("int2", 2);
- assertEquals("Unexpected number of entries in table1", 2, table1.size());
-
- final FieldTable emptyFieldTable = new FieldTable();
-
- table1.addAll(emptyFieldTable);
- assertEquals("Unexpected number of entries in table1 after addAll", 2, table1.size());
- }
-
- /**
- * Tests that when copying properties into a new FielTable using the addAll() method, the
- * properties are successfully added to the destination table when the source FieldTable
- * was created from encoded input bytes,
- */
- public void testAddingAllFromFieldTableCreatedUsingEncodedBytes() throws Exception
- {
- AMQShortString myBooleanTestProperty = new AMQShortString("myBooleanTestProperty");
-
- //Create a new FieldTable and use it to encode data into a byte array.
- FieldTable encodeTable = new FieldTable();
- encodeTable.put(myBooleanTestProperty, true);
- byte[] data = encodeTable.getDataAsBytes();
- int length = data.length;
-
- //Verify we got the expected mount of encoded data (1B type hdr + 21B for name + 1B type hdr + 1B for boolean)
- assertEquals("unexpected data length", 24, length);
-
- //Create a second FieldTable from the encoded bytes
- FieldTable tableFromBytes = new FieldTable(new DataInputStream(new ByteArrayInputStream(data)), length);
-
- //Create a final FieldTable and addAll() from the table created with encoded bytes
- FieldTable destinationTable = new FieldTable();
- assertTrue("unexpected size", destinationTable.isEmpty());
- destinationTable.addAll(tableFromBytes);
-
- //Verify that the destination table now contains the expected entry
- assertEquals("unexpected size", 1, destinationTable.size());
- assertTrue("expected property not present", destinationTable.containsKey(myBooleanTestProperty));
- assertTrue("unexpected property value", destinationTable.getBoolean(myBooleanTestProperty));
- }
-
- private void assertBytesEqual(byte[] expected, byte[] actual)
- {
- Assert.assertEquals(expected.length, actual.length);
-
- for (int index = 0; index < expected.length; index++)
- {
- Assert.assertEquals(expected[index], actual[index]);
- }
- }
-
- public static junit.framework.Test suite()
- {
- return new junit.framework.TestSuite(FieldTableTest.class);
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java
deleted file mode 100644
index aece8ed4e2..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.framing.abstraction;
-
-import junit.framework.TestCase;
-
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.MessagePublishInfo;
-
-public class MessagePublishInfoImplTest extends TestCase
-{
- private MessagePublishInfo _mpi;
- private final AMQShortString _exchange = new AMQShortString("exchange");
- private final AMQShortString _routingKey = new AMQShortString("routingKey");
-
- public void setUp()
- {
- _mpi = new MessagePublishInfo(_exchange, true, true, _routingKey);
- }
-
- /** Test that we can update the exchange value. */
- public void testExchange()
- {
- assertEquals(_exchange, _mpi.getExchange());
- AMQShortString newExchange = new AMQShortString("newExchange");
- //Check we can update the exchange
- _mpi.setExchange(newExchange);
- assertEquals(newExchange, _mpi.getExchange());
- //Ensure that the new exchange doesn't equal the old one
- assertFalse(_exchange.equals(_mpi.getExchange()));
- }
-
- /**
- * Check that the immedate value is set correctly and defaulted correctly
- */
- public void testIsImmediate()
- {
- //Check that the set value is correct
- assertTrue("Set value for immediate not as expected", _mpi.isImmediate());
-
- MessagePublishInfo mpi = new MessagePublishInfo();
-
- assertFalse("Default value for immediate should be false", mpi.isImmediate());
-
- mpi.setImmediate(true);
-
- assertTrue("Updated value for immediate not as expected", mpi.isImmediate());
-
- }
-
- /**
- * Check that the mandatory value is set correctly and defaulted correctly
- */
- public void testIsMandatory()
- {
- assertTrue("Set value for mandatory not as expected", _mpi.isMandatory());
-
- MessagePublishInfo mpi = new MessagePublishInfo();
-
- assertFalse("Default value for mandatory should be false", mpi.isMandatory());
-
- mpi.setMandatory(true);
-
- assertTrue("Updated value for mandatory not as expected", mpi.isMandatory());
- }
-
- /**
- * Check that the routingKey value is perserved
- */
- public void testRoutingKey()
- {
- assertEquals(_routingKey, _mpi.getRoutingKey());
- AMQShortString newRoutingKey = new AMQShortString("newRoutingKey");
-
- //Check we can update the routingKey
- _mpi.setRoutingKey(newRoutingKey);
- assertEquals(newRoutingKey, _mpi.getRoutingKey());
- //Ensure that the new routingKey doesn't equal the old one
- assertFalse(_routingKey.equals(_mpi.getRoutingKey()));
-
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java b/qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java
deleted file mode 100644
index de73a2ff88..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.pool;
-
-import junit.framework.TestCase;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-
-
-public class ReferenceCountingExecutorServiceTest extends TestCase
-{
-
-
- private ReferenceCountingExecutorService _executorService = ReferenceCountingExecutorService.getInstance(); // Class under test
- private ThreadFactory _beforeExecutorThreadFactory;
-
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- _beforeExecutorThreadFactory = _executorService.getThreadFactory();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown();
- _executorService.setThreadFactory(_beforeExecutorThreadFactory);
- }
-
-
-
- /**
- * Tests that the ReferenceCountingExecutorService correctly manages the reference count.
- */
- public void testReferenceCounting() throws Exception
- {
- final int countBefore = _executorService.getReferenceCount();
-
- try
- {
- _executorService.acquireExecutorService();
- _executorService.acquireExecutorService();
-
- assertEquals("Reference count should now be +2", countBefore + 2, _executorService.getReferenceCount());
- }
- finally
- {
- _executorService.releaseExecutorService();
- _executorService.releaseExecutorService();
- }
- assertEquals("Reference count should have returned to the initial value", countBefore, _executorService.getReferenceCount());
- }
-
- /**
- * Tests that the executor creates and executes a task using the default thread pool.
- */
- public void testExecuteCommandWithDefaultExecutorThreadFactory() throws Exception
- {
- final CountDownLatch latch = new CountDownLatch(1);
- final Set<ThreadGroup> threadGroups = new HashSet<ThreadGroup>();
-
- _executorService.acquireExecutorService();
-
- try
- {
- _executorService.getPool().execute(createRunnable(latch, threadGroups));
-
- latch.await(3, TimeUnit.SECONDS);
-
- assertTrue("Expect that executor created a thread using default thread factory",
- threadGroups.contains(Thread.currentThread().getThreadGroup()));
- }
- finally
- {
- _executorService.releaseExecutorService();
- }
- }
-
- /**
- * Tests that the executor creates and executes a task using an overridden thread pool.
- */
- public void testExecuteCommandWithOverriddenExecutorThreadFactory() throws Exception
- {
- final CountDownLatch latch = new CountDownLatch(1);
- final ThreadGroup expectedThreadGroup = new ThreadGroup("junit");
- _executorService.setThreadFactory(new ThreadGroupChangingThreadFactory(expectedThreadGroup));
- _executorService.acquireExecutorService();
-
- final Set<ThreadGroup> threadGroups = new HashSet<ThreadGroup>();
-
- try
- {
- _executorService.getPool().execute(createRunnable(latch, threadGroups));
-
- latch.await(3, TimeUnit.SECONDS);
-
- assertTrue("Expect that executor created a thread using overridden thread factory",
- threadGroups.contains(expectedThreadGroup));
- }
- finally
- {
- _executorService.releaseExecutorService();
- }
- }
-
- private Runnable createRunnable(final CountDownLatch latch, final Set<ThreadGroup> threadGroups)
- {
- return new Runnable()
- {
-
- public void run()
- {
- threadGroups.add(Thread.currentThread().getThreadGroup());
- latch.countDown();
- }
-
- };
- }
-
- private final class ThreadGroupChangingThreadFactory implements ThreadFactory
- {
- private final ThreadGroup _newGroup;
-
- private ThreadGroupChangingThreadFactory(final ThreadGroup newGroup)
- {
- this._newGroup = newGroup;
- }
-
- public Thread newThread(Runnable r)
- {
- return new Thread(_newGroup, r);
- }
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java b/qpid/java/common/src/test/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java
deleted file mode 100644
index b8cf8a40b0..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.pool;
-
-
-import javax.security.auth.Subject;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.qpid.test.utils.QpidTestCase;
-
-public class SuppressingInheritedAccessControlContextThreadFactoryTest extends QpidTestCase
-{
- public void testAccessControlContextIsNotInheritedByThread() throws Exception
- {
- final String principalName = getName();
- final CountDownLatch latch = new CountDownLatch(1);
-
- final AtomicReference<AccessControlContext> threadAccessControlContextCapturer = new AtomicReference<>();
- final AtomicReference<AccessControlContext> callerAccessControlContextCapturer = new AtomicReference<>();
-
- final Set<Principal> principals = Collections.<Principal>singleton(new Principal()
- {
- @Override
- public String getName()
- {
- return principalName;
- }
-
- @Override
- public String toString()
- {
- return "Principal{" + getName() + "}";
- }
- });
-
- Subject subject = new Subject(false, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
-
- Subject.doAs(subject, new PrivilegedAction<Void>()
- {
- @Override
- public Void run()
- {
- callerAccessControlContextCapturer.set(AccessController.getContext());
- SuppressingInheritedAccessControlContextThreadFactory factory = new SuppressingInheritedAccessControlContextThreadFactory();
- factory.newThread(new Runnable()
- {
-
- public void run()
- {
- threadAccessControlContextCapturer.set(AccessController.getContext());
- latch.countDown();
- }
-
- }).start();
- return null;
- }
- });
-
- latch.await(3, TimeUnit.SECONDS);
-
- Subject callerSubject = Subject.getSubject(callerAccessControlContextCapturer.get());
- Subject threadSubject = Subject.getSubject(threadAccessControlContextCapturer.get());
-
- assertEquals("Unexpected subject in main thread", callerSubject, subject);
- assertNull("Unexpected subject in executor thread", threadSubject);
-
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java b/qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java
deleted file mode 100644
index c5fa852f95..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpid.ssl;
-
-import org.apache.qpid.test.utils.QpidTestCase;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManagerFactory;
-
-import java.io.IOException;
-
-public class SSLContextFactoryTest extends QpidTestCase
-{
- private static final String BROKER_KEYSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_broker_keystore.jks";
- private static final String CLIENT_KEYSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_client_keystore.jks";
- private static final String CLIENT_TRUSTSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_client_truststore.jks";
- private static final String STORE_PASSWORD = "password";
- private static final String STORE_TYPE = "JKS";
- private static final String DEFAULT_KEY_MANAGER_ALGORITHM = KeyManagerFactory.getDefaultAlgorithm();
- private static final String DEFAULT_TRUST_MANAGER_ALGORITHM = TrustManagerFactory.getDefaultAlgorithm();
- private static final String CERT_ALIAS_APP1 = "app1";
-
-
- public void testTrustStoreDoesNotExist() throws Exception
- {
- try
- {
- SSLContextFactory.buildClientContext("/path/to/nothing", STORE_PASSWORD, STORE_TYPE, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, STORE_TYPE, DEFAULT_KEY_MANAGER_ALGORITHM, null);
- fail("Exception was not thrown due to incorrect path");
- }
- catch (IOException e)
- {
- //expected
- }
- }
-
- public void testBuildClientContextForSSLEncryptionOnly() throws Exception
- {
- SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE, DEFAULT_TRUST_MANAGER_ALGORITHM, null, null, null, null, null);
- assertNotNull("SSLContext should not be null", context);
- }
-
- public void testBuildClientContextWithForClientAuth() throws Exception
- {
- SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, STORE_TYPE, DEFAULT_KEY_MANAGER_ALGORITHM, null);
- assertNotNull("SSLContext should not be null", context);
- }
-
- public void testBuildClientContextWithForClientAuthWithCertAlias() throws Exception
- {
- SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, STORE_TYPE, DEFAULT_KEY_MANAGER_ALGORITHM, CERT_ALIAS_APP1);
- assertNotNull("SSLContext should not be null", context);
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/ssl/TrustManagerTest.java b/qpid/java/common/src/test/java/org/apache/qpid/ssl/TrustManagerTest.java
deleted file mode 100644
index 3b76d81e42..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/ssl/TrustManagerTest.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.qpid.ssl;
-
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Arrays;
-import java.util.Enumeration;
-
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-
-import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager;
-import org.apache.qpid.transport.network.security.ssl.QpidPeersOnlyTrustManager;
-import org.apache.qpid.transport.network.security.ssl.SSLUtil;
-
-public class TrustManagerTest extends QpidTestCase
-{
- private static final String BROKER_TRUSTSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_broker_truststore.jks";
- private static final String BROKER_PEERSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_broker_peerstore.jks";
- private static final String CLIENT_KEYSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_client_keystore.jks";
- private static final String CLIENT_UNTRUSTED_KEYSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_client_untrusted_keystore.jks";
- private static final String STORE_PASSWORD = "password";
- private static final String STORE_TYPE = "JKS";
- private static final String DEFAULT_TRUST_MANAGER_ALGORITHM = TrustManagerFactory.getDefaultAlgorithm();
- private static final String CERT_ALIAS_APP1 = "app1";
- private static final String CERT_ALIAS_APP2 = "app2";
- private static final String CERT_ALIAS_UNTRUSTED_CLIENT = "untrusted_client";
-
- // retrieves the client certificate's chain from store and returns it as an array
- private X509Certificate[] getClientChain(final String storePath, final String alias) throws Exception
- {
- final KeyStore ks = SSLUtil.getInitializedKeyStore(storePath, STORE_PASSWORD, STORE_TYPE);
- final Certificate[] chain = ks.getCertificateChain(alias);
- return Arrays.copyOf(chain, chain.length, X509Certificate[].class);
- }
-
- // verifies that peer store is loaded only with client's (peer's) app1 certificate (no CA)
- private void noCAinPeerStore(final KeyStore ps) throws KeyStoreException
- {
- final Enumeration<String> aliases = ps.aliases();
- while (aliases.hasMoreElements())
- {
- final String alias = aliases.nextElement();
- if (!alias.equalsIgnoreCase(CERT_ALIAS_APP1))
- {
- fail("Broker's peer store contains other certificate than client's app1 public key");
- }
- }
- }
-
- /**
- * Tests that the QpidPeersOnlyTrustManager gives the expected behaviour when loaded separately
- * with the broker peerstore and truststore.
- */
- public void testQpidPeersOnlyTrustManager() throws Exception
- {
- // first let's check that peer manager loaded with the PEERstore succeeds
- final KeyStore ps = SSLUtil.getInitializedKeyStore(BROKER_PEERSTORE_PATH, STORE_PASSWORD, STORE_TYPE);
- this.noCAinPeerStore(ps);
- final TrustManagerFactory pmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM);
- pmf.init(ps);
- final TrustManager[] delegatePeerManagers = pmf.getTrustManagers();
-
- X509TrustManager peerManager = null;
- for (final TrustManager tm : delegatePeerManagers)
- {
- if (tm instanceof X509TrustManager)
- {
- // peer manager is supposed to trust only clients which peers certificates
- // are directly in the store. CA signing will not be considered.
- peerManager = new QpidPeersOnlyTrustManager(ps, (X509TrustManager) tm);
- }
- }
-
- try
- {
- // since broker's peerstore contains the client's app1 certificate, the check should succeed
- peerManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA");
- }
- catch (CertificateException e)
- {
- fail("Trusted client's validation against the broker's peer store manager failed.");
- }
-
- try
- {
- // since broker's peerstore does not contain the client's app2 certificate, the check should fail
- peerManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA");
- fail("Untrusted client's validation against the broker's peer store manager succeeded.");
- }
- catch (CertificateException e)
- {
- //expected
- }
-
- // now let's check that peer manager loaded with the brokers TRUSTstore fails because
- // it does not have the clients certificate in it (though it does have a CA-cert that
- // would otherwise trust the client cert when using the regular trust manager).
- final KeyStore ts = SSLUtil.getInitializedKeyStore(BROKER_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE);
- final TrustManagerFactory tmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM);
- tmf.init(ts);
- final TrustManager[] delegateTrustManagers = tmf.getTrustManagers();
-
- peerManager = null;
- for (final TrustManager tm : delegateTrustManagers)
- {
- if (tm instanceof X509TrustManager)
- {
- // peer manager is supposed to trust only clients which peers certificates
- // are directly in the store. CA signing will not be considered.
- peerManager = new QpidPeersOnlyTrustManager(ts, (X509TrustManager) tm);
- }
- }
-
- try
- {
- // since broker's truststore doesn't contain the client's app1 certificate, the check should fail
- // despite the fact that the truststore does have a CA that would otherwise trust the cert
- peerManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA");
- fail("Client's validation against the broker's peer store manager didn't fail.");
- }
- catch (CertificateException e)
- {
- // expected
- }
-
- try
- {
- // since broker's truststore doesn't contain the client's app2 certificate, the check should fail
- // despite the fact that the truststore does have a CA that would otherwise trust the cert
- peerManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA");
- fail("Client's validation against the broker's peer store manager didn't fail.");
- }
- catch (CertificateException e)
- {
- // expected
- }
- }
-
- /**
- * Tests that the QpidMultipleTrustManager gives the expected behaviour when wrapping a
- * regular TrustManager against the broker truststore.
- */
- public void testQpidMultipleTrustManagerWithRegularTrustStore() throws Exception
- {
- final QpidMultipleTrustManager mulTrustManager = new QpidMultipleTrustManager();
- final KeyStore ts = SSLUtil.getInitializedKeyStore(BROKER_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE);
- final TrustManagerFactory tmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM);
- tmf.init(ts);
- final TrustManager[] delegateTrustManagers = tmf.getTrustManagers();
- boolean trustManagerAdded = false;
- for (final TrustManager tm : delegateTrustManagers)
- {
- if (tm instanceof X509TrustManager)
- {
- // add broker's trust manager
- mulTrustManager.addTrustManager((X509TrustManager) tm);
- trustManagerAdded = true;
- }
- }
- assertTrue("The regular trust manager for the trust store was not added", trustManagerAdded);
-
- try
- {
- // verify the CA-trusted app1 cert (should succeed)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA");
- }
- catch (CertificateException ex)
- {
- fail("Trusted client's validation against the broker's multi store manager failed.");
- }
-
- try
- {
- // verify the CA-trusted app2 cert (should succeed)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA");
- }
- catch (CertificateException ex)
- {
- fail("Trusted client's validation against the broker's multi store manager failed.");
- }
-
- try
- {
- // verify the untrusted cert (should fail)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_UNTRUSTED_KEYSTORE_PATH, CERT_ALIAS_UNTRUSTED_CLIENT), "RSA");
- fail("Untrusted client's validation against the broker's multi store manager unexpectedly passed.");
- }
- catch (CertificateException ex)
- {
- // expected
- }
- }
-
- /**
- * Tests that the QpidMultipleTrustManager gives the expected behaviour when wrapping a
- * QpidPeersOnlyTrustManager against the broker peerstore.
- */
- public void testQpidMultipleTrustManagerWithPeerStore() throws Exception
- {
- final QpidMultipleTrustManager mulTrustManager = new QpidMultipleTrustManager();
- final KeyStore ps = SSLUtil.getInitializedKeyStore(BROKER_PEERSTORE_PATH, STORE_PASSWORD, STORE_TYPE);
- final TrustManagerFactory pmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM);
- pmf.init(ps);
- final TrustManager[] delegatePeerManagers = pmf.getTrustManagers();
- boolean peerManagerAdded = false;
- for (final TrustManager tm : delegatePeerManagers)
- {
- if (tm instanceof X509TrustManager)
- {
- // add broker's peer manager
- mulTrustManager.addTrustManager(new QpidPeersOnlyTrustManager(ps, (X509TrustManager) tm));
- peerManagerAdded = true;
- }
- }
- assertTrue("The QpidPeersOnlyTrustManager for the peerstore was not added", peerManagerAdded);
-
- try
- {
- // verify the trusted app1 cert (should succeed as the key is in the peerstore)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA");
- }
- catch (CertificateException ex)
- {
- fail("Trusted client's validation against the broker's multi store manager failed.");
- }
-
- try
- {
- // verify the untrusted app2 cert (should fail as the key is not in the peerstore)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA");
- fail("Untrusted client's validation against the broker's multi store manager unexpectedly passed.");
- }
- catch (CertificateException ex)
- {
- // expected
- }
-
- try
- {
- // verify the untrusted cert (should fail as the key is not in the peerstore)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_UNTRUSTED_KEYSTORE_PATH, CERT_ALIAS_UNTRUSTED_CLIENT), "RSA");
- fail("Untrusted client's validation against the broker's multi store manager unexpectedly passed.");
- }
- catch (CertificateException ex)
- {
- // expected
- }
- }
-
- /**
- * Tests that the QpidMultipleTrustManager gives the expected behaviour when wrapping a
- * QpidPeersOnlyTrustManager against the broker peerstore, a regular TrustManager
- * against the broker truststore.
- */
- public void testQpidMultipleTrustManagerWithTrustAndPeerStores() throws Exception
- {
- final QpidMultipleTrustManager mulTrustManager = new QpidMultipleTrustManager();
- final KeyStore ts = SSLUtil.getInitializedKeyStore(BROKER_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE);
- final TrustManagerFactory tmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM);
- tmf.init(ts);
- final TrustManager[] delegateTrustManagers = tmf.getTrustManagers();
- boolean trustManagerAdded = false;
- for (final TrustManager tm : delegateTrustManagers)
- {
- if (tm instanceof X509TrustManager)
- {
- // add broker's trust manager
- mulTrustManager.addTrustManager((X509TrustManager) tm);
- trustManagerAdded = true;
- }
- }
- assertTrue("The regular trust manager for the trust store was not added", trustManagerAdded);
-
- final KeyStore ps = SSLUtil.getInitializedKeyStore(BROKER_PEERSTORE_PATH, STORE_PASSWORD, STORE_TYPE);
- final TrustManagerFactory pmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM);
- pmf.init(ps);
- final TrustManager[] delegatePeerManagers = pmf.getTrustManagers();
- boolean peerManagerAdded = false;
- for (final TrustManager tm : delegatePeerManagers)
- {
- if (tm instanceof X509TrustManager)
- {
- // add broker's peer manager
- mulTrustManager.addTrustManager(new QpidPeersOnlyTrustManager(ps, (X509TrustManager) tm));
- peerManagerAdded = true;
- }
- }
- assertTrue("The QpidPeersOnlyTrustManager for the peerstore was not added", peerManagerAdded);
-
- try
- {
- // verify the CA-trusted app1 cert (should succeed)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA");
- }
- catch (CertificateException ex)
- {
- fail("Trusted client's validation against the broker's multi store manager failed.");
- }
-
- try
- {
- // verify the CA-trusted app2 cert (should succeed)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA");
- }
- catch (CertificateException ex)
- {
- fail("Trusted client's validation against the broker's multi store manager failed.");
- }
-
- try
- {
- // verify the untrusted cert (should fail)
- mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_UNTRUSTED_KEYSTORE_PATH, CERT_ALIAS_UNTRUSTED_CLIENT), "RSA");
- fail("Untrusted client's validation against the broker's multi store manager unexpectedly passed.");
- }
- catch (CertificateException ex)
- {
- // expected
- }
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java b/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java
deleted file mode 100644
index 7b0f93700a..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.thread;
-
-import junit.framework.TestCase;
-
-/**
- * Tests the ThreadFactory.
- */
-public class ThreadFactoryTest extends TestCase
-{
- public void testThreadFactory()
- {
- Class<? extends ThreadFactory> threadFactoryClass = null;
- try
- {
- threadFactoryClass = Class.forName(System.getProperty("qpid.thread_factory",
- "org.apache.qpid.thread.DefaultThreadFactory")).asSubclass(ThreadFactory.class);
- }
- // If the thread factory class was wrong it will flagged way before it gets here.
- catch(Exception e)
- {
- fail("Invalid thread factory class");
- }
-
- assertEquals(threadFactoryClass, Threading.getThreadFactory().getClass());
- }
-
- /**
- * Tests creating a thread without a priority. Also verifies that the factory sets the
- * uncaught exception handler so uncaught exceptions are logged to SLF4J.
- */
- public void testCreateThreadWithDefaultPriority()
- {
- Runnable r = createRunnable();
-
- Thread t = null;
- try
- {
- t = Threading.getThreadFactory().createThread(r);
- }
- catch(Exception e)
- {
- fail("Error creating thread using Qpid thread factory");
- }
-
- assertNotNull(t);
- assertEquals(Thread.NORM_PRIORITY, t.getPriority());
- assertTrue(t.getUncaughtExceptionHandler() instanceof LoggingUncaughtExceptionHandler);
- }
-
- /**
- * Tests creating thread with a priority. Also verifies that the factory sets the
- * uncaught exception handler so uncaught exceptions are logged to SLF4J.
- */
- public void testCreateThreadWithSpecifiedPriority()
- {
- Runnable r = createRunnable();
-
- Thread t = null;
- try
- {
- t = Threading.getThreadFactory().createThread(r, 4);
- }
- catch(Exception e)
- {
- fail("Error creating thread using Qpid thread factory");
- }
-
- assertNotNull(t);
- assertEquals(4, t.getPriority());
- assertTrue(t.getUncaughtExceptionHandler() instanceof LoggingUncaughtExceptionHandler);
- }
-
- private Runnable createRunnable()
- {
- Runnable r = new Runnable(){
-
- public void run(){
-
- }
- };
- return r;
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java
deleted file mode 100644
index d031842f9d..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.TrustManagerFactory;
-
-import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.test.utils.QpidTestCase;
-
-public class ConnectionSettingsTest extends QpidTestCase
-{
- private static final String TEST_ALGORITHM_NAME = "algorithmName";
-
- private ConnectionSettings _conConnectionSettings;
-
- protected void setUp() throws Exception
- {
- super.setUp();
- _conConnectionSettings = new ConnectionSettings();
- }
-
- public void testTcpNoDelayDefault()
- {
- assertTrue("Default for isTcpNodelay() should be true", _conConnectionSettings.isTcpNodelay());
- }
-
- public void testTcpNoDelayOverrideTrue()
- {
- systemPropertyOverrideForTcpDelay(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, true);
- }
-
- public void testTcpNoDelayOverrideFalse()
- {
- systemPropertyOverrideForTcpDelay(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, false);
- }
-
- @SuppressWarnings("deprecation")
- public void testTcpNoDelayLegacyOverrideTrue()
- {
- systemPropertyOverrideForTcpDelay(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, true);
- }
-
- @SuppressWarnings("deprecation")
- public void testTcpNoDelayLegacyOverrideFalse()
- {
- systemPropertyOverrideForTcpDelay(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, false);
- }
-
- public void testKeyManagerFactoryAlgorithmDefault()
- {
- assertEquals(KeyManagerFactory.getDefaultAlgorithm(), _conConnectionSettings.getKeyManagerFactoryAlgorithm());
- }
-
- public void testKeyManagerFactoryAlgorithmOverridden()
- {
- String algorithmName = TEST_ALGORITHM_NAME;
- systemPropertyOverrideForKeyFactoryAlgorithm(ClientProperties.QPID_SSL_KEY_MANAGER_FACTORY_ALGORITHM_PROP_NAME, algorithmName);
- }
-
- @SuppressWarnings("deprecation")
- public void testKeyManagerFactoryAlgorithmLegacyOverridden()
- {
- String algorithmName = TEST_ALGORITHM_NAME;
- systemPropertyOverrideForKeyFactoryAlgorithm(ClientProperties.QPID_SSL_KEY_STORE_CERT_TYPE_PROP_NAME, algorithmName);
- }
-
- public void testTrustManagerFactoryAlgorithmDefault()
- {
- assertEquals(TrustManagerFactory.getDefaultAlgorithm(), _conConnectionSettings.getTrustManagerFactoryAlgorithm());
- }
-
- public void testTrustManagerFactoryAlgorithmOverridden()
- {
- String algorithmName = TEST_ALGORITHM_NAME;
- systemPropertyOverrideForTrustFactoryAlgorithm(ClientProperties.QPID_SSL_TRUST_MANAGER_FACTORY_ALGORITHM_PROP_NAME, algorithmName);
- }
-
- @SuppressWarnings("deprecation")
- public void testTrustManagerFactoryAlgorithmLegacyOverridden()
- {
- String algorithmName = TEST_ALGORITHM_NAME;
- systemPropertyOverrideForTrustFactoryAlgorithm(ClientProperties.QPID_SSL_TRUST_STORE_CERT_TYPE_PROP_NAME, algorithmName);
- }
-
- public void testSendBufferSizeDefault()
- {
- assertEquals("unexpected default for buffer size", 65535, _conConnectionSettings.getWriteBufferSize());
- }
-
- public void testSendBufferSizeOverridden()
- {
- systemPropertyOverrideForSocketBufferSize(ClientProperties.SEND_BUFFER_SIZE_PROP_NAME, 1024, false);
- }
-
- @SuppressWarnings("deprecation")
- public void testtestSendBufferSizeOverriddenLegacyOverridden()
- {
- systemPropertyOverrideForSocketBufferSize(ClientProperties.LEGACY_SEND_BUFFER_SIZE_PROP_NAME, 1024, false);
- }
-
- public void testReceiveBufferSizeDefault()
- {
- assertEquals("unexpected default for buffer size", 65535, _conConnectionSettings.getReadBufferSize());
- }
-
- public void testReceiveBufferSizeOverridden()
- {
- systemPropertyOverrideForSocketBufferSize(ClientProperties.RECEIVE_BUFFER_SIZE_PROP_NAME, 1024, true);
- }
-
- @SuppressWarnings("deprecation")
- public void testReceiveBufferSizeOverriddenLegacyOverridden()
- {
- systemPropertyOverrideForSocketBufferSize(ClientProperties.LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME, 1024, true);
- }
-
- public void testHeartbeatingDefaults()
- {
- assertNull(_conConnectionSettings.getHeartbeatInterval08());
- assertEquals(ClientProperties.QPID_HEARTBEAT_INTERVAL_010_DEFAULT,_conConnectionSettings.getHeartbeatInterval010());
- assertEquals(2.0, _conConnectionSettings.getHeartbeatTimeoutFactor(), 0.1);
- }
-
- public void testHeartbeatingOverridden()
- {
- resetSystemProperty(ClientProperties.QPID_HEARTBEAT_INTERVAL, "60");
- resetSystemProperty(ClientProperties.QPID_HEARTBEAT_TIMEOUT_FACTOR, "2.5");
-
- assertEquals(Integer.valueOf(60), _conConnectionSettings.getHeartbeatInterval08());
- assertEquals(60, _conConnectionSettings.getHeartbeatInterval010());
- assertEquals(2.5, _conConnectionSettings.getHeartbeatTimeoutFactor(), 0.1);
- }
-
- @SuppressWarnings("deprecation")
- public void testHeartbeatingOverriddenUsingAmqjLegacyOption()
- {
- resetSystemProperty(ClientProperties.AMQJ_HEARTBEAT_DELAY, "30");
- resetSystemProperty(ClientProperties.AMQJ_HEARTBEAT_TIMEOUT_FACTOR, "1.5");
-
- assertEquals(Integer.valueOf(30), _conConnectionSettings.getHeartbeatInterval08());
- assertEquals(30, _conConnectionSettings.getHeartbeatInterval010());
- assertEquals(1.5, _conConnectionSettings.getHeartbeatTimeoutFactor(), 0.1);
- }
-
- @SuppressWarnings("deprecation")
- public void testHeartbeatingOverriddenUsingOlderLegacyOption()
- {
- resetSystemProperty(ClientProperties.IDLE_TIMEOUT_PROP_NAME, "30000");
-
- assertEquals(Integer.valueOf(30), _conConnectionSettings.getHeartbeatInterval08());
- assertEquals(30, _conConnectionSettings.getHeartbeatInterval010());
- }
-
- private void systemPropertyOverrideForTcpDelay(String propertyName, boolean value)
- {
- resetSystemProperty(propertyName, String.valueOf(value));
- assertEquals("Value for isTcpNodelay() is incorrect", value, _conConnectionSettings.isTcpNodelay());
- }
-
- private void systemPropertyOverrideForKeyFactoryAlgorithm(String propertyName, String value)
- {
- resetSystemProperty(propertyName, value);
- assertEquals(value, _conConnectionSettings.getKeyManagerFactoryAlgorithm());
- }
-
- private void systemPropertyOverrideForTrustFactoryAlgorithm(String propertyName, String value)
- {
- resetSystemProperty(propertyName, value);
- assertEquals(value, _conConnectionSettings.getTrustManagerFactoryAlgorithm());
- }
-
-
- private void systemPropertyOverrideForSocketBufferSize(String propertyName, int value, boolean read)
- {
- resetSystemProperty(propertyName, String.valueOf(value));
- if(read)
- {
- assertEquals("unexpected value for receive buffer", value, _conConnectionSettings.getReadBufferSize());
- }
- else
- {
- assertEquals("unexpected value for send buffer", value, _conConnectionSettings.getWriteBufferSize());
- }
- }
-
- private void resetSystemProperty(String propertyName, String value)
- {
- setTestSystemProperty(propertyName, value);
-
- _conConnectionSettings = new ConnectionSettings();
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java
deleted file mode 100644
index 3a6006c338..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import static org.apache.qpid.transport.Option.EXPECTED;
-import static org.apache.qpid.transport.Option.NONE;
-import static org.apache.qpid.transport.Option.SYNC;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.transport.network.ConnectionBinding;
-import org.apache.qpid.transport.network.io.IoAcceptor;
-import org.apache.qpid.transport.util.Waiter;
-
-/**
- * ConnectionTest
- */
-public class ConnectionTest extends QpidTestCase implements SessionListener
-{
- private static final Logger _logger = LoggerFactory.getLogger(ConnectionTest.class);
- private int port;
- private volatile boolean queue = false;
- private List<MessageTransfer> messages = new ArrayList<MessageTransfer>();
- private List<MessageTransfer> incoming = new ArrayList<MessageTransfer>();
-
- private IoAcceptor _ioa = null;
-
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- port = findFreePort();
- }
-
- protected void tearDown() throws Exception
- {
- if (_ioa != null)
- {
- _ioa.close();
- }
-
- super.tearDown();
- }
-
- public void opened(Session ssn) {}
-
- public void resumed(Session ssn) {}
-
- public void message(final Session ssn, MessageTransfer xfr)
- {
- if (queue)
- {
- messages.add(xfr);
- ssn.processed(xfr);
- return;
- }
-
- String body = xfr.getBodyString();
-
- if (body.startsWith("CLOSE"))
- {
- ssn.getConnection().close();
- }
- else if (body.startsWith("DELAYED_CLOSE"))
- {
- ssn.processed(xfr);
- new Thread()
- {
- public void run()
- {
- try
- {
- sleep(3000);
- }
- catch (InterruptedException e)
- {
- throw new RuntimeException(e);
- }
- ssn.getConnection().close();
- }
- }.start();
- }
- else if (body.startsWith("ECHO"))
- {
- int id = xfr.getId();
- ssn.invoke(xfr);
- ssn.processed(id);
- }
- else if (body.startsWith("SINK"))
- {
- ssn.processed(xfr);
- }
- else if (body.startsWith("DROP"))
- {
- // do nothing
- }
- else if (body.startsWith("EXCP"))
- {
- ExecutionException exc = new ExecutionException();
- exc.setDescription("intentional exception for testing");
- ssn.invoke(exc);
- ssn.close();
- }
- else
- {
- throw new IllegalArgumentException
- ("unrecognized message: " + body);
- }
- }
-
- public void exception(Session ssn, SessionException exc)
- {
- throw exc;
- }
-
- public void closed(Session ssn) {}
-
- private void send(Session ssn, String msg)
- {
- send(ssn, msg, false);
- }
-
- private void send(Session ssn, String msg, boolean sync)
- {
- ssn.messageTransfer
- ("xxx", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- null, msg, sync ? SYNC : NONE);
- }
-
- private Connection connect(final CountDownLatch closed)
- {
- final Connection conn = new Connection();
- conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.addConnectionListener(new ConnectionListener()
- {
- public void opened(Connection conn) {}
- public void exception(Connection conn, ConnectionException exc)
- {
- exc.printStackTrace();
- }
- public void closed(Connection conn)
- {
- if (closed != null)
- {
- closed.countDown();
- }
- }
-
- @Override
- public boolean redirect(final String host, final List<Object> knownHosts)
- {
- return false;
- }
- });
- conn.connect("localhost", port, null, "guest", "guest", false, null);
- return conn;
- }
-
- public void testProtocolNegotiationExceptionOverridesCloseException() throws Exception
- {
- // Force os.name to be windows to exercise code in IoReceiver
- // that looks for the value of os.name
- setTestSystemProperty("os.name","windows");
-
- // Start server as 0-9 to force a ProtocolVersionException
- startServer(new ProtocolHeader(1, 0, 9));
-
- CountDownLatch closed = new CountDownLatch(1);
-
- try
- {
- connect(closed);
- fail("ProtocolVersionException expected");
- }
- catch (ProtocolVersionException pve)
- {
- //Expected code path
- }
- catch (Exception e)
- {
- fail("ProtocolVersionException expected. Got:" + e.getMessage());
- }
- }
-
- private void startServer()
- {
- startServer(new ProtocolHeader(1, 0, 10));
- }
-
- private void startServer(final ProtocolHeader protocolHeader)
- {
- ConnectionDelegate server = new ServerDelegate()
- {
- @Override
- public void init(Connection conn, ProtocolHeader hdr)
- {
- conn.send(protocolHeader);
- List<Object> utf8 = new ArrayList<Object>();
- utf8.add("utf8");
- conn.connectionStart(null, Collections.emptyList(), utf8);
- }
-
- @Override
- public Session getSession(Connection conn, SessionAttach atc)
- {
- Session ssn = super.getSession(conn, atc);
- ssn.setSessionListener(ConnectionTest.this);
- return ssn;
- }
-
- @Override
- public void connectionStartOk(Connection conn, ConnectionStartOk ok)
- {
- tuneAuthorizedConnection(conn);
- }
- };
-
- try
- {
- _ioa = new IoAcceptor("localhost", port, ConnectionBinding.get(server));
- }
- catch (IOException e)
- {
- fail("Unable to start Server for test due to:" + e.getMessage());
- }
-
- _ioa.start();
- }
-
- public void testClosedNotificationAndWriteToClosed() throws Exception
- {
- startServer();
-
- CountDownLatch closed = new CountDownLatch(1);
- Connection conn = connect(closed);
-
- Session ssn = conn.createSession(1);
- send(ssn, "CLOSE");
-
- if (!closed.await(3, TimeUnit.SECONDS))
- {
- fail("never got notified of connection close");
- }
-
- try
- {
- conn.connectionCloseOk();
- fail("writing to a closed socket succeeded");
- }
- catch (TransportException e)
- {
- // expected
- }
- }
-
-
-
- public void testResumeNonemptyReplayBuffer() throws Exception
- {
- startServer();
-
- Connection conn = new Connection();
- conn.addConnectionListener(new FailoverConnectionListener());
- conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest", false, null);
- Session ssn = conn.createSession(1);
- ssn.setSessionListener(new TestSessionListener());
-
- send(ssn, "SINK 0");
- send(ssn, "ECHO 1");
- send(ssn, "ECHO 2");
-
- ssn.sync();
-
- String[] msgs = { "DROP 3", "DROP 4", "DROP 5", "CLOSE 6", "SINK 7" };
- for (String m : msgs)
- {
- send(ssn, m);
- }
-
- ssn.sync();
-
- assertEquals(msgs.length, messages.size());
- for (int i = 0; i < msgs.length; i++)
- {
- assertEquals(msgs[i], messages.get(i).getBodyString());
- }
-
- queue = false;
-
- send(ssn, "ECHO 8");
- send(ssn, "ECHO 9");
-
- synchronized (incoming)
- {
- Waiter w = new Waiter(incoming, 30000);
- while (w.hasTime() && incoming.size() < 4)
- {
- w.await();
- }
-
- assertEquals(4, incoming.size());
- assertEquals("ECHO 1", incoming.get(0).getBodyString());
- assertEquals(0, incoming.get(0).getId());
- assertEquals("ECHO 2", incoming.get(1).getBodyString());
- assertEquals(1, incoming.get(1).getId());
- assertEquals("ECHO 8", incoming.get(2).getBodyString());
- assertEquals(0, incoming.get(0).getId());
- assertEquals("ECHO 9", incoming.get(3).getBodyString());
- assertEquals(1, incoming.get(1).getId());
- }
- }
-
- public void testResumeEmptyReplayBuffer() throws InterruptedException
- {
- startServer();
-
- Connection conn = new Connection();
- conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.addConnectionListener(new FailoverConnectionListener());
- conn.connect("localhost", port, null, "guest", "guest", false, null);
- Session ssn = conn.createSession(1);
- ssn.setSessionListener(new TestSessionListener());
-
- send(ssn, "SINK 0");
- send(ssn, "SINK 1");
- send(ssn, "DELAYED_CLOSE 2");
- ssn.sync();
- Thread.sleep(6000);
- send(ssn, "SINK 3");
- ssn.sync();
- if (_logger.isDebugEnabled())
- {
- _logger.debug(String.valueOf(messages));
- }
- assertEquals(1, messages.size());
- assertEquals("SINK 3", messages.get(0).getBodyString());
- }
-
- public void testFlushExpected() throws InterruptedException
- {
- startServer();
-
- Connection conn = new Connection();
- conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest", false, null);
- Session ssn = conn.createSession();
- ssn.sessionFlush(EXPECTED);
- send(ssn, "SINK 0");
- ssn.sessionFlush(EXPECTED);
- send(ssn, "SINK 1");
- ssn.sync();
- }
-
- public void testHeartbeat()
- {
- startServer();
- Connection conn = new Connection();
- conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest", false, null);
- conn.connectionHeartbeat();
- conn.close();
- }
-
- public void testExecutionExceptionInvoke() throws Exception
- {
- startServer();
-
- Connection conn = new Connection();
- conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest", false, null);
- Session ssn = conn.createSession();
- send(ssn, "EXCP 0");
- Thread.sleep(3000);
- try
- {
- send(ssn, "SINK 1");
- }
- catch (SessionException exc)
- {
- assertNotNull(exc.getException());
- }
- }
-
- public void testExecutionExceptionSync() throws Exception
- {
- startServer();
-
- Connection conn = new Connection();
- conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest", false, null);
- Session ssn = conn.createSession();
- send(ssn, "EXCP 0", true);
- try
- {
- ssn.sync();
- fail("this should have failed");
- }
- catch (SessionException exc)
- {
- assertNotNull(exc.getException());
- }
- }
-
- class FailoverConnectionListener implements ConnectionListener
- {
- public void opened(Connection conn) {}
-
- public void exception(Connection conn, ConnectionException e)
- {
- throw e;
- }
-
- public void closed(Connection conn)
- {
- queue = true;
- conn.connect("localhost", port, null, "guest", "guest", false, null);
- conn.resume();
- }
-
- @Override
- public boolean redirect(final String host, final List<Object> knownHosts)
- {
- return false;
- }
- }
-
- class TestSessionListener implements SessionListener
- {
- public void opened(Session s) {}
- public void resumed(Session s) {}
- public void exception(Session s, SessionException e) {}
- public void message(Session s, MessageTransfer xfr)
- {
- synchronized (incoming)
- {
- incoming.add(xfr);
- incoming.notifyAll();
- }
-
- s.processed(xfr);
- }
- public void closed(Session s) {}
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java
deleted file mode 100644
index 512a0a29a6..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import junit.framework.TestCase;
-
-/**
- * GenTest
- *
- */
-
-public class GenTest extends TestCase
-{
-
- public void testBooleans()
- {
- QueueDeclare qd = new QueueDeclare().queue("test-queue").durable(false);
- assertEquals(qd.getQueue(), "test-queue");
- assertFalse("durable should be false", qd.getDurable());
- qd.setDurable(true);
- assertTrue("durable should be true", qd.getDurable());
- qd.setDurable(false);
- assertFalse("durable should be false again", qd.getDurable());
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java
deleted file mode 100644
index 14589eb541..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport;
-
-import junit.framework.TestCase;
-
-import static org.apache.qpid.util.Serial.COMPARATOR;
-import static org.apache.qpid.util.Serial.eq;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * RangeSetTest
- *
- */
-
-public class RangeSetTest extends TestCase
-{
-
- private void check(RangeSet ranges)
- {
- List<Integer> posts = new ArrayList<Integer>();
- for (Range range : ranges)
- {
- posts.add(range.getLower());
- posts.add(range.getUpper());
- }
-
- List<Integer> sorted = new ArrayList<Integer>(posts);
- Collections.sort(sorted, COMPARATOR);
-
- assertEquals(posts, sorted);
-
- int idx = 1;
- while (idx + 1 < posts.size())
- {
- assertTrue(!eq(posts.get(idx) + 1, posts.get(idx+1)));
- idx += 2;
- }
- }
-
- public void test1()
- {
- RangeSet ranges = RangeSetFactory.createRangeSet();
- ranges.add(5, 10);
- check(ranges);
- ranges.add(15, 20);
- check(ranges);
- ranges.add(23, 25);
- check(ranges);
- ranges.add(12, 14);
- check(ranges);
- ranges.add(0, 1);
- check(ranges);
- ranges.add(3, 11);
- check(ranges);
- }
-
- public void test2()
- {
- RangeSet rs = RangeSetFactory.createRangeSet();
- check(rs);
-
- rs.add(1);
- assertTrue(rs.includes(1));
- assertTrue(!rs.includes(2));
- assertTrue(!rs.includes(0));
- check(rs);
-
- rs.add(2);
- assertTrue(!rs.includes(0));
- assertTrue(rs.includes(1));
- assertTrue(rs.includes(2));
- assertTrue(!rs.includes(3));
- check(rs);
-
- rs.add(0);
-
- assertTrue(!rs.includes(-1));
- assertTrue(rs.includes(0));
- assertTrue(rs.includes(1));
- assertTrue(rs.includes(2));
- assertTrue(!rs.includes(3));
- check(rs);
-
- rs.add(37);
-
- assertTrue(!rs.includes(-1));
- assertTrue(rs.includes(0));
- assertTrue(rs.includes(1));
- assertTrue(rs.includes(2));
- assertTrue(!rs.includes(3));
- assertTrue(!rs.includes(36));
- assertTrue(rs.includes(37));
- assertTrue(!rs.includes(38));
- check(rs);
-
- rs.add(-1);
- check(rs);
-
- rs.add(-3);
- check(rs);
-
- rs.add(1, 20);
- assertTrue(!rs.includes(21));
- assertTrue(rs.includes(20));
- check(rs);
- }
-
- public void testAddSelf()
- {
- RangeSet a = RangeSetFactory.createRangeSet();
- a.add(0, 8);
- check(a);
- a.add(0, 8);
- check(a);
- assertEquals(a.size(), 1);
- Range range = a.iterator().next();
- assertEquals(range.getLower(), 0);
- assertEquals(range.getUpper(), 8);
- }
-
- public void testIntersect1()
- {
- Range a = Range.newInstance(0, 10);
- Range b = Range.newInstance(9, 20);
- Range i1 = a.intersect(b);
- Range i2 = b.intersect(a);
- assertEquals(i1.getUpper(), 10);
- assertEquals(i2.getUpper(), 10);
- assertEquals(i1.getLower(), 9);
- assertEquals(i2.getLower(), 9);
- }
-
- public void testIntersect2()
- {
- Range a = Range.newInstance(0, 10);
- Range b = Range.newInstance(11, 20);
- assertNull(a.intersect(b));
- assertNull(b.intersect(a));
- }
-
- public void testIntersect3()
- {
- Range a = Range.newInstance(0, 10);
- Range b = Range.newInstance(3, 5);
- Range i1 = a.intersect(b);
- Range i2 = b.intersect(a);
- assertEquals(i1.getUpper(), 5);
- assertEquals(i2.getUpper(), 5);
- assertEquals(i1.getLower(), 3);
- assertEquals(i2.getLower(), 3);
- }
-
- public void testSubtract1()
- {
- Range a = Range.newInstance(0, 10);
- assertTrue(a.subtract(a).isEmpty());
- }
-
- public void testSubtract2()
- {
- Range a = Range.newInstance(0, 10);
- Range b = Range.newInstance(20, 30);
- List<Range> ranges = a.subtract(b);
- assertEquals(ranges.size(), 1);
- Range d = ranges.get(0);
- assertEquals(d.getLower(), a.getLower());
- assertEquals(d.getUpper(), a.getUpper());
- }
-
- public void testSubtract3()
- {
- Range a = Range.newInstance(20, 30);
- Range b = Range.newInstance(0, 10);
- List<Range> ranges = a.subtract(b);
- assertEquals(ranges.size(), 1);
- Range d = ranges.get(0);
- assertEquals(d.getLower(), a.getLower());
- assertEquals(d.getUpper(), a.getUpper());
- }
-
- public void testSubtract4()
- {
- Range a = Range.newInstance(0, 10);
- Range b = Range.newInstance(3, 5);
- List<Range> ranges = a.subtract(b);
- assertEquals(ranges.size(), 2);
- Range low = ranges.get(0);
- Range high = ranges.get(1);
- assertEquals(low.getLower(), 0);
- assertEquals(low.getUpper(), 2);
- assertEquals(high.getLower(), 6);
- assertEquals(high.getUpper(), 10);
- }
-
- public void testSubtract5()
- {
- Range a = Range.newInstance(0, 10);
- Range b = Range.newInstance(3, 20);
- List<Range> ranges = a.subtract(b);
- assertEquals(ranges.size(), 1);
- Range d = ranges.get(0);
- assertEquals(d.getLower(), 0);
- assertEquals(d.getUpper(), 2);
- }
-
- public void testSubtract6()
- {
- Range a = Range.newInstance(0, 10);
- Range b = Range.newInstance(-10, 5);
- List<Range> ranges = a.subtract(b);
- assertEquals(ranges.size(), 1);
- Range d = ranges.get(0);
- assertEquals(d.getLower(), 6);
- assertEquals(d.getUpper(), 10);
- }
-
- public void testSetSubtract1()
- {
- final RangeSet orig = createRangeSet(0, 10) ;
- final RangeSet update = createRangeSet(3, 15) ;
- orig.subtract(update) ;
- checkRange(orig, 0, 2) ;
- }
-
- public void testSetSubtract2()
- {
- final RangeSet orig = createRangeSet(0, 10) ;
- final RangeSet update = createRangeSet(3, 10) ;
- orig.subtract(update) ;
- checkRange(orig, 0, 2) ;
- }
-
- public void testSetSubtract3()
- {
- final RangeSet orig = createRangeSet(0, 10) ;
- final RangeSet update = createRangeSet(3, 4) ;
- orig.subtract(update) ;
- checkRange(orig, 0, 2, 5, 10) ;
- }
-
- public void testSetSubtract4()
- {
- final RangeSet orig = createRangeSet(3, 15) ;
- final RangeSet update = createRangeSet(0, 10) ;
- orig.subtract(update) ;
- checkRange(orig, 11, 15) ;
- }
-
- public void testSetSubtract5()
- {
- final RangeSet orig = createRangeSet(3, 10) ;
- final RangeSet update = createRangeSet(0, 10) ;
- orig.subtract(update) ;
- checkRange(orig) ;
- }
-
- public void testSetSubtract6()
- {
- final RangeSet orig = createRangeSet(3, 10) ;
- final RangeSet update = createRangeSet(0, 15) ;
- orig.subtract(update) ;
- checkRange(orig) ;
- }
-
- public void testSetSubtract7()
- {
- final RangeSet orig = createRangeSet(0, 10) ;
- final RangeSet update = createRangeSet(0, 15) ;
- orig.subtract(update) ;
- checkRange(orig) ;
- }
-
- public void testSetSubtract8()
- {
- final RangeSet orig = createRangeSet(0, 15) ;
- final RangeSet update = createRangeSet(0, 10) ;
- orig.subtract(update) ;
- checkRange(orig, 11, 15) ;
- }
-
- public void testSetSubtract9()
- {
- final RangeSet orig = createRangeSet(0, 15, 20, 30) ;
- final RangeSet update = createRangeSet(2, 3, 5, 6, 8, 9, 22, 23, 27, 28) ;
- orig.subtract(update) ;
- checkRange(orig, 0, 1, 4, 4, 7, 7, 10, 15, 20, 21, 24, 26, 29, 30) ;
- }
-
- public void testSetSubtract10()
- {
- final RangeSet orig = createRangeSet(0, 15, 20, 30) ;
- final RangeSet update = createRangeSet(0, 2, 4, 6, 10, 22, 24, 24, 27, 30) ;
- orig.subtract(update) ;
- checkRange(orig, 3, 3, 7, 9, 23, 23, 25, 26) ;
- }
-
- public void testSetSubtract11()
- {
- final RangeSet orig = createRangeSet(0, 2, 4, 6, 10, 22, 24, 24, 27, 30) ;
- final RangeSet update = createRangeSet(0, 2, 4, 6, 10, 22, 24, 24, 27, 30) ;
- orig.subtract(update) ;
- checkRange(orig) ;
- }
-
- private RangeSet createRangeSet(int ... bounds)
- {
- RangeSet set = RangeSetFactory.createRangeSet();
- final int length = (bounds == null ? 0 : bounds.length) ;
- int count = 0 ;
- while(count < length)
- {
- set.add(bounds[count++], bounds[count++]) ;
- }
- return set ;
- }
-
- private void checkRange(final RangeSet rangeSet, int ... bounds)
- {
- final int length = (bounds == null ? 0 : bounds.length) ;
- assertEquals("Range count", length/2, rangeSet.size()) ;
- final Iterator<Range> iter = rangeSet.iterator() ;
- int count = 0 ;
- while(count < length)
- {
- final Range range = iter.next() ;
- assertEquals("Range lower", bounds[count++], range.getLower()) ;
- assertEquals("Range upper", bounds[count++], range.getUpper()) ;
- }
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/SessionTimeoutTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/SessionTimeoutTest.java
deleted file mode 100644
index 5f1c1254a2..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/SessionTimeoutTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpid.transport;
-
-import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.test.utils.QpidTestCase;
-
-
-public class SessionTimeoutTest extends QpidTestCase
-{
- public void testSessionTimeout()
- {
- try
- {
- long timeout = 1;
- setTestSystemProperty("qpid.sync_op_timeout", Long.toString(timeout));
- assertSessionTimeout(timeout);
- }
- finally
- {
- revertTestSystemProperties();
- }
- }
-
- public void testSessionTimeoutSetWith_amqj_default_syncwrite_timeout()
- {
- try
- {
- long timeout = 1;
- setTestSystemProperty("amqj.default_syncwrite_timeout", Long.toString(timeout));
- setTestSystemProperty("qpid.sync_op_timeout", null);
- assertSessionTimeout(timeout);
- }
- finally
- {
- revertTestSystemProperties();
- }
- }
-
- private void assertSessionTimeout(long timeout)
- {
- Session session = new TestSession(null, null, 0);
- long startTime = System.currentTimeMillis();
- try
- {
- session.awaitOpen();
- fail("SessionTimeoutException is expected!");
- }
- catch (SessionException e)
- {
- long elapsedTime = System.currentTimeMillis() - startTime;
- assertTrue("Expected timeout should happened in " + timeout + " ms but timeout occured in "
- + elapsedTime + " ms!", elapsedTime >= timeout && elapsedTime < ClientProperties.DEFAULT_SYNC_OPERATION_TIMEOUT);
- }
- }
-
- class TestSession extends Session
- {
- public TestSession(Connection connection, Binary name, long expiry)
- {
- super(connection, name, expiry);
- }
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/codec/BBEncoderTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/codec/BBEncoderTest.java
deleted file mode 100644
index 79bf184fe2..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/codec/BBEncoderTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-import junit.framework.TestCase;
-
-import java.nio.ByteBuffer;
-
-/**
- * BBEncoderTest
- *
- */
-
-public class BBEncoderTest extends TestCase
-{
-
- public void testGrow()
- {
- BBEncoder enc = new BBEncoder(4);
- enc.writeInt32(0xDEADBEEF);
- ByteBuffer buf = enc.buffer();
- assertEquals(0xDEADBEEF, buf.getInt(0));
- enc.writeInt32(0xBEEFDEAD);
- buf = enc.buffer();
- assertEquals(0xDEADBEEF, buf.getInt(0));
- assertEquals(0xBEEFDEAD, buf.getInt(4));
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java
deleted file mode 100644
index 3da2a03f42..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network;
-
-
-import java.util.Set;
-
-import javax.net.ssl.SSLContext;
-
-import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.protocol.ProtocolEngineFactory;
-import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.transport.ByteBufferReceiver;
-import org.apache.qpid.transport.ConnectionSettings;
-import org.apache.qpid.transport.NetworkTransportConfiguration;
-import org.apache.qpid.transport.TransportException;
-import org.apache.qpid.transport.network.io.IoNetworkTransport;
-
-public class TransportTest extends QpidTestCase
-{
-
-
-
- public void testDefaultGetOutgoingTransportForv0_8() throws Exception
- {
- final OutgoingNetworkTransport networkTransport = Transport.getOutgoingTransportInstance(ProtocolVersion.v8_0);
- assertNotNull(networkTransport);
- assertTrue(networkTransport instanceof IoNetworkTransport);
- }
-
- public void testGloballyOverriddenOutgoingTransportForv0_8() throws Exception
- {
- setTestSystemProperty(Transport.QPID_TRANSPORT_PROPNAME, TestOutgoingNetworkTransport.class.getName());
-
- final OutgoingNetworkTransport networkTransport = Transport.getOutgoingTransportInstance(ProtocolVersion.v8_0);
- assertNotNull(networkTransport);
- assertTrue(networkTransport instanceof TestOutgoingNetworkTransport);
- }
-
- public void testProtocolSpecificOverriddenOutgoingTransportForv0_8() throws Exception
- {
- setTestSystemProperty(Transport.QPID_TRANSPORT_V0_8_PROPNAME, TestOutgoingNetworkTransport.class.getName());
-
- final OutgoingNetworkTransport networkTransport = Transport.getOutgoingTransportInstance(ProtocolVersion.v8_0);
- assertNotNull(networkTransport);
- assertTrue(networkTransport instanceof TestOutgoingNetworkTransport);
- }
-
- public void testDefaultGetOutgoingTransportForv0_10() throws Exception
- {
- final OutgoingNetworkTransport networkTransport = Transport.getOutgoingTransportInstance(ProtocolVersion.v0_10);
- assertNotNull(networkTransport);
- assertTrue(networkTransport instanceof IoNetworkTransport);
- }
-
- public void testDefaultGetIncomingTransport() throws Exception
- {
- final IncomingNetworkTransport networkTransport = Transport.getIncomingTransportInstance();
- assertNotNull(networkTransport);
- assertTrue(networkTransport instanceof IoNetworkTransport);
- }
-
- public void testOverriddenGetIncomingTransport() throws Exception
- {
- setTestSystemProperty(Transport.QPID_BROKER_TRANSPORT_PROPNAME, TestIncomingNetworkTransport.class.getName());
-
- final IncomingNetworkTransport networkTransport = Transport.getIncomingTransportInstance();
- assertNotNull(networkTransport);
- assertTrue(networkTransport instanceof TestIncomingNetworkTransport);
- }
-
- public void testInvalidOutgoingTransportClassName() throws Exception
- {
- setTestSystemProperty(Transport.QPID_TRANSPORT_PROPNAME, "invalid");
-
- try
- {
- Transport.getOutgoingTransportInstance(ProtocolVersion.v0_10);
- fail("Should have failed to load the invalid class");
- }
- catch(TransportException te)
- {
- //expected, ignore
- }
- }
-
- public void testInvalidOutgoingTransportProtocolVersion() throws Exception
- {
- try
- {
- Transport.getOutgoingTransportInstance(new ProtocolVersion((byte)0, (byte)0));
- fail("Should have failed to load the transport for invalid protocol version");
- }
- catch(IllegalArgumentException iae)
- {
- //expected, ignore
- }
- }
-
- public static class TestOutgoingNetworkTransport implements OutgoingNetworkTransport
- {
-
- public void close()
- {
- throw new UnsupportedOperationException();
- }
-
- public NetworkConnection getConnection()
- {
- throw new UnsupportedOperationException();
- }
-
- public NetworkConnection connect(ConnectionSettings settings,
- ByteBufferReceiver delegate,
- TransportActivity transportActivity)
- {
- throw new UnsupportedOperationException();
- }
- }
-
- public static class TestIncomingNetworkTransport implements IncomingNetworkTransport
- {
-
- public void close()
- {
- throw new UnsupportedOperationException();
- }
-
- public NetworkConnection getConnection()
- {
- throw new UnsupportedOperationException();
- }
-
- public void accept(NetworkTransportConfiguration config,
- ProtocolEngineFactory factory,
- SSLContext sslContext,
- final Set<TransportEncryption> encryptionSet)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getAcceptingPort()
- {
- return -1;
- }
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IdleTimeoutTickerTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IdleTimeoutTickerTest.java
deleted file mode 100644
index 69724438ec..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IdleTimeoutTickerTest.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.transport.network.io;
-
-import java.net.SocketAddress;
-import java.security.Principal;
-
-import junit.framework.TestCase;
-
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.network.NetworkConnection;
-import org.apache.qpid.transport.network.TransportActivity;
-
-public class IdleTimeoutTickerTest extends TestCase implements TransportActivity, NetworkConnection
-{
- private IdleTimeoutTicker _ticker;
- private static final int DEFAULT_TIMEOUT = 567890;
- private long _lastReadTime;
- private long _lastWriteTime;
- private long _currentTime;
- private int _maxWriteIdle;
- private int _maxReadIdle;
- private boolean _readerIdle;
- private boolean _writerIdle;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- _ticker = new IdleTimeoutTicker(this, DEFAULT_TIMEOUT);
- _ticker.setConnection(this);
- _readerIdle = false;
- _writerIdle = false;
- _lastReadTime = 0l;
- _lastWriteTime = 0l;
- _maxReadIdle = 0;
- _maxWriteIdle = 0;
- }
-
- public void testNoIdle() throws Exception
- {
- _maxReadIdle = 4;
- _maxWriteIdle = 2;
- _lastReadTime = 0;
- _lastWriteTime = 1500;
- _currentTime = 3000;
- // Current time = 3s,
- // last read = 0s, max read idle = 4s, should check in 1s
- // last write = 1.5s, max write idle = 2s, should check in 0.5s
- long nextTime = _ticker.tick(_currentTime);
- assertEquals("Incorrect next tick calculation", 500l, nextTime);
- assertFalse("Incorrectly caused reader idle", _readerIdle);
- assertFalse("Incorrectly caused writer idle", _writerIdle);
-
-
- // Current time = 3.4s,
- // last read = 0s, max read idle = 4s, should check in 0.6s
- // last write = 3.1s, max write idle = 2s, should check in 1.7s
- _lastWriteTime = 3100;
- _currentTime = 3400;
- nextTime = _ticker.tick(_currentTime);
- assertEquals("Incorrect next tick calculation", 600l, nextTime);
- assertFalse("Incorrectly caused reader idle", _readerIdle);
- assertFalse("Incorrectly caused writer idle", _writerIdle);
-
- _maxReadIdle = 0;
- nextTime = _ticker.tick(_currentTime);
- assertEquals("Incorrect next tick calculation", 1700l, nextTime);
- assertFalse("Incorrectly caused reader idle", _readerIdle);
- assertFalse("Incorrectly caused writer idle", _writerIdle);
-
- _maxWriteIdle = 0;
- nextTime = _ticker.tick(_currentTime);
- assertEquals("Incorrect next tick calculation", DEFAULT_TIMEOUT, nextTime);
- assertFalse("Incorrectly caused reader idle", _readerIdle);
- assertFalse("Incorrectly caused writer idle", _writerIdle);
-
- }
-
- public void testReaderIdle() throws Exception
- {
- _maxReadIdle = 4;
- _maxWriteIdle = 0;
- _lastReadTime = 0;
- _lastWriteTime = 2500;
- _currentTime = 4000;
- // Current time = 4s,
- // last read = 0s, max read idle = 4s, reader idle
- long nextTime = _ticker.tick(_currentTime);
-
- assertTrue(_readerIdle);
- assertFalse(_writerIdle);
-
- _readerIdle = false;
-
- // last write = 2.5s, max write idle = 2s, should check in 0.5s
- _maxWriteIdle = 2;
- nextTime = _ticker.tick(_currentTime);
- assertTrue(_readerIdle);
- assertFalse(_writerIdle);
-
- _readerIdle = false;
- // last write = 1.5s, max write idle = 2s, should check in 0.5s
-
- _lastWriteTime = 1500;
- nextTime = _ticker.tick(_currentTime);
-
- assertTrue(_readerIdle);
- assertTrue(_writerIdle);
-
- }
-
- public void testWriterIdle() throws Exception
- {
- _maxReadIdle = 0;
- _maxWriteIdle = 2;
- _lastReadTime = 0;
- _lastWriteTime = 1500;
- _currentTime = 4000;
- // Current time = 4s,
- // last write = 1.5s, max write idle = 2s, writer idle
- long nextTime = _ticker.tick(_currentTime);
-
- assertTrue(_writerIdle);
- assertFalse(_readerIdle);
- assertEquals(2000l,nextTime);
-
- _writerIdle = false;
- _lastWriteTime = 1500;
- _maxReadIdle = 5;
-
- nextTime = _ticker.tick(_currentTime);
-
- assertTrue(_writerIdle);
- assertFalse(_readerIdle);
- assertEquals(1000l,nextTime);
-
- }
-
- //-------------------------------------------------------------------------
- // Implement TransportActivity methods
- //-------------------------------------------------------------------------
-
- @Override
- public long getLastReadTime()
- {
- return _lastReadTime;
- }
-
- @Override
- public long getLastWriteTime()
- {
- return _lastWriteTime;
- }
-
- @Override
- public void writerIdle()
- {
- _writerIdle = true;
- _lastWriteTime = _currentTime;
- }
-
- @Override
- public void readerIdle()
- {
- _readerIdle = true;
- }
-
- //-------------------------------------------------------------------------
- // Implement NetworkConnection methods
- // Only actually use those relating to idle timeouts
- //-------------------------------------------------------------------------
-
- @Override
- public ByteBufferSender getSender()
- {
- return null;
- }
-
- @Override
- public void start()
- {
- }
-
- @Override
- public void close()
- {
- }
-
- @Override
- public SocketAddress getRemoteAddress()
- {
- return null;
- }
-
- @Override
- public SocketAddress getLocalAddress()
- {
- return null;
- }
-
- @Override
- public void setMaxWriteIdle(int sec)
- {
- _maxWriteIdle = sec;
- }
-
- @Override
- public void setMaxReadIdle(int sec)
- {
- _maxReadIdle = sec;
- }
-
- @Override
- public Principal getPeerPrincipal()
- {
- return null;
- }
-
- @Override
- public int getMaxReadIdle()
- {
- return _maxReadIdle;
- }
-
- @Override
- public int getMaxWriteIdle()
- {
- return _maxWriteIdle;
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java
deleted file mode 100644
index f1492273c8..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.io;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketAddress;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.transport.Binding;
-
-
-/**
- * IoAcceptor
- *
- */
-
-public class IoAcceptor<E> extends Thread
-{
- private static final Logger _logger = LoggerFactory.getLogger(IoAcceptor.class);
-
- private volatile boolean _closed = false;
-
- private ServerSocket socket;
- private Binding<E> binding;
-
- public IoAcceptor(SocketAddress address, Binding<E> binding)
- throws IOException
- {
- socket = new ServerSocket();
- socket.setReuseAddress(true);
- socket.bind(address);
- this.binding = binding;
-
- setName(String.format("IoAcceptor - %s", socket.getInetAddress()));
- }
-
- /**
- Close the underlying ServerSocket if it has not already been closed.
- */
- public void close() throws IOException
- {
- _closed = true;
-
- if (!socket.isClosed())
- {
- socket.close();
- }
- }
-
- public IoAcceptor(String host, int port, Binding<E> binding)
- throws IOException
- {
- this(new InetSocketAddress(host, port), binding);
- }
-
- public void run()
- {
- while (!_closed)
- {
- try
- {
- Socket sock = socket.accept();
- IoTransport<E> transport = new IoTransport<E>(sock, binding);
- }
- catch (IOException e)
- {
- if (!_closed)
- {
- _logger.error("Error in IoAcceptor thread", e);
- closeSocketIfNecessary(socket);
- try
- {
- Thread.sleep(1000);
- }
- catch (InterruptedException ie)
- {
- _logger.debug("Stopping io acceptor due to interrupt request");
- _closed = true;
- }
- }
- }
- }
- }
-
- private void closeSocketIfNecessary(final ServerSocket socket)
- {
- if(socket != null)
- {
- try
- {
- socket.close();
- }
- catch (IOException e)
- {
- _logger.debug("Exception while closing socket", e);
- }
- }
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java
deleted file mode 100644
index 4b5b4448ee..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.qpid.transport.network.io;
-
-import java.net.Socket;
-
-import org.apache.qpid.transport.Binding;
-import org.apache.qpid.transport.ByteBufferSender;
-import org.apache.qpid.transport.util.Logger;
-
-/**
- * This class provides a socket based transport using the java.io
- * classes.
- *
- * The following params are configurable via JVM arguments
- * TCP_NO_DELAY - amqj.tcpNoDelay
- * SO_RCVBUF - amqj.receiveBufferSize
- * SO_SNDBUF - amqj.sendBufferSize
- */
-public final class IoTransport<E>
-{
-
-
- private static final Logger log = Logger.get(IoTransport.class);
-
- private static int DEFAULT_READ_WRITE_BUFFER_SIZE = 64 * 1024;
- private static int readBufferSize = Integer.getInteger
- ("amqj.receiveBufferSize", DEFAULT_READ_WRITE_BUFFER_SIZE);
- private static int writeBufferSize = Integer.getInteger
- ("amqj.sendBufferSize", DEFAULT_READ_WRITE_BUFFER_SIZE);
-
- private Socket socket;
- private ByteBufferSender sender;
- private E endpoint;
- private IoReceiver receiver;
- private long timeout = 60000;
-
- IoTransport(Socket socket, Binding<E> binding)
- {
- this.socket = socket;
- setupTransport(socket, binding);
- }
-
- private void setupTransport(Socket socket, Binding<E> binding)
- {
- IoSender ios = new IoSender(socket, 2*writeBufferSize, timeout);
- ios.initiate();
-
- this.sender = ios;
- this.endpoint = binding.endpoint(sender);
- this.receiver = new IoReceiver(socket, binding.receiver(endpoint),
- 2*readBufferSize, timeout);
- this.receiver.initiate();
-
- ios.setReceiver(this.receiver);
- }
-
- public ByteBufferSender getSender()
- {
- return sender;
- }
-
- public IoReceiver getReceiver()
- {
- return receiver;
- }
-
- public Socket getSocket()
- {
- return socket;
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/security/ssl/SSLUtilTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/security/ssl/SSLUtilTest.java
deleted file mode 100644
index 4c91ccc406..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/security/ssl/SSLUtilTest.java
+++ /dev/null
@@ -1,1274 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.network.security.ssl;
-
-import java.io.ByteArrayInputStream;
-import java.nio.ByteBuffer;
-import java.security.KeyStore;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLEngineResult;
-import javax.net.ssl.TrustManagerFactory;
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.transport.TransportException;
-
-public class SSLUtilTest extends QpidTestCase
-{
- public void testGetIdFromSubjectDN()
- {
- // "normal" dn
- assertEquals("user@somewhere.example.org",SSLUtil.getIdFromSubjectDN("cn=user,dc=somewhere,dc=example,dc=org"));
- // quoting of values, case of types, spacing all ignored
- assertEquals("user2@somewhere.example.org",SSLUtil.getIdFromSubjectDN("DC=somewhere, dc=example,cn=\"user2\",dc=org"));
- // only first cn is used
- assertEquals("user@somewhere.example.org",SSLUtil.getIdFromSubjectDN("DC=somewhere, dc=example,cn=\"user\",dc=org, cn=user2"));
- // no cn, no Id
- assertEquals("",SSLUtil.getIdFromSubjectDN("DC=somewhere, dc=example,dc=org"));
- // cn in value is ignored
- assertEquals("",SSLUtil.getIdFromSubjectDN("C=CZ,O=Scholz,OU=\"JAKUB CN=USER1\""));
- // cn with no dc gives just user
- assertEquals("someone",SSLUtil.getIdFromSubjectDN("ou=someou, CN=\"someone\""));
- // null results in empty string
- assertEquals("",SSLUtil.getIdFromSubjectDN(null));
- // invalid name results in empty string
- assertEquals("",SSLUtil.getIdFromSubjectDN("ou=someou, ="));
- // component containing whitespace
- assertEquals("me@example.com",SSLUtil.getIdFromSubjectDN("CN=me,DC=example, DC=com, O=My Company Ltd, L=Newbury, ST=Berkshire, C=GB"));
- // empty CN
- assertEquals("",SSLUtil.getIdFromSubjectDN("CN=,DC=somewhere, dc=example,dc=org"));
-
-
- }
-
- public void testWildCardAndSubjectAltNameMatchingWorks() throws Exception
- {
- doNameMatchingTest(KEYSTORE_1,
- Arrays.asList("amqp.example.com"),
- Arrays.asList("amqp.example.net", "example.com", "*.example.com"));
-
- doNameMatchingTest(KEYSTORE_2,
- Arrays.asList("amqp.example.com", "amqp1.example.com"),
- Arrays.asList("amqp.example.net", "example.com", "*.example.com"));
-
- doNameMatchingTest(KEYSTORE_3,
- Arrays.asList("amqp.example.com", "amqp1.example.com", "amqp2.example.com"),
- Arrays.asList("amqp.example.net", "example.com", "*.example.com"));
-
- doNameMatchingTest(KEYSTORE_4,
- Arrays.asList("amqp.example.com", "amqp1.example.com", "amqp2.example.com", "foo.example.com"),
- Arrays.asList("amqp.example.net", "example.com", "foo.bar.example.com"));
-
- doNameMatchingTest(KEYSTORE_5,
- Arrays.asList("amqp.example.com", "foo.example.com"),
- Arrays.asList("amqp.example.net", "example.com", "foo.bar.example.com", "foo.org"));
-
- doNameMatchingTest(KEYSTORE_6,
- Arrays.asList("amqp.example.com"),
- Arrays.asList("amqp.example.net", "example.com", "foo.bar.example.com", "foo.org", "foo"));
-
- doNameMatchingTest(KEYSTORE_7,
- Arrays.asList("amqp.example.org", "amqp1.example.org", "amqp2.example.org"),
- Arrays.asList("amqp.example.net", "example.com", "foo.bar.example.com", "foo.org", "foo"));
-
- doNameMatchingTest(KEYSTORE_8,
- Arrays.asList("amqp.example.org", "example.org"),
- Arrays.asList("amqp1.example.org", "example.com", "foo.bar.example.com", "foo.org", "foo"));
-
- doNameMatchingTest(KEYSTORE_9,
- Arrays.asList("amqp.example.org"),
- Arrays.asList("amqp1.example.org", "example.org", "*.example.org"));
-
- doNameMatchingTest(KEYSTORE_10,
- Arrays.asList("amqp.example.org", "amqp1.example.org"),
- Arrays.asList("example.org", "a.mqp.example.org"));
-
- doNameMatchingTest(KEYSTORE_11,
- Collections.<String>emptyList(),
- Arrays.asList("example.org", "a.mqp.example.org", "org"));
-
- doNameMatchingTest(KEYSTORE_12,
- Collections.<String>emptyList(),
- Arrays.asList("example.org", "a.mqp.example.org", "org"));
-
- doNameMatchingTest(KEYSTORE_13,
- Collections.<String>emptyList(),
- Arrays.asList("example.org", "a.mqp.example.org", "org"));
- }
-
- private void doNameMatchingTest(byte[] keystoreBytes, List<String> validAddresses, List<String> invalidAddresses) throws Exception
- {
- KeyStore keyStore = KeyStore.getInstance("JKS");
- keyStore.load(new ByteArrayInputStream(keystoreBytes), "password".toCharArray());
-
-
- KeyStore trustStore = KeyStore.getInstance("JKS");
- trustStore.load(new ByteArrayInputStream(TRUSTSTORE), "password".toCharArray());
-
- for(String validAddress : validAddresses)
- {
- try
- {
- SSLUtil.verifyHostname(getSSLEngineAfterHandshake(keyStore, trustStore, validAddress, 5672),
- validAddress);
- }
- catch(TransportException e)
- {
- fail("The address " + validAddress + " should validate but does not");
- }
- }
-
- for(String invalidAddress : invalidAddresses)
- {
- try
- {
- SSLUtil.verifyHostname(getSSLEngineAfterHandshake(keyStore, trustStore, invalidAddress, 5672),
- invalidAddress);
- fail("The address " + invalidAddress + " should not validate but it does");
- }
- catch(TransportException e)
- {
- // pass
- }
- }
- }
-
- private SSLEngine getSSLEngineAfterHandshake(final KeyStore keyStore,
- final KeyStore trustStore,
- String host,
- int port)
- throws Exception
- {
- SSLContext sslContext = SSLContext.getInstance("TLS");
- KeyManagerFactory keyManager = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
- keyManager.init(keyStore, "password".toCharArray());
- sslContext.init(keyManager.getKeyManagers(), null,null);
-
- SSLEngine serverEngine = sslContext.createSSLEngine();
- serverEngine.setUseClientMode(false);
-
-
- SSLContext clientContext = SSLContext.getInstance("TLS");
- TrustManagerFactory trustManager = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- trustManager.init(trustStore);
-
- clientContext.init(null, trustManager.getTrustManagers(), null);
-
- SSLEngine clientEngine = clientContext.createSSLEngine(host, port);
-
- clientEngine.setUseClientMode(true);
- clientEngine.beginHandshake();
-
- byte[] clientInput = new byte[0];
- byte[] clientOutput = new byte[0];
-
- SSLEngineResult.HandshakeStatus clientStatus;
- while((clientStatus = clientEngine.getHandshakeStatus()) != SSLEngineResult.HandshakeStatus.FINISHED
- && clientStatus != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING)
- {
- switch (clientStatus)
- {
- case NEED_TASK:
- clientEngine.getDelegatedTask().run();
- break;
- case NEED_WRAP:
- ByteBuffer dst = ByteBuffer.allocate(1024*1024);
- clientEngine.wrap(ByteBuffer.allocate(0), dst);
- dst.flip();
- byte[] output = new byte[clientOutput.length+dst.remaining()];
- System.arraycopy(clientOutput,0,output,0,clientOutput.length);
- dst.get(output, clientOutput.length, dst.remaining());
- clientOutput = output;
- break;
- case NEED_UNWRAP:
- ByteBuffer unwrapDst = ByteBuffer.allocate(1024*1024);
- ByteBuffer src = ByteBuffer.wrap(clientInput);
- clientEngine.unwrap(src, unwrapDst);
- byte[] input = new byte[src.remaining()];
- src.get(input,0,src.remaining());
- clientInput = input;
- default:
- break;
- }
-
- SSLEngineResult.HandshakeStatus serverStatus = serverEngine.getHandshakeStatus();
- switch (serverStatus)
- {
- case NEED_TASK:
- serverEngine.getDelegatedTask().run();
- break;
- case NEED_WRAP:
- ByteBuffer dst = ByteBuffer.allocate(1024*1024);
- serverEngine.wrap(ByteBuffer.allocate(0), dst);
- dst.flip();
- byte[] serverOutput = new byte[clientInput.length+dst.remaining()];
- System.arraycopy(clientInput,0,serverOutput,0,clientInput.length);
- dst.get(serverOutput, clientInput.length, dst.remaining());
- clientInput = serverOutput;
- break;
-
- case NOT_HANDSHAKING:
- case NEED_UNWRAP:
- ByteBuffer unwrapDst = ByteBuffer.allocate(1024*1024);
- ByteBuffer src = ByteBuffer.wrap(clientOutput);
- serverEngine.unwrap(src, unwrapDst);
- byte[] input = new byte[src.remaining()];
- src.get(input,0,src.remaining());
- clientOutput = input;
- }
- }
- return clientEngine;
- }
-
- private static byte[] TRUSTSTORE = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAACAAAAAgAGcm9vdGNhAAABSDadDw4ABVguNTA5AAADyjCCA8Yw"
- + "ggKuoAMCAQICAQUwDQYJKoZIhvcNAQEFBQAwdDETMBEGCgmSJomT8ixkARkWA29y"
- + "ZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEX"
- + "MBUGA1UECwwOU2ltcGxlIFJvb3QgQ0ExFzAVBgNVBAMMDlNpbXBsZSBSb290IENB"
- + "MB4XDTE0MDkwMjExMTc1OFoXDTI0MDkwMTExMTc1OFowdDETMBEGCgmSJomT8ixk"
- + "ARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxl"
- + "IEluYzEXMBUGA1UECwwOU2ltcGxlIFJvb3QgQ0ExFzAVBgNVBAMMDlNpbXBsZSBS"
- + "b290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnbksOuGOSUBv"
- + "kbnUvWrgGOQeXQ7QoAMJEPhaxzW5aGZwpxf3F07yEyLKfyFH3URQOrXyl92xoH/u"
- + "b8RDjK8plBFQ93eteTK+k582REQdHHx7zdLAyaNDE/RHGJJV8WDbGj4mzguZGkDi"
- + "MGRS+j/UnQct6v5XXl/Ux2zahb16ZyoVtDlydKNVl8UR0aNn7esgfFw0x2OmplhN"
- + "0A8xqX//sQfVTi2rptBSo73whitUg29abcgtVXZnIQM5kssiJxA9ZewKLWc9K/g+"
- + "S2DOiPkNgVsliBaQUA7C5xlaCHrsyerUh8oOdvBe1eW8jfU3SwvejUvTfhMtu/sh"
- + "6Wu7GD44pQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB"
- + "/zAdBgNVHQ4EFgQUWpliNfMupTQEz0td70FDAFy4vc0wHwYDVR0jBBgwFoAUWpli"
- + "NfMupTQEz0td70FDAFy4vc0wDQYJKoZIhvcNAQEFBQADggEBAGUCdZ01c61JtIA+"
- + "mC1+uNGC6wf6+D70TBf8WnrsuFnVU/LFbeuhBg+QhT7GkWx2qAit2L06W4QZKpcT"
- + "nqIX+fKImxlLwBXG7VPJXpQBVZ88LY9bLMRwlwm9AoSR70ip+Sof8nV+siSVV46S"
- + "1WZYO8QE35XXSF5xlmAuUkHa8RDVyHE24okcLG/GcemPwyv7PXwTiCJjwx9GqgHh"
- + "GkNYGPJHig0Vb6j/RXJ9kliw4xhDBcQ53TkUg9Os2t88yuUpNdoJ3fdf59TwcWC7"
- + "P4queBPb190HLE3nR4KmiVR7V/XdVUI31bOb11yVmoQ/mATvy+oHCbmdxzrWeDvv"
- + "8VGW8o4AAAACAAlzaWduaW5nY2EAAAFINp1WbAAFWC41MDkAAAPTMIIDzzCCAreg"
- + "AwIBAgIBBjANBgkqhkiG9w0BAQUFADB0MRMwEQYKCZImiZPyLGQBGRYDb3JnMRYw"
- + "FAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1wbGUgSW5jMRcwFQYD"
- + "VQQLDA5TaW1wbGUgUm9vdCBDQTEXMBUGA1UEAwwOU2ltcGxlIFJvb3QgQ0EwHhcN"
- + "MTQwOTAyMTExODE3WhcNMjQwOTAxMTExODE3WjB6MRMwEQYKCZImiZPyLGQBGRYD"
- + "b3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1wbGUgSW5j"
- + "MRowGAYDVQQLDBFTaW1wbGUgU2lnbmluZyBDQTEaMBgGA1UEAwwRU2ltcGxlIFNp"
- + "Z25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDradZr1W8A"
- + "D8DmjziXB0UstOXnIEjL+7QbWeDlpgX5Mp4y8+iV+vxaI8x3ko1IfKsVa5Qge/W0"
- + "O4vVBF4f6Cbs9LBzUzlSeWJSPdGqWhn0nBLrIgnMbSmIy4k9bD3uo4zqZImrRhru"
- + "Y4GCGuc+51MWjIDTAx/UetaYgFk6Gu722yJBmOxzZ3WJmyBjBvKvBsAtetyenE9f"
- + "kXth4XJGOiqQYzW1RGhqOoFFbh92GB/5/0qQHkbMsfirguwjC0WwHJMrnDGolhbE"
- + "d9Spa4S6MtDbHS/PKe3C27D3ikknc3vUtDjGmpTYfSChBFbiNK+UGlcnKwMyBpnU"
- + "EPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAG"
- + "AQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J1mEa6qz8/tY9hzAfBgNVHSMEGDAW"
- + "gBRamWI18y6lNATPS13vQUMAXLi9zTANBgkqhkiG9w0BAQUFAAOCAQEAFYmn/VQf"
- + "Fk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGxnbYz3LmtzGQbf1R2vAwlEHTb"
- + "lNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1BUqisxrDeHnZP5UIxOSaTIOd"
- + "rl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x2iQkLHFmYhbNqyrABtg3cw+f"
- + "eyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAtl3494PqS4/fPC2y/+o8PjybK"
- + "YKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY1kb/jgfz9Xf1o4zlEa2U5LVU"
- + "I3xqsv1yM8JAKxuM8c3bu5LSXhqzhY/jpvuIiYo0"
- );
- // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com
- // X509v3 Subject Alternative Name:
- // DNS:amqp.example.com
-
- private static byte[] KEYSTORE_1 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l8fMAAAFAjCCBP4wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6lTe4rAo9QK4qEZTXZq7loi93Z/qHVzLceEu5wjsJyIJ8TJitAKXO4AY"
- +"g1onr3ZnBwL2cSP2ntSFPxvZdoq8zzWN9rl7AfrwojPmypeNJ0Qo47hEkraZyiRn"
- +"tyTLV8ecqBew4dzg2Je5rl2xCBV+Fww+DQUL2uoeEvkxl9y+075yqoacal/99Bkj"
- +"Ql4PD4iLnyMpeN8n8jnr9Ik+mBGLLBnR4wtzMrB71cxPss2HBZmSJtgq7rZFB/ER"
- +"vi5MVrwpT5DzlNrC08no3+hRIwjzWqt0kg3dBPkFLVKsQA/+UXfiQESc3LTRetuW"
- +"C49tyvx5X8RnZRSs9vz01Sacv4o61NwZxT5QQLLkBvEjH88CALn+QTe834me+SGs"
- +"bGjuBvKg0TMEQukk0/C/ow6ulLLTst/92pTetQ6pQjzXatTOoKcGJW3Nct05QKbz"
- +"mGsOtjwrTzceL7PXsbr8EQ55inIjSmjTU6O1J1/rd+VQfMh3bNrfnGJywT0rD1aU"
- +"MkvpzX6qUDtmJ2nDAuWiczYhWCWR1f85lPcJSsQ1QfxpdlEbS2pbU12VNFIscxWU"
- +"Pcs26pJSA2zffhzEPej2MkyW2DN3XXy+RAORxshg6pm1J5X80WFj/ZLs0lYZ64Pg"
- +"/BIT2dSgZ3gxPHuWimTUCsNnPzpYM0NihVTOAb+fXDcM6ZHUbQXPG83PW8RCmfDp"
- +"bRgAnyrfF/vRbC6csM/ujCDvLg3EHpgZUN2YGf2RBg49ChOm6YtfL3oMIuz7zulX"
- +"2cA24DiysMYQSa/QCF2k6JxH19aXjysFyrfLRIPFWY1FiCoWsuWKq/Bzu8X02KbO"
- +"NelvlLJFJPnkqjcM/c17jH2bzKyBClHoiuPRZKA2CCnLDEOwgiWKsXaJndSOhACE"
- +"xUQI7O4WHix5+s2mSHnDqF4WE+0aW4A72Un1t5Kab0sghvOMXeCH2qo7nGjZG9ij"
- +"pY8erh1GpE9iuj+Eucvn4lm/22H5wMzpP6lbmVjvBSrrIQoiTcBWh8XGCZA+TrbZ"
- +"uJN8rIwEWTvj/eoHBGIOzXydR86pf7rH5B4hftkhPCYz9+To5KGC/EIs3Ox9mrVE"
- +"XBIVDdcBmEH7LytiS0/juGd4AeLZza/sDV0YDC4g8zs8zuNfRMaNMDnRXb6ss5r5"
- +"yQzv/v2T9jlEnQmfDdH9UZMudXaaf+i4JVRCUywtz4PJOkILLOqJk5J1aNn2HpFc"
- +"fNdMLKI1RWVKov8CuW6LSRodf1qvNFwtSWEIJk0off/Bz9nwVYKYHhtntQC+QMlG"
- +"dD8ftBCR63KWqHl79hvnbwgZ2K6DoCcxSLmYEfmWj3uG0D18N5gOag8CavduNq+I"
- +"K7ky7fuAoBuwWU1FP65ZMS8x/D8aXa4QaVVweBHAZTY5WyIV8FfLbLQhjoEq+Pno"
- +"X805wwO5fWxv7/wDDh1hx+dGyYenCLdEopJ8EwTgXgoiBzL0wkePIoGSsNAI/I9M"
- +"J8OKWmgTqAB13Qz8LtkpauoG5CVDfQgfqwuUxDkoajmUnFqtbfubLWCNRRc4FaUH"
- +"2s+KGxJlJvpUnQJzXbEhSgfoLxnGINgbjJRvGwdvAYVHm7DoDY00TU0KLbZQqKLP"
- +"E6Tk67LsZ6OEK00iFjzbMoIV34/c7V+mIuxXKwuL9VK4oH9YbTigF1UnIToOeTEo"
- +"iM9pUpei6czwDBg1elybeGoAAAACAAVYLjUwOQAAA/AwggPsMIIC1KADAgECAgED"
- +"MA0GCSqGSIb3DQEBBQUAMHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJ"
- +"k/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNp"
- +"bXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTAeFw0x"
- +"NDA5MDIxMTI3MTdaFw0xNjA5MDExMTI3MTdaMFwxCzAJBgNVBAYTAlVTMRAwDgYD"
- +"VQQIDAdwcml2YXRlMREwDwYDVQQHDAhwcm92aW5jZTENMAsGA1UECgwEY2l0eTEZ"
- +"MBcGA1UEAwwQYW1xcC5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP"
- +"ADCCAQoCggEBAMisq2b7y/hCi2fg2MX6pGz+E9rJETA4ry0pLPXyK9WqGO1pP404"
- +"HuXSzL2Nc6muLjmTj6UqULh003sJJVUEukCBrd8PMwAFMiXte1o6KjPMnK2ZLyNE"
- +"ZPDPieA7FsGHN0ev241sJpUpNW/Cut34sSG9oNmBhco121BeDH1M1/G5EpDbHMQl"
- +"kdCGd+ZwCiN/NPeaNl7bG0XZVJ0QlqpiKkFg8sXc/AaLfQydVD+FcSu7UFuugSe+"
- +"fKpsJX6WDxcZZa4RpC1xTWsmGm6nDC61UJCjpbCa9ePHwJcrxQ118mFq5P9YLvpI"
- +"JfBnnSjK6T8DElh/0HkLnXEbB7njv+Rk8s0CAwEAAaOBmjCBlzAOBgNVHQ8BAf8E"
- +"BAMCBaAwCQYDVR0TBAIwADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw"
- +"HQYDVR0OBBYEFAuHTH2F/ZxklfxrFtIvi7d0b2KmMB8GA1UdIwQYMBaAFK19p1bT"
- +"BO7kTcnWYRrqrPz+1j2HMBsGA1UdEQQUMBKCEGFtcXAuZXhhbXBsZS5jb20wDQYJ"
- +"KoZIhvcNAQEFBQADggEBAMgMqw8OLBIcnsroUPmxPhzKVaSZng1xgbd9t/IIjkj/"
- +"EBCqzU/cclqr9S+HFCTCjLNp297tpH/1Fg5GjcaQFWLgHyN6lpoGpTDyWdZB0ngL"
- +"U1jbT2qdOLtA6fk0HiUBlqrfNJeWR9VRnKTNB9ljRVmlnXdfyH7no9/pTv7XLk3o"
- +"WwtkSR90LbN0QRXFmrRDWdTLi7gFrAyj6A8DgwyxhaOxnUaqtbMl1uwRDM9gwHuN"
- +"iPCobMXyApMT9BpTI/Gx7yFXdbkvrCidlytDB8ZRhSfjg6pNcaHRTDxUvEq7DOV0"
- +"4agqVIjgYjueBjkxtr/ftJm5k/Kijss1CzYWCnc0c9oABVguNTA5AAAD0zCCA88w"
- +"ggK3oAMCAQICAQYwDQYJKoZIhvcNAQEFBQAwdDETMBEGCgmSJomT8ixkARkWA29y"
- +"ZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEX"
- +"MBUGA1UECwwOU2ltcGxlIFJvb3QgQ0ExFzAVBgNVBAMMDlNpbXBsZSBSb290IENB"
- +"MB4XDTE0MDkwMjExMTgxN1oXDTI0MDkwMTExMTgxN1owejETMBEGCgmSJomT8ixk"
- +"ARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxl"
- +"IEluYzEaMBgGA1UECwwRU2ltcGxlIFNpZ25pbmcgQ0ExGjAYBgNVBAMMEVNpbXBs"
- +"ZSBTaWduaW5nIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62nW"
- +"a9VvAA/A5o84lwdFLLTl5yBIy/u0G1ng5aYF+TKeMvPolfr8WiPMd5KNSHyrFWuU"
- +"IHv1tDuL1QReH+gm7PSwc1M5UnliUj3RqloZ9JwS6yIJzG0piMuJPWw97qOM6mSJ"
- +"q0Ya7mOBghrnPudTFoyA0wMf1HrWmIBZOhru9tsiQZjsc2d1iZsgYwbyrwbALXrc"
- +"npxPX5F7YeFyRjoqkGM1tURoajqBRW4fdhgf+f9KkB5GzLH4q4LsIwtFsByTK5wx"
- +"qJYWxHfUqWuEujLQ2x0vzyntwtuw94pJJ3N71LQ4xpqU2H0goQRW4jSvlBpXJysD"
- +"MgaZ1BDzVXYzKQ1QmwIDAQABo2YwZDAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/"
- +"BAgwBgEB/wIBADAdBgNVHQ4EFgQUrX2nVtME7uRNydZhGuqs/P7WPYcwHwYDVR0j"
- +"BBgwFoAUWpliNfMupTQEz0td70FDAFy4vc0wDQYJKoZIhvcNAQEFBQADggEBABWJ"
- +"p/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/cfaKF89NqWvIBsZ22M9y5rcxkG39UdrwM"
- +"JRB025TVgX45IU0PY89SKXapQ/GLEu3CbULDnnJwO2Hr9QVKorMaw3h52T+VCMTk"
- +"mkyDna5demEuboXR7mut1qVdg2vx24XISnSBEfxulOS+MdokJCxxZmIWzasqwAbY"
- +"N3MPn3slpWSV5D8VZrE59wBpqw8HnwuHI0uPkHAeWcgwLZd+PeD6kuP3zwtsv/qP"
- +"D48mymChuoFyh282B7j3rmwjGazsa0KLkkS6sRWASdbq2NZG/44H8/V39aOM5RGt"
- +"lOS1VCN8arL9cjPCQCtHcAG+C//izulJLlMNMysvRmoUAA=="
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com
- // X509v3 Subject Alternative Name:
- // DNS:amqp1.example.com
- private static byte[] KEYSTORE_2 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l8mPAAAFATCCBP0wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6bP7B77bLs+focStL+3OxLuo6IqvAwjHc1hMv6ohPE5M73BwnOx8/b0k"
- +"Xk1UVdqcoFlk7a+BkrCkXlGqxCtqJ6+C4cwFxEWjD8hTTzq3zLv602hL9K+h5cdU"
- +"MYoKfDLyJbpK4RvlsFYm1k27yfzbLbQd4JOP9fCowBlp/Ybg73WTXBTbU4k4Bt8/"
- +"FWDGxz0b+Ov+wPfzsvdkpvnIYHP7/fhm3rFC/GVy7ua7+Y0hsQWJmoQ+7hQ4NGvr"
- +"Vmku9atTe9QtiDKqA6Ch3qxvJxD2Xn1d4RCyML0vQdA1enK2uJUkUjKx+fLKTA5Y"
- +"tK1SaPQNVmbqaXNmKlUNZBhr/4YeEry5e+Z1Nf3x8QqKdLOy31kefl99ErcSu3Lw"
- +"AHsbNQtfdvgmcEWxRuCqjLiqYXtZkYokeFz8K74T5cmailD2H53DyA7ufm6Ip+4E"
- +"pnmKLZO5D5yIzz+IfuR369Srhfb/c5w/1AenJPXxTWPfFiUZttidGe2+9lfz2334"
- +"ohVdfSfWJ5TjrO16DckE2c90XlAlwIgknpEDknvxnFjHQbgtOYNpc4OlodKyddbL"
- +"OEAoKz+D3Owcr3uxzSY0FTKpd3Ja5OTZaFpHag9j8NRIjv/JCif1sHKH/9ItQmsh"
- +"ZeMqAsjwggITdzQrnPiY+mAtiyS6iMFolt22OVve8Hx4jJbIR+IOwoys0nzU0b7W"
- +"FuTmUYpVJHY42k7avXLQc+CZyd6liE2PFW29Ljzwgxi797DlUoNTXTq8Buyb5fUU"
- +"MebK2c9U8ug+THX5G4BshrGsCA0xGle25TRZwY6Xw4iZ2ZRQon+IUEP9mf2W4l9t"
- +"rx3CcPXe2kWKNF2mw8Sek5FPaG2mG2QlbjiApIRYFY/ddfgvLlxxauv5jp7oAVuF"
- +"kFR24QVGdJ2/Z5zToCnbQ+G3mEdS2NraymSIOwpFv4peSrbZvDrk2YiNk2d8o+4N"
- +"r/ahYk0GWValDN7JfrxTLFUrgz1QCeGkyNu0oimTMm7N1062vjXWIQZk/X3wkh2x"
- +"TGc99Lypc/rsOyGrDlzC8h5/WmHYD0NJ30RWAunmLmuCBFjEkVMvBKy9h3k5GHHb"
- +"CF2c4Ce1C60JSnvrR3sggXPy0lU38Vto32oJyKMgi1RSRgrg1UymbHhBrp45GSfP"
- +"kNI1h8PvT/07RFhAi2YBo1dEyZiVU1q40A+nvV2Xoj4hnVGgfVREzlaDQBaiTSUO"
- +"498U8w9fbQBT17JdeYgJmlK7b2TdSvZ8kd9zjtPllu8WPA62GROJWvdqZEnsX3tX"
- +"cyVy8M46+WEIL+f0LJ5P3OoeJtXA970xKKeCXeGSy9/243Lf13VzV8078JtdeRww"
- +"hl87t9TtxqGL48yLBMKqvuGqul+BHPX0LEKYVS843d2ocg2cpI8SHhUD/PbAwmkU"
- +"Twe/lu/I15nAMjT3YVH/VxF0OmjBG4R0iZI3CUhkvc5ZlyiAgX9kDBOdurCUcduZ"
- +"mLyk45zAhSXXG+N4vsZbW98HhY3GqfZ5tvFK3mqrLliolbvwbyupc7jIkNoAP3YC"
- +"8J3pYkdr8t+6Pb98bAqv5RnJh4+C9C0GLh+kKxkaFM4ApBGgRXtTgdQljp9ys1az"
- +"nCRGC4lW9o8YMOneUahJ2SjMvgyFVz7ZBdrv+EHEDh2NvfOh5BtfHzfDjQJ0EEw8"
- +"8Ef6QpAYkeO+9Xr1iRkFPwAAAAIABVguNTA5AAAD8TCCA+0wggLVoAMCAQICAQQw"
- +"DQYJKoZIhvcNAQEFBQAwejETMBEGCgmSJomT8ixkARkWA29yZzEWMBQGCgmSJomT"
- +"8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEaMBgGA1UECwwRU2lt"
- +"cGxlIFNpZ25pbmcgQ0ExGjAYBgNVBAMMEVNpbXBsZSBTaWduaW5nIENBMB4XDTE0"
- +"MDkwMjExMjczM1oXDTE2MDkwMTExMjczM1owXDELMAkGA1UEBhMCVVMxEDAOBgNV"
- +"BAgMB3ByaXZhdGUxETAPBgNVBAcMCHByb3ZpbmNlMQ0wCwYDVQQKDARjaXR5MRkw"
- +"FwYDVQQDDBBhbXFwLmV4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A"
- +"MIIBCgKCAQEAzalzxbVIegmJmBD5ov50cLJkDFvbANHV+Q+Pl+il/v69l65tRjQk"
- +"tlBJZ+Kqs2AqQb0GY8Sh04Fp5AXY0SqWo8p+7cpeU8RUzE4XfH2vmbP/FojazYML"
- +"oTuxrH/yen25TteKSURinruCV0DvJWb9VGY26ZS1FVVzrp6u+2nQZcZtLQk+kOUm"
- +"l7NrNbvjWTWrlsl+5KY1GLjh2iUju/S0P0hKJlK/FOox4uy9iH/k/1BEE8EPQm5/"
- +"ZL9pRzvP0FooBdapjCm6GHBuF9m4q01ZQ9Cn55wwQiyIU7AwvDgJQPCk+6+Li1ho"
- +"3ixQ1U+c4vj7hqiKDpiu7o8CKzhT2V589wIDAQABo4GbMIGYMA4GA1UdDwEB/wQE"
- +"AwIFoDAJBgNVHRMEAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAd"
- +"BgNVHQ4EFgQUhSVc7tWTK2bhcAc0StBrR4lUezQwHwYDVR0jBBgwFoAUrX2nVtME"
- +"7uRNydZhGuqs/P7WPYcwHAYDVR0RBBUwE4IRYW1xcDEuZXhhbXBsZS5jb20wDQYJ"
- +"KoZIhvcNAQEFBQADggEBAM/BlBWw+5Y4jdq5kYLgczeEJNyNczhDROcbP2aSZIB6"
- +"1lsI6lBAzyRpZIySIbdm8+fX9WTp4+zHpcZCXMii/uVP5Eq+E44hNDBUWG1VQ8li"
- +"rW+SQqKst2dZN57C9GkbVV0s2+BMoVn+uc65YSYbP5M6rmVxTIA5xXTr2Kq5g6Kk"
- +"agldlZUfaQ6yKlzoRnWUGWYeWDtjJDfbSr2t80AeKLSUMlCL73MSflSRNyjo8wWg"
- +"7z+nyQVMu/jO7DsswzO90gilnSsbqvV2gbIhuiqE1Bk5X8BFuqgyAoNIj9Ig4UEv"
- +"b6/8IbVeg+3ydzQvqQftGBH7qK5HZcnxZuRBmBHjTeAABVguNTA5AAAD0zCCA88w"
- +"ggK3oAMCAQICAQYwDQYJKoZIhvcNAQEFBQAwdDETMBEGCgmSJomT8ixkARkWA29y"
- +"ZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEX"
- +"MBUGA1UECwwOU2ltcGxlIFJvb3QgQ0ExFzAVBgNVBAMMDlNpbXBsZSBSb290IENB"
- +"MB4XDTE0MDkwMjExMTgxN1oXDTI0MDkwMTExMTgxN1owejETMBEGCgmSJomT8ixk"
- +"ARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxl"
- +"IEluYzEaMBgGA1UECwwRU2ltcGxlIFNpZ25pbmcgQ0ExGjAYBgNVBAMMEVNpbXBs"
- +"ZSBTaWduaW5nIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62nW"
- +"a9VvAA/A5o84lwdFLLTl5yBIy/u0G1ng5aYF+TKeMvPolfr8WiPMd5KNSHyrFWuU"
- +"IHv1tDuL1QReH+gm7PSwc1M5UnliUj3RqloZ9JwS6yIJzG0piMuJPWw97qOM6mSJ"
- +"q0Ya7mOBghrnPudTFoyA0wMf1HrWmIBZOhru9tsiQZjsc2d1iZsgYwbyrwbALXrc"
- +"npxPX5F7YeFyRjoqkGM1tURoajqBRW4fdhgf+f9KkB5GzLH4q4LsIwtFsByTK5wx"
- +"qJYWxHfUqWuEujLQ2x0vzyntwtuw94pJJ3N71LQ4xpqU2H0goQRW4jSvlBpXJysD"
- +"MgaZ1BDzVXYzKQ1QmwIDAQABo2YwZDAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/"
- +"BAgwBgEB/wIBADAdBgNVHQ4EFgQUrX2nVtME7uRNydZhGuqs/P7WPYcwHwYDVR0j"
- +"BBgwFoAUWpliNfMupTQEz0td70FDAFy4vc0wDQYJKoZIhvcNAQEFBQADggEBABWJ"
- +"p/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/cfaKF89NqWvIBsZ22M9y5rcxkG39UdrwM"
- +"JRB025TVgX45IU0PY89SKXapQ/GLEu3CbULDnnJwO2Hr9QVKorMaw3h52T+VCMTk"
- +"mkyDna5demEuboXR7mut1qVdg2vx24XISnSBEfxulOS+MdokJCxxZmIWzasqwAbY"
- +"N3MPn3slpWSV5D8VZrE59wBpqw8HnwuHI0uPkHAeWcgwLZd+PeD6kuP3zwtsv/qP"
- +"D48mymChuoFyh282B7j3rmwjGazsa0KLkkS6sRWASdbq2NZG/44H8/V39aOM5RGt"
- +"lOS1VCN8arL9cjPCQCs/TOYuPh7fygTHDAeqoBJ70T98Iw=="
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com
- // X509v3 Subject Alternative Name:
- // DNS:amqp1.example.com, DNS:amqp2.example.com
- private static byte[] KEYSTORE_3 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l8tcAAAFAzCCBP8wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6+cDkIo+wYoKHcQlj0XPkJcrAjV3Gw9JGLQWgC2nF4EgcHUf/+642gag"
- +"Gy4OBlwXwxhLOtB0D2vEIdKoeD5npFwHbwbkE4uflQRmEMx0M2mlFsLf83Uzoiar"
- +"UgXoXvf6oJ4IrVLaHfKdrfnJQ5kRz3ege6kkRI4UecI1EXcdJNzrSfuJHorSEieW"
- +"trTMCTVwqdrQkz0GwRtcY0b1S4rbrUgysnkVGg+nmsME3ou+rela0J0JSN+KBdSn"
- +"3apebBe0t+Ru1/JaDp8cKeoACj8ibyTIUj/MOAJ2fmV7fHGenCLmRdz6mLrJ6QDK"
- +"zClc3KH+pJBZL79pyRr2qjRRNgnVVruoMBV2PZ3MFa3bsB4GLr/b2lBfyNVaudtJ"
- +"3UVW3KbeIULIWBLlI9OKD5IGUJmmJA+U+vFyMppdZ88TmNPieyRB5huxG5gu61pW"
- +"BnerxmKuj5ZZk+FG4K4albOZDs5Lf+zROyjeb/gouIQd80N1ksB8yPXQUfO/mLLo"
- +"1MsFYfNcGrZZ//vdtadjgiw4E0gJ+s9dKhZERKwJ4Aknb6NXaDBR8bGkqc1l2hpv"
- +"9jk0J2KWn9aDe96iz2BgWtwXfYBK0dnG9kmn+LlSDDTmGOe6APzZn8nu53sP/Oz7"
- +"HayxzM0hNi0hi7V/fWMemoakbs0bhHY6EWkBbzSdqdMYAECAGbfHD8xbnoqwUBTw"
- +"cUBw/lNlm69ls3iUhqXtPJpiVVSbJ0kEN9MYaiWzpmjwk6v/h2iWbo2ZOYh3PEPz"
- +"ZTcdPedlkfTbg5pF6ZI1pH7aK7ZLWgEUbQiIQUItg2oEA19njWiqx/Wc1Ay+TdD9"
- +"dtA5zTh/T/YuuS0NDMEmyaCPqEDj3NziZAEL3UfhtASkvXhMZwmS/dAzPHHfWD+T"
- +"tqXld6a7tSwK7jeypv5Ku7ujZd9MsCVRPkJFNYbC5f1GqBIBlwO0j7PRs6IUC+EJ"
- +"ZyTzsKjYVlSR/+Or67BlABDuPeVGIbjlWUTiERKLBgABCY7cvSEKS3qJWVDDBg3G"
- +"axkaen8ak7e8/QdxalQYcV8mopWu4Qed/SYTU0MzDL4jJlGPTGyPD1GCBWcjLkB7"
- +"CqgljrM5hlanqXFj/SM0urLNYzCWPUs6+lX13MPo4K9ZTU7RnPOtXWcxzD3NQvtb"
- +"7gkm3SCjklf0qA4fvwGoYnrVz+Bt+IDzJCjnESRRQd9SBeR5oyUrcYz6r3J+i1TD"
- +"ceIQ2ys9UC5qc5JIc4+CQpXkyWjWmH5Mtz5+fi7coDX3sC9AdD125A7GTLgqXFk4"
- +"FsLHeC//BCBga05tX3LV6CL+Rdr605hDNbA/mgrmqH4t1XjM/eMwi85bzNnmvHBP"
- +"0VU5JFVuukylh8XNYu/qJGg+NO537XmxLIEjkiNCbE2e0mvTCPnaWB3YiO556iY6"
- +"5nFxNQx1ECvFhSdHd3WpFke85wP3fYOVtV7wL0+SC2JFNmmuvcH32GIS/bAd+DmA"
- +"vLB+Xn5Y3PnzWgAix0ZCX4ZZhQ04aFiwlgGHz6C78PCPF5bFxTEbjmImqJNgsnAm"
- +"1ZetK5WFQ1yrj925Xpd4ZLY81UFSZzKb9D9W8P9rqHnq8KjyAxuieGJyaaw8KLSu"
- +"ButbjmrkSxz5voj73gTr4DawY8EeAUly0F6SxacEjETHGc0+91EGPeH/O+DmKBKn"
- +"48UHMsXZ7tAk7l5i+6U1eZDUAAAAAgAFWC41MDkAAAQEMIIEADCCAuigAwIBAgIB"
- +"BTANBgkqhkiG9w0BAQUFADB6MRMwEQYKCZImiZPyLGQBGRYDb3JnMRYwFAYKCZIm"
- +"iZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1wbGUgSW5jMRowGAYDVQQLDBFT"
- +"aW1wbGUgU2lnbmluZyBDQTEaMBgGA1UEAwwRU2ltcGxlIFNpZ25pbmcgQ0EwHhcN"
- +"MTQwOTAyMTEyODAwWhcNMTYwOTAxMTEyODAwWjBcMQswCQYDVQQGEwJVUzEQMA4G"
- +"A1UECAwHcHJpdmF0ZTERMA8GA1UEBwwIcHJvdmluY2UxDTALBgNVBAoMBGNpdHkx"
- +"GTAXBgNVBAMMEGFtcXAuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB"
- +"DwAwggEKAoIBAQC8jh2z6+cNfv+CoWtPI3FiJ6Bl/rwPpT05Lje25KrtZQ8TBXuf"
- +"k8gOB9zSTlFxWNGUV5FrR+tuqzNSHmx6OtwYgdxsoy4aJ7eSxfxjNG8rAdrngn66"
- +"3pkWBtdBCyQLbV2jo95FnfAyTv5i76RJHDKNc6+GHvQnd2Q7KbKvXLt9aOD96cCI"
- +"fveWW6ZvlzCn1JOVBzwssJbHbQWEvnDS2LVDzD0+f9wN+Mmtj+yZ1fEGaAZ6qMOv"
- +"/ub2Q9wi31WxLLt+Jp75uP/CQz/g7fCOFIJ/cE20KB0P746IgTssU3LVxJvVfPL5"
- +"Fl5WgbzIgw7kVHjyQBMhfz/rzFGLFT5Wfkh5AgMBAAGjga4wgaswDgYDVR0PAQH/"
- +"BAQDAgWgMAkGA1UdEwQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC"
- +"MB0GA1UdDgQWBBTD7xOXn59GJ/f45r1z4HjRmSXktjAfBgNVHSMEGDAWgBStfadW"
- +"0wTu5E3J1mEa6qz8/tY9hzAvBgNVHREEKDAmghFhbXFwMS5leGFtcGxlLmNvbYIR"
- +"YW1xcDIuZXhhbXBsZS5jb20wDQYJKoZIhvcNAQEFBQADggEBAE/AZ1hFZWDUtVV1"
- +"QIpFbIZY831sDxx+gfieGLWmLgKX6x6zEAWfQcri6eyrCw9bZKivoaqbboQ4Y92S"
- +"oW+S+ztdiQVWi6bEzTGJqRNXj/8Dbc0Eii8OT+o+a3iUZi96zdgDf4F/v04KLrX0"
- +"/fEGJ7i3v4Z3xJwW/mDxJ9ihykHJrEmheI7GFsM93XecgLtboxq7qvi1tDPyXaMv"
- +"a9IQ8ouEr8+vFRlsgVuOOqqdLKvwptyiYdJCK7sz2PDGmWFvX7VRCsB2tFiCLged"
- +"D974qkBH8iNh0UK/25uZfbIbX6K1ejOJmQQ5oB+yn54eNFBU+0cm6p+/uvP7Wiur"
- +"Bh2TiPsABVguNTA5AAAD0zCCA88wggK3oAMCAQICAQYwDQYJKoZIhvcNAQEFBQAw"
- +"dDETMBEGCgmSJomT8ixkARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTET"
- +"MBEGA1UECgwKU2ltcGxlIEluYzEXMBUGA1UECwwOU2ltcGxlIFJvb3QgQ0ExFzAV"
- +"BgNVBAMMDlNpbXBsZSBSb290IENBMB4XDTE0MDkwMjExMTgxN1oXDTI0MDkwMTEx"
- +"MTgxN1owejETMBEGCgmSJomT8ixkARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNp"
- +"bXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEaMBgGA1UECwwRU2ltcGxlIFNpZ25p"
- +"bmcgQ0ExGjAYBgNVBAMMEVNpbXBsZSBTaWduaW5nIENBMIIBIjANBgkqhkiG9w0B"
- +"AQEFAAOCAQ8AMIIBCgKCAQEA62nWa9VvAA/A5o84lwdFLLTl5yBIy/u0G1ng5aYF"
- +"+TKeMvPolfr8WiPMd5KNSHyrFWuUIHv1tDuL1QReH+gm7PSwc1M5UnliUj3RqloZ"
- +"9JwS6yIJzG0piMuJPWw97qOM6mSJq0Ya7mOBghrnPudTFoyA0wMf1HrWmIBZOhru"
- +"9tsiQZjsc2d1iZsgYwbyrwbALXrcnpxPX5F7YeFyRjoqkGM1tURoajqBRW4fdhgf"
- +"+f9KkB5GzLH4q4LsIwtFsByTK5wxqJYWxHfUqWuEujLQ2x0vzyntwtuw94pJJ3N7"
- +"1LQ4xpqU2H0goQRW4jSvlBpXJysDMgaZ1BDzVXYzKQ1QmwIDAQABo2YwZDAOBgNV"
- +"HQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUrX2nVtME"
- +"7uRNydZhGuqs/P7WPYcwHwYDVR0jBBgwFoAUWpliNfMupTQEz0td70FDAFy4vc0w"
- +"DQYJKoZIhvcNAQEFBQADggEBABWJp/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/cfaKF"
- +"89NqWvIBsZ22M9y5rcxkG39UdrwMJRB025TVgX45IU0PY89SKXapQ/GLEu3CbULD"
- +"nnJwO2Hr9QVKorMaw3h52T+VCMTkmkyDna5demEuboXR7mut1qVdg2vx24XISnSB"
- +"EfxulOS+MdokJCxxZmIWzasqwAbYN3MPn3slpWSV5D8VZrE59wBpqw8HnwuHI0uP"
- +"kHAeWcgwLZd+PeD6kuP3zwtsv/qPD48mymChuoFyh282B7j3rmwjGazsa0KLkkS6"
- +"sRWASdbq2NZG/44H8/V39aOM5RGtlOS1VCN8arL9cjPCQCvCXf4pd3xvKYuWrd8V"
- +"hGx16B8uYQ=="
- );
-
-
- // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com
- // X509v3 Subject Alternative Name:
- // DNS:amqp1.example.com, DNS:*.example.com
- private static byte[] KEYSTORE_4 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l80rAAAFAzCCBP8wDgYKKwYBBAEqAhEB"
- +"AQUABIIE61DeikCVpX4o8NE02fBn0FNrubcRZ2RkdGV2pyYXJBm+Sz+VdeFdhYwB"
- +"eEl9otrz/r+5k5RUrZDxVmRFXGGil2z6dOxMbJXdyF3d5/0vaiGEyHvtBvPPWaL3"
- +"4Q0JGMSemiXkrt8b50V1bwQTODYVE3nX/SifoAxhRofmDGRsTx/JG/cA5uthamna"
- +"WA573ZdaFaIhGQGB3JkoyyRclD2HBym02/U+ZfIZjOACF7sn7A+9361o9/YHwXoz"
- +"7GzyFwcjvoVataqOAG8YjlpvD3d51mSSqJJP1SCuzqcJUZgdh39rCpr121rdzYiU"
- +"ndPWTdGmJzvC8wJBaZr+9QsZHrcXFLb+Em4Wg08YIadFH56SrMQVj+El4kJgYBTH"
- +"l5ixK9Kq2rmJ45o+P69Ir3c/nI5zh5LuwCunSvw0adjnEsxmGv8+Q5Hqd/KvHC5k"
- +"UZKOHRUUCP0k49BRI58uJfKZNRvbzgNkIWBl//QU9Rsf1gZ0voWaOuNsKBV1TezX"
- +"J+h9zgtaJSrYHf7NNN6F4Q511MJO9vkgjsD/id4kX3rvdusxhS+4bm7lT+29oJPx"
- +"2pPngP2XS6IeCmOeFCFDwwFQjgR9gwBuwm6E/onv4dwBOBDAWvFvZThamnIhKe+b"
- +"yLyZacPk07AmERpWwSL2AJ40a5ZqPoLWfWotSSXsNFwQdnSmER2H5i/6YF9WIjjQ"
- +"j1JvqY7FtCmk3zC3d8FPg73XyM7Bx7ooGJcP9+lyQdq3TcDRaswmfiA+So74resa"
- +"VrFCEM18xgubTPKEKsd0GvBArUMwzvarzntJNYumQxv4AZ3yUXMAkq0ZvldLzcMQ"
- +"xmYsWrUvihm6+Q1eydACAQaAjapZSdB6rUn3cPM7adZbHZDN5tmNtlLIG43FmCkR"
- +"fsyXFRw9utcokv2fmcZ0xOt4OxKJ4g01faTcy60474+Zczk0P7mU9+8Cx72eorR3"
- +"Sp8DFfpeK0lIwc4QrtsZaq8LBvQsKcW/vqM5ghBog4ElUwUw81M0aDWFC89/2X8l"
- +"N5CslGibei0DixXO/iUIiAfgyX9jBPKKXZYGGyLPXWpiDK9LYNc864CI2a6J17aK"
- +"qEdnaymUGpbnjccFw5MKtqk1lWc7zy5UQuISZT2vkQ20fbpGF7ZgvXr+E/t1LQwL"
- +"DH/AROIjBfaNH89OM+4wUfzyZW4mazTZ5INcVRjoMA9jUnBPzLx/PvJUy0w2QV5D"
- +"wgs+V6kRJRhTIuHaO1nl2bPETnlje/phKKRrM7sCcXoSv+i/ssix3KO3ymUWI2/X"
- +"mprOBCDW9mECWslwe3ztjzmmw99KvprzEZxuQphJij02K+fxucgxTrSuOm/jf8Hr"
- +"Ev0qyCJWtxnrcMC9YJX8xG4RLBPBne5TEJzwinYZXxhNo/E08yTF32UVUC9DssYG"
- +"eRs9NuD4W3XeWmFnrdWEKK3fHg+BsBp3/IPu7PkL4WwpF7ud+qV26vgC0NaxIeHI"
- +"O8K3EXRRiNspnjgxuJn83fAQWreKjbi07qEuRZp7Wat/69AwjbAUj9P6fJsv0tuu"
- +"hkF9Kz3zdzaT5ttVCsdyYX94WQegQUjXr4uCx6qV+leYkbW+9BbQZrNopAxXpwjx"
- +"GeorNRPZmME4v76UMUbYd0KKtD2y6YctU+L+59AVKF8/OI0EkVzSp3iiIW9EsDJV"
- +"6vwom1DefcQqIDuBDJJkhBHBAAAAAgAFWC41MDkAAAQAMIID/DCCAuSgAwIBAgIB"
- +"BjANBgkqhkiG9w0BAQUFADB6MRMwEQYKCZImiZPyLGQBGRYDb3JnMRYwFAYKCZIm"
- +"iZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1wbGUgSW5jMRowGAYDVQQLDBFT"
- +"aW1wbGUgU2lnbmluZyBDQTEaMBgGA1UEAwwRU2ltcGxlIFNpZ25pbmcgQ0EwHhcN"
- +"MTQwOTAyMTEyODMyWhcNMTYwOTAxMTEyODMyWjBcMQswCQYDVQQGEwJVUzEQMA4G"
- +"A1UECAwHcHJpdmF0ZTERMA8GA1UEBwwIcHJvdmluY2UxDTALBgNVBAoMBGNpdHkx"
- +"GTAXBgNVBAMMEGFtcXAuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB"
- +"DwAwggEKAoIBAQDzQ7PhJWzhPegPznoYPVoNOT+WitfPJlGv3a34kF5uG8PYD2kM"
- +"OL+xKyu6QgmDxykw2GIYxaxg0HYYHYtmFTWqs7U9J+lOQUn/MYoXE4hwxGJwdKo1"
- +"afNKri6/dN4o0gRhT6WFfNKaTh4O45VTViy/Z7hEziaI2XZCdo+EupIU7LA8ZLFd"
- +"SMLku/cWx4VtXY3P3/lmOqhYRQC3IBuJL81K0XCa7tR27SL3S08czsa0loLsy4gt"
- +"Yniw6kwe/le+7rAx4hp5booW2G6pwPF8IF64f44WyiBUKzJVBvBdB08+fQEXEBxh"
- +"HkbPjD7YnkWUu3+kMwHrpnvaxZGg+DQWZ0IHAgMBAAGjgaowgacwDgYDVR0PAQH/"
- +"BAQDAgWgMAkGA1UdEwQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC"
- +"MB0GA1UdDgQWBBSkNCehfAeCHqFxdoBSySAH+l99QDAfBgNVHSMEGDAWgBStfadW"
- +"0wTu5E3J1mEa6qz8/tY9hzArBgNVHREEJDAighFhbXFwMS5leGFtcGxlLmNvbYIN"
- +"Ki5leGFtcGxlLmNvbTANBgkqhkiG9w0BAQUFAAOCAQEA41o2Ydl3xnqE7cDkXlWH"
- +"QlTG4zERT51019oPGo1NnOzutjUo3DH/vK5ff+9crOS0t+soULLq/bJj15IoC3PK"
- +"QkFXi4IUcSMjq0qprTtmym8tAZ6wKQ8q9GL4fsvi2JbC7eQXJCLIVlkCS9DqxQy2"
- +"nqf2iPO05Qt8cMEf51GrnSRFy0Pu+QNZiSYufqEL/k4DEU7fFzkJlSZSfqSBDYvr"
- +"5Ke2P8L6uJH4mhd0aWPDi4aC3Wd97GPhldYt06lAmGXhEj1uHqLiojLXgOq5fVS+"
- +"7HezhUZncSQwAaNV0y/FLaKlnu+BWKlB+txRR/eyYZS3F8dUSkUrUvYUGVlTQmm/"
- +"cwAFWC41MDkAAAPTMIIDzzCCAregAwIBAgIBBjANBgkqhkiG9w0BAQUFADB0MRMw"
- +"EQYKCZImiZPyLGQBGRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYD"
- +"VQQKDApTaW1wbGUgSW5jMRcwFQYDVQQLDA5TaW1wbGUgUm9vdCBDQTEXMBUGA1UE"
- +"AwwOU2ltcGxlIFJvb3QgQ0EwHhcNMTQwOTAyMTExODE3WhcNMjQwOTAxMTExODE3"
- +"WjB6MRMwEQYKCZImiZPyLGQBGRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxl"
- +"MRMwEQYDVQQKDApTaW1wbGUgSW5jMRowGAYDVQQLDBFTaW1wbGUgU2lnbmluZyBD"
- +"QTEaMBgGA1UEAwwRU2ltcGxlIFNpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUA"
- +"A4IBDwAwggEKAoIBAQDradZr1W8AD8DmjziXB0UstOXnIEjL+7QbWeDlpgX5Mp4y"
- +"8+iV+vxaI8x3ko1IfKsVa5Qge/W0O4vVBF4f6Cbs9LBzUzlSeWJSPdGqWhn0nBLr"
- +"IgnMbSmIy4k9bD3uo4zqZImrRhruY4GCGuc+51MWjIDTAx/UetaYgFk6Gu722yJB"
- +"mOxzZ3WJmyBjBvKvBsAtetyenE9fkXth4XJGOiqQYzW1RGhqOoFFbh92GB/5/0qQ"
- +"HkbMsfirguwjC0WwHJMrnDGolhbEd9Spa4S6MtDbHS/PKe3C27D3ikknc3vUtDjG"
- +"mpTYfSChBFbiNK+UGlcnKwMyBpnUEPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB"
- +"/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J"
- +"1mEa6qz8/tY9hzAfBgNVHSMEGDAWgBRamWI18y6lNATPS13vQUMAXLi9zTANBgkq"
- +"hkiG9w0BAQUFAAOCAQEAFYmn/VQfFk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa"
- +"8gGxnbYz3LmtzGQbf1R2vAwlEHTblNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7"
- +"Yev1BUqisxrDeHnZP5UIxOSaTIOdrl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U"
- +"5L4x2iQkLHFmYhbNqyrABtg3cw+feyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5Z"
- +"yDAtl3494PqS4/fPC2y/+o8PjybKYKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ"
- +"1urY1kb/jgfz9Xf1o4zlEa2U5LVUI3xqsv1yM8JAK5mCNuauka9csZWHFYKP0W/Q"
- +"vx7F"
- );
-
-
- // Subject: C=US, ST=private, L=province, O=city, CN=*.example.com
- // X509v3 Subject Alternative Name:
- // DNS:amqp1.example.net, DNS:*.org
- private static byte[] KEYSTORE_5 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l87/AAAFAjCCBP4wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6gOUc8kP6zRRbndvTajWGz4qluUI2KftA4cCyrLFMMjUN3NzDsATlG13"
- +"ONTxuPkgRwcUX2ilHnCoSyC2lS+WIeiIOclXF2hRLcJsFh2tF+f/f2fndvHPhzJR"
- +"hwf+32Ic6YXJt9b2daMM7tnWb73hvcJIHMMH48+fJFpBSdVzA+n7s1vVcjSnXuzc"
- +"nSUz8LIxg3MKXR8A2RQw6CgE9+BfJg77DNbTTr4bGSoMN6+I98rjTBzQHiPBLrtl"
- +"+DJSlBUa91681uI+Lq1NXD7EVzr1t5RGwnCo3efxs/7jWrZ02ZSMLIbt1RwMNt2H"
- +"c7/taIIoTpbQcHVbZcf3KHrfkeI7hHVvNdp+mPdczRXdK7jHzvm/RK1VS43QwqHw"
- +"POOMugeyfqzUkdrdB3JiwYKH4RsQOwOO7CAswxSeQ32SU3IVXNvpJSHdtanyOjNR"
- +"TcFCQEP/gs/uNh3NMIiKRBgKJOvPZ3wQem6rPkTBVky36291ai5Wb9/++B5R9Djm"
- +"iZO95chm0yKe+yOEknFxSGiIVVAKLcIE5mgrD3V7rjx2JW5pWnYD8uvShGLqm3XN"
- +"a8Yq/YpTtdkUh5So38GfILu5LdzprUtls/gEtLx6Nh+xR5kfosWkLNURTCTzxrHt"
- +"zalnPqgIIkS/WR9WBuGMi/Y2Wk+7D1QI44rOloJvvfhydmh77Fds/G4X+rdFKZtd"
- +"zX7/SLvuZwJTlnNGjyHg7b7y88tlPB4EgUf+E0nSNJKT2RsdkT029/GWxC92dM8X"
- +"ycAXuzOKn9xN2jSpo7q/vRoqhxS0TLvAKmorEwlT/GMzMJBmlVRLyFSqXGky0d5L"
- +"J0W2PR63e2lLkc4GxeeW7tze+VktcIhjOCyg9N/w5eUHZRgHBXbeCWEviPKwvLJQ"
- +"XW0jUYlaeCULsVu18ZAyJ0bVRTxITUwM4WYoBIsqpCOoiAfxRK+wYNFRA1h5Oul3"
- +"ydflUkC0qS+Gui6el8Y/n4rzfhXxCdtUv51SBhudoM2Nl+0Wg3BG8BMBTNV+kHIA"
- +"YVLNyexOgmSF3LMOwYzfKbEDQ7K+dd3i1+THY7Of1K63yDDVSgPKDxaQp/GICcGJ"
- +"v92NXF2K1ih70KAEosHmbis3HQPQFHObNFaOdjgHZERyUq3uHmJqXL1AgDg3vaTh"
- +"evDfTxVPNV9nh8mvGKqvBT5fwEuCvNxLRE3P2MBn7W4QsrqBTf37XMFyiRT6KnGI"
- +"1RF4Gp2M5OUNRI9UiP5/TkANSdMWNY0xdNdc2TqHLmcRUlE0Om/ZEPps+3WWwfxF"
- +"qInzYj4KueMzflsZD8E02cQF+1rAxpjXSef1PD0wochJJPdXzxryNKQOA/84GC3Z"
- +"d/O65CmH1DUktV4xDejp8hh2VdlwCX/nbgsKj0Kkw88Dpcz51qX6kxcpj4W1bcFH"
- +"Y5cvFd4x6RmBsnuTJElCnyYiw3Slqua1IGJW0AKAdVtG0ZsaUkpe+6ArDlTW6eCq"
- +"GoQGMHojivwg9ixax8C58YPrL96UZv8lAnpppvptz4v4UHA6hZeEuSzdez9NX16+"
- +"/gj8C0vLpoc5eryAlB9o2hG1g1Zjz/cI/N1iDCkjPU9XUYURLIzdqFDqCUPJ/WpZ"
- +"9k4IK80RuIgJYeOKObK8Wm4lxJ0x1idI/RcCruIuwORD2Ojn4R0sWmvjYbZwJCaV"
- +"xFq+p2TRuvW3x+VUuM+Pu1oAAAACAAVYLjUwOQAAA/UwggPxMIIC2aADAgECAgEH"
- +"MA0GCSqGSIb3DQEBBQUAMHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJ"
- +"k/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNp"
- +"bXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTAeFw0x"
- +"NDA5MDIxMTI5MTFaFw0xNjA5MDExMTI5MTFaMFkxCzAJBgNVBAYTAlVTMRAwDgYD"
- +"VQQIDAdwcml2YXRlMREwDwYDVQQHDAhwcm92aW5jZTENMAsGA1UECgwEY2l0eTEW"
- +"MBQGA1UEAwwNKi5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC"
- +"AQoCggEBAMnuNJw2UOzZpu8VQdoh17dcmaOKEsF9b5IodndfcIdTAZhMh46suCSX"
- +"80U4oGnayL9za3r9O8ZsSaoepqncCceLcQ9YyTuWeMjpRpYxd7l/8r5AaL+SstkN"
- +"0q7I0nCvwNFWxwAnLRyNdeWlQu6iraM2eGne5JSn0hXGTDPLgzQHTdZBobE70Ju5"
- +"IVRsSTAiQDggyDjniA+H2leRmneuDOSRyGyckTCcyLo2i700Yu85kE3RHB9yzQaR"
- +"obb25fPPzG3tQIIpbQYLZWaIPCK4ae23KNiJtOYWRfTAbW8506DFYZLjTk9pCbNW"
- +"NlBVX3daT3bUNbWe2h4c9L+wD61PQfkCAwEAAaOBojCBnzAOBgNVHQ8BAf8EBAMC"
- +"BaAwCQYDVR0TBAIwADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwHQYD"
- +"VR0OBBYEFMz+tCQvgir8HIApbpuFYn8pRE2RMB8GA1UdIwQYMBaAFK19p1bTBO7k"
- +"TcnWYRrqrPz+1j2HMCMGA1UdEQQcMBqCEWFtcXAxLmV4YW1wbGUubmV0ggUqLm9y"
- +"ZzANBgkqhkiG9w0BAQUFAAOCAQEAlHjepIFUXNQDU7GIFdOZJl6kinoSMlGx9SsY"
- +"PGaC9dieGcG5VkB+l47hxYX51KyuqjiyirtJbbVfTgqcEiJaVRp0Kvq5u0W4fXaL"
- +"j0UD4IXOWp+NRYyDMf5Kr/09xtadq1lR1teuqOu++OYJ5CFcdYaBx3zaqrEReG25"
- +"2FeFYr/rlIWxqhmg2wpwfUI4P9FV+IO/jwBvpB8qFqnshFo4aV1G5vyp9fNbM5z2"
- +"+uuIebaMlj3R/zFwWeXVk1FxDaZL3Mdsu1YbIon4i0gK3Cn6BL36mW/Hz1+AerSE"
- +"BMuTenA/O/AM/mML257Td3woZpRdvqyHQpzkZLfc87h+lhC36wAFWC41MDkAAAPT"
- +"MIIDzzCCAregAwIBAgIBBjANBgkqhkiG9w0BAQUFADB0MRMwEQYKCZImiZPyLGQB"
- +"GRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1wbGUg"
- +"SW5jMRcwFQYDVQQLDA5TaW1wbGUgUm9vdCBDQTEXMBUGA1UEAwwOU2ltcGxlIFJv"
- +"b3QgQ0EwHhcNMTQwOTAyMTExODE3WhcNMjQwOTAxMTExODE3WjB6MRMwEQYKCZIm"
- +"iZPyLGQBGRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApT"
- +"aW1wbGUgSW5jMRowGAYDVQQLDBFTaW1wbGUgU2lnbmluZyBDQTEaMBgGA1UEAwwR"
- +"U2ltcGxlIFNpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB"
- +"AQDradZr1W8AD8DmjziXB0UstOXnIEjL+7QbWeDlpgX5Mp4y8+iV+vxaI8x3ko1I"
- +"fKsVa5Qge/W0O4vVBF4f6Cbs9LBzUzlSeWJSPdGqWhn0nBLrIgnMbSmIy4k9bD3u"
- +"o4zqZImrRhruY4GCGuc+51MWjIDTAx/UetaYgFk6Gu722yJBmOxzZ3WJmyBjBvKv"
- +"BsAtetyenE9fkXth4XJGOiqQYzW1RGhqOoFFbh92GB/5/0qQHkbMsfirguwjC0Ww"
- +"HJMrnDGolhbEd9Spa4S6MtDbHS/PKe3C27D3ikknc3vUtDjGmpTYfSChBFbiNK+U"
- +"GlcnKwMyBpnUEPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB/wQEAwIBBjASBgNV"
- +"HRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J1mEa6qz8/tY9hzAf"
- +"BgNVHSMEGDAWgBRamWI18y6lNATPS13vQUMAXLi9zTANBgkqhkiG9w0BAQUFAAOC"
- +"AQEAFYmn/VQfFk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGxnbYz3LmtzGQb"
- +"f1R2vAwlEHTblNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1BUqisxrDeHnZ"
- +"P5UIxOSaTIOdrl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x2iQkLHFmYhbN"
- +"qyrABtg3cw+feyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAtl3494PqS4/fP"
- +"C2y/+o8PjybKYKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY1kb/jgfz9Xf1"
- +"o4zlEa2U5LVUI3xqsv1yM8JAK9xE2TT/3My6zv50mEYVm+Q9Or2m"
- );
-
-
- // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com
- // X509v3 Subject Alternative Name:
- // DNS:*
- private static byte[] KEYSTORE_6 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg6+zQqAAAFAjCCBP4wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6jRPeljruu54AV3tCXcgQtCkk1iLW44cv8PNY1s47/SKLBsR76vD2lkX"
- +"6H0C/IDmFFKu91BAJnuSycOp6fj86K05nrgG1zfGHq/fP7nGrHIb13fAx7ODZeMB"
- +"jHtPlvnz7rXJGw/GPvGi4W0Evr55xFY86VA2Hz3dv3FNL58wP6HEnQfY4UNQywX5"
- +"DwvA0Fmxbfoy11bGuk/370HgQFl3P1MA/HTpVB/rhfrA3gKDKVV3Zy5CIBRR7HrZ"
- +"O/dnetk/zomcKMty0bftEeJowK42KTsR7OYKMSHX78VvHrYFwnniqgVxjj+gvVo7"
- +"cvnezd5wZcdaIDM9GWUs8YKKMEs6dLJLTduQ5dAXj0bi4d36qkS7l05niB2iglu/"
- +"69EsMEDtNiWp8Gxr0jjlkVDCINuBp8LQGW3cs6MR9ZJydW22W02rlzaieJPjNkDN"
- +"QC7tSw2HksIa/5oMHkKWVRcmECruGTNXQ3dpzWPJ83unIoCewQiiCH3FGUJziXdA"
- +"Dm4amDPrkVQ55GGgHmBmAzGC9oH8Papg0K48B0J+teFbLvBGW4vIe0PYae1Vzh3T"
- +"rOscPI1gHrck6JTjqy+3Cipb0NATg3S1TuYJQbTM4D8eo3pcUmhhqqShtyKQaGb5"
- +"L1DQ6bwWmVa0B6ufmjTiWNC+kszvu5KZxhJ0u6lJakmz+y2X3xude4GXFvJb2hMm"
- +"TfWq+GCoIaOTEw8zKRCHvi3P7AEEltpN6xaruVaaYVahJ65YHAuidPYPT+j/tueg"
- +"hY9ocaAswUCiaoFksnbX3mlrGfKhTkgPekYGHyialkGRb2XYtXaM33UrmIikqPyO"
- +"1sa/0IvIZzFs5QD0XY68z1vyqXA0wXY5h23x+R0sZo8kD8NxfuGFjrTZcga2hH0t"
- +"zqBzu+lU2a/CY3MJiERyDdRrRCYrD1R3iIAxLcgHlN5lGI5ULFwJohqXTOvq5VJx"
- +"kW528PFZSfU6P9dQkVovS1SBgwp51fYumC4N4vGfP6W5q5auHcQy8LO3Kxd1PSr9"
- +"X3cnwM662anc5QJR3o/xcCzFzNVg6IC3Rl4DNCeD7b3AdongrLLiDbqTtgmjA739"
- +"3S1lTt9ewaQyCoqQYpxv9nAB9PZ4dSDOk2GbQZsltcDoYkDdZQeuvgIdedUleevK"
- +"yHUjANzjuoBk5sbBfzFWil8JRUBZPHeRq+Cc0EAx+b5TaCCYFMrahVNwyGmi53Ih"
- +"aXUhiW2/rsvWDaHcfSgdBtc1sPnw2P41SKqfuus+aRQahMXEKUySjmKKe+hdrjNG"
- +"fH7xMHjo50hwAfbRkHpE3Ppqubo9VEWqJz2+6+T6cZhqP1UjW/hQP54iwBvwKOBG"
- +"fmG//lJeR+GARGV5Mk6wb41liHEuh+mFpzMT5m2pJr4f3sh+FSZnSLdXGsv8+xjf"
- +"jUK79P0+MsnzZIQaEI3c+kPXCH2UYE0P/xYpicx6Hv4Vs4az/qSpW7DXxGaGgzxH"
- +"slLr8xsKkqwu4eeklIg8NEN6/GKdvkEYcZGyZ9X9oAC2Q8iJRu/cA/lqOcCnxnb9"
- +"IKdizBszVw/fnDh0YdKTdGDdN2M8lzVcnG+xjYPH82EgH4lcQ72YcHPUdBlVP48G"
- +"YtqibjDQYp6gNhtVnoKWKnDPMH+Kzux3oYAh1jqlhYKAtiiCV+6RUZU9GHWRqmV+"
- +"odOwHMmH/Yu+lRusM6psnrUAAAACAAVYLjUwOQAAA+EwggPdMIICxaADAgECAgET"
- +"MA0GCSqGSIb3DQEBBQUAMHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJ"
- +"k/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNp"
- +"bXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTAeFw0x"
- +"NDA5MDMxMDA2NDhaFw0xNjA5MDIxMDA2NDhaMFwxCzAJBgNVBAYTAlVTMRAwDgYD"
- +"VQQIDAdwcml2YXRlMREwDwYDVQQHDAhwcm92aW5jZTENMAsGA1UECgwEY2l0eTEZ"
- +"MBcGA1UEAwwQYW1xcC5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP"
- +"ADCCAQoCggEBAPyKlDBlZeHrpFmkiOuLymtsDfyKc1d74tGZJT5d3Px8ULv5EceC"
- +"4KmKgFyp2UbeGqbRmpNfi9mD8FmawLosp+DsN2MP+9rmqiCi4TS6pGOqGGv3/1Vb"
- +"4l/j25jUyftRQ4ycz7NvBkfjgkvmQ71KVCr2c+M3aRwG/ftdxKD9m6LpM8iNcOX5"
- +"lzgayq0AqS9cNKGbXq3I8g3sU1BvyhopjTNKpQ8lEfH0ul4pIQ4RfDtH2y42271Z"
- +"1kN8e+UNytw73flQvwr5d0eHWkNxcbJwRIzecIlXZLQX59rStipBrskJhTNbO63W"
- +"qX/phiMlcpr+KusiPALmFvnxqsGLIBgKEqMCAwEAAaOBizCBiDAOBgNVHQ8BAf8E"
- +"BAMCBaAwCQYDVR0TBAIwADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw"
- +"HQYDVR0OBBYEFCST0LxFS2pcZDhBEBCk8DLwSg21MB8GA1UdIwQYMBaAFK19p1bT"
- +"BO7kTcnWYRrqrPz+1j2HMAwGA1UdEQQFMAOCASowDQYJKoZIhvcNAQEFBQADggEB"
- +"ANEr5tRN3cfPqwVsZGz3VMS25keTQjh3FV0K9O7StfecRGrDbOtqu4ybHvYDniJT"
- +"Co9DvSLD/5wVuiRyhgFasc0X4HG4wt1sjhwnqCWkkqsTGD2Z4DehO2LUD5D1GXJm"
- +"SxxH5rcT3vYCaTECkAJ0LOeV4HBAp1UCHdoS/qf6+eETm8Qd1bZGYHR1ZFp2EbZ8"
- +"laFH9MlY0E13FL4qoAABms2A59UvlR3MdPQFNlS79ABUHvpD726M5RL85CM9b7Tl"
- +"A9mHr3fryVeGLB3QYu008U2VndRhOWB/Wwj3G9/jV8k5tE4YH4/yh8vCoHrH5L8F"
- +"OyBBuZGfXrQOLNl/reDvTSEABVguNTA5AAAD0zCCA88wggK3oAMCAQICAQYwDQYJ"
- +"KoZIhvcNAQEFBQAwdDETMBEGCgmSJomT8ixkARkWA29yZzEWMBQGCgmSJomT8ixk"
- +"ARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEXMBUGA1UECwwOU2ltcGxl"
- +"IFJvb3QgQ0ExFzAVBgNVBAMMDlNpbXBsZSBSb290IENBMB4XDTE0MDkwMjExMTgx"
- +"N1oXDTI0MDkwMTExMTgxN1owejETMBEGCgmSJomT8ixkARkWA29yZzEWMBQGCgmS"
- +"JomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEaMBgGA1UECwwR"
- +"U2ltcGxlIFNpZ25pbmcgQ0ExGjAYBgNVBAMMEVNpbXBsZSBTaWduaW5nIENBMIIB"
- +"IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62nWa9VvAA/A5o84lwdFLLTl"
- +"5yBIy/u0G1ng5aYF+TKeMvPolfr8WiPMd5KNSHyrFWuUIHv1tDuL1QReH+gm7PSw"
- +"c1M5UnliUj3RqloZ9JwS6yIJzG0piMuJPWw97qOM6mSJq0Ya7mOBghrnPudTFoyA"
- +"0wMf1HrWmIBZOhru9tsiQZjsc2d1iZsgYwbyrwbALXrcnpxPX5F7YeFyRjoqkGM1"
- +"tURoajqBRW4fdhgf+f9KkB5GzLH4q4LsIwtFsByTK5wxqJYWxHfUqWuEujLQ2x0v"
- +"zyntwtuw94pJJ3N71LQ4xpqU2H0goQRW4jSvlBpXJysDMgaZ1BDzVXYzKQ1QmwID"
- +"AQABo2YwZDAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNV"
- +"HQ4EFgQUrX2nVtME7uRNydZhGuqs/P7WPYcwHwYDVR0jBBgwFoAUWpliNfMupTQE"
- +"z0td70FDAFy4vc0wDQYJKoZIhvcNAQEFBQADggEBABWJp/1UHxZOi5oFyRYc6jXh"
- +"qPTJpQW/Hf/cfaKF89NqWvIBsZ22M9y5rcxkG39UdrwMJRB025TVgX45IU0PY89S"
- +"KXapQ/GLEu3CbULDnnJwO2Hr9QVKorMaw3h52T+VCMTkmkyDna5demEuboXR7mut"
- +"1qVdg2vx24XISnSBEfxulOS+MdokJCxxZmIWzasqwAbYN3MPn3slpWSV5D8VZrE5"
- +"9wBpqw8HnwuHI0uPkHAeWcgwLZd+PeD6kuP3zwtsv/qPD48mymChuoFyh282B7j3"
- +"rmwjGazsa0KLkkS6sRWASdbq2NZG/44H8/V39aOM5RGtlOS1VCN8arL9cjPCQCs0"
- +"JJw3oAO8wr8AKRM7MuukYfesjw=="
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=*
- // X509v3 Subject Alternative Name:
- // DNS:amqp.example.org, DNS:amqp1.example.org, DNS:amqp2.example.org
- private static byte[] KEYSTORE_7 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg6/IKyAAAFAzCCBP8wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6xPeRrIQPV5WZeUis8cSobRcuNJs0or2dJXdHeWJ04IEqEIjryGaM0mk"
- +"FgGn6pqFWldORIxRUs7Wuv8BDrkZdQvruzON0NU+ZMw2jb0SxmgezuZN0P7GqFFh"
- +"T/VCdo/6ACPYE35oruu/04ll+cNuXRUpOnle8UJO255+6gANjc2UXvePw78zhx97"
- +"4l5Oly5iJv15vyS3og1bn7DbMewzATC/kIzp7sOx1jyxgrGGS5+NtSMomovEtZC3"
- +"qFgEipt7yjncalnhD6xI6wIyoAILhgbVmzrTV8z0PQptlMIF5RdH4z3kwePw5De5"
- +"nr3mKb2bY7L7MiyWoTDdi+Gjpq1gXhoqF670Gw2bX3E4ekn7XByhFvpeT15eJ/SE"
- +"t9MeLEx1hjxEsdNdEucca7hCLBLr/7Msq/w9jytYEtRUBp7i9vKtjNEuE9eiisNB"
- +"JdyISKuXwilyGkHvpjy5kySkJqgLLPPa0WXbveNuoyTD8n2eU59EeFiut3/F5Irn"
- +"bj8c8gKHvGQUDlN/RW/OVr5dxVoysG5PBqNVcPfrzDBoo6ZNa6l3C76AoarWsqv8"
- +"meMSuIGBdhWVFaOP8tgspyoHZOX5MmcNuLcipLxlU533+B5fv0YSdEtcIqUxFMl3"
- +"PFJJ4XD8O+6Gw1fR/zLckJgXtwsuKbtHjFYe48oueJ/KyD2XxOmgpjIEcMDXVysK"
- +"2+p39G0Y47voLE5/aNLQJsokr0wk/EVj9Ibdmib7R/j18lsiOy8pvX3s/wkNVw5o"
- +"RjEYDBe8FDY2TfvJvfBu/s7WNVflv5h5ersF8BX4EvZFyN9ysw2mb07OSYbn1rG8"
- +"piFZUIGcnY5xLu9/TEAVV8eTudDWcn1S68C1B7URl6dQiSQQJ616JWI6+6/ho8TF"
- +"e0yO653JzXBMd5jfNLh/8BnfBHtW++7vHNK+444/vgaS242F2uyK6YgkD5oMu9ja"
- +"ao2W9oYGby0ewa9Cda2ghE1HRPbSgMQDGtpDr0dRauBFN6v6SuYNidfN/eTe1R08"
- +"sU3ReUHCReJssF7xRwSpb3MMd4tdL171OtOyjkU6w3RK/6omnaP12PGz0yibqXiK"
- +"42nUPNnGJ3P+BDW5XQmzvrlLCD+HFrU0Xez+5O1P7Q2LwcLp7f4bd6gc172Poflb"
- +"hCnbrb7iWawAb7Hwb1+V4v27TRA/Ws2Og7QkqKR0C3oxaCCORZVCXuPgMvRW5Y89"
- +"T1MDgN0d0d5I7N13xHqMu5azd5L3cHVN/pDguSgMDdWvvkVBgVI8kNz+yfoxlGEb"
- +"pHMef8wEzXZZG0Jii/C23TpFHAcVxhBtfldfUr0oAJapEeBE1JsAt7RDR8s0UQ7b"
- +"C4okMSyfX6SkxSu/AutWnD4pwgYo2q1r0vlC/o/F52Kujv6eeCo1U9wY52BCFxYi"
- +"t9GpqXpobMc+FpzHlIBoA5Rmf1hJaEJJ2/63/Rijlfey9UWVYsV5iJM0jttAvFoJ"
- +"qMN6dPTs3dNzhOQbzY4gcR4JyoUnPP4KErxL3TSYcnBzz0p5Sdhc/epngTWUVGt/"
- +"LwCgmy6yIF9zgEuqQFn98sYnhngWds9SKqGH7Aw4bEtb0cBebaSjM3101kigQXSa"
- +"KKqR7J/qxdcJofcuphCTE89hCarKNL4dvTIRp77B1Yyuu3Q7+iFIBIiT5G1Yfzxd"
- +"E1gSwzSOik45UGjcs8OJddFZAAAAAgAFWC41MDkAAAQHMIIEAzCCAuugAwIBAgIB"
- +"FTANBgkqhkiG9w0BAQUFADB6MRMwEQYKCZImiZPyLGQBGRYDb3JnMRYwFAYKCZIm"
- +"iZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1wbGUgSW5jMRowGAYDVQQLDBFT"
- +"aW1wbGUgU2lnbmluZyBDQTEaMBgGA1UEAwwRU2ltcGxlIFNpZ25pbmcgQ0EwHhcN"
- +"MTQwOTAzMTAwODE1WhcNMTYwOTAyMTAwODE1WjBNMQswCQYDVQQGEwJVUzEQMA4G"
- +"A1UECAwHcHJpdmF0ZTERMA8GA1UEBwwIcHJvdmluY2UxDTALBgNVBAoMBGNpdHkx"
- +"CjAIBgNVBAMMASowggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzVrHe"
- +"Ue2+O512CXzSWcG9z8T3JK0xONLPnGznMsYVBlz0uhSDdexxL25QlTGlJYdr5RMj"
- +"hdMXAH8xChRezVtQ9nFyRjjD7/b8FODObHNXKoqNHX6gOre5WlonhLi7xyVwpn5p"
- +"3K450jjkjaKZnadbk3zxAad4PSogNWNwRxKCRm4AFcPNFpN40vav+IACDcF8XC/p"
- +"/OcJdCvUXBblG1nY03jACQL1zAwJlc0z3SMoZ1Zozsnp+BJz26oXJ5HN+j9QFts9"
- +"JPqrxHSeG2G0NQP+dEOIzPDZn2k3aEuqEs3NW3ply7vWb2gtdgXF/vItITOr5q9S"
- +"fXCfWN0nzYsFtIyFAgMBAAGjgcAwgb0wDgYDVR0PAQH/BAQDAgWgMAkGA1UdEwQC"
- +"MAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBRhDip3"
- +"fzplRpkR+VTdmjVH9qoPtDAfBgNVHSMEGDAWgBStfadW0wTu5E3J1mEa6qz8/tY9"
- +"hzBBBgNVHREEOjA4ghBhbXFwLmV4YW1wbGUub3JnghFhbXFwMS5leGFtcGxlLm9y"
- +"Z4IRYW1xcDIuZXhhbXBsZS5vcmcwDQYJKoZIhvcNAQEFBQADggEBAArwhCSAi6sS"
- +"EO93CbmWNvwfKla7QH2wIiXwLrP5Bia5C9YHpDrCR1S7e4Is0YhroIqx5WUR4KMR"
- +"Gwn4rKqihJy4c1nuKSbYyPnN1eiZ+uSNUoTEAFv6g0oGFfslR+F5x6xZdObW1POx"
- +"l7wvSQWHxEFdAmCPgxkR47EuuZD3m8vqv/K/vZg8a802SfE3mUmZF1t1Vj+80xC9"
- +"/YUirCFERJMiurbOAZ6irqv1bxPkZp2S5pgpD2hEU5NdY3XINTUKxkjv/Opr9eS6"
- +"6VVTLikPZaFBRenFY7ibr4wVi9BOYeQ9dUQwkxmT0vjwazRpvLb4fxJqvhl+Nrc1"
- +"DTLvkOrHRsgABVguNTA5AAAD0zCCA88wggK3oAMCAQICAQYwDQYJKoZIhvcNAQEF"
- +"BQAwdDETMBEGCgmSJomT8ixkARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNpbXBs"
- +"ZTETMBEGA1UECgwKU2ltcGxlIEluYzEXMBUGA1UECwwOU2ltcGxlIFJvb3QgQ0Ex"
- +"FzAVBgNVBAMMDlNpbXBsZSBSb290IENBMB4XDTE0MDkwMjExMTgxN1oXDTI0MDkw"
- +"MTExMTgxN1owejETMBEGCgmSJomT8ixkARkWA29yZzEWMBQGCgmSJomT8ixkARkW"
- +"BnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEaMBgGA1UECwwRU2ltcGxlIFNp"
- +"Z25pbmcgQ0ExGjAYBgNVBAMMEVNpbXBsZSBTaWduaW5nIENBMIIBIjANBgkqhkiG"
- +"9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62nWa9VvAA/A5o84lwdFLLTl5yBIy/u0G1ng"
- +"5aYF+TKeMvPolfr8WiPMd5KNSHyrFWuUIHv1tDuL1QReH+gm7PSwc1M5UnliUj3R"
- +"qloZ9JwS6yIJzG0piMuJPWw97qOM6mSJq0Ya7mOBghrnPudTFoyA0wMf1HrWmIBZ"
- +"Ohru9tsiQZjsc2d1iZsgYwbyrwbALXrcnpxPX5F7YeFyRjoqkGM1tURoajqBRW4f"
- +"dhgf+f9KkB5GzLH4q4LsIwtFsByTK5wxqJYWxHfUqWuEujLQ2x0vzyntwtuw94pJ"
- +"J3N71LQ4xpqU2H0goQRW4jSvlBpXJysDMgaZ1BDzVXYzKQ1QmwIDAQABo2YwZDAO"
- +"BgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUrX2n"
- +"VtME7uRNydZhGuqs/P7WPYcwHwYDVR0jBBgwFoAUWpliNfMupTQEz0td70FDAFy4"
- +"vc0wDQYJKoZIhvcNAQEFBQADggEBABWJp/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/c"
- +"faKF89NqWvIBsZ22M9y5rcxkG39UdrwMJRB025TVgX45IU0PY89SKXapQ/GLEu3C"
- +"bULDnnJwO2Hr9QVKorMaw3h52T+VCMTkmkyDna5demEuboXR7mut1qVdg2vx24XI"
- +"SnSBEfxulOS+MdokJCxxZmIWzasqwAbYN3MPn3slpWSV5D8VZrE59wBpqw8HnwuH"
- +"I0uPkHAeWcgwLZd+PeD6kuP3zwtsv/qPD48mymChuoFyh282B7j3rmwjGazsa0KL"
- +"kkS6sRWASdbq2NZG/44H8/V39aOM5RGtlOS1VCN8arL9cjPCQCtx4aFLK6xAD0Uj"
- +"jQ15cQCSY9N44A=="
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=*
- // X509v3 Subject Alternative Name:
- // DNS:amqp.example.org, DNS:example.org
- private static byte[] KEYSTORE_8 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg6/PpoAAAFAjCCBP4wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6vr3QPQOVRlUDdw7s/OhTAL9KGNH+qX2s1QAv2T8Uu8OSn1tdmZG1FO+"
- +"VJP1/lrx9RkyoM7ObMZ29Ic4LR4A5n/qMPPRNUG2gtcGJGZGBULCQlvfX2TCR58h"
- +"rvopvvXPRsxPaHkhwBu7Yt4MCTem7nYOBFcSkE0TkYIqHizBbiQQ5mBZvdXo8olZ"
- +"L4KuH9Eeueemvp7hXTRnDezUOwxldRIb4JP2/faoQ7KT1SSM/dNnQu3obNeZa5w0"
- +"a/EGtjArvg1FaTEDWByxCQcpSzen84bH8+/n4OV9EtHpkv5rZnsGP0H6kLd+WFCI"
- +"/pwEz9FU+vbsXyEBVoF+8n+HA6AS+dm5BYcoyojx7ywlyLF1H3YzSznewhXIbEKe"
- +"fgMIbGtj1DtSvbbgrFBKOmbSH69hDjfM1vOS8QA09nQTFBWNPuE5yZwzhAkRGXPC"
- +"TGmh2h0/BCODs9ipPSkImzWnD2nDo2gWGd4VuG+skyvuRGB4CPSdKWCKHpJcc4P+"
- +"uUSqmAAAW61A0cvBlON4hg0joM0cmPwvVtC5uyXQCcHcXDCEz7FQs2NChBUDFqxx"
- +"3b7YW50tQthCu5UiD8eSYH/AZRM0D+EsF/3HXGKqsDnBXuxZvSrPidvhr9crsJR2"
- +"qYejWEgBl6WPm8o/wjqvhX6Dmq63EMc0bifTTbzYsI6MvQUVrIbNehINKo7dBtsD"
- +"xzKjXMmDD2ghrzHTZ1CWQ0QuVKnmYrcVodtybzcpu5TZrwh1oHR0JtGZEE5pTjKw"
- +"lv+IOG9FkHl7nihnZ4c34XaVDFgO5e0IKwOVXxvVcHEm72p2h7HkgLtGnz1PLJ7N"
- +"g10ToxiGO+V6ybQbvz+ikkGSGRKaTy5B9WuyFNW4lwJ8IU2xCYffTsZ3xQ6i+Kxe"
- +"+cFwavf6CsPyRsSXWyW/Q+Pi4gfmJ0E69/+zDjj9UTYJv54ge3d4mlmWJVlchqBL"
- +"0zjMfHBk+bpy0Ms6ztxVKLYMPigk9x81ufpUFupTvPA59hEct8jVsoT/RxRATSD4"
- +"AsSw6NlLlMh+Vf6cJpcUG0PI4lOWrEsOlGg19w/C9AayBLSGSeC2odAEscI+kS8h"
- +"VAHgXHSaQLjO8dvlfKMM8QEqXZ2gGp32lzj9II0CoZ9W8nGRMROT5hrs3NYRkZgo"
- +"2Wdcj4e0eCQVUFK6oWqceAwKKl711Tlnd8lEPcxNj3bfl3WzI18E7boxnU2FcVHS"
- +"uvjdSKI4lJUeObZzY8wsusf/UdOjOp2Budl2oLRFzeYiz72OezTv8kc9coE5bZOU"
- +"HG6UftmD9u7jBmyL5wHlmHZ6VBo6qm2RGJIg7GnnZBUrKQ+zD9eOfuqcELtRQLAG"
- +"QXN4u5qLkp+i80H9Fag37a0y2Rug9kQU7A9+PijLXPAjOz03bzNozlpuhenb6ZF6"
- +"gOJHZWdPfF9kYbpCW5BcPO2x3aiIQk+iycMR3gN8TXgepoe195aFvpa+4LadoRQt"
- +"+dLsAPSVVuiFbUTkXz3+p3+EdSmAGIofS6rzL8HQpAonp5/X8s29MPCPYfUJkgJe"
- +"6+Jkj/YhVwj/l5yQe0CYsqVki6OHWPL1aLFtIAzsPDIQSYcg9nCAx8wUR7N9fTpb"
- +"1JSMq/FypdVxA459dMGy1DlmmTaT8y3UlydtsPgVXps+OZEI55jpJeYGjokIr0yL"
- +"7Fobx8k4VhNVFhUtXhv2hFgAAAACAAVYLjUwOQAAA+4wggPqMIIC0qADAgECAgEW"
- +"MA0GCSqGSIb3DQEBBQUAMHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJ"
- +"k/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNp"
- +"bXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTAeFw0x"
- +"NDA5MDMxMDA4NDRaFw0xNjA5MDIxMDA4NDRaME0xCzAJBgNVBAYTAlVTMRAwDgYD"
- +"VQQIDAdwcml2YXRlMREwDwYDVQQHDAhwcm92aW5jZTENMAsGA1UECgwEY2l0eTEK"
- +"MAgGA1UEAwwBKjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMWdZ3aq"
- +"0PdVT8Bn6bPrPny+6ze9JQ5Zdi5+caLINsqkaj9R5p4gmSlae2qUEL9f+eTH9/fD"
- +"yFlfn5OngZyj3nJI53vMZXUr1SnMEnxQHQZsaX03KcsfHNFLsWIHUW74/YSOPb3w"
- +"Ta5N/ytIYCgblG2vRS3e96tL+V+q6kU05sDztD6b98iZXjfv2PSHJ9s9Ze+7fG6X"
- +"BVtskxbs/tk6lJ9obNsyYD9t7eLgUD+z15Op4RYGc3i9Uqec5L6HORWfjrB75X3Y"
- +"z91y4LNYAffTKFR6Uf9flBDwQaA8KRQ3YKeDWtPFmAryvAIA4AYW6s6prtE27MEL"
- +"dM7mi3vZ2Yw161cCAwEAAaOBpzCBpDAOBgNVHQ8BAf8EBAMCBaAwCQYDVR0TBAIw"
- +"ADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwHQYDVR0OBBYEFF0IKxaW"
- +"i7pEz+CjhUIQlt9lz4tLMB8GA1UdIwQYMBaAFK19p1bTBO7kTcnWYRrqrPz+1j2H"
- +"MCgGA1UdEQQhMB+CEGFtcXAuZXhhbXBsZS5vcmeCC2V4YW1wbGUub3JnMA0GCSqG"
- +"SIb3DQEBBQUAA4IBAQACSY2LX47W76FD2VhGkU/RmfLH+B04amTdeRZJbMBbyez8"
- +"0qLCZOHJm6Hf2LdNSlvROq6x7wUksjVoDVorp6Hw/kZQtw/dX7ohnjooE2iO3Q01"
- +"wyTrS7HuGLk8ip/jObSBLM6lxinvQqiZKB+i/55N28c0K3HhXyVztOnF9PLtoylg"
- +"RzVdx4JhHu1/8jCw99rIUh5bGB6mbF8RR1R1XiyVGuTPEZCRIClN8dkncwiVQFIh"
- +"IFb2M0NsIuHcl0GksQ1X2ApwDq3CvP9GO/Ic4Xyd1TDDvHc+rFc0+V8T07wo4AgC"
- +"tmks+yZWpwilvQT8oPdjtGG1g3oTG9U8QfHcBcd3AAVYLjUwOQAAA9MwggPPMIIC"
- +"t6ADAgECAgEGMA0GCSqGSIb3DQEBBQUAMHQxEzARBgoJkiaJk/IsZAEZFgNvcmcx"
- +"FjAUBgoJkiaJk/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxFzAV"
- +"BgNVBAsMDlNpbXBsZSBSb290IENBMRcwFQYDVQQDDA5TaW1wbGUgUm9vdCBDQTAe"
- +"Fw0xNDA5MDIxMTE4MTdaFw0yNDA5MDExMTE4MTdaMHoxEzARBgoJkiaJk/IsZAEZ"
- +"FgNvcmcxFjAUBgoJkiaJk/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJ"
- +"bmMxGjAYBgNVBAsMEVNpbXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUg"
- +"U2lnbmluZyBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOtp1mvV"
- +"bwAPwOaPOJcHRSy05ecgSMv7tBtZ4OWmBfkynjLz6JX6/FojzHeSjUh8qxVrlCB7"
- +"9bQ7i9UEXh/oJuz0sHNTOVJ5YlI90apaGfScEusiCcxtKYjLiT1sPe6jjOpkiatG"
- +"Gu5jgYIa5z7nUxaMgNMDH9R61piAWToa7vbbIkGY7HNndYmbIGMG8q8GwC163J6c"
- +"T1+Re2HhckY6KpBjNbVEaGo6gUVuH3YYH/n/SpAeRsyx+KuC7CMLRbAckyucMaiW"
- +"FsR31KlrhLoy0NsdL88p7cLbsPeKSSdze9S0OMaalNh9IKEEVuI0r5QaVycrAzIG"
- +"mdQQ81V2MykNUJsCAwEAAaNmMGQwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQI"
- +"MAYBAf8CAQAwHQYDVR0OBBYEFK19p1bTBO7kTcnWYRrqrPz+1j2HMB8GA1UdIwQY"
- +"MBaAFFqZYjXzLqU0BM9LXe9BQwBcuL3NMA0GCSqGSIb3DQEBBQUAA4IBAQAViaf9"
- +"VB8WTouaBckWHOo14aj0yaUFvx3/3H2ihfPTalryAbGdtjPcua3MZBt/VHa8DCUQ"
- +"dNuU1YF+OSFND2PPUil2qUPxixLtwm1Cw55ycDth6/UFSqKzGsN4edk/lQjE5JpM"
- +"g52uXXphLm6F0e5rrdalXYNr8duFyEp0gRH8bpTkvjHaJCQscWZiFs2rKsAG2Ddz"
- +"D597JaVkleQ/FWaxOfcAaasPB58LhyNLj5BwHlnIMC2Xfj3g+pLj988LbL/6jw+P"
- +"JspgobqBcodvNge4965sIxms7GtCi5JEurEVgEnW6tjWRv+OB/P1d/WjjOURrZTk"
- +"tVQjfGqy/XIzwkArUVeR0qcBd2hG0EwOWN/Sj4i5rM4="
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.org
- private static byte[] KEYSTORE_9 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l9Y0AAAFATCCBP0wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6ZHuMlKfegj23VzIn/Ld1KvgIk8ODWj6++FFAILf7T1fuoWRC/9yUIyR"
- +"yIJc8RMlz7zDn9TZci8kY6ECpnQJ4w9MZpGjgg5IQMui/a8ovtEqx11SUHRfQCGA"
- +"b1m9HJ8KHz015PAP12m9ZQOQXfIFZfbYuTA5yqVo98NBXVYEBQ5cw28RGUQ89Jpk"
- +"9HB4jNplmpbvK/huGldAWWR5QDiIFj0Mgq6IPHTnDCi7Hh+2ubfMUKO6iV4nJV4h"
- +"+JF0Cx6jdNmRP42yGXpaOeKahNSzAPUwyEUIDPZQE5nVuDtl8rZqOfCnQ7GYEAMF"
- +"EpccRHSD9RxvS3xDh8qxB5i63fpllE+yh+nVL+B0htkUNQu6ZAAl9hsE7b76xcGo"
- +"p62n0B7kzBrLC3cV5AcWu43x36g1YlyH8fX6gdIrvi4qjhOTQNcifQtFoLRG32No"
- +"0NEuuvBFWEDNZQHb94ahXiHnT4dIe/i2MLiQlVl+AFLgI1YK4H4lkDxw6E46X7+o"
- +"/NF2Zi+JxiHDEafetn6EuhXZ6gZQ0fr5GuZw9i+tYBDROUrU8XvtEe0/4lAyG3db"
- +"VPSAiaqgQWuEqrUI1xRMSENF/uA72BBl+pusKttIsYjMMrbp+8VRcidBRck/logJ"
- +"jUNK0K2H340vWuQAHIBJAjA1UzEDDz4wjwivvPMs1azps6kVNOESDO90fm0O++aN"
- +"reQadK9I5UouEtUEke+N/zteKz3ZRXPRqlYWCKfiSuRMorcQH5Bb4MyZhiTxWo1U"
- +"LlOJvM7JtO285cVGvUjQnb65dVvOeN8cYmkSnG/iDnCxjbNS38N241dvpzicuP+N"
- +"yZQeI8ZEfLWPSy5fWlxFcGkQV+4hZ5pwsMsAnZGBsKa6YWGWgOZVRWAx7AKUlNf5"
- +"e3LLkDaA5CBoKg3ferNWrHYm7Rd7WSSkD8sZ/1mgxZh5rAc86x+zBuq5KpRszRLe"
- +"DH5Y3hZYpM0cCIy2IUmFmXMGh6zUc6/oxrT5lSkkMyrfjjT8uPLOSYpRfEo24GPM"
- +"4TwIbLVku2olw5jmxSjvhxwRcH+85vgaSW71JSxhsS9QCbuRsUVybzhYRaq41SPr"
- +"C4xbVCIM0kZvaIsXJ4PZUv2cyle0mrwiPJ/Zy1Ly6IUyNJjAex4TKMwurVFnarb0"
- +"fLjtxprmYtWJ2Yi3efklYet0u6OZZq6z0d+pnhLF32GAc1l+W8kc/BIbKSzgR/f8"
- +"REvcu/wmfrrAOvzYWXMarC+szEvLPTjyFIoX0cNob5vF10bMFgCp1bO5hi3rtwDI"
- +"Itkr0Xz+c6JqJdG5ivGUzjxU1SPffLUMz3S3NIN0Qhu/LhlSUvugoQCq3a6jGCS9"
- +"1IOXMqHP6CeVpPq5+9LaFkBPY0lO4QfP1kHIz1wBn/SqaxZMzcp9nqINiWBzbZb+"
- +"dz6He7sWe0EEiBtLV8HdF5E2awtT/gsgM+xUXI6FKWHTOcsEbhLMVuzCPwHEGsAo"
- +"6Mje2SEsOAsEJf7Juw3+T5DhIBNu+vcgP/D1wp+Ww0Iiq8dgbNMyF1dmXLskSM4S"
- +"z7XU7EeWQSNUiShJwQJmJGTJRcQwyveBbSbwv2daJ6eoummLXxIrW9WTJX5V7/n+"
- +"QdVefD1hqFuXNCmhUAlj2L+eoh+qM4gLbuGZl/vWu9TOUew/VF8IPxA8LMdKUCoz"
- +"bT4ONT4j8hCM9uAKjL/oIAAAAAIABVguNTA5AAAD0TCCA80wggK1oAMCAQICAQww"
- +"DQYJKoZIhvcNAQEFBQAwejETMBEGCgmSJomT8ixkARkWA29yZzEWMBQGCgmSJomT"
- +"8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEaMBgGA1UECwwRU2lt"
- +"cGxlIFNpZ25pbmcgQ0ExGjAYBgNVBAMMEVNpbXBsZSBTaWduaW5nIENBMB4XDTE0"
- +"MDkwMjEzMDcyMloXDTE2MDkwMTEzMDcyMlowXDELMAkGA1UEBhMCVVMxEDAOBgNV"
- +"BAgMB3ByaXZhdGUxETAPBgNVBAcMCHByb3ZpbmNlMQ0wCwYDVQQKDARjaXR5MRkw"
- +"FwYDVQQDDBBhbXFwLmV4YW1wbGUub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A"
- +"MIIBCgKCAQEAuqOsmdIrogDvqdC5ImLolv1lb/Hs34RbYrvT/leMyCIYahFuY18f"
- +"lExqquZyrtAAYq/cFuDUpHu2xV9dFhs62WWEFGzRwC3hgfQNWh/XageDAYsWwjey"
- +"IQb0y+18wBbIGvDW394SLxpDyyhCjTXFIywiazXv74S6M3u3durPVzQbj+k2gXKS"
- +"aKo0lPncCNAB4Bpf80w1oUe4n3Pv6n6NgoQx4q5mVJrNyePyMBG45k8PeRPRnJnX"
- +"qaQ5jtoZEDZMCw0WH+t2faFKSAcjCW6FZ+MH8CSr+C3Hh77bp7bNSkbdeKNSvZGW"
- +"p7IcE7fe/WxGM2Y9k5gTiNiTvhqjfnpH8QIDAQABo3wwejAOBgNVHQ8BAf8EBAMC"
- +"BaAwCQYDVR0TBAIwADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwHQYD"
- +"VR0OBBYEFMtvlzEh/s0B0hCUwlg/eeKu9HcEMB8GA1UdIwQYMBaAFK19p1bTBO7k"
- +"TcnWYRrqrPz+1j2HMA0GCSqGSIb3DQEBBQUAA4IBAQB64he0kg20qXrEqUaWcDMa"
- +"s5fshQqpZN6nRyil3jgYCP/f/g2T16A6k6GFL+3l5I9+kwlpLWpX7TlqiWykx4tD"
- +"vxkKQacN990enqvvRo1lzuzDmY46iSwlv2sJq3GPNVcXeBNlYsHHopsFn/ITYKYH"
- +"VJHpa4+4noQilXQZs1L9ozB8W7YjWk0ZfLBK+RDzXfb0wZxztVGpod8aEQjYFsf2"
- +"TfeP8PS2SUsNECWXAh2vSxKF6mQtsGurWO9ot7SNEkEh585n4VbZmbJcqYkvNlpF"
- +"AqVbiv3Dz7X8/lBvultf8a4jZjmUP/6j7MEdcu1AADU5CV9h6uPQGF0oqppsxmlU"
- +"AAVYLjUwOQAAA9MwggPPMIICt6ADAgECAgEGMA0GCSqGSIb3DQEBBQUAMHQxEzAR"
- +"BgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJk/IsZAEZFgZzaW1wbGUxEzARBgNV"
- +"BAoMClNpbXBsZSBJbmMxFzAVBgNVBAsMDlNpbXBsZSBSb290IENBMRcwFQYDVQQD"
- +"DA5TaW1wbGUgUm9vdCBDQTAeFw0xNDA5MDIxMTE4MTdaFw0yNDA5MDExMTE4MTda"
- +"MHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJk/IsZAEZFgZzaW1wbGUx"
- +"EzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNpbXBsZSBTaWduaW5nIENB"
- +"MRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTCCASIwDQYJKoZIhvcNAQEBBQAD"
- +"ggEPADCCAQoCggEBAOtp1mvVbwAPwOaPOJcHRSy05ecgSMv7tBtZ4OWmBfkynjLz"
- +"6JX6/FojzHeSjUh8qxVrlCB79bQ7i9UEXh/oJuz0sHNTOVJ5YlI90apaGfScEusi"
- +"CcxtKYjLiT1sPe6jjOpkiatGGu5jgYIa5z7nUxaMgNMDH9R61piAWToa7vbbIkGY"
- +"7HNndYmbIGMG8q8GwC163J6cT1+Re2HhckY6KpBjNbVEaGo6gUVuH3YYH/n/SpAe"
- +"Rsyx+KuC7CMLRbAckyucMaiWFsR31KlrhLoy0NsdL88p7cLbsPeKSSdze9S0OMaa"
- +"lNh9IKEEVuI0r5QaVycrAzIGmdQQ81V2MykNUJsCAwEAAaNmMGQwDgYDVR0PAQH/"
- +"BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFK19p1bTBO7kTcnW"
- +"YRrqrPz+1j2HMB8GA1UdIwQYMBaAFFqZYjXzLqU0BM9LXe9BQwBcuL3NMA0GCSqG"
- +"SIb3DQEBBQUAA4IBAQAViaf9VB8WTouaBckWHOo14aj0yaUFvx3/3H2ihfPTalry"
- +"AbGdtjPcua3MZBt/VHa8DCUQdNuU1YF+OSFND2PPUil2qUPxixLtwm1Cw55ycDth"
- +"6/UFSqKzGsN4edk/lQjE5JpMg52uXXphLm6F0e5rrdalXYNr8duFyEp0gRH8bpTk"
- +"vjHaJCQscWZiFs2rKsAG2DdzD597JaVkleQ/FWaxOfcAaasPB58LhyNLj5BwHlnI"
- +"MC2Xfj3g+pLj988LbL/6jw+PJspgobqBcodvNge4965sIxms7GtCi5JEurEVgEnW"
- +"6tjWRv+OB/P1d/WjjOURrZTktVQjfGqy/XIzwkArZq9d5Dleg7IfF4il2Y2B3ACA"
- +"xAU="
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=*.example.org
- private static byte[] KEYSTORE_10 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l9f2AAAFAjCCBP4wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6l7GDh04s5YLo4/+WM3II4qELbDv4C/LVCeTsUus2xYUkKLG4Ys8AwAa"
- +"PTQw2A8a/Rr4gn+ocx9V+xwXaG5Zf+Lp7jJ2zLR43LH1PxrPs1dN0jz1Ucz9f5Jr"
- +"QrfGKuWxuPuf8XCYJxuxHQThHkmz6ppTQtDkCgk3QmP77OY5a4aOP+fTbWHUPUKF"
- +"r01/rgkHSI1mHjBY5SJAX4ROaC208eLyNBW6KECkOp0pgkAjKU2doI+P4VUU54M1"
- +"VLQ9eeqTJHjzUVKQfkG4DhGPw9lpSLrtkVr/KheDYjR8sLzreVeyk+oU16WjFUKp"
- +"/DD/CZYsSGFvIwNdviFubiZfkK+DqYDj0IA3N5TlwtFyqBzWBL/f415OgQ8ScMMZ"
- +"bSTEu4sPtFtpzWBPyVZTRoxfGkhLwLWfRDAo8WnSxQGPtAg5A3GHjUYbxX2KhymC"
- +"UhoCL/t+qGCXCSei9j0ofuBvubeP/hInIxWeQ4XKMsaCIqsXaYqed2A0sLkZ/2nE"
- +"jtaJ0tqxW/JxNp6psOg9JgYFHv7e47B01vrVV7zkRyOyzVzTbFvhfZljHqxxBbFZ"
- +"StdjpwjiXvTGtRpcmV/u/Vah/dHm/V4hE3kIGV6aAJeHg/c1gSP6bv2BEESWj00L"
- +"f9icwObBPV9hfWrHPgNnzsKrD0qIrpQP8K3FPLA8qwWZjUT42vSHKSJGV9uaMNuk"
- +"uMRfHOEypI701PbBwk8Di4vbLSqhsi4RV/6vNop5lECGbYd1sFOfgDj5kMFUE0kn"
- +"MQ6UE3rctbvkfP6Kx1ZmQrW0QKtph105E1jpvAOqcVgI7zTgpcknj1+xUThdSAkx"
- +"M6TlmRnlv9N3iX04JshbpeEdwWnN8mtOfuGWubml8DWZbB/WNkH95TMPRXInZWpD"
- +"xJ0zEibHkqVMV3GR6NqmJRZ7BzkzfTV11cG5r9+wDXQMmgwOVmVUJQksXiKCyiRS"
- +"lMRfU9jh4RE2atmZWrQHRoPf+zmHuOa+Dhz1WTbdTBQGRuUlm4vwGmpSzqxjoD18"
- +"OsuJqoDBeEJCVJDetMvfiKCDtFWZunbxb/7iscR05c4DQxT3zBIEB43jOagE+BQp"
- +"tRkz+WcoH8X85S+VwRY0yM6xhgp2q0ymefxjU8KbNnTc5Rgb8sllV5cskuxpCCLl"
- +"uPTelnSdNeCfdL7zG4uWDf29BDI0hPpRhP29fejMn05rbNKNjnxnZGtAsW029U0P"
- +"wTcszt+3vSe+7ImDszBvir2kc4FJKgSKibMYEMOAhVGioWi5eDEk1Sj6CErG3lo/"
- +"DuKEm8O+BEC42lH8sZK1PUhO0um6K/zlGzecwAvXKPT0z5sy3UYDgfmynBc6UFBB"
- +"bJKF9XYQgnhLoy2h3UTGzg3kAoNX4jcmSMHAJEyRr6KKZcb305NBdB2lFD15xwwj"
- +"C1X3t4udPq9A3edURWmMBYNezADMEUV/xmEaCnA1ZM+wi38W7ivFVWeXzuB2V9/b"
- +"Z5nhzA2u/4DQU61RzBTmCc3w6sjSR19x0NPlRLCd/pGefsruxKxl506eg+5mUQye"
- +"UiIVYmYDyZ+X9Y6n8nfbuh0BF3PsaqHCqD9fFr0qFFkdMAFKqc75rfnT2QPF0ftl"
- +"MEzKq93L1+81rOB86mtXQ3nnXgJBJrRGSOh0oI6YhRied19xOvO6uD7D8sxBbVDz"
- +"B5iaPUNOKUR+R9w7IPOeQ7AAAAACAAVYLjUwOQAAA84wggPKMIICsqADAgECAgEN"
- +"MA0GCSqGSIb3DQEBBQUAMHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJ"
- +"k/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNp"
- +"bXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTAeFw0x"
- +"NDA5MDIxMzA3MzdaFw0xNjA5MDExMzA3MzdaMFkxCzAJBgNVBAYTAlVTMRAwDgYD"
- +"VQQIDAdwcml2YXRlMREwDwYDVQQHDAhwcm92aW5jZTENMAsGA1UECgwEY2l0eTEW"
- +"MBQGA1UEAwwNKi5leGFtcGxlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC"
- +"AQoCggEBAK33U4fX80G6nQ2e+rIROAu+DkcUoB1qHHWAYFMsXIpem4vVgdIjlEY7"
- +"qpSHtUgZiblbJeQuFflRtLimni0YoKWJ3LQ3gNUWBhiXt3B+VtrtDhkp+6qxkV8h"
- +"jKcIXtmAxTqdYG/hNuTrkCmpcktGWn4+1J93dwC1YOs3FxuMQM0+F2d+t6VLSqEL"
- +"xEKH2/QijfxsnQJGC1FYh0R4sL4/XHT4L+x+JgNJVAc1E6eA2vRF9JYFAuapRBgL"
- +"KEmruDk4yY65J2FE4rcOaytqN6shXZFf8weKUyjfDfbr5ahtTTyPHnSHwM1gpeC3"
- +"eTy2MiQbXuPeL9M8frQPyqxaDf4TOZUCAwEAAaN8MHowDgYDVR0PAQH/BAQDAgWg"
- +"MAkGA1UdEwQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1Ud"
- +"DgQWBBSEBgGqmsJMTLdMMcCt8QQ7Ou0nlzAfBgNVHSMEGDAWgBStfadW0wTu5E3J"
- +"1mEa6qz8/tY9hzANBgkqhkiG9w0BAQUFAAOCAQEAk35d4B65xhYNiuxS1ShSCjgZ"
- +"v7YjjnqvwSGxSj9RiNA6pKdNEKWCDGSq030xbJJ2cDnep5DzFssXjC4llMIGC8ut"
- +"nfwiopD4F/IQwwx4zRKjpEzTQA1iQzenEy4h46/7xncDeYEDQhQwYoj7Y6coIwBg"
- +"uHolvKFjqE0iEXbfNYLxzQmDvdpmuNhJH1AXX5ln+MxuBdKNSHxrOEqjHr1iepd9"
- +"6iy/GmZe1tJGiJE/JE3aS6JMst8AxtgUJ4TgDbR5LfklyoEIvpjim9e2kVG5LPbY"
- +"t3//QYhLqwjaJfUaMxNbUn6O6XlzsNJY2AzZocu68KpPajCVxfBptImSF5pVNAAF"
- +"WC41MDkAAAPTMIIDzzCCAregAwIBAgIBBjANBgkqhkiG9w0BAQUFADB0MRMwEQYK"
- +"CZImiZPyLGQBGRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQK"
- +"DApTaW1wbGUgSW5jMRcwFQYDVQQLDA5TaW1wbGUgUm9vdCBDQTEXMBUGA1UEAwwO"
- +"U2ltcGxlIFJvb3QgQ0EwHhcNMTQwOTAyMTExODE3WhcNMjQwOTAxMTExODE3WjB6"
- +"MRMwEQYKCZImiZPyLGQBGRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMw"
- +"EQYDVQQKDApTaW1wbGUgSW5jMRowGAYDVQQLDBFTaW1wbGUgU2lnbmluZyBDQTEa"
- +"MBgGA1UEAwwRU2ltcGxlIFNpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IB"
- +"DwAwggEKAoIBAQDradZr1W8AD8DmjziXB0UstOXnIEjL+7QbWeDlpgX5Mp4y8+iV"
- +"+vxaI8x3ko1IfKsVa5Qge/W0O4vVBF4f6Cbs9LBzUzlSeWJSPdGqWhn0nBLrIgnM"
- +"bSmIy4k9bD3uo4zqZImrRhruY4GCGuc+51MWjIDTAx/UetaYgFk6Gu722yJBmOxz"
- +"Z3WJmyBjBvKvBsAtetyenE9fkXth4XJGOiqQYzW1RGhqOoFFbh92GB/5/0qQHkbM"
- +"sfirguwjC0WwHJMrnDGolhbEd9Spa4S6MtDbHS/PKe3C27D3ikknc3vUtDjGmpTY"
- +"fSChBFbiNK+UGlcnKwMyBpnUEPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB/wQE"
- +"AwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J1mEa"
- +"6qz8/tY9hzAfBgNVHSMEGDAWgBRamWI18y6lNATPS13vQUMAXLi9zTANBgkqhkiG"
- +"9w0BAQUFAAOCAQEAFYmn/VQfFk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGx"
- +"nbYz3LmtzGQbf1R2vAwlEHTblNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1"
- +"BUqisxrDeHnZP5UIxOSaTIOdrl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x"
- +"2iQkLHFmYhbNqyrABtg3cw+feyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAt"
- +"l3494PqS4/fPC2y/+o8PjybKYKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY"
- +"1kb/jgfz9Xf1o4zlEa2U5LVUI3xqsv1yM8JAK6gw7LJ/3sVVgIpQRDfUT5zUTBhc"
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=*.org
- private static byte[] KEYSTORE_11 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l9nJAAAFAjCCBP4wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6oO0QMJXLxMfEkyCq7PrV65no5vS0X2QejueGEex71obiMP4ZkbwJTb6"
- +"B4ZvlmZKeHJ4m0E7ty+wh09Cr5cSIDSkQLp5oleA9dDMeGeAHOTnM3+J3dyRihnG"
- +"qRjlu5rWjZEGKx37e4gvtvm10875xCpYqcqACucbZIaJOW6N+oYUo6cV1G5qTFB+"
- +"sC8llSwpOotaLoTvEtAQIrd65tIHWxGZInWpqOO9frAMHTIafQzMVlBkPQZa0GTr"
- +"HqSawglNq2iCOyz/3ISL3LawI8p02mZRsD2NmcqDnexnJzLoLqF/J60gOltgiwOm"
- +"0L9/l0JaBkWQ4Z6xmgduftxCIJzEXJRuRKXTw3Sl51gKRwllmMpMyKm5Xa4HoMzE"
- +"v4O2IhqInvhAj4sP0RbcbGL13K8G5DCZIhEnjMBnotgHzQzmNllZq0vYOlck8FJL"
- +"f9Lg2raxdm/rCMUxcqGAXirevUnryfFjJrOtQp5uxj5Xcz4UkqcEUdvBC7ZL33yd"
- +"l2EG0VHn+yOmX1tztnEIF/KOC/04OsBEFtA2Ha+/2a1tdH5jkQIouEFQGHhbrvee"
- +"QwTeS2CncxN7lkqZ6MrS+FqVdWDFuOVznNPSpNLuCfY2Q+Z+UqQEbtHOsnnQH+UM"
- +"aXJEaYpil8fR5lvWhC0y+PjV/JinvFe+Cx20vE1htGBFAuiDCx4THCTmN0Omifgn"
- +"VEwS5BPWGTgJFuTldMLOI53zVcHuV+mLDoG0U5XxlmzkHgjDI/WuyHc12c4ATZPt"
- +"IQ+dXvRshQGrBpsBM3MNxZpwsvFm+0++5s7psZSEdVpAwMlSUSyMks4tu+0pcVAo"
- +"lKjyyQyNOUAELSwmVxnx3vaj2Md9i/9kmgt74tY6YeAJJ+9jKSZFl4dV3jREUfZj"
- +"cQLXWALJ0WwP2+YNrzMdeCSyLNU0v1Dzwum5InhGUhW6uE91o1gzMwuiJ3AEOmIl"
- +"4X1CldK3XMyKd923Xe4l27jIZ105wMJBi/bXDlZQAICBWsrqQxuy7hDJvoY+4nxX"
- +"HFsaBjLFax8mHBr4ptvgO5vkKp8m+2F3L/CS/zrmmopLvHSM7Cd/fw3Ysxl3oUJw"
- +"0G0DOCJ90mwDujQQ5sHUkgRJKX29dibnHRcFUpWjDy7VRcL2JFtEE8K4DavMbvWQ"
- +"3TSEODtTdIZ71/io1/8vw1Reu1pFpzvyMUMCEFFOx61UOFXYAQrXMohesFLIqX90"
- +"LLl12mpIjX/lR5EGunfkov+nqJCgxNv2OcKlKw2bLAIXl+sXCJv5yIpi7BLDt3Ys"
- +"O574ygrrk4Hnrf1L8DnhJP6ESZL/TiOPxtAGf1wnOe7RFCbluwgjj4GGXZspIWMJ"
- +"tXy56udb+nE0NwPt4p92wz6ApKVsmakVrkkJFLpP/5n+qWnFXrD5h1i1JhrGvZtl"
- +"uJmQYjwS8cbsZMk253fpeozYL1cWlmMOd7sFjsIBIUzAUFM7dyQ5oO5EY5JfluE5"
- +"sAkQSUs3L63IruIbQoVgDvJ+8dNxsMm3SP+sbIpoCVAgNPZK4W8vaytvw3pZ4FH0"
- +"c5GrfonwbgdXzjOBHzYGknyi3qnzBRLyRACH6o8ya8G5T6DQQTdngHQ0PwJ9kalE"
- +"iNqKQT1F7g9TSCqbnLiBDR7cQn+WFSKTqiIy3ZrwvsnkI1SaM9PLkW+b0v0nBV3/"
- +"D3+le1nyybEgH52Kzcd9DMMAAAACAAVYLjUwOQAAA8YwggPCMIICqqADAgECAgEO"
- +"MA0GCSqGSIb3DQEBBQUAMHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJ"
- +"k/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNp"
- +"bXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTAeFw0x"
- +"NDA5MDIxMzA3NTBaFw0xNjA5MDExMzA3NTBaMFExCzAJBgNVBAYTAlVTMRAwDgYD"
- +"VQQIDAdwcml2YXRlMREwDwYDVQQHDAhwcm92aW5jZTENMAsGA1UECgwEY2l0eTEO"
- +"MAwGA1UEAwwFKi5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDA"
- +"ZPwBrHPci0iiAkLpoa1am4acRrSp/rPFUxemcV0lULdv94J8M+qHDPtc0FaRWbd8"
- +"1dAeeCX/t56oP62iHAQx/xYJJtOiPUIlCj+8amXtfOS8N437wND2dYXLb2vn7vx+"
- +"ZAaHOqtZ6nKCXCIhqBw3/zAchOZHwjY65SDLDFbJd4Bf6cz6aSJrF1FXtxLmfYPm"
- +"R8ZTX7zDGeGLKmGF/+Ajj6D+6NkW3KiuFvJLMo37LMgPAf8JvZk5wL2noZ818VeB"
- +"9uvCRAvsL+/ebe/tNJVrKB1V/uRMY9BEEU0sm1PoGnqSWkVoXOgHRCbjc3STvPAo"
- +"fcw53lk+pSv1UNyOGX3FAgMBAAGjfDB6MA4GA1UdDwEB/wQEAwIFoDAJBgNVHRME"
- +"AjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAdBgNVHQ4EFgQU+i+5"
- +"4YJYvedAB438GtV0yUulDhcwHwYDVR0jBBgwFoAUrX2nVtME7uRNydZhGuqs/P7W"
- +"PYcwDQYJKoZIhvcNAQEFBQADggEBAH79GcKlUKRHUXj2a9/mTAnfRIcNR15AOvDs"
- +"uZhcasPGjfjoT+qlZsyvchqtlE71q02o8Q9wYy4t0XGjjRLdip6djaigYED8pLR8"
- +"9QnjQ3J7XxJu/LzZcImR/Oxjc3ElBmsuskEs8WqhvfCjC+aA+m6UNpH6hpOtWnuI"
- +"+BnwlJzaF0h1tIpdy7663bxwEjElQeVAi9X6qWvfs/FFbTwNqK5xaO57NBFNeUgS"
- +"5+xcQg2EumAohiYh72qbZQMyjytOQUfBxlg9JpGkiNjKM2XK6k4IMo+y2PnH78NU"
- +"EjsoZxN7LReosUSFpZ2PEjThfqHaCZO6yMiHsD0tkzCEygwrQkYABVguNTA5AAAD"
- +"0zCCA88wggK3oAMCAQICAQYwDQYJKoZIhvcNAQEFBQAwdDETMBEGCgmSJomT8ixk"
- +"ARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxl"
- +"IEluYzEXMBUGA1UECwwOU2ltcGxlIFJvb3QgQ0ExFzAVBgNVBAMMDlNpbXBsZSBS"
- +"b290IENBMB4XDTE0MDkwMjExMTgxN1oXDTI0MDkwMTExMTgxN1owejETMBEGCgmS"
- +"JomT8ixkARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwK"
- +"U2ltcGxlIEluYzEaMBgGA1UECwwRU2ltcGxlIFNpZ25pbmcgQ0ExGjAYBgNVBAMM"
- +"EVNpbXBsZSBTaWduaW5nIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC"
- +"AQEA62nWa9VvAA/A5o84lwdFLLTl5yBIy/u0G1ng5aYF+TKeMvPolfr8WiPMd5KN"
- +"SHyrFWuUIHv1tDuL1QReH+gm7PSwc1M5UnliUj3RqloZ9JwS6yIJzG0piMuJPWw9"
- +"7qOM6mSJq0Ya7mOBghrnPudTFoyA0wMf1HrWmIBZOhru9tsiQZjsc2d1iZsgYwby"
- +"rwbALXrcnpxPX5F7YeFyRjoqkGM1tURoajqBRW4fdhgf+f9KkB5GzLH4q4LsIwtF"
- +"sByTK5wxqJYWxHfUqWuEujLQ2x0vzyntwtuw94pJJ3N71LQ4xpqU2H0goQRW4jSv"
- +"lBpXJysDMgaZ1BDzVXYzKQ1QmwIDAQABo2YwZDAOBgNVHQ8BAf8EBAMCAQYwEgYD"
- +"VR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUrX2nVtME7uRNydZhGuqs/P7WPYcw"
- +"HwYDVR0jBBgwFoAUWpliNfMupTQEz0td70FDAFy4vc0wDQYJKoZIhvcNAQEFBQAD"
- +"ggEBABWJp/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/cfaKF89NqWvIBsZ22M9y5rcxk"
- +"G39UdrwMJRB025TVgX45IU0PY89SKXapQ/GLEu3CbULDnnJwO2Hr9QVKorMaw3h5"
- +"2T+VCMTkmkyDna5demEuboXR7mut1qVdg2vx24XISnSBEfxulOS+MdokJCxxZmIW"
- +"zasqwAbYN3MPn3slpWSV5D8VZrE59wBpqw8HnwuHI0uPkHAeWcgwLZd+PeD6kuP3"
- +"zwtsv/qPD48mymChuoFyh282B7j3rmwjGazsa0KLkkS6sRWASdbq2NZG/44H8/V3"
- +"9aOM5RGtlOS1VCN8arL9cjPCQCsgdwVU/RVDFxE/lntqxKBUgsne0A=="
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=*.*.org
- private static byte[] KEYSTORE_12 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l9u4AAAFAjCCBP4wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6p4HqnSbHITrIX+wJDIMbnFuJiQMvi5ArsqwCBMMuBg7/BYlJxQECWBG"
- +"7EuxN/IuuhnexSeDxZReOtOZ4saM8k6Li5GlEFN/nVvZ/xrPOsG0Vo/bhCEUNp/w"
- +"4akQmpLIndJWGBrjCu46CH9p2h4hwRUOzeM4JYcyjv4R6jNL3EeMDdzHnuc1zv+t"
- +"tadcyPthFFAYT7eLZoGDTJiUy1l0GouAgGKMGSsyRUd3NyEwQx1NgRzx/tMNIkCV"
- +"AFFec5gzchLS8lR8mV9GJ2XQXOK0TKILfGK4/akKlphTGANiCU0q1U0kVJzAGg4j"
- +"gE22x2d2Sy/NQMxEOg8u8kGy97ISaWAvHPtpsZrFf1KqvbTWNjWgvFehDirk1xj+"
- +"lp79OnlkODK+Kb0m8lB2EnY1xj4jhkWu8Z/q4i3J/+rHbax9TFP55dGXLK0pwRv2"
- +"qf8ym57Fbk3QuS9jbf3/bwwXoCemAn2hhDHCBDBCQA9dTNDWt30gQ++7+3O28M0D"
- +"Z5/wicThCs+Ygn2recR6y4L2lZ/8g4amGsuVtaV2RZAwmrA8457PfH2t7tHySnMp"
- +"r6s2ynB6cep+t7DRO+LcDl6sSt6R1AoohsS2sw2/jhdwP2J5K96eiLcOp29aLFvR"
- +"lALJOohKOx7w0KWGtHPmVJlpkM4o9spmQ4va9BeQ4BXOSwFA+WJXSFO0AV7uL3ww"
- +"VXRcXG/yPAnKt1XaC2bhNfQnauBoOqqVlrOcK+5pyupPnaNvjTvdH5hxWkauSaIS"
- +"c7rmpoZOwBjsIx0yVZ5ZBnUq4Wx/b6iyAXBLypdPTJZtUz99h54dEAkKbh6VHDKl"
- +"Mgm2KwdaRJGjKzD7Lb4qSvSdLWViSV2+tJJry6CyI/mjd1XHqk0IIIroYtmInVqY"
- +"ZWJk8mhF38duWLVDQ9cmTmd3YGV1tnZ9RUiMQVxncFWcOl0HSe7cLtJqQhJkkfY9"
- +"GzpECa+KwqNMdNnpmSj0Esrcjvz/yqoZd6vG1yzLQ/+7yrdxe3HBqbdqTktyJ6Uy"
- +"kJdcVbYrQhi6EHLr+kYlffPKPH/fzi0zvgWDfSSkeYPNYpsdUbrPvNsprY4OkVlz"
- +"akej/MLSaYXNTcChgZXYU5RhWNhHlzbu+9mPmupViW+ypn6uLskz+Kst/7tUGtbn"
- +"6qU18y5ddGabUUCw7BnB0Hhpwzxi5JVuKECXW8zD0jcVS7YlMYJJhNo0XphM+am5"
- +"2I3Ftr3JTw8Vmz/vlWvFOQHzvaH8p9DUoEbxs1V82IF4YI6lT6q3JHrGZ8vFKLF9"
- +"Sm2O7BPts3s+dMKRkfzW+s2IitBq4pt0OfsjvMG+WPyB5/WWCfLU9KX5rcS+OQsC"
- +"LZuOZOt3sxYll7GvWR9ZybGfOo0aX6S11PSopiwM5qQspRwz1+8DBRQ4S2OgXKWf"
- +"syBvJTM0wXW/6omEf1A+427YLarQx3R5/fj66OV+2ntnR/gweTSHNn5bM+18N6Qn"
- +"ATzryEraXDmHOSR8bblz4Nx5B9YAb3KMUYA2DF8eIKf0zID78xkSP+JHFOBvZ5k/"
- +"jOCuaiX5ZGXQEKbDw2335odUU9CQsrzAljL8KFisZn1FDx6LULDZmXHJGVj8BIlr"
- +"guXS5KNqnvybv8n9aiuhFD6569G46vjizmKWMVws/S4GhBG6xZKVTC/9uf1VqKBU"
- +"jjtvrvbYDG1/0EME8Sdg9/8AAAACAAVYLjUwOQAAA8gwggPEMIICrKADAgECAgEP"
- +"MA0GCSqGSIb3DQEBBQUAMHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJ"
- +"k/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNp"
- +"bXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTAeFw0x"
- +"NDA5MDIxMzA4MDhaFw0xNjA5MDExMzA4MDhaMFMxCzAJBgNVBAYTAlVTMRAwDgYD"
- +"VQQIDAdwcml2YXRlMREwDwYDVQQHDAhwcm92aW5jZTENMAsGA1UECgwEY2l0eTEQ"
- +"MA4GA1UEAwwHKi4qLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB"
- +"ALtU5Q4lwiOZCIZsjafk1mVJBeB9KqJwsRb61ONPnuj1aad8UoDGvR9DJ5gApG7W"
- +"5Lkp7LFcFKnpVGIHHVTdlLfsm8wKPxU8ykWZkl6zVSj4KxWMgem3jg+x7FDJFoyl"
- +"t+QEsFCzks3Tj+LSFQ2R3CJgH0UcYo+MMsxTrec9fLIhow/8gN/x9gIhfly8OMgX"
- +"Gz3TrsE0y2N4kRAGzSXmuZxO+VucuE0vGZnRTHs3OuS+b7mheDGbLbcFujdnumzb"
- +"RvjGd/3BhVjMQZWF6HvBxVCtoXyTAyH01WZhDyLbGkHimtaLqPuhOpaAZP2uchGk"
- +"8YbMOAJiNblKHqzf15H+kp8CAwEAAaN8MHowDgYDVR0PAQH/BAQDAgWgMAkGA1Ud"
- +"EwQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBQk"
- +"S82rAWM4EJl7eYTwwFk1I6kYZTAfBgNVHSMEGDAWgBStfadW0wTu5E3J1mEa6qz8"
- +"/tY9hzANBgkqhkiG9w0BAQUFAAOCAQEAN4s6hJ0DrHrJuJwfZ3u8l+jTuuuMGxVf"
- +"zDUYPJIBMVMIl18d92ujJW0RTDkElHZ8zbOVqBGajAWJ/kj6MQNzpqEYhsvJxxwX"
- +"sZ3xE5zOzeeTJEBlaBPzfGKsl4BPJmWljs2lwPbANivB6IZ7jcM1azt8Vqtb5KzJ"
- +"st99VGd4zMhi9rFWV7N7So2zWiERIjq2syNqjd0jQYS8uwp92IcaTGycxqJ+Kafz"
- +"8t3UiG07aU/ZZGSBcSMZjEAgnWzh5abqQNL3l2jKw7krpjDFbD/eIrYIV/jXaRzw"
- +"DmGgfKxktVvpXzmuQ9tdwOktCyrPsLqD/BxwsBJSldYV9tu/vnx/9AAFWC41MDkA"
- +"AAPTMIIDzzCCAregAwIBAgIBBjANBgkqhkiG9w0BAQUFADB0MRMwEQYKCZImiZPy"
- +"LGQBGRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1w"
- +"bGUgSW5jMRcwFQYDVQQLDA5TaW1wbGUgUm9vdCBDQTEXMBUGA1UEAwwOU2ltcGxl"
- +"IFJvb3QgQ0EwHhcNMTQwOTAyMTExODE3WhcNMjQwOTAxMTExODE3WjB6MRMwEQYK"
- +"CZImiZPyLGQBGRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQK"
- +"DApTaW1wbGUgSW5jMRowGAYDVQQLDBFTaW1wbGUgU2lnbmluZyBDQTEaMBgGA1UE"
- +"AwwRU2ltcGxlIFNpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK"
- +"AoIBAQDradZr1W8AD8DmjziXB0UstOXnIEjL+7QbWeDlpgX5Mp4y8+iV+vxaI8x3"
- +"ko1IfKsVa5Qge/W0O4vVBF4f6Cbs9LBzUzlSeWJSPdGqWhn0nBLrIgnMbSmIy4k9"
- +"bD3uo4zqZImrRhruY4GCGuc+51MWjIDTAx/UetaYgFk6Gu722yJBmOxzZ3WJmyBj"
- +"BvKvBsAtetyenE9fkXth4XJGOiqQYzW1RGhqOoFFbh92GB/5/0qQHkbMsfirguwj"
- +"C0WwHJMrnDGolhbEd9Spa4S6MtDbHS/PKe3C27D3ikknc3vUtDjGmpTYfSChBFbi"
- +"NK+UGlcnKwMyBpnUEPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB/wQEAwIBBjAS"
- +"BgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J1mEa6qz8/tY9"
- +"hzAfBgNVHSMEGDAWgBRamWI18y6lNATPS13vQUMAXLi9zTANBgkqhkiG9w0BAQUF"
- +"AAOCAQEAFYmn/VQfFk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGxnbYz3Lmt"
- +"zGQbf1R2vAwlEHTblNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1BUqisxrD"
- +"eHnZP5UIxOSaTIOdrl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x2iQkLHFm"
- +"YhbNqyrABtg3cw+feyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAtl3494PqS"
- +"4/fPC2y/+o8PjybKYKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY1kb/jgfz"
- +"9Xf1o4zlEa2U5LVUI3xqsv1yM8JAK44kbn5woKcmKSS6+GvVtU+kemw0"
- );
-
- // Subject: C=US, ST=private, L=province, O=city, CN=*
- private static byte[] KEYSTORE_13 = DatatypeConverter.parseBase64Binary(
- "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg6/X/ZAAAFAjCCBP4wDgYKKwYBBAEqAhEB"
- +"AQUABIIE6sihgiLKcpB5cNmjjoz30yxaOdYiihTRLK+LZRxEIDaJcJ6CqUm7VHzx"
- +"bGjy+nS15h75UV2CxpmMKmEEFU1IxX5UqdTBRs5iKGiPFPOyH25+dTgOuiSzM4Ch"
- +"8XwPZLZLIaT1MLQ8AqnVNYvydbiPQhogqBBBtG4gZW7RzN2tzmhgeTywii4RBuhT"
- +"Oh/MFPylGA01fqrq+5cAnYW9h2Get/DjL9Rj0VG+jdtvpTmBDUyYp9P1ZamfrcSQ"
- +"KL3NN/DFXSfSln0Qn98gEDUdCGS7IuL7gmOSqt+NINkZ53PTSN5iX0/BAQPqoXl2"
- +"Oubjs1BKNzWBhPVAE29B7i83OaHWAUua0JcuInlaaCSFYKyP86dX9nH2005sm10a"
- +"1GaSdMi9D9JJ74B/GYC1l0hZrBcMGpvDNUt13Q5ZQ+xlXhiBCZlyIss87VIfOGQo"
- +"pt3sO38Wi/DomOkUzkOKhInjcIoIuEEwY+1oc8icCiKPD5EcKj6ukkXVUn3NoWmf"
- +"ZlJyClexWnbi2vmp+zxYmDpYWjFRL8jkEiMBQ4lyck6ZV4sTKu7sbbwF42QcLZE1"
- +"5BuFw+3cWusHYuEDDqe6sTINGgwqdyk/F2c0hGZlEAEIU0+jJsx7x+WD6WhZFb8w"
- +"wEnt44jmd65Bos3vdPQp+F/T+1JhMtkW2ThlKiB1iWzAIAYP+UR31fpkKlG4NlgQ"
- +"irkd+U1uCB6r1ItLeBcXeMOOOylKHhXckwmz47Q0C41uBVM0apDdo1TQgYcnfFu8"
- +"/0rK49JEJ4tBL30EihrSfN5E94bBCyUgt+Dtv3VQp0BpEmzCTZtbvTfCGdwueEMX"
- +"NcRPSPeqv0K/1pE1xBTFXWb+2Trbdw+UARrOlZCA0q3NkorBZRh7RsLHdnvYYWl8"
- +"lcJci9eLAqO48PIwliP9BTKYxAjAbR2FfKVZyepDz4cn1TYSeDz6LKBmWQKf1gb/"
- +"JFCe6ygM05+PzNAV9kOcPvnj/pLitfNdBR5VkQqQR1c1RZbfHAZgzKlN0MQjIFgA"
- +"saqNBRuvBxLaVvIfA0tgsppqsXuBu1mtl/BzApvVfTptp0TdaiCbELNUVJ8LLAF2"
- +"HEQ5ioZ7nmrTNJISyxplpgwUtYfKZJ8rSK2d+uCudN5M9bLF+bDKoh7ErQVxh4M4"
- +"lTKkfMPvxqJ6gxaV8RI3C2N1xnGzakIPk/l1D77P9eXTAAHrneumbiAKJvUF/NTW"
- +"9hUsszLEN1wQRXsbYBTBFzYMpXItqlKwAD9GpWFjnw7zH7mxje5RDd+SQyVCsJPY"
- +"daNqcx2JWLWPmp4ZXgwNPk4GOqoeg9a4ierXY30STH3S9Dl3I5os2r5nLVM8rMkG"
- +"JhTV6Xg9CSNa+LcLUFNuXsoUEAXpVDMUN3lvoaTxetGDU+IKYFertFiHd903tZF4"
- +"HCaePuyeUCJ+U4zPyZzuq612eMOU94Om1thNAfdVRObLB6V91dJ/IyZoFuIRzLm2"
- +"VgcKtUbDpkJ8HaINyV0f2H3xp/42rS/zSlAtU293STcdeeHfH8Ytykc2gnCPgbgx"
- +"Rz9ug2yW33mi4otouiQ/f2GS8uEKw15zKAwYA7lyLFaMGQlHNT13gCm8yj+K08os"
- +"m3mJ2gTR/PkSAbdQK6XzD5qpsU57efxItFFjRjg2IRy4H/AKYkHCofH7TMbaPxln"
- +"TYAiwZvnYMpi0WpvDLe1E8sAAAACAAVYLjUwOQAAA8IwggO+MIICpqADAgECAgEX"
- +"MA0GCSqGSIb3DQEBBQUAMHoxEzARBgoJkiaJk/IsZAEZFgNvcmcxFjAUBgoJkiaJ"
- +"k/IsZAEZFgZzaW1wbGUxEzARBgNVBAoMClNpbXBsZSBJbmMxGjAYBgNVBAsMEVNp"
- +"bXBsZSBTaWduaW5nIENBMRowGAYDVQQDDBFTaW1wbGUgU2lnbmluZyBDQTAeFw0x"
- +"NDA5MDMxMDA5MTlaFw0xNjA5MDIxMDA5MTlaME0xCzAJBgNVBAYTAlVTMRAwDgYD"
- +"VQQIDAdwcml2YXRlMREwDwYDVQQHDAhwcm92aW5jZTENMAsGA1UECgwEY2l0eTEK"
- +"MAgGA1UEAwwBKjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALvGjp6T"
- +"DWl7gMIFWru+h7F8Jdk7WM977pIKO8FwyktuNLMNn6b5GXzt1uNdbaNmytUrEyEh"
- +"UrU4/2qjQlMsuJ+X+gDwvptQ+7Sn6+joYrKeYNpvs2Nq2rX3zOyuNEZ9ALKaCvdt"
- +"CdgvFgAnBxKpZ/n4xBWECm0pFDgyCVAOndDOIPltMtZsfdADL7PiLUicsfWJpeMv"
- +"X7zZibe3aA297QP3EjfdDdyc50I+QXvDqVpmIRtViVENH9kcK/udptYmvGHqCs7S"
- +"3ID8kRD/p7jt3eVOj7P7HxEeuw6s5KNXANm/rq8t+Erre9yAGRU9x+aDiI31ybPG"
- +"JqBOvYvZxv4QkMcCAwEAAaN8MHowDgYDVR0PAQH/BAQDAgWgMAkGA1UdEwQCMAAw"
- +"HQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBQiDAXvxabe"
- +"R5+0gko4+Ei2cwjJVjAfBgNVHSMEGDAWgBStfadW0wTu5E3J1mEa6qz8/tY9hzAN"
- +"BgkqhkiG9w0BAQUFAAOCAQEAtkrQ+WucI71Nt5Rp/OzkX0HbXNGZ40XSQQ8t63h0"
- +"rKytV6JGz4rTqQ/89ZnJe8xz4M1DWQDF4LYIZJkyIjKa0n4ogflcARXe8nUEMeDx"
- +"PnZ6lxXn+8IIItgGAMjL1fPKIBQjMuXwFnajx+M2B0GP1RrW4B8IrniaMQnQK2ld"
- +"BjoP0T9e30MU58YUFrp4cuTpAWA3le8DRroDFUm2O036uK9CK8oLDdShY13KcMPT"
- +"Y2jHgz7jmo+lUDuHqQ6m9xqgGZlwjUFO853Ml6ylHeyP/riDf1j9Xw/YJMNOzfRL"
- +"IzBN9RLbnPElY2/wji112hmf7PhsUgTYGJNjeGC/IpthywAFWC41MDkAAAPTMIID"
- +"zzCCAregAwIBAgIBBjANBgkqhkiG9w0BAQUFADB0MRMwEQYKCZImiZPyLGQBGRYD"
- +"b3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1wbGUgSW5j"
- +"MRcwFQYDVQQLDA5TaW1wbGUgUm9vdCBDQTEXMBUGA1UEAwwOU2ltcGxlIFJvb3Qg"
- +"Q0EwHhcNMTQwOTAyMTExODE3WhcNMjQwOTAxMTExODE3WjB6MRMwEQYKCZImiZPy"
- +"LGQBGRYDb3JnMRYwFAYKCZImiZPyLGQBGRYGc2ltcGxlMRMwEQYDVQQKDApTaW1w"
- +"bGUgSW5jMRowGAYDVQQLDBFTaW1wbGUgU2lnbmluZyBDQTEaMBgGA1UEAwwRU2lt"
- +"cGxlIFNpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDr"
- +"adZr1W8AD8DmjziXB0UstOXnIEjL+7QbWeDlpgX5Mp4y8+iV+vxaI8x3ko1IfKsV"
- +"a5Qge/W0O4vVBF4f6Cbs9LBzUzlSeWJSPdGqWhn0nBLrIgnMbSmIy4k9bD3uo4zq"
- +"ZImrRhruY4GCGuc+51MWjIDTAx/UetaYgFk6Gu722yJBmOxzZ3WJmyBjBvKvBsAt"
- +"etyenE9fkXth4XJGOiqQYzW1RGhqOoFFbh92GB/5/0qQHkbMsfirguwjC0WwHJMr"
- +"nDGolhbEd9Spa4S6MtDbHS/PKe3C27D3ikknc3vUtDjGmpTYfSChBFbiNK+UGlcn"
- +"KwMyBpnUEPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMB"
- +"Af8ECDAGAQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J1mEa6qz8/tY9hzAfBgNV"
- +"HSMEGDAWgBRamWI18y6lNATPS13vQUMAXLi9zTANBgkqhkiG9w0BAQUFAAOCAQEA"
- +"FYmn/VQfFk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGxnbYz3LmtzGQbf1R2"
- +"vAwlEHTblNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1BUqisxrDeHnZP5UI"
- +"xOSaTIOdrl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x2iQkLHFmYhbNqyrA"
- +"Btg3cw+feyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAtl3494PqS4/fPC2y/"
- +"+o8PjybKYKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY1kb/jgfz9Xf1o4zl"
- +"Ea2U5LVUI3xqsv1yM8JAK7QGe+SIq7OzY799930MjoSSK6HI"
- );
-
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java
deleted file mode 100644
index 53626b6658..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import junit.framework.TestCase;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-public class ByteBufferInputStreamTest extends TestCase
-{
- private byte[] _data = {2, 1, 5, 3, 4};
- private ByteBufferInputStream _inputStream;
-
- public void setUp() throws Exception
- {
- _inputStream = new ByteBufferInputStream(ByteBuffer.wrap(_data));
- }
-
- public void testRead() throws IOException
- {
- for (int i = 0; i < _data.length; i++)
- {
- assertEquals("Unexpected byte at position " + i, _data[i], _inputStream.read());
- }
- assertEquals("EOF not reached", -1, _inputStream.read());
- }
-
- public void testReadByteArray() throws IOException
- {
- byte[] readBytes = new byte[_data.length];
- int length = _inputStream.read(readBytes, 0, 2);
-
- byte[] expected = new byte[_data.length];
- System.arraycopy(_data, 0, expected, 0, 2);
-
- assertTrue("Unexpected data", Arrays.equals(expected, readBytes));
- assertEquals("Unexpected length", 2, length);
-
- length = _inputStream.read(readBytes, 2, 3);
-
- assertTrue("Unexpected data", Arrays.equals(_data, readBytes));
- assertEquals("Unexpected length", 3, length);
-
- length = _inputStream.read(readBytes);
- assertEquals("EOF not reached", -1, length);
- }
-
- public void testSkip() throws IOException
- {
- _inputStream.skip(3);
- byte[] readBytes = new byte[_data.length - 3];
- int length = _inputStream.read(readBytes);
-
- byte[] expected = new byte[_data.length - 3];
- System.arraycopy(_data, 3, expected, 0, _data.length - 3);
-
- assertTrue("Unexpected data", Arrays.equals(expected, readBytes));
- assertEquals("Unexpected length", _data.length - 3, length);
- }
-
- public void testAvailable() throws IOException
- {
- int available = _inputStream.available();
- assertEquals("Unexpected number of available bytes", _data.length, available);
- byte[] readBytes = new byte[_data.length];
- _inputStream.read(readBytes);
- available = _inputStream.available();
- assertEquals("Unexpected number of available bytes", 0, available);
- }
-
- public void testMarkReset() throws IOException
- {
- _inputStream.mark(0);
- byte[] readBytes = new byte[_data.length];
- int length = _inputStream.read(readBytes);
- assertEquals("Unexpected length", _data.length, length);
- assertEquals("Unexpected number of available bytes", 0, _inputStream.available());
-
- _inputStream.reset();
- readBytes = new byte[_data.length];
- length = _inputStream.read(readBytes);
- assertEquals("Unexpected length", _data.length, length);
- assertEquals("Unexpected number of available bytes", 0, _inputStream.available());
- }
-
- public void testMarkSupported() throws IOException
- {
- assertTrue("Unexpected mark supported", _inputStream.markSupported());
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java
deleted file mode 100644
index 7ba5038faa..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.util;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-/**
- * Unit tests the {@link CommandLineParser} class.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Check that parsing a single flag works ok.
- * <tr><td> Check that parsing multiple flags condensed together works ok.
- * <tr><td> Check that parsing an option with a space between it and its argument works ok.
- * <tr><td> Check that parsing an option with no space between it and its argument works ok.
- * <tr><td> Check that parsing an option with specific argument format works ok.
- * <tr><td> Check that parsing an option with specific argument format fails on bad argument.
- * <tr><td> Check that parsing a flag condensed together with an option fails.
- * <tr><td> Check that parsing a free argument works ok.
- * <tr><td> Check that parsing a free argument with specific format works ok.
- * <tr><td> Check that parsing a free argument with specific format fails on bad argument.
- * <tr><td> Check that parsing a mandatory option works ok.
- * <tr><td> Check that parsing a mandatory free argument works ok.
- * <tr><td> Check that parsing a mandatory option fails when no option is set.
- * <tr><td> Check that parsing a mandatory free argument fails when no argument is specified.
- * <tr><td> Check that parsing an unknown option works when unknowns not errors.
- * <tr><td> Check that parsing an unknown flag fails when unknowns are to be reported as errors.
- * <tr><td> Check that parsing an unknown option fails when unknowns are to be reported as errors.
- * <tr><td> Check that get errors returns a string on errors.
- * <tr><td> Check that get errors returns an empty string on no errors.
- * <tr><td> Check that get usage returns a string.
- * <tr><td> Check that get options in force returns an empty string before parsing.
- * <tr><td> Check that get options in force return a non-empty string after parsing.
- * </table>
- */
-public class CommandLineParserTest extends TestCase
-{
- private static final Logger log = LoggerFactory.getLogger(CommandLineParserTest.class);
-
- public CommandLineParserTest(String name)
- {
- super(name);
- }
-
- /**
- * Compile all the tests for the default test implementation of a traversable state into a test suite.
- */
- public static Test suite()
- {
- // Build a new test suite
- TestSuite suite = new TestSuite("CommandLineParser Tests");
-
- // Add all the tests defined in this class (using the default constructor)
- suite.addTestSuite(CommandLineParserTest.class);
-
- return suite;
- }
-
- /** Check that get errors returns an empty string on no errors. */
- public void testGetErrorsReturnsEmptyStringOnNoErrors() throws Exception
- {
- // Create a command line parser for some flags and options.
- CommandLineParser parser =
- new CommandLineParser(
- new String[][]
- {
- { "t1", "Test Flag 1." },
- { "t2", "Test Option 2.", "test" },
- { "t3", "Test Option 3.", "test", "true" },
- { "t4", "Test Option 4.", "test", null, "^test$" }
- });
-
- // Do some legal parsing.
- parser.parseCommandLine(new String[] { "-t1", "-t2test", "-t3test", "-t4test" });
-
- // Check that the get errors message returns an empty string.
- assertTrue("The errors method did not return an empty string.", "".equals(parser.getErrors()));
- }
-
- /** Check that get errors returns a string on errors. */
- public void testGetErrorsReturnsStringOnErrors() throws Exception
- {
- // Create a command line parser for some flags and options.
- CommandLineParser parser =
- new CommandLineParser(
- new String[][]
- {
- { "t1", "Test Flag 1." },
- { "t2", "Test Option 2.", "test" },
- { "t3", "Test Option 3.", "test", "true" },
- { "t4", "Test Option 4.", "test", null, "^test$" }
- });
-
- try
- {
- // Do some illegal parsing.
- parser.parseCommandLine(new String[] { "-t1", "-t1t2test", "-t4fail" });
- }
- catch (IllegalArgumentException e)
- { }
-
- // Check that the get errors message returns a string.
- assertTrue("The errors method returned an empty string.",
- !((parser.getErrors() == null) || "".equals(parser.getErrors())));
-
- }
-
- /** Check that get options in force returns an empty string before parsing. */
- public void testGetOptionsInForceReturnsEmptyStringBeforeParsing() throws Exception
- {
- // Create a command line parser for some flags and options.
- CommandLineParser parser =
- new CommandLineParser(
- new String[][]
- {
- { "t1", "Test Flag 1." },
- { "t2", "Test Option 2.", "test" },
- { "t3", "Test Option 3.", "test", "true" },
- { "t4", "Test Option 4.", "test", null, "^test$" }
- });
-
- // Check that the options in force method returns an empty string.
- assertTrue("The options in force method did not return an empty string.", "".equals(parser.getOptionsInForce()));
- }
-
- /** Check that get options in force return a non-empty string after parsing. */
- public void testGetOptionsInForceReturnsNonEmptyStringAfterParsing() throws Exception
- {
- // Create a command line parser for some flags and options.
- CommandLineParser parser =
- new CommandLineParser(
- new String[][]
- {
- { "t1", "Test Flag 1." },
- { "t2", "Test Option 2.", "test" },
- { "t3", "Test Option 3.", "test", "true" },
- { "t4", "Test Option 4.", "test", null, "^test$" }
- });
-
- // Do some parsing.
- parser.parseCommandLine(new String[] { "-t1", "-t2test", "-t3test", "-t4test" });
-
- // Check that the options in force method returns a string.
- assertTrue("The options in force method did not return a non empty string.",
- !((parser.getOptionsInForce() == null) || "".equals(parser.getOptionsInForce())));
- }
-
- /** Check that get usage returns a string. */
- public void testGetUsageReturnsString() throws Exception
- {
- // Create a command line parser for some flags and options.
- CommandLineParser parser =
- new CommandLineParser(
- new String[][]
- {
- { "t1", "Test Flag 1." },
- { "t2", "Test Option 2.", "test" },
- { "t3", "Test Option 3.", "test", "true" },
- { "t4", "Test Option 4.", "test", null, "^test$" }
- });
-
- // Check that the usage method returns a string.
- assertTrue("The usage method did not return a non empty string.",
- !((parser.getUsage() == null) || "".equals(parser.getUsage())));
- }
-
- /** Check that parsing multiple flags condensed together works ok. */
- public void testParseCondensedFlagsOk() throws Exception
- {
- // Create a command line parser for multiple flags.
- CommandLineParser parser =
- new CommandLineParser(
- new String[][]
- {
- { "t1", "Test Flag 1." },
- { "t2", "Test Flag 2." },
- { "t3", "Test Flag 3." }
- });
-
- // Parse a command line with the flags set and condensed together.
- Properties testProps = parser.parseCommandLine(new String[] { "-t1t2t3" });
-
- // Check that the flags were set in the parsed properties.
- assertTrue("The t1 flag was not \"true\", it was: " + testProps.get("t1"), "true".equals(testProps.get("t1")));
- assertTrue("The t2 flag was not \"true\", it was: " + testProps.get("t2"), "true".equals(testProps.get("t2")));
- assertTrue("The t3 flag was not \"true\", it was: " + testProps.get("t3"), "true".equals(testProps.get("t3")));
- }
-
- /** Check that parsing a flag condensed together with an option fails. */
- public void testParseFlagCondensedWithOptionFails() throws Exception
- {
- // Create a command line parser for a flag and an option.
- CommandLineParser parser =
- new CommandLineParser(new String[][]
- {
- { "t1", "Test Flag 1." },
- { "t2", "Test Option 2.", "test" }
- });
-
- // Check that the parser reports an error.
- boolean testPassed = false;
-
- try
- {
- // Parse a command line with the flag and option condensed together.
- Properties testProps = parser.parseCommandLine(new String[] { "-t1t2" });
- }
- catch (IllegalArgumentException e)
- {
- testPassed = true;
- }
-
- assertTrue("IllegalArgumentException not thrown when a flag and option are condensed together.", testPassed);
- }
-
- /** Check that parsing a free argument with specific format fails on bad argument. */
- public void testParseFormattedFreeArgumentFailsBadArgument() throws Exception
- {
- // Create a command line parser for a formatted free argument.
- CommandLineParser parser =
- new CommandLineParser(new String[][]
- {
- { "1", "Test Free Argument.", "test", null, "^test$" }
- });
-
- // Check that the parser signals an error for a badly formatted argument.
- boolean testPassed = false;
-
- try
- {
- // Parse a command line with this option set incorrectly.
- Properties testProps = parser.parseCommandLine(new String[] { "fail" });
- }
- catch (IllegalArgumentException e)
- {
- testPassed = true;
- }
-
- assertTrue("IllegalArgumentException not thrown when a badly formatted argument was set.", testPassed);
- }
-
- /** Check that parsing a free argument with specific format works ok. */
- public void testParseFormattedFreeArgumentOk() throws Exception
- {
- // Create a command line parser for a formatted free argument.
- CommandLineParser parser =
- new CommandLineParser(new String[][]
- {
- { "1", "Test Free Argument.", "test", null, "^test$" }
- });
-
- // Parse a command line with this argument set correctly.
- Properties testProps = parser.parseCommandLine(new String[] { "test" });
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"),
- "test".equals(testProps.get("1")));
- }
-
- /** Check that parsing an option with specific argument format fails on bad argument. */
- public void testParseFormattedOptionArgumentFailsBadArgument() throws Exception
- {
- // Create a command line parser for a formatted option.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "t", "Test Option.", "test", null, "^test$" }
- });
-
- // Check that the parser signals an error for a badly formatted argument.
- boolean testPassed = false;
-
- try
- {
- // Parse a command line with this option set incorrectly.
- Properties testProps = parser.parseCommandLine(new String[] { "-t", "fail" });
- }
- catch (IllegalArgumentException e)
- {
- testPassed = true;
- }
-
- assertTrue("IllegalArgumentException not thrown when a badly formatted argument was set.", testPassed);
- }
-
- /** Check that parsing an option with specific argument format works ok. */
- public void testParseFormattedOptionArgumentOk() throws Exception
- {
- // Create a command line parser for a formatted option.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "t", "Test Option.", "test", null, "^test$" }
- });
-
- // Parse a command line with this option set correctly.
- Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" });
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"),
- "test".equals(testProps.get("t")));
- }
-
- /** Check that parsing a free argument works ok. */
- public void testParseFreeArgumentOk() throws Exception
- {
- // Create a command line parser for a free argument.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "1", "Test Free Argument.", "test" }
- });
-
- // Parse a command line with this argument set.
- Properties testProps = parser.parseCommandLine(new String[] { "test" });
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"),
- "test".equals(testProps.get("1")));
- }
-
- /** Check that parsing a mandatory option works ok. */
- public void testParseMandatoryOptionOk() throws Exception
- {
- // Create a command line parser for a mandatory option.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "t", "Test Option.", "test", "true" }
- });
-
- // Parse a command line with this option set correctly.
- Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" });
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"),
- "test".equals(testProps.get("t")));
- }
-
- /** Check that parsing a mandatory free argument works ok. */
- public void testParseMandatoryFreeArgumentOk() throws Exception
- {
- // Create a command line parser for a mandatory free argument.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "1", "Test Option.", "test", "true" }
- });
-
- // Parse a command line with this argument set.
- Properties testProps = parser.parseCommandLine(new String[] { "test" });
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"),
- "test".equals(testProps.get("1")));
- }
-
- /** Check that parsing a mandatory free argument fails when no argument is specified. */
- public void testParseManadatoryFreeArgumentFailsNoArgument() throws Exception
- {
- // Create a command line parser for a mandatory free argument.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "1", "Test Option.", "test", "true" }
- });
-
- // Check that parsing fails when this mandatory free argument is missing.
- boolean testPassed = false;
-
- try
- {
- // Parse a command line with this free argument not set.
- Properties testProps = parser.parseCommandLine(new String[] {});
- }
- catch (IllegalArgumentException e)
- {
- testPassed = true;
- }
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("IllegalArgumentException not thrown for a missing mandatory option.", testPassed);
- }
-
- /** Check that parsing a mandatory option fails when no option is set. */
- public void testParseMandatoryFailsNoOption() throws Exception
- {
- // Create a command line parser for a mandatory option.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "t", "Test Option.", "test", "true" }
- });
-
- // Check that parsing fails when this mandatory option is missing.
- boolean testPassed = false;
-
- try
- {
- // Parse a command line with this option not set.
- Properties testProps = parser.parseCommandLine(new String[] {});
- }
- catch (IllegalArgumentException e)
- {
- testPassed = true;
- }
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("IllegalArgumentException not thrown for a missing mandatory option.", testPassed);
- }
-
- /** Check that parsing an option with no space between it and its argument works ok. */
- public void testParseOptionWithNoSpaceOk() throws Exception
- {
- // Create a command line parser for an option.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "t", "Test Option.", "test" }
- });
-
- // Parse a command line with this option set with no space.
- Properties testProps = parser.parseCommandLine(new String[] { "-ttest" });
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"),
- "test".equals(testProps.get("t")));
- }
-
- /** Check that parsing an option with a space between it and its argument works ok. */
- public void testParseOptionWithSpaceOk() throws Exception
- {
- // Create a command line parser for an option.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "t", "Test Option.", "test" }
- });
-
- // Parse a command line with this option set with a space.
- Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" });
-
- // Check that the resultant properties contains the correctly parsed option.
- assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"),
- "test".equals(testProps.get("t")));
- }
-
- /** Check that parsing a single flag works ok. */
- public void testParseSingleFlagOk() throws Exception
- {
- // Create a command line parser for a single flag.
- CommandLineParser parser = new CommandLineParser(new String[][]
- {
- { "t", "Test Flag." }
- });
-
- // Parse a command line with the single flag set.
- Properties testProps = parser.parseCommandLine(new String[] { "-t" });
-
- // Check that the flag is set in the parsed properties.
- assertTrue("The t flag was not \"true\", it was: " + testProps.get("t"), "true".equals(testProps.get("t")));
-
- // Reset the parser.
- parser.reset();
-
- // Parse a command line with the single flag not set.
- testProps = parser.parseCommandLine(new String[] {});
-
- // Check that the flag is cleared in the parsed properties.
- assertTrue("The t flag was not \"false\", it was: " + testProps.get("t"), "false".equals(testProps.get("t")));
- }
-
- /** Check that parsing an unknown option works when unknowns not errors. */
- public void testParseUnknownOptionOk() throws Exception
- {
- // Create a command line parser for no flags or options
- CommandLineParser parser = new CommandLineParser(new String[][] {});
-
- // Check that parsing does not fail on an unknown flag.
- try
- {
- parser.parseCommandLine(new String[] { "-t" });
- }
- catch (IllegalArgumentException e)
- {
- fail("The parser threw an IllegalArgumentException on an unknown flag when errors on unkowns is off.");
- }
- }
-
- /** Check that parsing an unknown flag fails when unknowns are to be reported as errors. */
- public void testParseUnknownFlagFailsWhenUnknownsAreErrors() throws Exception
- {
- // Create a command line parser for no flags or options
- CommandLineParser parser = new CommandLineParser(new String[][] {});
-
- // Turn on fail on unknowns mode.
- parser.setErrorsOnUnknowns(true);
-
- // Check that parsing fails on an unknown flag.
- boolean testPassed = false;
-
- try
- {
- parser.parseCommandLine(new String[] { "-t" });
- }
- catch (IllegalArgumentException e)
- {
- testPassed = true;
- }
-
- assertTrue("IllegalArgumentException not thrown for an unknown flag when errors on unknowns mode is on.",
- testPassed);
- }
-
- /** Check that parsing an unknown option fails when unknowns are to be reported as errors. */
- public void testParseUnknownOptionFailsWhenUnknownsAreErrors() throws Exception
- {
- // Create a command line parser for no flags or options
- CommandLineParser parser = new CommandLineParser(new String[][] {});
-
- // Turn on fail on unknowns mode.
- parser.setErrorsOnUnknowns(true);
-
- // Check that parsing fails on an unknown flag.
- boolean testPassed = false;
-
- try
- {
- parser.parseCommandLine(new String[] { "-t", "test" });
- }
- catch (IllegalArgumentException e)
- {
- testPassed = true;
- }
-
- assertTrue("IllegalArgumentException not thrown for an unknown option when errors on unknowns mode is on.",
- testPassed);
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java
deleted file mode 100644
index d6767eb9c0..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import junit.framework.TestCase;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Properties;
-
-public class FileUtilsTest extends TestCase
-{
- private static final String COPY = "-Copy";
- private static final String SUB = "-Sub";
-
- /**
- * Additional test for the copy method.
- * Ensures that the directory count did increase by more than 1 after the copy.
- */
- public void testCopyFile()
- {
- final String TEST_DATA = "FileUtilsTest-testCopy-TestDataTestDataTestDataTestDataTestDataTestData";
- String fileName = "FileUtilsTest-testCopy";
- String fileNameCopy = fileName + COPY;
-
- File[] beforeCopyFileList = null;
-
- //Create initial file
- File test = createTestFile(fileName, TEST_DATA);
-
- try
- {
- //Check number of files before copy
- beforeCopyFileList = test.getAbsoluteFile().getParentFile().listFiles();
- int beforeCopy = beforeCopyFileList.length;
-
- //Perform Copy
- File destination = new File(fileNameCopy);
- FileUtils.copy(test, destination);
- //Ensure the JVM cleans up if cleanup failues
- destination.deleteOnExit();
-
- //Retrieve counts after copy
- int afterCopy = test.getAbsoluteFile().getParentFile().listFiles().length;
-
- int afterCopyFromCopy = new File(fileNameCopy).getAbsoluteFile().getParentFile().listFiles().length;
-
- // Validate the copy counts
- assertEquals("The file listing from the original and the copy differ in length.", afterCopy, afterCopyFromCopy);
- assertEquals("The number of files did not increase.", beforeCopy + 1, afterCopy);
- assertEquals("The number of files did not increase.", beforeCopy + 1, afterCopyFromCopy);
-
- //Validate copy
- // Load content
- String copiedFileContent = FileUtils.readFileAsString(fileNameCopy);
- assertEquals(TEST_DATA, copiedFileContent);
- }
- finally // Ensure clean
- {
- //Clean up
- assertTrue("Unable to cleanup", FileUtils.deleteFile(fileNameCopy));
-
- //Check file list after cleanup
- File[] afterCleanup = new File(test.getAbsoluteFile().getParent()).listFiles();
- checkFileLists(beforeCopyFileList, afterCleanup);
-
- //Remove original file
- assertTrue("Unable to cleanup", test.delete());
- }
- }
-
- /**
- * Create and Copy the following structure:
- *
- * testDirectory --+
- * +-- testSubDirectory --+
- * +-- testSubFile
- * +-- File
- *
- * to testDirectory-Copy
- *
- * Validate that the file count in the copy is correct and contents of the copied files is correct.
- */
- public void testCopyRecursive()
- {
- final String TEST_DATA = "FileUtilsTest-testDirectoryCopy-TestDataTestDataTestDataTestDataTestDataTestData";
- String fileName = "FileUtilsTest-testCopy";
- String TEST_DIR = "testDirectoryCopy";
-
- //Create Initial Structure
- File testDir = new File(TEST_DIR);
-
- //Check number of files before copy
- File[] beforeCopyFileList = testDir.getAbsoluteFile().getParentFile().listFiles();
-
- try
- {
- //Create Directories
- assertTrue("Test directory already exists cannot test.", !testDir.exists());
-
- if (!testDir.mkdir())
- {
- fail("Unable to make test Directory");
- }
-
- File testSubDir = new File(TEST_DIR + File.separator + TEST_DIR + SUB);
- if (!testSubDir.mkdir())
- {
- fail("Unable to make test sub Directory");
- }
-
- //Create Files
- createTestFile(testDir.toString() + File.separator + fileName, TEST_DATA);
- createTestFile(testSubDir.toString() + File.separator + fileName + SUB, TEST_DATA);
-
- //Ensure the JVM cleans up if cleanup failues
- testSubDir.deleteOnExit();
- testDir.deleteOnExit();
-
- //Perform Copy
- File copyDir = new File(testDir.toString() + COPY);
- try
- {
- FileUtils.copyRecursive(testDir, copyDir);
- }
- catch (FileNotFoundException e)
- {
- fail(e.getMessage());
- }
- catch (FileUtils.UnableToCopyException e)
- {
- fail(e.getMessage());
- }
-
- //Validate Copy
- assertEquals("Copied directory should only have one file and one directory in it.", 2, copyDir.listFiles().length);
-
- //Validate Copy File Contents
- String copiedFileContent = FileUtils.readFileAsString(copyDir.toString() + File.separator + fileName);
- assertEquals(TEST_DATA, copiedFileContent);
-
- //Validate Name of Sub Directory
- assertTrue("Expected subdirectory is not a directory", new File(copyDir.toString() + File.separator + TEST_DIR + SUB).isDirectory());
-
- //Assert that it contains only one item
- assertEquals("Copied sub directory should only have one directory in it.", 1, new File(copyDir.toString() + File.separator + TEST_DIR + SUB).listFiles().length);
-
- //Validate content of Sub file
- copiedFileContent = FileUtils.readFileAsString(copyDir.toString() + File.separator + TEST_DIR + SUB + File.separator + fileName + SUB);
- assertEquals(TEST_DATA, copiedFileContent);
- }
- finally
- {
- //Clean up source and copy directory.
- assertTrue("Unable to cleanup", FileUtils.delete(testDir, true));
- assertTrue("Unable to cleanup", FileUtils.delete(new File(TEST_DIR + COPY), true));
-
- //Check file list after cleanup
- File[] afterCleanup = testDir.getAbsoluteFile().getParentFile().listFiles();
- checkFileLists(beforeCopyFileList, afterCleanup);
- }
- }
-
-
- /**
- * Helper method to create a temporary file with test content.
- *
- * @param test_data The data to store in the file
- *
- * @return The File reference
- */
- private File createTestFileInTmpDir(final String testData) throws Exception
- {
- final File tmpFile = File.createTempFile("test", "tmp");
-
- return createTestFile(tmpFile.getCanonicalPath(), testData);
- }
- /**
- * Helper method to create a test file with a string content
- *
- * @param fileName The fileName to use in the creation
- * @param test_data The data to store in the file
- *
- * @return The File reference
- */
- private File createTestFile(String fileName, String test_data)
- {
- File test = new File(fileName);
-
- try
- {
- test.createNewFile();
- //Ensure the JVM cleans up if cleanup failues
- test.deleteOnExit();
- }
- catch (IOException e)
- {
- fail(e.getMessage());
- }
-
- BufferedWriter writer = null;
- try
- {
- writer = new BufferedWriter(new FileWriter(test));
- try
- {
- writer.write(test_data);
- }
- catch (IOException e)
- {
- fail(e.getMessage());
- }
- }
- catch (IOException e)
- {
- fail(e.getMessage());
- }
- finally
- {
- try
- {
- if (writer != null)
- {
- writer.close();
- }
- }
- catch (IOException e)
- {
- fail(e.getMessage());
- }
- }
-
- return test;
- }
-
- /** Test that deleteFile only deletes the specified file */
- public void testDeleteFile()
- {
- File test = new File("FileUtilsTest-testDelete");
- //Record file count in parent directory to check it is not changed by delete
- String path = test.getAbsolutePath();
- File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountBefore = filesBefore.length;
-
- try
- {
- test.createNewFile();
- //Ensure the JVM cleans up if cleanup failues
- test.deleteOnExit();
- }
- catch (IOException e)
- {
- fail(e.getMessage());
- }
-
- assertTrue("File does not exists", test.exists());
- assertTrue("File is not a file", test.isFile());
-
- //Check that file creation can be seen on disk
- int fileCountCreated = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles().length;
- assertEquals("File creation was no registered", fileCountBefore + 1, fileCountCreated);
-
- //Perform Delete
- assertTrue("Unable to cleanup", FileUtils.deleteFile("FileUtilsTest-testDelete"));
-
- assertTrue("File exists after delete", !test.exists());
-
- //Check that after deletion the file count is now accurate
- File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountAfter = filesAfter.length;
- assertEquals("File creation was no registered", fileCountBefore, fileCountAfter);
-
- checkFileLists(filesBefore, filesAfter);
- }
-
- public void testDeleteNonExistentFile()
- {
- File test = new File("FileUtilsTest-testDelete-" + System.currentTimeMillis());
-
- assertTrue("File exists", !test.exists());
- assertFalse("File is a directory", test.isDirectory());
-
- assertTrue("Delete Succeeded ", !FileUtils.delete(test, true));
- }
-
- public void testDeleteNull()
- {
- try
- {
- FileUtils.delete(null, true);
- fail("Delete with null value should throw NPE.");
- }
- catch (NullPointerException npe)
- {
- // expected path
- }
- }
-
- /**
- * Tests that openFileOrDefaultResource can open a file on the filesystem.
- *
- */
- public void testOpenFileOrDefaultResourceOpensFileOnFileSystem() throws Exception
- {
- final File testFile = createTestFileInTmpDir("src=tmpfile");
- final String filenameOnFilesystem = testFile.getCanonicalPath();
- final String defaultResource = "org/apache/qpid/util/default.properties";
-
-
- final InputStream is = FileUtils.openFileOrDefaultResource(filenameOnFilesystem, defaultResource, this.getClass().getClassLoader());
- assertNotNull("Stream must not be null", is);
- final Properties p = new Properties();
- p.load(is);
- assertEquals("tmpfile", p.getProperty("src"));
- }
-
- /**
- * Tests that openFileOrDefaultResource can open a file on the classpath.
- *
- */
- public void testOpenFileOrDefaultResourceOpensFileOnClasspath() throws Exception
- {
- final String mydefaultsResource = "org/apache/qpid/util/mydefaults.properties";
- final String defaultResource = "org/apache/qpid/util/default.properties";
-
-
- final InputStream is = FileUtils.openFileOrDefaultResource(mydefaultsResource, defaultResource, this.getClass().getClassLoader());
- assertNotNull("Stream must not be null", is);
- final Properties p = new Properties();
- p.load(is);
- assertEquals("mydefaults", p.getProperty("src"));
- }
-
- /**
- * Tests that openFileOrDefaultResource returns the default resource when file cannot be found.
- */
- public void testOpenFileOrDefaultResourceOpensDefaultResource() throws Exception
- {
- final File fileThatDoesNotExist = new File("/does/not/exist.properties");
- assertFalse("Test must not exist", fileThatDoesNotExist.exists());
-
- final String defaultResource = "org/apache/qpid/util/default.properties";
-
- final InputStream is = FileUtils.openFileOrDefaultResource(fileThatDoesNotExist.getCanonicalPath(), defaultResource, this.getClass().getClassLoader());
- assertNotNull("Stream must not be null", is);
- Properties p = new Properties();
- p.load(is);
- assertEquals("default.properties", p.getProperty("src"));
- }
-
- /**
- * Tests that openFileOrDefaultResource returns null if neither the file nor
- * the default resource can be found..
- */
- public void testOpenFileOrDefaultResourceReturnsNullWhenNeitherCanBeFound() throws Exception
- {
-
- final String mydefaultsResource = "org/apache/qpid/util/doesnotexisteiether.properties";
- final String defaultResource = "org/apache/qpid/util/doesnotexisteiether.properties";
-
- final InputStream is = FileUtils.openFileOrDefaultResource(mydefaultsResource, defaultResource, this.getClass().getClassLoader());
- assertNull("Stream must be null", is);
- }
-
- /**
- * Given two lists of File arrays ensure they are the same length and all entries in Before are in After
- *
- * @param filesBefore File[]
- * @param filesAfter File[]
- */
- private void checkFileLists(File[] filesBefore, File[] filesAfter)
- {
- assertNotNull("Before file list cannot be null", filesBefore);
- assertNotNull("After file list cannot be null", filesAfter);
-
- assertEquals("File lists are unequal", filesBefore.length, filesAfter.length);
-
- for (File fileBefore : filesBefore)
- {
- boolean found = false;
-
- for (File fileAfter : filesAfter)
- {
- if (fileBefore.getAbsolutePath().equals(fileAfter.getAbsolutePath()))
- {
- found = true;
- break;
- }
- }
-
- assertTrue("File'" + fileBefore.getName() + "' was not in directory afterwards", found);
- }
- }
-
- public void testNonRecursiveNonEmptyDirectoryDeleteFails()
- {
- String directoryName = "FileUtilsTest-testRecursiveDelete";
- File test = new File(directoryName);
-
- //Record file count in parent directory to check it is not changed by delete
- String path = test.getAbsolutePath();
- File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountBefore = filesBefore.length;
-
- assertTrue("Directory exists", !test.exists());
-
- test.mkdir();
-
- //Create a file in the directory
- String fileName = test.getAbsolutePath() + File.separatorChar + "testFile";
- File subFile = new File(fileName);
- try
- {
- subFile.createNewFile();
- //Ensure the JVM cleans up if cleanup failues
- subFile.deleteOnExit();
- }
- catch (IOException e)
- {
- fail(e.getMessage());
- }
- //Ensure the JVM cleans up if cleanup failues
- // This must be after the subFile as the directory must be empty before
- // the delete is performed
- test.deleteOnExit();
-
- //Try and delete the non-empty directory
- assertFalse("Non Empty Directory was successfully deleted.", FileUtils.deleteDirectory(directoryName));
-
- //Check directory is still there
- assertTrue("Directory was deleted.", test.exists());
-
- // Clean up
- assertTrue("Unable to cleanup", FileUtils.delete(test, true));
-
- //Check that after deletion the file count is now accurate
- File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountAfter = filesAfter.length;
- assertEquals("File creation was no registered", fileCountBefore, fileCountAfter);
-
- checkFileLists(filesBefore, filesAfter);
- }
-
- /** Test that an empty directory can be deleted with deleteDirectory */
- public void testEmptyDirectoryDelete()
- {
- String directoryName = "FileUtilsTest-testRecursiveDelete";
- File test = new File(directoryName);
-
- //Record file count in parent directory to check it is not changed by delete
- String path = test.getAbsolutePath();
- File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountBefore = filesBefore.length;
-
- assertTrue("Directory exists", !test.exists());
-
- test.mkdir();
- //Ensure the JVM cleans up if cleanup failues
- test.deleteOnExit();
-
- //Try and delete the empty directory
- assertTrue("Non Empty Directory was successfully deleted.", FileUtils.deleteDirectory(directoryName));
-
- //Check directory is still there
- assertTrue("Directory was deleted.", !test.exists());
-
- //Check that after deletion the file count is now accurate
- File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountAfter = filesAfter.length;
- assertEquals("File creation was no registered", fileCountBefore, fileCountAfter);
-
- checkFileLists(filesBefore, filesAfter);
-
- }
-
- /** Test that deleteDirectory on a non empty directory to complete */
- public void testNonEmptyDirectoryDelete()
- {
- String directoryName = "FileUtilsTest-testRecursiveDelete";
- File test = new File(directoryName);
-
- assertTrue("Directory exists", !test.exists());
-
- //Record file count in parent directory to check it is not changed by delete
- String path = test.getAbsolutePath();
- File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountBefore = filesBefore.length;
-
- test.mkdir();
-
- //Create a file in the directory
- String fileName = test.getAbsolutePath() + File.separatorChar + "testFile";
- File subFile = new File(fileName);
- try
- {
- subFile.createNewFile();
- //Ensure the JVM cleans up if cleanup failues
- subFile.deleteOnExit();
- }
- catch (IOException e)
- {
- fail(e.getMessage());
- }
-
- // Ensure the JVM cleans up if cleanup failues
- // This must be after the subFile as the directory must be empty before
- // the delete is performed
- test.deleteOnExit();
-
- //Try and delete the non-empty directory non-recursively
- assertFalse("Non Empty Directory was successfully deleted.", FileUtils.delete(test, false));
-
- //Check directory is still there
- assertTrue("Directory was deleted.", test.exists());
-
- // Clean up
- assertTrue("Unable to cleanup", FileUtils.delete(test, true));
-
- //Check that after deletion the file count is now accurate
- File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountAfter = filesAfter.length;
- assertEquals("File creation was no registered", fileCountBefore, fileCountAfter);
-
- checkFileLists(filesBefore, filesAfter);
-
- }
-
- /** Test that a recursive delete successeds */
- public void testRecursiveDelete()
- {
- String directoryName = "FileUtilsTest-testRecursiveDelete";
- File test = new File(directoryName);
-
- assertTrue("Directory exists", !test.exists());
-
- //Record file count in parent directory to check it is not changed by delete
- String path = test.getAbsolutePath();
- File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountBefore = filesBefore.length;
-
- test.mkdir();
-
- createSubDir(directoryName, 2, 4);
-
- //Ensure the JVM cleans up if cleanup failues
- // This must be after the sub dir creation as the delete order is
- // recorded and the directory must be empty to be deleted.
- test.deleteOnExit();
-
- assertFalse("Non recursive delete was able to directory", FileUtils.delete(test, false));
-
- assertTrue("File does not exist after non recursive delete", test.exists());
-
- assertTrue("Unable to cleanup", FileUtils.delete(test, true));
-
- assertTrue("File exist after recursive delete", !test.exists());
-
- //Check that after deletion the file count is now accurate
- File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles();
- int fileCountAfter = filesAfter.length;
- assertEquals("File creation was no registered", fileCountBefore, fileCountAfter);
-
- checkFileLists(filesBefore, filesAfter);
-
- }
-
- private void createSubDir(String path, int directories, int files)
- {
- File directory = new File(path);
-
- assertTrue("Directory" + path + " does not exists", directory.exists());
-
- for (int dir = 0; dir < directories; dir++)
- {
- String subDirName = path + File.separatorChar + "sub" + dir;
- File subDir = new File(subDirName);
-
- subDir.mkdir();
-
- createSubDir(subDirName, directories - 1, files);
- //Ensure the JVM cleans up if cleanup failues
- // This must be after the sub dir creation as the delete order is
- // recorded and the directory must be empty to be deleted.
- subDir.deleteOnExit();
- }
-
- for (int file = 0; file < files; file++)
- {
- String subDirName = path + File.separatorChar + "file" + file;
- File subFile = new File(subDirName);
- try
- {
- subFile.createNewFile();
- //Ensure the JVM cleans up if cleanup failues
- subFile.deleteOnExit();
- }
- catch (IOException e)
- {
- fail(e.getMessage());
- }
- }
- }
-
- public static final String SEARCH_STRING = "testSearch";
-
- /**
- * Test searchFile(File file, String search) will find a match when it
- * exists.
- *
- * @throws java.io.IOException if unable to perform test setup
- */
- public void testSearchSucceed() throws IOException
- {
- File _logfile = File.createTempFile("FileUtilsTest-testSearchSucceed", ".out");
-
- prepareFileForSearchTest(_logfile);
-
- List<String> results = FileUtils.searchFile(_logfile, SEARCH_STRING);
-
- assertNotNull("Null result set returned", results);
-
- assertEquals("Results do not contain expected count", 1, results.size());
- }
-
- /**
- * Test searchFile(File file, String search) will not find a match when the
- * test string does not exist.
- *
- * @throws java.io.IOException if unable to perform test setup
- */
- public void testSearchFail() throws IOException
- {
- File _logfile = File.createTempFile("FileUtilsTest-testSearchFail", ".out");
-
- prepareFileForSearchTest(_logfile);
-
- List<String> results = FileUtils.searchFile(_logfile, "Hello");
-
- assertNotNull("Null result set returned", results);
-
- //Validate we only got one message
- if (results.size() > 0)
- {
- System.err.println("Unexpected messages");
-
- for (String msg : results)
- {
- System.err.println(msg);
- }
- }
-
- assertEquals("Results contains data when it was not expected",
- 0, results.size());
- }
-
- /**
- * Write the SEARCH_STRING in to the given file.
- *
- * @param logfile The file to write the SEARCH_STRING into
- *
- * @throws IOException if an error occurs
- */
- private void prepareFileForSearchTest(File logfile) throws IOException
- {
- BufferedWriter writer = new BufferedWriter(new FileWriter(logfile));
- writer.append(SEARCH_STRING);
- writer.flush();
- writer.close();
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/GZIPUtilsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/GZIPUtilsTest.java
deleted file mode 100644
index 60e80da15f..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/GZIPUtilsTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-import junit.framework.TestCase;
-
-public class GZIPUtilsTest extends TestCase
-{
- public void testCompressUncompress() throws Exception
- {
- byte[] data = new byte[1024];
- Arrays.fill(data, (byte)'a');
- byte[] compressed = GZIPUtils.compressBufferToArray(ByteBuffer.wrap(data));
- assertTrue("Compression didn't compress", compressed.length < data.length);
- byte[] uncompressed = GZIPUtils.uncompressBufferToArray(ByteBuffer.wrap(compressed));
- assertTrue("Compression not reversible", Arrays.equals(data,uncompressed));
- }
-
- public void testUncompressNonZipReturnsNull() throws Exception
- {
- byte[] data = new byte[1024];
- Arrays.fill(data, (byte)'a');
- assertNull("Non zipped data should not uncompress", GZIPUtils.uncompressBufferToArray(ByteBuffer.wrap(data)));
- }
-
- public void testUncompressStreamWithErrorReturnsNull() throws Exception
- {
- InputStream is = new InputStream()
- {
- @Override
- public int read() throws IOException
- {
- throw new IOException();
- }
- };
- assertNull("Stream error should return null", GZIPUtils.uncompressStreamToArray(is));
- }
-
-
- public void testUncompressNullStreamReturnsNull() throws Exception
- {
- assertNull("Null Stream should return null", GZIPUtils.uncompressStreamToArray(null));
- }
- public void testUncompressNullBufferReturnsNull() throws Exception
- {
- assertNull("Null buffer should return null", GZIPUtils.uncompressBufferToArray(null));
- }
-
- public void testCompressNullArrayReturnsNull()
- {
- assertNull(GZIPUtils.compressBufferToArray(null));
- }
-
- public void testNonHeapBuffers() throws Exception
- {
-
- byte[] data = new byte[1024];
- Arrays.fill(data, (byte)'a');
- ByteBuffer directBuffer = ByteBuffer.allocateDirect(1024);
- directBuffer.put(data);
- directBuffer.flip();
-
- byte[] compressed = GZIPUtils.compressBufferToArray(directBuffer);
-
- assertTrue("Compression didn't compress", compressed.length < data.length);
-
- directBuffer.clear();
- directBuffer.position(1);
- directBuffer = directBuffer.slice();
- directBuffer.put(compressed);
- directBuffer.flip();
-
- byte[] uncompressed = GZIPUtils.uncompressBufferToArray(directBuffer);
-
- assertTrue("Compression not reversible", Arrays.equals(data,uncompressed));
-
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java
deleted file mode 100644
index c5464aab79..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import org.apache.qpid.configuration.PropertyException;
-import org.apache.qpid.configuration.PropertyUtils;
-import org.apache.qpid.test.utils.QpidTestCase;
-
-public class PropertyUtilsTest extends QpidTestCase
-{
- public void testSimpleExpansion() throws PropertyException
- {
- System.setProperty("banana", "fruity");
- String expandedProperty = PropertyUtils.replaceProperties("${banana}");
- assertEquals(expandedProperty, "fruity");
- }
-
- public void testDualExpansion() throws PropertyException
- {
- System.setProperty("banana", "fruity");
- System.setProperty("concrete", "horrible");
- String expandedProperty = PropertyUtils.replaceProperties("${banana}xyz${concrete}");
- assertEquals(expandedProperty, "fruityxyzhorrible");
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java
deleted file mode 100644
index c3fcf73b38..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-
-import junit.framework.TestCase;
-
-/**
- *Junit tests for the Serial class
- */
-public class SerialTest extends TestCase
-{
-
- /**
- * Test the key boundaries where wraparound occurs.
- */
- public void testBoundaries()
- {
- assertTrue(Serial.gt(1, 0));
- assertTrue(Serial.lt(0, 1));
-
- assertTrue(Serial.gt(Integer.MAX_VALUE+1, Integer.MAX_VALUE));
- assertTrue(Serial.lt(Integer.MAX_VALUE, Integer.MAX_VALUE+1));
-
- assertTrue(Serial.gt(0xFFFFFFFF + 1, 0xFFFFFFFF));
- assertTrue(Serial.lt(0xFFFFFFFF, 0xFFFFFFFF + 1));
- }
-
- /**
- * Test the first Corollary of RFC 1982
- * For any sequence number s and any integer n such that addition of n
- * to s is well defined, (s + n) >= s. Further (s + n) == s only when
- * n == 0, in all other defined cases, (s + n) > s.
- */
- public void testCorollary1()
- {
- int wrapcount = 0;
-
- int s = 0;
-
- for (int i = 0; i < 67108664; i++)
- {
- for (int n = 1; n < 4096; n += 512)
- {
- assertTrue(Serial.gt(s+n, s));
- assertTrue(Serial.lt(s, s+n));
- }
-
- s += 1024;
-
- if (s == 0)
- {
- wrapcount += 1;
- }
- }
-
- assertTrue(wrapcount > 0);
- }
-
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/StringsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/StringsTest.java
deleted file mode 100644
index e513b488e6..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/StringsTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-
-import junit.framework.TestCase;
-
-public class StringsTest extends TestCase
-{
- public void testSubstitutionResolver()
- {
- Strings.MapResolver mapResolver =
- new Strings.MapResolver(Collections.singletonMap("test", "C:\\TEMP\\\"Hello World\""));
-
- Strings.Resolver jsonResolver = Strings.createSubstitutionResolver("json:",
- new LinkedHashMap<String, String>()
- {
- {
- put("\\", "\\\\");
- put("\"", "\\\"");
- }
- });
-
- assertEquals("{ \"path\" : \"C:\\\\TEMP\\\\\\\"Hello World\\\"\\foo\" }",
- Strings.expand("{ \"path\" : \"${json:test}\\foo\" }",Strings.chain(jsonResolver,mapResolver)));
-
- }
-}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/default.properties b/qpid/java/common/src/test/java/org/apache/qpid/util/default.properties
deleted file mode 100644
index 8214cc1fee..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/default.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Used by FileUtilsTests
-src=default.properties \ No newline at end of file
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/mydefaults.properties b/qpid/java/common/src/test/java/org/apache/qpid/util/mydefaults.properties
deleted file mode 100644
index c0a21d08d1..0000000000
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/mydefaults.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Used by FileUtilsTests
-src=mydefaults \ No newline at end of file