summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan Skinner <aidan@apache.org>2008-04-14 10:43:27 +0000
committerAidan Skinner <aidan@apache.org>2008-04-14 10:43:27 +0000
commit2d34e47e824a0871b328acc8ee32dfd95ae35053 (patch)
treeec86fd3ea93a43aa5b82f73bf0939ba947047bb9
parent0858c0e1d36ce3585528ce792f60fecce790406c (diff)
downloadqpid-python-2d34e47e824a0871b328acc8ee32dfd95ae35053.tar.gz
QPID-832 delete for resync with trunk (cpp, ruby) and M2.1 (java/broker)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/thegreatmerge@647726 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/DESIGN79
-rw-r--r--qpid/cpp/DISCLAIMER5
-rw-r--r--qpid/cpp/LICENSE350
-rw-r--r--qpid/cpp/Makefile.am43
-rw-r--r--qpid/cpp/NOTICE25
-rw-r--r--qpid/cpp/README291
-rw-r--r--qpid/cpp/RELEASE_NOTES41
-rwxr-xr-xqpid/cpp/bootstrap32
-rwxr-xr-xqpid/cpp/build-aux/compile142
-rwxr-xr-xqpid/cpp/build-aux/config.guess1501
-rwxr-xr-xqpid/cpp/build-aux/config.rpath614
-rwxr-xr-xqpid/cpp/build-aux/config.sub1619
-rwxr-xr-xqpid/cpp/build-aux/depcomp584
-rwxr-xr-xqpid/cpp/build-aux/install-sh507
-rwxr-xr-xqpid/cpp/build-aux/ltmain.sh6871
-rwxr-xr-xqpid/cpp/build-aux/mdate-sh201
-rwxr-xr-xqpid/cpp/build-aux/missing367
-rw-r--r--qpid/cpp/configure.ac181
-rw-r--r--qpid/cpp/docs/api/Makefile.am18
-rw-r--r--qpid/cpp/docs/api/developer.doxygen.in1241
-rw-r--r--qpid/cpp/docs/api/user.doxygen.in1244
-rw-r--r--qpid/cpp/docs/man/Makefile.am20
-rw-r--r--qpid/cpp/docs/man/qpidd.x46
-rwxr-xr-xqpid/cpp/etc/qpidd79
-rw-r--r--qpid/cpp/etc/qpidd.conf2
-rw-r--r--qpid/cpp/examples/Makefile.am76
-rw-r--r--qpid/cpp/examples/examples/Makefile6
-rw-r--r--qpid/cpp/examples/examples/direct/Makefile10
-rw-r--r--qpid/cpp/examples/examples/direct/declare_queues.cpp86
-rw-r--r--qpid/cpp/examples/examples/direct/direct_producer.cpp106
-rw-r--r--qpid/cpp/examples/examples/direct/listener.cpp90
-rw-r--r--qpid/cpp/examples/examples/direct/verify3
-rw-r--r--qpid/cpp/examples/examples/direct/verify.in15
-rw-r--r--qpid/cpp/examples/examples/direct/verify_cpp_python4
-rw-r--r--qpid/cpp/examples/examples/direct/verify_cpp_python.in14
-rw-r--r--qpid/cpp/examples/examples/direct/verify_python_cpp5
-rw-r--r--qpid/cpp/examples/examples/direct/verify_python_cpp.in15
-rw-r--r--qpid/cpp/examples/examples/fanout/Makefile10
-rw-r--r--qpid/cpp/examples/examples/fanout/fanout_producer.cpp104
-rw-r--r--qpid/cpp/examples/examples/fanout/listener.cpp105
-rw-r--r--qpid/cpp/examples/examples/fanout/verify6
-rw-r--r--qpid/cpp/examples/examples/fanout/verify.in43
-rw-r--r--qpid/cpp/examples/examples/fanout/verify_cpp_python7
-rw-r--r--qpid/cpp/examples/examples/fanout/verify_cpp_python.in31
-rw-r--r--qpid/cpp/examples/examples/fanout/verify_python_cpp7
-rw-r--r--qpid/cpp/examples/examples/fanout/verify_python_cpp.in29
-rw-r--r--qpid/cpp/examples/examples/pub-sub/Makefile10
-rw-r--r--qpid/cpp/examples/examples/pub-sub/topic_listener.cpp175
-rw-r--r--qpid/cpp/examples/examples/pub-sub/topic_publisher.cpp125
-rw-r--r--qpid/cpp/examples/examples/pub-sub/verify4
-rw-r--r--qpid/cpp/examples/examples/pub-sub/verify.in59
-rw-r--r--qpid/cpp/examples/examples/pub-sub/verify_cpp_python6
-rw-r--r--qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in51
-rw-r--r--qpid/cpp/examples/examples/pub-sub/verify_python_cpp6
-rw-r--r--qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in59
-rw-r--r--qpid/cpp/examples/examples/request-response/Makefile10
-rw-r--r--qpid/cpp/examples/examples/request-response/client.cpp179
-rw-r--r--qpid/cpp/examples/examples/request-response/server.cpp165
-rw-r--r--qpid/cpp/examples/examples/request-response/verify5
-rw-r--r--qpid/cpp/examples/examples/request-response/verify.in19
-rw-r--r--qpid/cpp/examples/examples/request-response/verify_cpp_python5
-rw-r--r--qpid/cpp/examples/examples/request-response/verify_cpp_python.in15
-rw-r--r--qpid/cpp/examples/examples/request-response/verify_python_cpp5
-rw-r--r--qpid/cpp/examples/examples/request-response/verify_python_cpp.in18
-rwxr-xr-xqpid/cpp/examples/verify85
-rwxr-xr-xqpid/cpp/examples/verify_all23
-rw-r--r--qpid/cpp/m4/clock_time.m430
-rw-r--r--qpid/cpp/m4/compiler-flags.m423
-rw-r--r--qpid/cpp/m4/cppunit.m489
-rw-r--r--qpid/cpp/m4/extensions.m458
-rwxr-xr-xqpid/cpp/make-dist83
-rwxr-xr-xqpid/cpp/managementgen/generate.py253
-rwxr-xr-xqpid/cpp/managementgen/main.py50
-rwxr-xr-xqpid/cpp/managementgen/schema.py822
-rw-r--r--qpid/cpp/managementgen/templates/Args.h40
-rw-r--r--qpid/cpp/managementgen/templates/Class.cpp112
-rw-r--r--qpid/cpp/managementgen/templates/Class.h72
-rw-r--r--qpid/cpp/managementgen/templates/Makefile.mk37
-rwxr-xr-xqpid/cpp/qpid-autotools-install205
-rwxr-xr-xqpid/cpp/qpid-config.in98
-rw-r--r--qpid/cpp/qpidc.spec.in243
-rw-r--r--qpid/cpp/rpm/README.qpidd-devel7
-rwxr-xr-xqpid/cpp/rubygen/0-10/specification.rb177
-rwxr-xr-xqpid/cpp/rubygen/99-0/MethodBodyConstVisitor.rb27
-rwxr-xr-xqpid/cpp/rubygen/99-0/MethodBodyDefaultVisitor.rb35
-rwxr-xr-xqpid/cpp/rubygen/99-0/MethodHolder.rb100
-rwxr-xr-xqpid/cpp/rubygen/99-0/Operations.rb96
-rwxr-xr-xqpid/cpp/rubygen/99-0/OperationsInvoker.rb92
-rwxr-xr-xqpid/cpp/rubygen/99-0/Proxy.rb82
-rw-r--r--qpid/cpp/rubygen/99-0/Session.rb195
-rwxr-xr-xqpid/cpp/rubygen/99-0/all_method_bodies.rb21
-rwxr-xr-xqpid/cpp/rubygen/99-0/constants.rb82
-rw-r--r--qpid/cpp/rubygen/99-0/frame_body_lists.rb31
-rw-r--r--qpid/cpp/rubygen/99-0/structs.rb538
-rwxr-xr-xqpid/cpp/rubygen/MethodBodyDefaultVisitor.rb34
-rw-r--r--qpid/cpp/rubygen/README17
-rwxr-xr-xqpid/cpp/rubygen/amqpgen.rb490
-rwxr-xr-xqpid/cpp/rubygen/cppgen.rb332
-rwxr-xr-xqpid/cpp/rubygen/generate104
-rw-r--r--qpid/cpp/src/Makefile.am470
-rw-r--r--qpid/cpp/src/cluster.mk24
-rwxr-xr-xqpid/cpp/src/generate.sh48
-rwxr-xr-xqpid/cpp/src/prof18
-rw-r--r--qpid/cpp/src/qpid/DataDir.cpp79
-rw-r--r--qpid/cpp/src/qpid/DataDir.h47
-rw-r--r--qpid/cpp/src/qpid/Exception.cpp62
-rw-r--r--qpid/cpp/src/qpid/Exception.h84
-rw-r--r--qpid/cpp/src/qpid/IList.h196
-rw-r--r--qpid/cpp/src/qpid/ISList.h176
-rw-r--r--qpid/cpp/src/qpid/InlineAllocator.h69
-rw-r--r--qpid/cpp/src/qpid/InlineVector.h68
-rw-r--r--qpid/cpp/src/qpid/Msg.h61
-rw-r--r--qpid/cpp/src/qpid/Options.cpp160
-rw-r--r--qpid/cpp/src/qpid/Options.h150
-rw-r--r--qpid/cpp/src/qpid/Plugin.cpp40
-rw-r--r--qpid/cpp/src/qpid/Plugin.h98
-rw-r--r--qpid/cpp/src/qpid/RefCounted.h86
-rw-r--r--qpid/cpp/src/qpid/Serializer.h109
-rw-r--r--qpid/cpp/src/qpid/SharedObject.h55
-rw-r--r--qpid/cpp/src/qpid/Url.cpp174
-rw-r--r--qpid/cpp/src/qpid/Url.h109
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Codec.h187
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Decimal.h52
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/built_in_types.h108
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/helpers.cpp30
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/helpers.h67
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/visitors.h15
-rw-r--r--qpid/cpp/src/qpid/assert.cpp44
-rw-r--r--qpid/cpp/src/qpid/assert.h38
-rw-r--r--qpid/cpp/src/qpid/broker/Bridge.cpp98
-rw-r--r--qpid/cpp/src/qpid/broker/Bridge.h64
-rw-r--r--qpid/cpp/src/qpid/broker/Broker.cpp300
-rw-r--r--qpid/cpp/src/qpid/broker/Broker.h153
-rw-r--r--qpid/cpp/src/qpid/broker/BrokerAdapter.cpp353
-rw-r--r--qpid/cpp/src/qpid/broker/BrokerAdapter.h199
-rw-r--r--qpid/cpp/src/qpid/broker/BrokerSingleton.cpp36
-rw-r--r--qpid/cpp/src/qpid/broker/BrokerSingleton.h52
-rw-r--r--qpid/cpp/src/qpid/broker/Connection.cpp327
-rw-r--r--qpid/cpp/src/qpid/broker/Connection.h117
-rw-r--r--qpid/cpp/src/qpid/broker/ConnectionFactory.cpp45
-rw-r--r--qpid/cpp/src/qpid/broker/ConnectionFactory.h47
-rw-r--r--qpid/cpp/src/qpid/broker/ConnectionHandler.cpp158
-rw-r--r--qpid/cpp/src/qpid/broker/ConnectionHandler.h92
-rw-r--r--qpid/cpp/src/qpid/broker/ConnectionState.h84
-rw-r--r--qpid/cpp/src/qpid/broker/ConnectionToken.h38
-rw-r--r--qpid/cpp/src/qpid/broker/Consumer.h65
-rw-r--r--qpid/cpp/src/qpid/broker/Daemon.cpp192
-rw-r--r--qpid/cpp/src/qpid/broker/Daemon.h81
-rw-r--r--qpid/cpp/src/qpid/broker/Deliverable.h40
-rw-r--r--qpid/cpp/src/qpid/broker/DeliverableMessage.cpp43
-rw-r--r--qpid/cpp/src/qpid/broker/DeliverableMessage.h43
-rw-r--r--qpid/cpp/src/qpid/broker/DeliveryAdapter.h52
-rw-r--r--qpid/cpp/src/qpid/broker/DeliveryId.h35
-rw-r--r--qpid/cpp/src/qpid/broker/DeliveryRecord.cpp182
-rw-r--r--qpid/cpp/src/qpid/broker/DeliveryRecord.h106
-rw-r--r--qpid/cpp/src/qpid/broker/DeliveryToken.h45
-rw-r--r--qpid/cpp/src/qpid/broker/DirectExchange.cpp151
-rw-r--r--qpid/cpp/src/qpid/broker/DirectExchange.h62
-rw-r--r--qpid/cpp/src/qpid/broker/DtxAck.cpp59
-rw-r--r--qpid/cpp/src/qpid/broker/DtxAck.h47
-rw-r--r--qpid/cpp/src/qpid/broker/DtxBuffer.cpp83
-rw-r--r--qpid/cpp/src/qpid/broker/DtxBuffer.h56
-rw-r--r--qpid/cpp/src/qpid/broker/DtxHandlerImpl.cpp171
-rw-r--r--qpid/cpp/src/qpid/broker/DtxHandlerImpl.h67
-rw-r--r--qpid/cpp/src/qpid/broker/DtxManager.cpp168
-rw-r--r--qpid/cpp/src/qpid/broker/DtxManager.h74
-rw-r--r--qpid/cpp/src/qpid/broker/DtxTimeout.cpp35
-rw-r--r--qpid/cpp/src/qpid/broker/DtxTimeout.h48
-rw-r--r--qpid/cpp/src/qpid/broker/DtxWorkRecord.cpp177
-rw-r--r--qpid/cpp/src/qpid/broker/DtxWorkRecord.h75
-rw-r--r--qpid/cpp/src/qpid/broker/Exchange.cpp140
-rw-r--r--qpid/cpp/src/qpid/broker/Exchange.h108
-rw-r--r--qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp92
-rw-r--r--qpid/cpp/src/qpid/broker/ExchangeRegistry.h61
-rw-r--r--qpid/cpp/src/qpid/broker/FanOutExchange.cpp124
-rw-r--r--qpid/cpp/src/qpid/broker/FanOutExchange.h64
-rw-r--r--qpid/cpp/src/qpid/broker/HandlerImpl.h53
-rw-r--r--qpid/cpp/src/qpid/broker/HeadersExchange.cpp205
-rw-r--r--qpid/cpp/src/qpid/broker/HeadersExchange.h70
-rw-r--r--qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp142
-rw-r--r--qpid/cpp/src/qpid/broker/IncomingExecutionContext.h58
-rw-r--r--qpid/cpp/src/qpid/broker/Message.cpp240
-rw-r--r--qpid/cpp/src/qpid/broker/Message.h143
-rw-r--r--qpid/cpp/src/qpid/broker/MessageAdapter.cpp60
-rw-r--r--qpid/cpp/src/qpid/broker/MessageAdapter.h60
-rw-r--r--qpid/cpp/src/qpid/broker/MessageBuilder.cpp105
-rw-r--r--qpid/cpp/src/qpid/broker/MessageBuilder.h55
-rw-r--r--qpid/cpp/src/qpid/broker/MessageDelivery.cpp136
-rw-r--r--qpid/cpp/src/qpid/broker/MessageDelivery.h55
-rw-r--r--qpid/cpp/src/qpid/broker/MessageHandlerImpl.cpp210
-rw-r--r--qpid/cpp/src/qpid/broker/MessageHandlerImpl.h110
-rw-r--r--qpid/cpp/src/qpid/broker/MessageStore.h189
-rw-r--r--qpid/cpp/src/qpid/broker/MessageStoreModule.cpp145
-rw-r--r--qpid/cpp/src/qpid/broker/MessageStoreModule.h79
-rw-r--r--qpid/cpp/src/qpid/broker/MultiVersionConnectionInputHandler.cpp92
-rw-r--r--qpid/cpp/src/qpid/broker/MultiVersionConnectionInputHandler.h60
-rw-r--r--qpid/cpp/src/qpid/broker/NameGenerator.cpp32
-rw-r--r--qpid/cpp/src/qpid/broker/NameGenerator.h39
-rw-r--r--qpid/cpp/src/qpid/broker/NullMessageStore.cpp149
-rw-r--r--qpid/cpp/src/qpid/broker/NullMessageStore.h79
-rw-r--r--qpid/cpp/src/qpid/broker/Persistable.h63
-rw-r--r--qpid/cpp/src/qpid/broker/PersistableExchange.h45
-rw-r--r--qpid/cpp/src/qpid/broker/PersistableMessage.cpp48
-rw-r--r--qpid/cpp/src/qpid/broker/PersistableMessage.h188
-rw-r--r--qpid/cpp/src/qpid/broker/PersistableQueue.h90
-rw-r--r--qpid/cpp/src/qpid/broker/Prefetch.h42
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewConnection.cpp327
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewConnection.h118
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewConnectionHandler.cpp158
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewConnectionHandler.h92
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewSessionHandler.cpp210
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewSessionHandler.h111
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp112
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewSessionManager.h100
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewSessionState.cpp169
-rw-r--r--qpid/cpp/src/qpid/broker/PreviewSessionState.h124
-rw-r--r--qpid/cpp/src/qpid/broker/Queue.cpp640
-rw-r--r--qpid/cpp/src/qpid/broker/Queue.h189
-rw-r--r--qpid/cpp/src/qpid/broker/QueueBindings.cpp45
-rw-r--r--qpid/cpp/src/qpid/broker/QueueBindings.h55
-rw-r--r--qpid/cpp/src/qpid/broker/QueuePolicy.cpp70
-rw-r--r--qpid/cpp/src/qpid/broker/QueuePolicy.h54
-rw-r--r--qpid/cpp/src/qpid/broker/QueueRegistry.cpp93
-rw-r--r--qpid/cpp/src/qpid/broker/QueueRegistry.h117
-rw-r--r--qpid/cpp/src/qpid/broker/RecoverableExchange.h50
-rw-r--r--qpid/cpp/src/qpid/broker/RecoverableMessage.h58
-rw-r--r--qpid/cpp/src/qpid/broker/RecoverableQueue.h59
-rw-r--r--qpid/cpp/src/qpid/broker/RecoverableTransaction.h49
-rw-r--r--qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp39
-rw-r--r--qpid/cpp/src/qpid/broker/RecoveredDequeue.h50
-rw-r--r--qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp39
-rw-r--r--qpid/cpp/src/qpid/broker/RecoveredEnqueue.h50
-rw-r--r--qpid/cpp/src/qpid/broker/RecoveryManager.h58
-rw-r--r--qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp222
-rw-r--r--qpid/cpp/src/qpid/broker/RecoveryManagerImpl.h55
-rw-r--r--qpid/cpp/src/qpid/broker/SemanticHandler.cpp195
-rw-r--r--qpid/cpp/src/qpid/broker/SemanticHandler.h102
-rw-r--r--qpid/cpp/src/qpid/broker/SemanticState.cpp642
-rw-r--r--qpid/cpp/src/qpid/broker/SemanticState.h192
-rw-r--r--qpid/cpp/src/qpid/broker/SessionContext.h50
-rw-r--r--qpid/cpp/src/qpid/broker/SessionHandler.cpp246
-rw-r--r--qpid/cpp/src/qpid/broker/SessionHandler.h118
-rw-r--r--qpid/cpp/src/qpid/broker/SessionManager.cpp112
-rw-r--r--qpid/cpp/src/qpid/broker/SessionManager.h100
-rw-r--r--qpid/cpp/src/qpid/broker/SessionState.cpp267
-rw-r--r--qpid/cpp/src/qpid/broker/SessionState.h152
-rw-r--r--qpid/cpp/src/qpid/broker/Timer.cpp102
-rw-r--r--qpid/cpp/src/qpid/broker/Timer.h77
-rw-r--r--qpid/cpp/src/qpid/broker/TopicExchange.cpp240
-rw-r--r--qpid/cpp/src/qpid/broker/TopicExchange.h104
-rw-r--r--qpid/cpp/src/qpid/broker/TransactionalStore.h60
-rw-r--r--qpid/cpp/src/qpid/broker/TxAck.cpp59
-rw-r--r--qpid/cpp/src/qpid/broker/TxAck.h57
-rw-r--r--qpid/cpp/src/qpid/broker/TxBuffer.cpp67
-rw-r--r--qpid/cpp/src/qpid/broker/TxBuffer.h115
-rw-r--r--qpid/cpp/src/qpid/broker/TxOp.h42
-rw-r--r--qpid/cpp/src/qpid/broker/TxPublish.cpp73
-rw-r--r--qpid/cpp/src/qpid/broker/TxPublish.h80
-rw-r--r--qpid/cpp/src/qpid/broker/Vhost.cpp40
-rw-r--r--qpid/cpp/src/qpid/broker/Vhost.h51
-rw-r--r--qpid/cpp/src/qpid/client/AckMode.h53
-rw-r--r--qpid/cpp/src/qpid/client/AckPolicy.h56
-rw-r--r--qpid/cpp/src/qpid/client/ChainableFrameHandler.h47
-rw-r--r--qpid/cpp/src/qpid/client/Channel.cpp268
-rw-r--r--qpid/cpp/src/qpid/client/Channel.h316
-rw-r--r--qpid/cpp/src/qpid/client/Completion.h64
-rw-r--r--qpid/cpp/src/qpid/client/CompletionTracker.cpp121
-rw-r--r--qpid/cpp/src/qpid/client/CompletionTracker.h77
-rw-r--r--qpid/cpp/src/qpid/client/Connection.cpp97
-rw-r--r--qpid/cpp/src/qpid/client/Connection.h149
-rw-r--r--qpid/cpp/src/qpid/client/ConnectionHandler.cpp209
-rw-r--r--qpid/cpp/src/qpid/client/ConnectionHandler.h85
-rw-r--r--qpid/cpp/src/qpid/client/ConnectionImpl.cpp158
-rw-r--r--qpid/cpp/src/qpid/client/ConnectionImpl.h87
-rw-r--r--qpid/cpp/src/qpid/client/Connector.cpp297
-rw-r--r--qpid/cpp/src/qpid/client/Connector.h143
-rw-r--r--qpid/cpp/src/qpid/client/Correlator.cpp45
-rw-r--r--qpid/cpp/src/qpid/client/Correlator.h52
-rw-r--r--qpid/cpp/src/qpid/client/Demux.cpp132
-rw-r--r--qpid/cpp/src/qpid/client/Demux.h100
-rw-r--r--qpid/cpp/src/qpid/client/Dispatcher.cpp142
-rw-r--r--qpid/cpp/src/qpid/client/Dispatcher.h84
-rw-r--r--qpid/cpp/src/qpid/client/Exchange.cpp34
-rw-r--r--qpid/cpp/src/qpid/client/Exchange.h106
-rw-r--r--qpid/cpp/src/qpid/client/Execution.h50
-rw-r--r--qpid/cpp/src/qpid/client/ExecutionHandler.cpp267
-rw-r--r--qpid/cpp/src/qpid/client/ExecutionHandler.h104
-rw-r--r--qpid/cpp/src/qpid/client/Future.h108
-rw-r--r--qpid/cpp/src/qpid/client/FutureCompletion.cpp48
-rw-r--r--qpid/cpp/src/qpid/client/FutureCompletion.h48
-rw-r--r--qpid/cpp/src/qpid/client/FutureFactory.cpp51
-rw-r--r--qpid/cpp/src/qpid/client/FutureFactory.h48
-rw-r--r--qpid/cpp/src/qpid/client/FutureResponse.cpp45
-rw-r--r--qpid/cpp/src/qpid/client/FutureResponse.h46
-rw-r--r--qpid/cpp/src/qpid/client/FutureResult.cpp43
-rw-r--r--qpid/cpp/src/qpid/client/FutureResult.h46
-rw-r--r--qpid/cpp/src/qpid/client/LocalQueue.cpp64
-rw-r--r--qpid/cpp/src/qpid/client/LocalQueue.h60
-rw-r--r--qpid/cpp/src/qpid/client/Message.h104
-rw-r--r--qpid/cpp/src/qpid/client/MessageListener.cpp24
-rw-r--r--qpid/cpp/src/qpid/client/MessageListener.h49
-rw-r--r--qpid/cpp/src/qpid/client/MessageQueue.h50
-rw-r--r--qpid/cpp/src/qpid/client/Queue.cpp58
-rw-r--r--qpid/cpp/src/qpid/client/Queue.h103
-rw-r--r--qpid/cpp/src/qpid/client/Response.h52
-rw-r--r--qpid/cpp/src/qpid/client/Session.h38
-rw-r--r--qpid/cpp/src/qpid/client/SessionBase.cpp50
-rw-r--r--qpid/cpp/src/qpid/client/SessionBase.h134
-rw-r--r--qpid/cpp/src/qpid/client/SessionCore.cpp440
-rw-r--r--qpid/cpp/src/qpid/client/SessionCore.h141
-rw-r--r--qpid/cpp/src/qpid/client/StateManager.cpp68
-rw-r--r--qpid/cpp/src/qpid/client/StateManager.h46
-rw-r--r--qpid/cpp/src/qpid/client/SubscriptionManager.cpp111
-rw-r--r--qpid/cpp/src/qpid/client/SubscriptionManager.h141
-rw-r--r--qpid/cpp/src/qpid/client/TypedResult.h51
-rw-r--r--qpid/cpp/src/qpid/cluster/ClassifierHandler.cpp51
-rw-r--r--qpid/cpp/src/qpid/cluster/ClassifierHandler.h50
-rw-r--r--qpid/cpp/src/qpid/cluster/Cluster.cpp260
-rw-r--r--qpid/cpp/src/qpid/cluster/Cluster.h130
-rw-r--r--qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp79
-rw-r--r--qpid/cpp/src/qpid/cluster/Cpg.cpp176
-rw-r--r--qpid/cpp/src/qpid/cluster/Cpg.h184
-rw-r--r--qpid/cpp/src/qpid/cluster/Dispatchable.h52
-rw-r--r--qpid/cpp/src/qpid/doxygen_mainpage.h45
-rw-r--r--qpid/cpp/src/qpid/framing/AMQBody.cpp64
-rw-r--r--qpid/cpp/src/qpid/framing/AMQBody.h78
-rw-r--r--qpid/cpp/src/qpid/framing/AMQContentBody.cpp44
-rw-r--r--qpid/cpp/src/qpid/framing/AMQContentBody.h53
-rw-r--r--qpid/cpp/src/qpid/framing/AMQDataBlock.h42
-rw-r--r--qpid/cpp/src/qpid/framing/AMQFrame.cpp120
-rw-r--r--qpid/cpp/src/qpid/framing/AMQFrame.h111
-rw-r--r--qpid/cpp/src/qpid/framing/AMQHeaderBody.cpp63
-rw-r--r--qpid/cpp/src/qpid/framing/AMQHeaderBody.h109
-rw-r--r--qpid/cpp/src/qpid/framing/AMQHeartbeatBody.cpp29
-rw-r--r--qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h46
-rw-r--r--qpid/cpp/src/qpid/framing/AMQMethodBody.cpp28
-rw-r--r--qpid/cpp/src/qpid/framing/AMQMethodBody.h72
-rw-r--r--qpid/cpp/src/qpid/framing/AMQP_HighestVersion.h41
-rw-r--r--qpid/cpp/src/qpid/framing/AccumulatedAck.cpp164
-rw-r--r--qpid/cpp/src/qpid/framing/AccumulatedAck.h76
-rw-r--r--qpid/cpp/src/qpid/framing/Array.cpp114
-rw-r--r--qpid/cpp/src/qpid/framing/Array.h75
-rw-r--r--qpid/cpp/src/qpid/framing/Blob.cpp31
-rw-r--r--qpid/cpp/src/qpid/framing/Blob.h191
-rw-r--r--qpid/cpp/src/qpid/framing/BodyHandler.cpp55
-rw-r--r--qpid/cpp/src/qpid/framing/BodyHandler.h56
-rw-r--r--qpid/cpp/src/qpid/framing/BodyHolder.cpp75
-rw-r--r--qpid/cpp/src/qpid/framing/BodyHolder.h88
-rw-r--r--qpid/cpp/src/qpid/framing/Buffer.cpp198
-rw-r--r--qpid/cpp/src/qpid/framing/Buffer.h90
-rw-r--r--qpid/cpp/src/qpid/framing/ChannelHandler.h53
-rw-r--r--qpid/cpp/src/qpid/framing/FieldTable.cpp165
-rw-r--r--qpid/cpp/src/qpid/framing/FieldTable.h96
-rw-r--r--qpid/cpp/src/qpid/framing/FieldValue.cpp123
-rw-r--r--qpid/cpp/src/qpid/framing/FieldValue.h229
-rw-r--r--qpid/cpp/src/qpid/framing/FrameDefaultVisitor.h60
-rw-r--r--qpid/cpp/src/qpid/framing/FrameHandler.h33
-rw-r--r--qpid/cpp/src/qpid/framing/FrameSet.cpp84
-rw-r--r--qpid/cpp/src/qpid/framing/FrameSet.h105
-rw-r--r--qpid/cpp/src/qpid/framing/FramingContent.cpp73
-rw-r--r--qpid/cpp/src/qpid/framing/FramingContent.h63
-rw-r--r--qpid/cpp/src/qpid/framing/Handler.h122
-rw-r--r--qpid/cpp/src/qpid/framing/HeaderProperties.h46
-rw-r--r--qpid/cpp/src/qpid/framing/InitiationHandler.cpp24
-rw-r--r--qpid/cpp/src/qpid/framing/InitiationHandler.h41
-rw-r--r--qpid/cpp/src/qpid/framing/InputHandler.h41
-rw-r--r--qpid/cpp/src/qpid/framing/Invoker.h86
-rw-r--r--qpid/cpp/src/qpid/framing/MethodContent.h40
-rw-r--r--qpid/cpp/src/qpid/framing/ModelMethod.h49
-rw-r--r--qpid/cpp/src/qpid/framing/OutputHandler.h42
-rw-r--r--qpid/cpp/src/qpid/framing/ProtocolInitiation.cpp63
-rw-r--r--qpid/cpp/src/qpid/framing/ProtocolInitiation.h54
-rw-r--r--qpid/cpp/src/qpid/framing/ProtocolVersion.cpp44
-rw-r--r--qpid/cpp/src/qpid/framing/ProtocolVersion.h57
-rw-r--r--qpid/cpp/src/qpid/framing/Proxy.cpp37
-rw-r--r--qpid/cpp/src/qpid/framing/Proxy.h52
-rw-r--r--qpid/cpp/src/qpid/framing/SendContent.cpp69
-rw-r--r--qpid/cpp/src/qpid/framing/SendContent.h55
-rw-r--r--qpid/cpp/src/qpid/framing/SequenceNumber.cpp88
-rw-r--r--qpid/cpp/src/qpid/framing/SequenceNumber.h66
-rw-r--r--qpid/cpp/src/qpid/framing/SequenceNumberSet.cpp89
-rw-r--r--qpid/cpp/src/qpid/framing/SequenceNumberSet.h68
-rw-r--r--qpid/cpp/src/qpid/framing/SerializeHandler.h49
-rw-r--r--qpid/cpp/src/qpid/framing/SessionState.cpp137
-rw-r--r--qpid/cpp/src/qpid/framing/SessionState.h138
-rw-r--r--qpid/cpp/src/qpid/framing/StructHelper.h56
-rw-r--r--qpid/cpp/src/qpid/framing/TemplateVisitor.h89
-rw-r--r--qpid/cpp/src/qpid/framing/TransferContent.cpp102
-rw-r--r--qpid/cpp/src/qpid/framing/TransferContent.h58
-rw-r--r--qpid/cpp/src/qpid/framing/TypeFilter.h51
-rw-r--r--qpid/cpp/src/qpid/framing/Uuid.cpp61
-rw-r--r--qpid/cpp/src/qpid/framing/Uuid.h84
-rw-r--r--qpid/cpp/src/qpid/framing/Visitor.h91
-rw-r--r--qpid/cpp/src/qpid/framing/amqp_framing.h33
-rw-r--r--qpid/cpp/src/qpid/framing/amqp_types.h71
-rw-r--r--qpid/cpp/src/qpid/framing/amqp_types_full.h39
-rw-r--r--qpid/cpp/src/qpid/framing/frame_functors.h116
-rw-r--r--qpid/cpp/src/qpid/framing/variant.h91
-rw-r--r--qpid/cpp/src/qpid/log/Helpers.h79
-rw-r--r--qpid/cpp/src/qpid/log/Logger.cpp211
-rw-r--r--qpid/cpp/src/qpid/log/Logger.h113
-rw-r--r--qpid/cpp/src/qpid/log/Options.cpp66
-rw-r--r--qpid/cpp/src/qpid/log/Options.h42
-rw-r--r--qpid/cpp/src/qpid/log/Selector.cpp66
-rw-r--r--qpid/cpp/src/qpid/log/Selector.h70
-rw-r--r--qpid/cpp/src/qpid/log/Statement.cpp92
-rw-r--r--qpid/cpp/src/qpid/log/Statement.h114
-rw-r--r--qpid/cpp/src/qpid/management/Args.h44
-rw-r--r--qpid/cpp/src/qpid/management/Manageable.cpp36
-rw-r--r--qpid/cpp/src/qpid/management/Manageable.h66
-rw-r--r--qpid/cpp/src/qpid/management/ManagementAgent.cpp343
-rw-r--r--qpid/cpp/src/qpid/management/ManagementAgent.h97
-rw-r--r--qpid/cpp/src/qpid/management/ManagementExchange.cpp78
-rw-r--r--qpid/cpp/src/qpid/management/ManagementExchange.h62
-rw-r--r--qpid/cpp/src/qpid/management/ManagementObject.cpp37
-rw-r--r--qpid/cpp/src/qpid/management/ManagementObject.h117
-rw-r--r--qpid/cpp/src/qpid/memory.h32
-rw-r--r--qpid/cpp/src/qpid/pointer_to_other.h62
-rw-r--r--qpid/cpp/src/qpid/ptr_map.h116
-rw-r--r--qpid/cpp/src/qpid/shared_ptr.h51
-rw-r--r--qpid/cpp/src/qpid/sys/Acceptor.h56
-rw-r--r--qpid/cpp/src/qpid/sys/AggregateOutput.cpp61
-rw-r--r--qpid/cpp/src/qpid/sys/AggregateOutput.h54
-rw-r--r--qpid/cpp/src/qpid/sys/AsynchIO.h134
-rw-r--r--qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp393
-rw-r--r--qpid/cpp/src/qpid/sys/AtomicCount.h53
-rw-r--r--qpid/cpp/src/qpid/sys/BlockingQueue.h142
-rw-r--r--qpid/cpp/src/qpid/sys/Condition.h31
-rw-r--r--qpid/cpp/src/qpid/sys/ConnectionInputHandler.h47
-rw-r--r--qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h53
-rw-r--r--qpid/cpp/src/qpid/sys/ConnectionOutputHandler.h42
-rw-r--r--qpid/cpp/src/qpid/sys/DeletionManager.h138
-rw-r--r--qpid/cpp/src/qpid/sys/Dispatcher.cpp441
-rw-r--r--qpid/cpp/src/qpid/sys/Dispatcher.h96
-rw-r--r--qpid/cpp/src/qpid/sys/Module.h50
-rw-r--r--qpid/cpp/src/qpid/sys/Monitor.h51
-rw-r--r--qpid/cpp/src/qpid/sys/Mutex.h89
-rw-r--r--qpid/cpp/src/qpid/sys/OutputControl.h38
-rw-r--r--qpid/cpp/src/qpid/sys/OutputTask.h38
-rw-r--r--qpid/cpp/src/qpid/sys/Poller.h110
-rw-r--r--qpid/cpp/src/qpid/sys/RefCountedMap.h163
-rw-r--r--qpid/cpp/src/qpid/sys/Runnable.cpp32
-rw-r--r--qpid/cpp/src/qpid/sys/Runnable.h50
-rw-r--r--qpid/cpp/src/qpid/sys/ScopedIncrement.h67
-rw-r--r--qpid/cpp/src/qpid/sys/Semaphore.h67
-rw-r--r--qpid/cpp/src/qpid/sys/Serializer.cpp71
-rw-r--r--qpid/cpp/src/qpid/sys/Serializer.h181
-rw-r--r--qpid/cpp/src/qpid/sys/Shlib.cpp38
-rw-r--r--qpid/cpp/src/qpid/sys/Shlib.h82
-rw-r--r--qpid/cpp/src/qpid/sys/ShutdownHandler.h37
-rw-r--r--qpid/cpp/src/qpid/sys/Socket.h116
-rw-r--r--qpid/cpp/src/qpid/sys/StateMonitor.h78
-rw-r--r--qpid/cpp/src/qpid/sys/SystemInfo.cpp35
-rw-r--r--qpid/cpp/src/qpid/sys/SystemInfo.h44
-rw-r--r--qpid/cpp/src/qpid/sys/Thread.h31
-rw-r--r--qpid/cpp/src/qpid/sys/Time.h119
-rw-r--r--qpid/cpp/src/qpid/sys/TimeoutHandler.h39
-rw-r--r--qpid/cpp/src/qpid/sys/Waitable.h71
-rw-r--r--qpid/cpp/src/qpid/sys/apr/APRBase.cpp89
-rw-r--r--qpid/cpp/src/qpid/sys/apr/APRBase.h74
-rw-r--r--qpid/cpp/src/qpid/sys/apr/APRPool.cpp41
-rw-r--r--qpid/cpp/src/qpid/sys/apr/APRPool.h50
-rw-r--r--qpid/cpp/src/qpid/sys/apr/Condition.h84
-rw-r--r--qpid/cpp/src/qpid/sys/apr/Mutex.h124
-rw-r--r--qpid/cpp/src/qpid/sys/apr/Shlib.cpp49
-rw-r--r--qpid/cpp/src/qpid/sys/apr/Socket.cpp114
-rw-r--r--qpid/cpp/src/qpid/sys/apr/Thread.cpp34
-rw-r--r--qpid/cpp/src/qpid/sys/apr/Thread.h106
-rw-r--r--qpid/cpp/src/qpid/sys/apr/Time.cpp36
-rw-r--r--qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp338
-rw-r--r--qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp364
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Condition.h86
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Mutex.h201
-rw-r--r--qpid/cpp/src/qpid/sys/posix/PrivatePosix.h44
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Shlib.cpp59
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Socket.cpp282
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Thread.cpp29
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Thread.h92
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Time.cpp57
-rw-r--r--qpid/cpp/src/qpid/sys/posix/check.h47
-rw-r--r--qpid/cpp/src/qpidd.cpp260
-rw-r--r--qpid/cpp/src/tests/.valgrind.supp32
-rw-r--r--qpid/cpp/src/tests/.valgrindrc7
-rw-r--r--qpid/cpp/src/tests/AccumulatedAckTest.cpp250
-rw-r--r--qpid/cpp/src/tests/Array.cpp79
-rw-r--r--qpid/cpp/src/tests/BasicP2PTest.cpp66
-rw-r--r--qpid/cpp/src/tests/BasicP2PTest.h46
-rw-r--r--qpid/cpp/src/tests/BasicPubSubTest.cpp121
-rw-r--r--qpid/cpp/src/tests/BasicPubSubTest.h51
-rw-r--r--qpid/cpp/src/tests/Blob.cpp128
-rw-r--r--qpid/cpp/src/tests/BrokerFixture.h107
-rw-r--r--qpid/cpp/src/tests/ClientChannelTest.cpp220
-rw-r--r--qpid/cpp/src/tests/ClientSessionTest.cpp220
-rw-r--r--qpid/cpp/src/tests/ConcurrentQueue.cpp208
-rw-r--r--qpid/cpp/src/tests/Cpg.cpp115
-rw-r--r--qpid/cpp/src/tests/DeliveryRecordTest.cpp68
-rw-r--r--qpid/cpp/src/tests/DispatcherTest.cpp128
-rw-r--r--qpid/cpp/src/tests/DtxWorkRecordTest.cpp202
-rw-r--r--qpid/cpp/src/tests/EventChannelTest.cpp187
-rw-r--r--qpid/cpp/src/tests/EventChannelThreadsTest.cpp247
-rw-r--r--qpid/cpp/src/tests/ExchangeTest.cpp178
-rw-r--r--qpid/cpp/src/tests/FieldTable.cpp84
-rw-r--r--qpid/cpp/src/tests/FieldValue.cpp90
-rw-r--r--qpid/cpp/src/tests/Frame.cpp80
-rw-r--r--qpid/cpp/src/tests/FramingTest.cpp232
-rw-r--r--qpid/cpp/src/tests/HeaderTest.cpp126
-rw-r--r--qpid/cpp/src/tests/HeadersExchangeTest.cpp131
-rw-r--r--qpid/cpp/src/tests/IList.cpp164
-rw-r--r--qpid/cpp/src/tests/ISList.cpp207
-rw-r--r--qpid/cpp/src/tests/InlineVector.cpp89
-rw-r--r--qpid/cpp/src/tests/Makefile.am176
-rw-r--r--qpid/cpp/src/tests/MessageBuilderTest.cpp224
-rw-r--r--qpid/cpp/src/tests/MessageTest.cpp97
-rw-r--r--qpid/cpp/src/tests/MessageUtils.h54
-rw-r--r--qpid/cpp/src/tests/MockConnectionInputHandler.h113
-rw-r--r--qpid/cpp/src/tests/PollerTest.cpp164
-rw-r--r--qpid/cpp/src/tests/QueuePolicyTest.cpp89
-rw-r--r--qpid/cpp/src/tests/QueueRegistryTest.cpp95
-rw-r--r--qpid/cpp/src/tests/QueueTest.cpp257
-rw-r--r--qpid/cpp/src/tests/README71
-rw-r--r--qpid/cpp/src/tests/RefCounted.cpp73
-rw-r--r--qpid/cpp/src/tests/RefCountedMap.cpp123
-rw-r--r--qpid/cpp/src/tests/SequenceNumberTest.cpp220
-rw-r--r--qpid/cpp/src/tests/Serializer.cpp157
-rw-r--r--qpid/cpp/src/tests/SessionState.cpp146
-rw-r--r--qpid/cpp/src/tests/Shlib.cpp60
-rw-r--r--qpid/cpp/src/tests/SimpleTestCaseBase.cpp87
-rw-r--r--qpid/cpp/src/tests/SimpleTestCaseBase.h88
-rw-r--r--qpid/cpp/src/tests/SocketProxy.h164
-rw-r--r--qpid/cpp/src/tests/TestCase.h64
-rw-r--r--qpid/cpp/src/tests/TestOptions.h94
-rw-r--r--qpid/cpp/src/tests/TimerTest.cpp130
-rw-r--r--qpid/cpp/src/tests/TopicExchangeTest.cpp200
-rw-r--r--qpid/cpp/src/tests/TxAckTest.cpp118
-rw-r--r--qpid/cpp/src/tests/TxBufferTest.cpp185
-rw-r--r--qpid/cpp/src/tests/TxMocks.h226
-rw-r--r--qpid/cpp/src/tests/TxPublishTest.cpp113
-rw-r--r--qpid/cpp/src/tests/Url.cpp64
-rw-r--r--qpid/cpp/src/tests/Uuid.cpp78
-rwxr-xr-xqpid/cpp/src/tests/ais_check27
-rwxr-xr-xqpid/cpp/src/tests/ais_run15
-rw-r--r--qpid/cpp/src/tests/ais_test.cpp23
-rw-r--r--qpid/cpp/src/tests/client_test.cpp147
-rw-r--r--qpid/cpp/src/tests/cluster.mk20
-rw-r--r--qpid/cpp/src/tests/cluster_client.cpp84
-rw-r--r--qpid/cpp/src/tests/dlclose_noop.c30
-rw-r--r--qpid/cpp/src/tests/echo_service.cpp229
-rw-r--r--qpid/cpp/src/tests/exception_test.cpp99
-rwxr-xr-xqpid/cpp/src/tests/fanout_perftest2
-rw-r--r--qpid/cpp/src/tests/interop_runner.cpp240
-rw-r--r--qpid/cpp/src/tests/latencytest.cpp372
-rw-r--r--qpid/cpp/src/tests/logging.cpp390
-rwxr-xr-xqpid/cpp/src/tests/multiq_perftest2
-rwxr-xr-xqpid/cpp/src/tests/perfdist50
-rw-r--r--qpid/cpp/src/tests/perftest.cpp640
-rwxr-xr-xqpid/cpp/src/tests/python_tests8
-rw-r--r--qpid/cpp/src/tests/qpid_test_plugin.h43
-rwxr-xr-xqpid/cpp/src/tests/quick_perftest2
-rwxr-xr-xqpid/cpp/src/tests/quick_topictest9
-rwxr-xr-xqpid/cpp/src/tests/run-unit-tests28
-rwxr-xr-xqpid/cpp/src/tests/run_perftest8
-rwxr-xr-xqpid/cpp/src/tests/run_test51
-rw-r--r--qpid/cpp/src/tests/serialize.cpp135
-rwxr-xr-xqpid/cpp/src/tests/shared_perftest2
-rw-r--r--qpid/cpp/src/tests/shlibtest.cpp28
-rwxr-xr-xqpid/cpp/src/tests/start_broker4
-rwxr-xr-xqpid/cpp/src/tests/start_cluster19
-rwxr-xr-xqpid/cpp/src/tests/stop_broker20
-rwxr-xr-xqpid/cpp/src/tests/stop_cluster14
-rw-r--r--qpid/cpp/src/tests/test_tools.h76
-rw-r--r--qpid/cpp/src/tests/topic_listener.cpp189
-rwxr-xr-xqpid/cpp/src/tests/topic_perftest2
-rw-r--r--qpid/cpp/src/tests/topic_publisher.cpp206
-rwxr-xr-xqpid/cpp/src/tests/topictest40
-rw-r--r--qpid/cpp/src/tests/txtest.cpp270
-rw-r--r--qpid/cpp/src/tests/unit_test.cpp23
-rw-r--r--qpid/cpp/src/tests/unit_test.h45
-rw-r--r--qpid/cpp/src/tests/vg_check23
-rwxr-xr-xqpid/cpp/versions12
-rw-r--r--qpid/cpp/xml/cluster.xml37
-rwxr-xr-xqpid/java/broker/bin/msTool.sh60
-rw-r--r--qpid/java/broker/bin/qpid-passwd30
-rw-r--r--qpid/java/broker/bin/qpid-server31
-rw-r--r--qpid/java/broker/bin/qpid-server-bdb.bat22
-rw-r--r--qpid/java/broker/bin/qpid-server.bat70
-rw-r--r--qpid/java/broker/bin/qpid.start21
-rw-r--r--qpid/java/broker/bin/qpid.stop137
-rw-r--r--qpid/java/broker/bin/qpid.stopall74
-rwxr-xr-xqpid/java/broker/bin/run.bat31
-rwxr-xr-xqpid/java/broker/bin/run.sh44
-rw-r--r--qpid/java/broker/bin/runAll37
-rw-r--r--qpid/java/broker/distribution/pom.xml153
-rw-r--r--qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml116
-rw-r--r--qpid/java/broker/distribution/src/main/assembly/broker-bin.xml183
-rw-r--r--qpid/java/broker/distribution/src/main/assembly/broker-src.xml78
-rw-r--r--qpid/java/broker/etc/access19
-rw-r--r--qpid/java/broker/etc/acl.config.xml229
-rw-r--r--qpid/java/broker/etc/config.xml128
-rw-r--r--qpid/java/broker/etc/debug.log4j.xml114
-rw-r--r--qpid/java/broker/etc/jmxremote.access23
-rw-r--r--qpid/java/broker/etc/log4j.xml112
-rw-r--r--qpid/java/broker/etc/md5passwd21
-rw-r--r--qpid/java/broker/etc/mstool-log4j.xml54
-rw-r--r--qpid/java/broker/etc/passwd22
-rw-r--r--qpid/java/broker/etc/passwdVhost19
-rw-r--r--qpid/java/broker/etc/persistent_config.xml115
-rw-r--r--qpid/java/broker/etc/qpid-server.conf25
-rw-r--r--qpid/java/broker/etc/qpid-server.conf.jpp49
-rw-r--r--qpid/java/broker/etc/qpid.passwd23
-rw-r--r--qpid/java/broker/etc/transient_config.xml127
-rw-r--r--qpid/java/broker/etc/virtualhosts.xml123
-rw-r--r--qpid/java/broker/pom.xml272
-rwxr-xr-xqpid/java/broker/python-test.xml56
-rw-r--r--qpid/java/broker/src/main/grammar/SelectorParser.jj621
-rw-r--r--qpid/java/broker/src/main/java/log4j.properties24
-rw-r--r--qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java1007
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java188
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java244
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java1021
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/ConsumerTagNotUniqueException.java25
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java522
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/ManagedChannel.java68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/RequiredDeliveryException.java68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/ack/TxAck.java132
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessage.java91
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessageMap.java80
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessageMapImpl.java235
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/Configurator.java118
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java269
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java217
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java113
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java138
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java260
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DestWildExchange.java579
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Exchange.java97
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java40
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeInUseException.java45
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java51
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeType.java35
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java240
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java219
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java360
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Index.java90
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ManagedExchange.java98
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/MessageRouter.java40
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/NoRouteException.java48
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java275
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java106
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/BooleanExpression.java40
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java595
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ConstantExpression.java210
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/Expression.java37
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManager.java37
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java77
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/JMSSelectorFilter.java68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java110
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/MessageFilter.java29
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java42
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/PropertyExpression.java322
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/SimpleFilterManager.java76
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/UnaryExpression.java337
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XPathExpression.java126
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XQueryExpression.java57
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XalanXPathEvaluator.java102
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/AccessRequestHandler.java44
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicAckMethodHandler.java67
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java76
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java169
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicGetMethodHandler.java101
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java101
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java60
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverMethodHandler.java73
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverSyncMethodHandler.java54
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRejectMethodHandler.java130
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java77
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseOkHandler.java53
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java66
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java103
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java72
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseOkMethodHandler.java63
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java99
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java126
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java161
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionTuneOkMethodHandler.java54
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeBoundHandler.java180
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java113
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeleteHandler.java71
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/OnCurrentThreadExecutor.java34
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueBindHandler.java139
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java213
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java124
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueuePurgeHandler.java121
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueUnbindHandler.java113
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl.java566
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl_0_9.java164
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl_8_0.java86
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxCommitHandler.java80
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxRollbackHandler.java77
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxSelectHandler.java63
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/handler/UnexpectedMethodException.java33
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/jms/JmsConsumer.java110
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java97
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java191
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java283
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanAttribute.java41
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanConstructor.java39
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanDescription.java38
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java388
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java239
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperation.java43
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperationParameter.java37
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/Managable.java34
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java98
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedObject.java58
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedObjectRegistry.java48
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagementConfiguration.java30
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/management/NoopManagedObjectRegistry.java60
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverter.java57
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverterRegistry.java61
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java285
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java372
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/Activator.java44
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java145
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java788
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQNoMethodHandlerException.java46
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java277
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPProtocolProvider.java52
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java179
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java306
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.java51
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/HeartbeatConfig.java67
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java135
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/UnknnownMessageTypeException.java46
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java719
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.java79
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java1022
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java479
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AsyncDeliveryConfig.java56
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java1077
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/DefaultQueueRegistry.java71
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/DeliveryManager.java102
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExchangeBindings.java135
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java50
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.java143
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ManagedQueue.java245
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java52
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageHandleFactory.java46
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageMetaData.java92
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java47
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NotificationCheck.java138
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueEntry.java173
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueNotificationListener.java27
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueRegistry.java43
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/Subscription.java63
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionFactory.java43
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java669
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionManager.java34
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionSet.java274
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/TransientMessageData.java127
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.java227
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/WeightedSubscriptionManager.java26
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java203
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java187
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java75
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java161
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLPlugin.java58
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/AccessResult.java66
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/AccessRights.java63
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/Accessable.java27
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/Permission.java37
-rwxr-xr-xqpid/java/broker/src/main/java/org/apache/qpid/server/security/access/PrincipalPermissions.java587
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/VirtualHostAccess.java68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java468
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/management/UserManagement.java118
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/AllowAll.java68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/DenyAll.java57
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/SimpleXML.java431
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java43
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java598
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/ConfigurationFilePrincipalDatabaseManager.java236
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java240
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabase.java100
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabaseManager.java34
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java160
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabaseManager.java48
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java37
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java241
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/AuthenticationProviderInitialiser.java76
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/JCAProvider.java47
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/UsernamePasswordInitialiser.java123
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/UsernamePrincipal.java44
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainInitialiser.java38
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainSaslServer.java129
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainSaslServerFactory.java60
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedInitialiser.java50
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java105
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedServerFactory.java61
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5Initialiser.java71
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainInitialiser.java38
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServer.java149
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServerFactory.java60
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQState.java36
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java263
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/state/IllegalStateTransitionException.java52
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/state/StateAwareMethodListener.java35
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/state/StateListener.java30
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java223
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStore.java261
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java36
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/StoreContext.java68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.java114
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ThreadPoolFilter.java705
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/CleanupMessageOperation.java77
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/LocalTransactionalContext.java262
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/NonTransactionalContext.java228
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/StoreMessageOperation.java58
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TransactionalContext.java170
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TxnBuffer.java109
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TxnOp.java55
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/util/CircularBuffer.java131
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/util/ConcurrentLinkedQueueNoSize.java38
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/util/LoggingProxy.java105
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/util/NullApplicationRegistry.java131
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/ManagedVirtualHost.java44
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java304
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java70
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/MessageStoreTool.java652
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/AbstractCommand.java66
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Clear.java85
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Command.java36
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Copy.java55
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Dump.java301
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Help.java98
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/List.java314
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Load.java94
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Move.java206
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Purge.java68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Quit.java54
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Select.java233
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Show.java515
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/security/Passwd.java81
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/CommandParser.java51
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/Console.java90
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/SimpleCommandParser.java121
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/SimpleConsole.java363
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/RunBrokerWithCommand.java132
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/TestPropertyUtils.java50
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java612
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java138
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java199
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/TestIoSession.java295
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/TestMinaProtocolSession.java52
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java306
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java305
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java73
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/util/LoggingProxyTest.java88
-rw-r--r--qpid/ruby/DISCLAIMER5
-rwxr-xr-xqpid/ruby/LICENSE.txt330
-rw-r--r--qpid/ruby/NOTICE.txt19
-rw-r--r--qpid/ruby/RELEASE_NOTES19
-rw-r--r--qpid/ruby/qpid.rb25
-rw-r--r--qpid/ruby/qpid/client.rb135
-rw-r--r--qpid/ruby/qpid/codec.rb257
-rw-r--r--qpid/ruby/qpid/connection.rb254
-rw-r--r--qpid/ruby/qpid/fields.rb49
-rw-r--r--qpid/ruby/qpid/peer.rb287
-rw-r--r--qpid/ruby/qpid/queue.rb52
-rw-r--r--qpid/ruby/qpid/spec.rb289
-rw-r--r--qpid/ruby/qpid/test.rb38
-rw-r--r--qpid/ruby/qpid/traverse.rb64
-rwxr-xr-xqpid/ruby/run-tests4
-rw-r--r--qpid/ruby/tests/basic.rb69
-rw-r--r--qpid/ruby/tests/channel.rb48
873 files changed, 0 insertions, 116308 deletions
diff --git a/qpid/cpp/DESIGN b/qpid/cpp/DESIGN
deleted file mode 100644
index 7e9ba6755c..0000000000
--- a/qpid/cpp/DESIGN
+++ /dev/null
@@ -1,79 +0,0 @@
-Qpid C++ AMQP implementation
-=============================
-
-= Project layout =
-
-For Build system design see comment at start of Makefile.
-
-Project contains:
- * Client library (lib/libqpid_client): src/qpid/client
- * Broker library (lib/libqpid_broker): src/qpid/broker
- * Common classes
- * src/qpid/concurrent: concurrecy
- * src/qpid/framing: wire encoding/decoding
- * src/qpid/io: reading/writing
- * src/qpid/Exception.cpp, QpidError.cpp: Exception classes.
- * Qpid Daemon (bin/qpidd): src/qpidd.cpp
-
-Unit tests in test/unit: each *Test.cpp builds a CppUnit plugin.
-
-Client tests in test/client: each *.cpp builds a test executable.
-
-Test utilities: test/include
-
-= Client Design =
-
-The client module is primarily concerned with presenting the
-functionality offered by AMQP to users through a simple API that
-nevertheless allows all the protocol functionality to be exploited.
-[Note: it is currently nothing like complete in this regard!]
-
-The code in the client module is concerned with the logic of the AMQP
-protocol and interacts with the lower level transport issues through
-the InputHandler and OutputHandler abstractions defined in
-common/framing. It uses these in conjunction with the Connector
-interface, defined in common/io, for establishing a connection to the
-broker and interacting with it through the sending and receiving of
-messages represented by AMQFrame (defined in common/framing).
-
-The Connector implementation is responsible for connection set up,
-threading strategy and getting data on and off the wire. It delegates
-to the framing module for encode/decode operations. The interface
-between the io and the framing modules is primarily through the Buffer
-and AMQFrame classes.
-
-A Buffer allows 'raw' data to be read or written in terms of the AMQP
-defined 'types' (octet, short, long, long long, short string, long
-string, field table etc.). AMQP is defined in terms frames with
-specific bodies and the frame (as well as these different bodies) are
-defined in terms of these 'types'. The AMQFrame class allows a frame
-to be decoded by reading from the supplied buffer, or it allows a
-particular frame to be constructed and then encoded by writing to the
-supplied buffer. The io layer can then access the raw data that
-'backs' the buffer to either out it on the wire or to populate it from
-the wire.
-
-One minor exception to this is the protocol initiation. AMQP defines
-a protocol 'header', that is not a frame, and is sent by a client to
-intiate a connection. The Connector allows (indeed requires) such a
-frame to be passed in to initialise the connection (the Acceptor, when
-defined, will allow an InitiationHandler to be set allowing the broker
-to hook into the connection initiation). In order to remove
-duplication, the ProtocolInitiation class and the AMQFrame class both
-implement a AMQDataBlock class that defines the encode and decode
-methods. This allows both types to be treated generically for the
-purposes of encoding. In decoding, the context determines which type
-is expected and should be used for decoding (this is only relevant to
-the broker).
-
-
-
-
- --------api--------
- Client Impl ...............uses.....
-input handler --> --------- --------- <-- output handler .
- A | .
- | | framing utils
- | V .
- ------------------- <-- connector .
- IO Layer ................uses....
diff --git a/qpid/cpp/DISCLAIMER b/qpid/cpp/DISCLAIMER
deleted file mode 100644
index c321113c9e..0000000000
--- a/qpid/cpp/DISCLAIMER
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Qpid is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC.
-
-Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
-
-While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
diff --git a/qpid/cpp/LICENSE b/qpid/cpp/LICENSE
deleted file mode 100644
index 8211e7c96e..0000000000
--- a/qpid/cpp/LICENSE
+++ /dev/null
@@ -1,350 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-=========================================================================
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
-==========================================================================
- AMQP License
-=========================================================================
- Copyright Notice
- ================
- (c) Copyright JPMorgan Chase Bank & Co., Cisco Systems, Inc., Envoy Technologies Inc.,
- iMatix Corporation, IONA\ufffd Technologies, Red Hat, Inc.,
- TWIST Process Innovations, and 29West Inc. 2006. All rights reserved.
-
- License
- =======
- JPMorgan Chase Bank & Co., Cisco Systems, Inc., Envoy Technologies Inc., iMatix
- Corporation, IONA Technologies, Red Hat, Inc., TWIST Process Innovations, and
- 29West Inc. (collectively, the "Authors") each hereby grants to you a worldwide,
- perpetual, royalty-free, nontransferable, nonexclusive license to
- (i) copy, display, distribute and implement the Advanced Messaging Queue Protocol
- ("AMQP") Specification and (ii) the Licensed Claims that are held by
- the Authors, all for the purpose of implementing the Advanced Messaging
- Queue Protocol Specification. Your license and any rights under this
- Agreement will terminate immediately without notice from
- any Author if you bring any claim, suit, demand, or action related to
- the Advanced Messaging Queue Protocol Specification against any Author.
- Upon termination, you shall destroy all copies of the Advanced Messaging
- Queue Protocol Specification in your possession or control.
-
- As used hereunder, "Licensed Claims" means those claims of a patent or
- patent application, throughout the world, excluding design patents and
- design registrations, owned or controlled, or that can be sublicensed
- without fee and in compliance with the requirements of this
- Agreement, by an Author or its affiliates now or at any
- future time and which would necessarily be infringed by implementation
- of the Advanced Messaging Queue Protocol Specification. A claim is
- necessarily infringed hereunder only when it is not possible to avoid
- infringing it because there is no plausible non-infringing alternative
- for implementing the required portions of the Advanced Messaging Queue
- Protocol Specification. Notwithstanding the foregoing, Licensed Claims
- shall not include any claims other than as set forth above even if
- contained in the same patent as Licensed Claims; or that read solely
- on any implementations of any portion of the Advanced Messaging Queue
- Protocol Specification that are not required by the Advanced Messaging
- Queue Protocol Specification, or that, if licensed, would require a
- payment of royalties by the licensor to unaffiliated third parties.
- Moreover, Licensed Claims shall not include (i) any enabling technologies
- that may be necessary to make or use any Licensed Product but are not
- themselves expressly set forth in the Advanced Messaging Queue Protocol
- Specification (e.g., semiconductor manufacturing technology, compiler
- technology, object oriented technology, networking technology, operating
- system technology, and the like); or (ii) the implementation of other
- published standards developed elsewhere and merely referred to in the
- body of the Advanced Messaging Queue Protocol Specification, or
- (iii) any Licensed Product and any combinations thereof the purpose or
- function of which is not required for compliance with the Advanced
- Messaging Queue Protocol Specification. For purposes of this definition,
- the Advanced Messaging Queue Protocol Specification shall be deemed to
- include both architectural and interconnection requirements essential
- for interoperability and may also include supporting source code artifacts
- where such architectural, interconnection requirements and source code
- artifacts are expressly identified as being required or documentation to
- achieve compliance with the Advanced Messaging Queue Protocol Specification.
-
- As used hereunder, "Licensed Products" means only those specific portions
- of products (hardware, software or combinations thereof) that implement
- and are compliant with all relevant portions of the Advanced Messaging
- Queue Protocol Specification.
-
- The following disclaimers, which you hereby also acknowledge as to any
- use you may make of the Advanced Messaging Queue Protocol Specification:
-
- THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION IS PROVIDED "AS IS,"
- AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
- IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE
- CONTENTS OF THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION ARE
- SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF THE ADVANCED
- MESSAGING QUEUE PROTOCOL SPECIFICATION WILL NOT INFRINGE ANY THIRD PARTY
- PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
- THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
- INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
- USE, IMPLEMENTATION OR DISTRIBUTION OF THE ADVANCED MESSAGING QUEUE
- PROTOCOL SPECIFICATION.
-
- The name and trademarks of the Authors may NOT be used in any manner,
- including advertising or publicity pertaining to the Advanced Messaging
- Queue Protocol Specification or its contents without specific, written
- prior permission. Title to copyright in the Advanced Messaging Queue
- Protocol Specification will at all times remain with the Authors.
-
- No other rights are granted by implication, estoppel or otherwise.
-
- Upon termination of your license or rights under this Agreement, you
- shall destroy all copies of the Advanced Messaging Queue Protocol
- Specification in your possession or control.
-
- Trademarks
- ==========
- "JPMorgan", "JPMorgan Chase", "Chase", the JPMorgan Chase logo and the
- Octagon Symbol are trademarks of JPMorgan Chase & Co.
-
- IMATIX and the iMatix logo are trademarks of iMatix Corporation sprl.
-
- IONA, IONA Technologies, and the IONA logos are trademarks of IONA
- Technologies PLC and/or its subsidiaries.
-
- LINUX is a trademark of Linus Torvalds. RED HAT and JBOSS are registered
- trademarks of Red Hat, Inc. in the US and other countries.
-
- Java, all Java-based trademarks and OpenOffice.org are trademarks of
- Sun Microsystems, Inc. in the United States, other countries, or both.
-
- Other company, product, or service names may be trademarks or service
- marks of others.
-
- Links to full AMQP specification:
- =================================
- http://www.envoytech.org/spec/amq/
- http://www.iona.com/opensource/amqp/
- http://www.redhat.com/solutions/specifications/amqp/
- http://www.twiststandards.org/tiki-index.php?page=AMQ
- http://www.imatix.com/amqp
diff --git a/qpid/cpp/Makefile.am b/qpid/cpp/Makefile.am
deleted file mode 100644
index 42fc47ba5f..0000000000
--- a/qpid/cpp/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-AUTOMAKE_OPTIONS = 1.9.2 foreign
-ACLOCAL_AMFLAGS = -I m4
-
-SPEC=$(PACKAGE).spec
-
-EXTRA_DIST = \
- LICENSE NOTICE README RELEASE_NOTES\
- etc/qpidd etc/qpidd.conf \
- $(SPEC) $(SPEC).in \
- rpm/README.qpidd-devel \
- xml/cluster.xml
-
-sysconf_DATA = etc/qpidd.conf
-
-SUBDIRS = src docs/api docs/man examples
-
-# Update libtool, if needed.
-libtool: $(LIBTOOL_DEPS)
- $(SHELL) ./config.status --recheck
-
-#
-# Build RPMs from the distribution tarball.
-#
-RPMDIRS=rpm/BUILD rpm/RPMS rpm/SPECS rpm/SRPMS
-RPMMACROS=--define "_topdir @abs_builddir@/rpm" --define "_sourcedir @abs_builddir@"
-# Override this variable e.g. with -bs to produce srpm only
-RPMOPTS=-ba
-
-clean-local:
- -rm -rf $(RPMDIRS)
-
-.PHONY: rpmbuild
-
-rpmbuild: $(SPEC) dist-gzip
- mkdir -p $(RPMDIRS)
- rpmbuild $(RPMMACROS) $(RPMOPTS) $(SPEC)
-if HAS_RPMLINT
- rpmlint `find rpm -name '*.rpm'`
-else
- @echo "WARNING: rpmlint not found, could not validate RPMs."
-endif
-
-
diff --git a/qpid/cpp/NOTICE b/qpid/cpp/NOTICE
deleted file mode 100644
index cae69a873a..0000000000
--- a/qpid/cpp/NOTICE
+++ /dev/null
@@ -1,25 +0,0 @@
-=========================================================================
-== NOTICE file corresponding to the section 4 d of ==
-== the Apache License, Version 2.0, ==
-== in this case for the Apache Qpid distribution. ==
-=========================================================================
-
-This product includes software developed by the Apache Software Foundation
-(http://www.apache.org/).
-
-Please read the LICENSE file present in the root directory of this
-distribution.
-
-
-Aside from contributions to the Apache Qpid project, this software also
-includes (binary only):
- - None at this time
-
-Project requires, not packaged:
- * apr version 1.2.7 or later under the Apache Software License, Version 2.0,
- and can be downloded from http://apr.apache.org
-
- * boost version 1.33.1 or later under the Boost Software License, and
- can be downloaded from http://www.boost.org
- - Included in most OS platfroms by defualt.
-
diff --git a/qpid/cpp/README b/qpid/cpp/README
deleted file mode 100644
index 7de7fd3f98..0000000000
--- a/qpid/cpp/README
+++ /dev/null
@@ -1,291 +0,0 @@
-= Qpid C++ =
-
-Qpid C++ is a C++ implementation of the AMQP protcol described at
- http://amqp.org/
-
-The Qpid project also provides Java, Ruby and Python implementations.
-
-NOTE: This release of Qpid C++ implements the AMQP 0-9 WIP.
-It will not inter-operate with AMQP 0-8 implementations.
-We will be moving to 0-10 as soon as it is available.
-
-For additional software or information on the Qpid project go to:
- http://cwiki.apache.org/qpid/
-
-Available documentation:
- qpidd(1) man page - how to run the broker daemon.
- html/index.html - C++ client API.
- NEWS - release notes.
-Note the daemon and client API can be installed separately.
-
-This README describes how to build the Qpid C++ broker and client, either
-from a checkout of the source or from a source distribution.
-
-== Prerequisites ==
-
-We prefer to avoid spending time accommodating older versions of these
-packages, so please make sure that you have the latest stable versions.
-Known version numbers for a succesfull build are given in brackets, take
-these as a recommended minimum version. Older unix versions, for example,
-Redhat Linux 3, will almost certainly require some packages to be upgraded.
-
-The following libraries and header files must be installed to build
-a source distribution:
- * boost <http://www.boost.org> (1.33.1)
- * e2fsprogs <http://e2fsprogs.sourceforge.net/> (1.39)
- * pkgconfig <http://pkgconfig.freedesktop.org/wiki/> (0.21)
-
-Optional cluster functionality requires:
- * openais <http://openais.org/> (0.80.3)
-
-Running qpid test suite requires:
- * cppunit <http://cppunit.sourceforge.net> (1.11.4)
-
-Qpid has been built using the GNU C++ compiler:
- * gcc <http://gcc.gnu.org/> (3.2.3)
-
-If you want to build directly from the SVN repository you will need
-all of the above plus:
-
- * GNU make <http://www.gnu.org/software/make/> (3.8.0)
- * autoconf <http://www.gnu.org/software/autoconf/> (2.61)
- * automake <http://www.gnu.org/software/automake/> (1.9.6)
- * help2man <http://www.gnu.org/software/help2man/> (1.36.4)
- * libtool <http://www.gnu.org/software/libtool/> (1.5.22)
- * doxygen <ftp://ftp.stack.nl/pub/users/dimitri/> (1.5.1)
- * graphviz <http://www.graphviz.org/> (2.12)
- * ruby 1.8 <http://www.ruby-lang.org> (1.8.4)
-
-=== Installing as root ===
-
-On linux most packages can be installed using your distribution's package
-management tool. For example on Fedora:
- # yum install pkgconfig e2fsprogs boost-devel cppunit-devel openais-devel ruby
- # yum install make gcc-c++ autoconf automake libtool doxygen help2man graphviz
- # yum install e2fsprogs-devel
-
-Follow the manual installation instruction below for any packages not
-available through yum.
-
-=== Building and installing packages manually or as non-root user ===
-
-Required dependencies can be installed and built from source distributions.
-It is recommended that you create a directory to install them to, for example,
-~/qpid-tools. To build and install the dependency pakcages:
-
- 1. Unzip and untar them and cd to the untared directory.
- 2. do:
- # ./configure --prefix=~/qpid-tools
- # make install
-
-The exceptions are openais, boost, JDK 5.0.
-
-==== To build and install openais from source ====
-
-Unpack the source distribution and do:
- # make
- # sudo make install DESTDIR=
- # sudo ldconfig
-
-This will install in the standard places (/usr/lib, /usr/include etc.)
-
-Edit /etc/ais/openais.conf and modify the "bindnetaddr" setting
-to your hosts IP address. Do not use 127.0.0.1.
-
-Make sure the UDP port set for mcastport in openais.conf (5405 by
-default) is not blocked by your firewall. Disable the firewall or
-configure it to allow this port for UDP.
-
-Finally start the ais daemon (must be done as root):
- # sudo /sbin/aisexec
-
-Note that to run the AIS tests your primary group must be "ais". You
-can change your primary group with the usermod command or set it
-temporarily with the newgrp command.
-
-Troubleshooting tips:
-
-If aisexec goes into a loop printing "entering GATHER state", verify your firewall is allowing UDP traffic on the mcastport set in openais.conf.
-
-If aisexec reports "got nodejoin message 127.0.0.1" verify the
-bindnetaddr in openais.conf is an active local IP address. ifconfig
-will list local addresses.
-
-When aisexec is working correctly, the start-up log messages will end
-with "entering OPERATIONAL state." and "got nodejoin message <ip
-address>" where <ip address> is the local IP address specified for
-bindnetaddr in openais.conf.
-
-For further info on openais http://openais.org/
-
-==== To build the boost library ====
-
- 1. Unpack boost-jam.
- 2. Add bjam in the unpacked directory to your path.
- 3. Unpack boost and cd to the boost untarred directory.
- 4. do:
-
- # bjam -sTOOLS=gcc --prefix=~/qpid-tools
-
-==== To install JDK 5.0 ====
-Download and run its install script, or whatever
-alternative instructions may be on the sun website.
-
-Ensure that all the build tools are available on your path, when they are
-manually installed to non-standard locations. For example:
-
- # export PATH=~/qpid-tools/bin:$PATH
-
-Ensure that pkg-config is set up correctly. For example:
-
- # export PKG_CONFIG_PATH=~/qpid-tools/lib/pkgconfig:/usr/local/pkgconfig
- # export PKG_CONFIG=~/qpid-tools/bin/pkg-config
-
-Ensure that the boost libraries are made available on the gcc library path.
-For example:
-
- # export CXXFLAGS=-I~/qpid-tools/include/boost-1_33_1
-
-Ensure that JDK 5.0 has its home location set up correctly and is added to
-the path. For example:
-
- # export PATH=~/jdk1.5.0_11/bin:$PATH
-
-== Building from a source distribution. ==
-
-In the distribution directory
-
-Build and install with:
-
- # ./configure --prefix=<install_location>
- # make all
- # make install
-
-To build and test everything:
-
- # make
- # make check
-
-This builds in the source tree. You can have multiple builds in the
-same working copy with different configuration. For example you can do
-the following to build twice, once for debug, the other with
-optimization:
-
- # make distclean
- # mkdir .build-dbg .build-opt
- # (cd .build-opt ../configure --prefix=/tmp/x && make && make check)
- # (cd .build-dbg ../configure CXXFLAGS=-g --prefix=/tmp/x \
- && make && make check)
-
-
-== For Qpid developers: building a repository working copy ==
-
-=== Installing the latest autotools ===
-
-If you don't have sufficiently up-to-date autotools you can get the
-latest by running run the script qpid-autotools-install.
-
-1. Decide where you would like to install the tools. It should be in a
- local directory so that you do not need root privileges. (Suggest
- $HOME/qpid-tools.) Create an empty directory.
-2. Modify your environment variable PATH to ensure that the bin directory
- within this directory comes first in the PATH string:
- PATH=$HOME/qpid-tools/bin:$PATH
-3. Set PKG_CONFIG_PATH=$HOME/qpid-tools/lib/pkgconfig:/usr/lib/pkgconfig
- (or if it already exists, make sure that the above path to your
- qpid-tools directory is first).
-4. Run the install utility from the cpp directory:
- ./qpid-autotools-install --prefix=$HOME/qpid-tools --skip-check
- (Note that --prefix will only accept an absolute path, so don't use
- ~/qpid-tools.) The utility will download, compile and install the
- required tools into the qpid-tools directory (this may take a little
- time). Watch for any notices about paths at the end of the install -
- this means that your environment is not correct - see steps 2 and 3
- above.
- NOTE: If you omit the --skip-check option, the check of the build
- can add up to an hour to what is normally a few minutes of install
- time.
-5. Perform a check: from the command-line run "which automake" and
- ensure that it finds the automake in your qpid-tools directory. If not,
- check that the build completed normally and your environment.
-6. (Optional) If having the build artifacts lying around bothers you, delete
- the (hidden) build directory cpp/.build-auto-tools.
-
-To see help, run ./qpid-autotools-install --help.
-
-=== Building a checkout ===
-To get the source code from the subversion repository (trunk) do:
-
- # svn checkout https://svn.apache.org/repos/asf/incubator/qpid/trunk/ .
-
-To build a fresh checkout:
-
-Cd to qpid/cpp subdirectory. Before running make on a fresh checkout do:
-
- # ./bootstrap
-
-This generates config, makefiles and the like - check the script for
-details. You only need to do this once, "make" will keep everything up
-to date thereafter (including re-generating configuration & Makefiles
-if the automake templates change etc.)
-
-If you are developing code yourself, or if you want to help
-us keep the code as tight and robust as possible, consider enabling
-the use of valgrind. If you configure like this:
-
- # ./configure --enable-valgrind
-
-That will arrange (assuming you have valgrind installed) for "make check"
-to run tests via valgrind. That makes the tests run more slowly, but
-helps detect certain types of bugs, as well as memory leaks. If you run
-"make check" and valgrind detects a leak that is not listed as being
-"ignorable-for-now", the test script in question will fail. However,
-recording whether a leak is ignorable is not easy, when the stack
-signature, libraries, compiler, O/S, architecture, etc., may all vary,
-so if you see a new leak, try to figure out if it's one you can fix
-before adding it to the list.
-
-Now follow instruction for building from a source distribution.
-
-=== Portability ===
-
-All system calls are abstracted by classes under lib/common/sys. This
-provides an object-oriented C++ API and contains platform-specific
-code.
-
-These wrappers are mainly inline by-value classes so they impose no
-run-time penalty compared do direct system calls.
-
-Initially we will have a full linux implementation and a portable
-implementation sufficient for the client using the APR portability
-library. The implementations may change in future but the interface
-for qpid code outside the qpid/sys namespace should remain stable.
-
-=== Tests ===
-
-See src/tests/README for details.
-
-== Doxygen ==
-
-Doxygen generates documentation in several formats from source code
-using special comments. You can use javadoc style comments if you know
-javadoc, if you don't or want to know the fully story on doxygen
-markup see http://www.stack.nl/~dimitri/doxygen/
-
-Even even if the code is completely uncommented, doxygen generates
-UML-esque dependency diagrams that are ''extremely'' useful in navigating
-around the code, especially for newcomers.
-
-To try it out "make doxygen" then open doxygen/html/index.html
-This README describes how to build the Qpid C++ broker and client, either
-from a checkout of the source or from a source distribution.
-
-=== Troubleshooting ===
-
-When building, get the following on configure
- configure: error: Package requirements (apr-1 >= 1.2.2) were not met:
- No package 'apr-1' foun
-
-The following has not been set
- export PKG_CONFIG_PATH=$HOME/qpid-tools/lib/pkgconfig:/usr/lib/pkgconfig
-
diff --git a/qpid/cpp/RELEASE_NOTES b/qpid/cpp/RELEASE_NOTES
deleted file mode 100644
index 819539b1ec..0000000000
--- a/qpid/cpp/RELEASE_NOTES
+++ /dev/null
@@ -1,41 +0,0 @@
-Apache Incubator Qpid C++ M2 Release Notes
--------------------------------------------
-
-The Qpid M2 release contains support the for AMQP 0-8 specification.
-You can access the 0-8 specification using the following link.
-http://www.amqp.org/tikiwiki/tiki-index.php?page=Download
-
-For full details of Qpid capabilities, as they currently stand, see our
-detailed project documentation at:
-
-http://cwiki.apache.org/confluence/pages/viewpage.action?pageId=28284
-
-Please take time to go through the README file provided with the distro to get a good understanding about build system etc.
-
-
-Known Issues
-------------
-
-You can view the outstanding task list for Qpid by visiting our JIRA:
-http://issues.apache.org/jira/browse/QPID
-
-Bug QPID-437 c++ broker doesn't obey the mandatory flag
-
-
-M2 Tasks Completed
--------------------
-
-Test QPID-412 Implement initial C++ interop tests
-Task QPID-124 Connect AMQP version from ProtocolInitiation object to all version-aware objects
-
-New Feature QPID-154 Logging/tracing for C++.
-New Feature QPID-98 implement durable exchanges
-New Feature QPID-41 Persistent storage for messages & durable queues
-
-Improvement QPID-450 C++ demos
-Improvement QPID-64 C++ cluster design.
-Improvement QPID-62 C++ event queue design.
-
-Bug QPID-481 c++ broker dosen't implement channel.flow
-Bug QPID-467 Complete Interop Testing
-Bug QPID-123 Sporadic failure on Python tests
diff --git a/qpid/cpp/bootstrap b/qpid/cpp/bootstrap
deleted file mode 100755
index c1fb753201..0000000000
--- a/qpid/cpp/bootstrap
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-set -e
-aclocal -I m4
-autoheader
-libtoolize --automake
-
-# Generate (for automake) lots of repetitive parts of tests/Makefile.am.
-(cd src/tests && rm -f gen.mk
- perl -ne '/^(include |if |else|endif)/ or print' Makefile.am \
- | make -f - abs_srcdir=`dirname $(pwd)` gen.mk > /dev/null )
-
-# Create initial Makefile fragments that will force make to generate
-# the real ones.
-cat > src/rubygen.mk <<EOF
-\$(srcdir)/rubygen.mk: force
- \$(rgen_cmd)
-EOF
-cat > src/managementgen.mk <<EOF
-\$(srcdir)/managementgen.mk: force
- \$(mgen_cmd)
-EOF
-
-
-automake
-autoconf
-
-if [ "$1" = "-build" -o "$1" = "--build" ] ; then
- shift
- ./configure "$@"
- make
- make check
-fi
diff --git a/qpid/cpp/build-aux/compile b/qpid/cpp/build-aux/compile
deleted file mode 100755
index 1b1d232169..0000000000
--- a/qpid/cpp/build-aux/compile
+++ /dev/null
@@ -1,142 +0,0 @@
-#! /bin/sh
-# Wrapper for compilers which do not understand `-c -o'.
-
-scriptversion=2005-05-14.22
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-# Written by Tom Tromey <tromey@cygnus.com>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# This file is maintained in Automake, please report
-# bugs to <bug-automake@gnu.org> or send patches to
-# <automake-patches@gnu.org>.
-
-case $1 in
- '')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
- exit 1;
- ;;
- -h | --h*)
- cat <<\EOF
-Usage: compile [--help] [--version] PROGRAM [ARGS]
-
-Wrapper for compilers which do not understand `-c -o'.
-Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
-arguments, and rename the output as expected.
-
-If you are trying to build a whole package this is not the
-right script to run: please start by reading the file `INSTALL'.
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
- exit $?
- ;;
- -v | --v*)
- echo "compile $scriptversion"
- exit $?
- ;;
-esac
-
-ofile=
-cfile=
-eat=
-
-for arg
-do
- if test -n "$eat"; then
- eat=
- else
- case $1 in
- -o)
- # configure might choose to run compile as `compile cc -o foo foo.c'.
- # So we strip `-o arg' only if arg is an object.
- eat=1
- case $2 in
- *.o | *.obj)
- ofile=$2
- ;;
- *)
- set x "$@" -o "$2"
- shift
- ;;
- esac
- ;;
- *.c)
- cfile=$1
- set x "$@" "$1"
- shift
- ;;
- *)
- set x "$@" "$1"
- shift
- ;;
- esac
- fi
- shift
-done
-
-if test -z "$ofile" || test -z "$cfile"; then
- # If no `-o' option was seen then we might have been invoked from a
- # pattern rule where we don't need one. That is ok -- this is a
- # normal compilation that the losing compiler can handle. If no
- # `.c' file was seen then we are probably linking. That is also
- # ok.
- exec "$@"
-fi
-
-# Name of file we expect compiler to create.
-cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
-
-# Create the lock directory.
-# Note: use `[/.-]' here to ensure that we don't use the same name
-# that we are using for the .o file. Also, base the name on the expected
-# object file name, since that is what matters with a parallel build.
-lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
-while true; do
- if mkdir "$lockdir" >/dev/null 2>&1; then
- break
- fi
- sleep 1
-done
-# FIXME: race condition here if user kills between mkdir and trap.
-trap "rmdir '$lockdir'; exit 1" 1 2 15
-
-# Run the compile.
-"$@"
-ret=$?
-
-if test -f "$cofile"; then
- mv "$cofile" "$ofile"
-elif test -f "${cofile}bj"; then
- mv "${cofile}bj" "$ofile"
-fi
-
-rmdir "$lockdir"
-exit $ret
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/qpid/cpp/build-aux/config.guess b/qpid/cpp/build-aux/config.guess
deleted file mode 100755
index c93201a4d2..0000000000
--- a/qpid/cpp/build-aux/config.guess
+++ /dev/null
@@ -1,1501 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-# Inc.
-
-timestamp='2006-11-08'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[45])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- case ${UNAME_MACHINE} in
- pc98)
- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- i*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- x86:Interix*:[3456]*)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- EM64T:Interix*:[3456]* | authenticamd:Interix*:[3456]*)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- arm*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- cris:Linux:*:*)
- echo cris-axis-linux-gnu
- exit ;;
- crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
- exit ;;
- frv:Linux:*:*)
- echo frv-unknown-linux-gnu
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- mips:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips
- #undef mipsel
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
- #else
- CPU=
- #endif
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
- #else
- CPU=
- #endif
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- or32:Linux:*:*)
- echo or32-unknown-linux-gnu
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
- exit ;;
- x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
- exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- coff-i386)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^LIBC/{
- s: ::g
- p
- }'`"
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/qpid/cpp/build-aux/config.rpath b/qpid/cpp/build-aux/config.rpath
deleted file mode 100755
index c492a93b66..0000000000
--- a/qpid/cpp/build-aux/config.rpath
+++ /dev/null
@@ -1,614 +0,0 @@
-#! /bin/sh
-# Output a system dependent set of variables, describing how to set the
-# run time search path of shared libraries in an executable.
-#
-# Copyright 1996-2006 Free Software Foundation, Inc.
-# Taken from GNU libtool, 2001
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# The first argument passed to this file is the canonical host specification,
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
-# should be set by the caller.
-#
-# The set of defined variables is at the end of this script.
-
-# Known limitations:
-# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
-# than 256 bytes, otherwise the compiler driver will dump core. The only
-# known workaround is to choose shorter directory names for the build
-# directory and/or the installation directory.
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-shrext=.so
-
-host="$1"
-host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-# Code taken from libtool.m4's _LT_CC_BASENAME.
-
-for cc_temp in $CC""; do
- case $cc_temp in
- compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
- distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
- \-*) ;;
- *) break;;
- esac
-done
-cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
-
-# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
-
-wl=
-if test "$GCC" = yes; then
- wl='-Wl,'
-else
- case "$host_os" in
- aix*)
- wl='-Wl,'
- ;;
- darwin*)
- case $cc_basename in
- xlc*)
- wl='-Wl,'
- ;;
- esac
- ;;
- mingw* | pw32* | os2*)
- ;;
- hpux9* | hpux10* | hpux11*)
- wl='-Wl,'
- ;;
- irix5* | irix6* | nonstopux*)
- wl='-Wl,'
- ;;
- newsos6)
- ;;
- linux*)
- case $cc_basename in
- icc* | ecc*)
- wl='-Wl,'
- ;;
- pgcc | pgf77 | pgf90)
- wl='-Wl,'
- ;;
- ccc*)
- wl='-Wl,'
- ;;
- como)
- wl='-lopt='
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- wl='-Wl,'
- ;;
- esac
- ;;
- esac
- ;;
- osf3* | osf4* | osf5*)
- wl='-Wl,'
- ;;
- sco3.2v5*)
- ;;
- solaris*)
- wl='-Wl,'
- ;;
- sunos4*)
- wl='-Qoption ld '
- ;;
- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
- wl='-Wl,'
- ;;
- sysv4*MP*)
- ;;
- unicos*)
- wl='-Wl,'
- ;;
- uts4*)
- ;;
- esac
-fi
-
-# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
-
-hardcode_libdir_flag_spec=
-hardcode_libdir_separator=
-hardcode_direct=no
-hardcode_minus_L=no
-
-case "$host_os" in
- cygwin* | mingw* | pw32*)
- # FIXME: the MSVC++ port hasn't been tested in a loooong time
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- if test "$GCC" != yes; then
- with_gnu_ld=no
- fi
- ;;
- interix*)
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
- openbsd*)
- with_gnu_ld=no
- ;;
-esac
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
- # Set some defaults for GNU ld with shared library support. These
- # are reset later if shared libraries are not supported. Putting them
- # here allows them to be overridden if necessary.
- # Unlike libtool, we use -rpath here, not --rpath, since the documented
- # option of GNU ld is called -rpath, not --rpath.
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- case "$host_os" in
- aix3* | aix4* | aix5*)
- # On AIX/PPC, the GNU linker is very broken
- if test "$host_cpu" != ia64; then
- ld_shlibs=no
- fi
- ;;
- amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
- # that the semantics of dynamic libraries on AmigaOS, at least up
- # to version 4, is to share data among multiple programs linked
- # with the same dynamic library. Since this doesn't match the
- # behavior of shared libraries on other platforms, we cannot use
- # them.
- ld_shlibs=no
- ;;
- beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- cygwin* | mingw* | pw32*)
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec='-L$libdir'
- if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- interix3*)
- hardcode_direct=no
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- ;;
- linux*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- netbsd*)
- ;;
- solaris*)
- if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
- ld_shlibs=no
- elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
- case `$LD -v 2>&1` in
- *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
- ld_shlibs=no
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- else
- ld_shlibs=no
- fi
- ;;
- esac
- ;;
- sunos4*)
- hardcode_direct=yes
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- esac
- if test "$ld_shlibs" = no; then
- hardcode_libdir_flag_spec=
- fi
-else
- case "$host_os" in
- aix3*)
- # Note: this linker hardcodes the directories in LIBPATH if there
- # are no directories specified by -L.
- hardcode_minus_L=yes
- if test "$GCC" = yes; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- hardcode_direct=unsupported
- fi
- ;;
- aix4* | aix5*)
- if test "$host_cpu" = ia64; then
- # On IA64, the linker does run time linking by default, so we don't
- # have to do anything special.
- aix_use_runtimelinking=no
- else
- aix_use_runtimelinking=no
- # Test if we are trying to use run time linking or normal
- # AIX style linking. If -brtl is somewhere in LDFLAGS, we
- # need to do runtime linking.
- case $host_os in aix4.[23]|aix4.[23].*|aix5*)
- for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
- done
- ;;
- esac
- fi
- hardcode_direct=yes
- hardcode_libdir_separator=':'
- if test "$GCC" = yes; then
- case $host_os in aix4.[012]|aix4.[012].*)
- collect2name=`${CC} -print-prog-name=collect2`
- if test -f "$collect2name" && \
- strings "$collect2name" | grep resolve_lib_name >/dev/null
- then
- # We have reworked collect2
- hardcode_direct=yes
- else
- # We have old collect2
- hardcode_direct=unsupported
- hardcode_minus_L=yes
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_libdir_separator=
- fi
- ;;
- esac
- fi
- # Begin _LT_AC_SYS_LIBPATH_AIX.
- echo 'int main () { return 0; }' > conftest.c
- ${CC} ${LDFLAGS} conftest.c -o conftest
- aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`
- if test -z "$aix_libpath"; then
- aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`
- fi
- if test -z "$aix_libpath"; then
- aix_libpath="/usr/lib:/lib"
- fi
- rm -f conftest.c conftest
- # End _LT_AC_SYS_LIBPATH_AIX.
- if test "$aix_use_runtimelinking" = yes; then
- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- else
- if test "$host_cpu" = ia64; then
- hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
- else
- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- fi
- fi
- ;;
- amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # see comment about different semantics on the GNU ld section
- ld_shlibs=no
- ;;
- bsdi[45]*)
- ;;
- cygwin* | mingw* | pw32*)
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec=' '
- libext=lib
- ;;
- darwin* | rhapsody*)
- hardcode_direct=no
- if test "$GCC" = yes ; then
- :
- else
- case $cc_basename in
- xlc*)
- ;;
- *)
- ld_shlibs=no
- ;;
- esac
- fi
- ;;
- dgux*)
- hardcode_libdir_flag_spec='-L$libdir'
- ;;
- freebsd1*)
- ld_shlibs=no
- ;;
- freebsd2.2*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- freebsd2*)
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
- freebsd* | kfreebsd*-gnu | dragonfly*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- hpux9*)
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- ;;
- hpux10*)
- if test "$with_gnu_ld" = no; then
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- fi
- ;;
- hpux11*)
- if test "$with_gnu_ld" = no; then
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- case $host_cpu in
- hppa*64*|ia64*)
- hardcode_direct=no
- ;;
- *)
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- ;;
- esac
- fi
- ;;
- irix5* | irix6* | nonstopux*)
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- netbsd*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- newsos6)
- hardcode_direct=yes
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- openbsd*)
- hardcode_direct=yes
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- else
- case "$host_os" in
- openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
- hardcode_libdir_flag_spec='-R$libdir'
- ;;
- *)
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- ;;
- esac
- fi
- ;;
- os2*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- ;;
- osf3*)
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- osf4* | osf5*)
- if test "$GCC" = yes; then
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- else
- # Both cc and cxx compiler support -rpath directly
- hardcode_libdir_flag_spec='-rpath $libdir'
- fi
- hardcode_libdir_separator=:
- ;;
- solaris*)
- hardcode_libdir_flag_spec='-R$libdir'
- ;;
- sunos4*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
- sysv4)
- case $host_vendor in
- sni)
- hardcode_direct=yes # is this really true???
- ;;
- siemens)
- hardcode_direct=no
- ;;
- motorola)
- hardcode_direct=no #Motorola manual says yes, but my tests say they lie
- ;;
- esac
- ;;
- sysv4.3*)
- ;;
- sysv4*MP*)
- if test -d /usr/nec; then
- ld_shlibs=yes
- fi
- ;;
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- hardcode_libdir_separator=':'
- ;;
- uts4*)
- hardcode_libdir_flag_spec='-L$libdir'
- ;;
- *)
- ld_shlibs=no
- ;;
- esac
-fi
-
-# Check dynamic linker characteristics
-# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
-libname_spec='lib$name'
-case "$host_os" in
- aix3*)
- ;;
- aix4* | aix5*)
- ;;
- amigaos*)
- ;;
- beos*)
- ;;
- bsdi[45]*)
- ;;
- cygwin* | mingw* | pw32*)
- shrext=.dll
- ;;
- darwin* | rhapsody*)
- shrext=.dylib
- ;;
- dgux*)
- ;;
- freebsd1*)
- ;;
- kfreebsd*-gnu)
- ;;
- freebsd* | dragonfly*)
- ;;
- gnu*)
- ;;
- hpux9* | hpux10* | hpux11*)
- case $host_cpu in
- ia64*)
- shrext=.so
- ;;
- hppa*64*)
- shrext=.sl
- ;;
- *)
- shrext=.sl
- ;;
- esac
- ;;
- interix3*)
- ;;
- irix5* | irix6* | nonstopux*)
- case "$host_os" in
- irix5* | nonstopux*)
- libsuff= shlibsuff=
- ;;
- *)
- case $LD in
- *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
- *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
- *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
- *) libsuff= shlibsuff= ;;
- esac
- ;;
- esac
- ;;
- linux*oldld* | linux*aout* | linux*coff*)
- ;;
- linux*)
- ;;
- knetbsd*-gnu)
- ;;
- netbsd*)
- ;;
- newsos6)
- ;;
- nto-qnx*)
- ;;
- openbsd*)
- ;;
- os2*)
- libname_spec='$name'
- shrext=.dll
- ;;
- osf3* | osf4* | osf5*)
- ;;
- solaris*)
- ;;
- sunos4*)
- ;;
- sysv4 | sysv4.3*)
- ;;
- sysv4*MP*)
- ;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- ;;
- uts4*)
- ;;
-esac
-
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
-shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
-escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-
-LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
-
-# How to pass a linker flag through the compiler.
-wl="$escaped_wl"
-
-# Static library suffix (normally "a").
-libext="$libext"
-
-# Shared library suffix (normally "so").
-shlibext="$shlibext"
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator="$hardcode_libdir_separator"
-
-# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct="$hardcode_direct"
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L="$hardcode_minus_L"
-
-EOF
diff --git a/qpid/cpp/build-aux/config.sub b/qpid/cpp/build-aux/config.sub
deleted file mode 100755
index 7ccee73057..0000000000
--- a/qpid/cpp/build-aux/config.sub
+++ /dev/null
@@ -1,1619 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-# Inc.
-
-timestamp='2006-11-07'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
- uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
- | bfin \
- | c4x | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64vr | mips64vrel \
- | mips64orion | mips64orionel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | mt \
- | msp430 \
- | nios | nios2 \
- | ns16k | ns32k \
- | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- | pyramid \
- | score \
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu | strongarm \
- | tahoe | thumb | tic4x | tic80 | tron \
- | v850 | v850e \
- | we32k \
- | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-unknown
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nios-* | nios2-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- | pyramid-* \
- | romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tron-* \
- | v850-* | v850e-* | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa-* \
- | ymp-* \
- | z8k-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16c)
- basic_machine=cr16c-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tic55x | c55x*)
- basic_machine=tic55x-unknown
- os=-coff
- ;;
- tic6x | c6x*)
- basic_machine=tic6x-unknown
- os=-coff
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -kaos*)
- os=-kaos
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/qpid/cpp/build-aux/depcomp b/qpid/cpp/build-aux/depcomp
deleted file mode 100755
index ca5ea4e1ef..0000000000
--- a/qpid/cpp/build-aux/depcomp
+++ /dev/null
@@ -1,584 +0,0 @@
-#! /bin/sh
-# depcomp - compile a program generating dependencies as side-effects
-
-scriptversion=2006-10-15.18
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
-# Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
-
-case $1 in
- '')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
- exit 1;
- ;;
- -h | --h*)
- cat <<\EOF
-Usage: depcomp [--help] [--version] PROGRAM [ARGS]
-
-Run PROGRAMS ARGS to compile a file, generating dependencies
-as side-effects.
-
-Environment variables:
- depmode Dependency tracking mode.
- source Source file read by `PROGRAMS ARGS'.
- object Object file output by `PROGRAMS ARGS'.
- DEPDIR directory where to store dependencies.
- depfile Dependency file to output.
- tmpdepfile Temporary file to use when outputing dependencies.
- libtool Whether libtool is used (yes/no).
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
- exit $?
- ;;
- -v | --v*)
- echo "depcomp $scriptversion"
- exit $?
- ;;
-esac
-
-if test -z "$depmode" || test -z "$source" || test -z "$object"; then
- echo "depcomp: Variables source, object and depmode must be set" 1>&2
- exit 1
-fi
-
-# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
-depfile=${depfile-`echo "$object" |
- sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
-tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
-
-rm -f "$tmpdepfile"
-
-# Some modes work just like other modes, but use different flags. We
-# parameterize here, but still list the modes in the big case below,
-# to make depend.m4 easier to write. Note that we *cannot* use a case
-# here, because this file can only contain one case statement.
-if test "$depmode" = hp; then
- # HP compiler uses -M and no extra arg.
- gccflag=-M
- depmode=gcc
-fi
-
-if test "$depmode" = dashXmstdout; then
- # This is just like dashmstdout with a different argument.
- dashmflag=-xM
- depmode=dashmstdout
-fi
-
-case "$depmode" in
-gcc3)
-## gcc 3 implements dependency tracking that does exactly what
-## we want. Yay! Note: for some reason libtool 1.4 doesn't like
-## it if -MD -MP comes after the -MF stuff. Hmm.
-## Unfortunately, FreeBSD c89 acceptance of flags depends upon
-## the command line argument order; so add the flags where they
-## appear in depend2.am. Note that the slowdown incurred here
-## affects only configure: in makefiles, %FASTDEP% shortcuts this.
- for arg
- do
- case $arg in
- -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
- *) set fnord "$@" "$arg" ;;
- esac
- shift # fnord
- shift # $arg
- done
- "$@"
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
- mv "$tmpdepfile" "$depfile"
- ;;
-
-gcc)
-## There are various ways to get dependency output from gcc. Here's
-## why we pick this rather obscure method:
-## - Don't want to use -MD because we'd like the dependencies to end
-## up in a subdir. Having to rename by hand is ugly.
-## (We might end up doing this anyway to support other compilers.)
-## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-## -MM, not -M (despite what the docs say).
-## - Using -M directly means running the compiler twice (even worse
-## than renaming).
- if test -z "$gccflag"; then
- gccflag=-MD,
- fi
- "$@" -Wp,"$gccflag$tmpdepfile"
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
- rm -f "$depfile"
- echo "$object : \\" > "$depfile"
- alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
- sed -e 's/^[^:]*: / /' \
- -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header). We avoid this by adding
-## dummy dependencies for each header file. Too bad gcc doesn't do
-## this for us directly.
- tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'. On the theory
-## that the space means something, we add a space to the output as
-## well.
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-hp)
- # This case exists only to let depend.m4 do its work. It works by
- # looking at the text of this script. This case will never be run,
- # since it is checked for above.
- exit 1
- ;;
-
-sgi)
- if test "$libtool" = yes; then
- "$@" "-Wp,-MDupdate,$tmpdepfile"
- else
- "$@" -MDupdate "$tmpdepfile"
- fi
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
- rm -f "$depfile"
-
- if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
- echo "$object : \\" > "$depfile"
-
- # Clip off the initial element (the dependent). Don't try to be
- # clever and replace this with sed code, as IRIX sed won't handle
- # lines with more than a fixed number of characters (4096 in
- # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
- # the IRIX cc adds comments like `#:fec' to the end of the
- # dependency line.
- tr ' ' '
-' < "$tmpdepfile" \
- | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
- tr '
-' ' ' >> $depfile
- echo >> $depfile
-
- # The second pass generates a dummy entry for each header file.
- tr ' ' '
-' < "$tmpdepfile" \
- | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
- >> $depfile
- else
- # The sourcefile does not contain any dependencies, so just
- # store a dummy comment line, to avoid errors with the Makefile
- # "include basename.Plo" scheme.
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile"
- ;;
-
-aix)
- # The C for AIX Compiler uses -M and outputs the dependencies
- # in a .u file. In older versions, this file always lives in the
- # current directory. Also, the AIX compiler puts `$object:' at the
- # start of each line; $object doesn't have directory information.
- # Version 6 uses the directory in both cases.
- stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
- tmpdepfile="$stripped.u"
- if test "$libtool" = yes; then
- "$@" -Wc,-M
- else
- "$@" -M
- fi
- stat=$?
-
- if test -f "$tmpdepfile"; then :
- else
- stripped=`echo "$stripped" | sed 's,^.*/,,'`
- tmpdepfile="$stripped.u"
- fi
-
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
-
- if test -f "$tmpdepfile"; then
- outname="$stripped.o"
- # Each line is of the form `foo.o: dependent.h'.
- # Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
- sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
- sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
- else
- # The sourcefile does not contain any dependencies, so just
- # store a dummy comment line, to avoid errors with the Makefile
- # "include basename.Plo" scheme.
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile"
- ;;
-
-icc)
- # Intel's C compiler understands `-MD -MF file'. However on
- # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
- # ICC 7.0 will fill foo.d with something like
- # foo.o: sub/foo.c
- # foo.o: sub/foo.h
- # which is wrong. We want:
- # sub/foo.o: sub/foo.c
- # sub/foo.o: sub/foo.h
- # sub/foo.c:
- # sub/foo.h:
- # ICC 7.1 will output
- # foo.o: sub/foo.c sub/foo.h
- # and will wrap long lines using \ :
- # foo.o: sub/foo.c ... \
- # sub/foo.h ... \
- # ...
-
- "$@" -MD -MF "$tmpdepfile"
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
- rm -f "$depfile"
- # Each line is of the form `foo.o: dependent.h',
- # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
- # Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
- sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
- # Some versions of the HPUX 10.20 sed can't process this invocation
- # correctly. Breaking it into two sed invocations is a workaround.
- sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
- sed -e 's/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-hp2)
- # The "hp" stanza above does not work with aCC (C++) and HP's ia64
- # compilers, which have integrated preprocessors. The correct option
- # to use with these is +Maked; it writes dependencies to a file named
- # 'foo.d', which lands next to the object file, wherever that
- # happens to be.
- # Much of this is similar to the tru64 case; see comments there.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
- if test "$libtool" = yes; then
- tmpdepfile1=$dir$base.d
- tmpdepfile2=$dir.libs/$base.d
- "$@" -Wc,+Maked
- else
- tmpdepfile1=$dir$base.d
- tmpdepfile2=$dir$base.d
- "$@" +Maked
- fi
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile1" "$tmpdepfile2"
- exit $stat
- fi
-
- for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
- do
- test -f "$tmpdepfile" && break
- done
- if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
- # Add `dependent.h:' lines.
- sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
- else
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile" "$tmpdepfile2"
- ;;
-
-tru64)
- # The Tru64 compiler uses -MD to generate dependencies as a side
- # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
- # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
- # dependencies in `foo.d' instead, so we check for that too.
- # Subdirectories are respected.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
- if test "$libtool" = yes; then
- # With Tru64 cc, shared objects can also be used to make a
- # static library. This mechanism is used in libtool 1.4 series to
- # handle both shared and static libraries in a single compilation.
- # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
- #
- # With libtool 1.5 this exception was removed, and libtool now
- # generates 2 separate objects for the 2 libraries. These two
- # compilations output dependencies in $dir.libs/$base.o.d and
- # in $dir$base.o.d. We have to check for both files, because
- # one of the two compilations can be disabled. We should prefer
- # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
- # automatically cleaned when .libs/ is deleted, while ignoring
- # the former would cause a distcleancheck panic.
- tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
- tmpdepfile2=$dir$base.o.d # libtool 1.5
- tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
- tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
- "$@" -Wc,-MD
- else
- tmpdepfile1=$dir$base.o.d
- tmpdepfile2=$dir$base.d
- tmpdepfile3=$dir$base.d
- tmpdepfile4=$dir$base.d
- "$@" -MD
- fi
-
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
- exit $stat
- fi
-
- for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
- do
- test -f "$tmpdepfile" && break
- done
- if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- # That's a tab and a space in the [].
- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
- else
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile"
- ;;
-
-#nosideeffect)
- # This comment above is used by automake to tell side-effect
- # dependency tracking mechanisms from slower ones.
-
-dashmstdout)
- # Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout, regardless of -o.
- "$@" || exit $?
-
- # Remove the call to Libtool.
- if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
- shift
- done
- shift
- fi
-
- # Remove `-o $object'.
- IFS=" "
- for arg
- do
- case $arg in
- -o)
- shift
- ;;
- $object)
- shift
- ;;
- *)
- set fnord "$@" "$arg"
- shift # fnord
- shift # $arg
- ;;
- esac
- done
-
- test -z "$dashmflag" && dashmflag=-M
- # Require at least two characters before searching for `:'
- # in the target name. This is to cope with DOS-style filenames:
- # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
- "$@" $dashmflag |
- sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
- rm -f "$depfile"
- cat < "$tmpdepfile" > "$depfile"
- tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-dashXmstdout)
- # This case only exists to satisfy depend.m4. It is never actually
- # run, as this mode is specially recognized in the preamble.
- exit 1
- ;;
-
-makedepend)
- "$@" || exit $?
- # Remove any Libtool call
- if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
- shift
- done
- shift
- fi
- # X makedepend
- shift
- cleared=no
- for arg in "$@"; do
- case $cleared in
- no)
- set ""; shift
- cleared=yes ;;
- esac
- case "$arg" in
- -D*|-I*)
- set fnord "$@" "$arg"; shift ;;
- # Strip any option that makedepend may not understand. Remove
- # the object too, otherwise makedepend will parse it as a source file.
- -*|$object)
- ;;
- *)
- set fnord "$@" "$arg"; shift ;;
- esac
- done
- obj_suffix="`echo $object | sed 's/^.*\././'`"
- touch "$tmpdepfile"
- ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
- rm -f "$depfile"
- cat < "$tmpdepfile" > "$depfile"
- sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile" "$tmpdepfile".bak
- ;;
-
-cpp)
- # Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout.
- "$@" || exit $?
-
- # Remove the call to Libtool.
- if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
- shift
- done
- shift
- fi
-
- # Remove `-o $object'.
- IFS=" "
- for arg
- do
- case $arg in
- -o)
- shift
- ;;
- $object)
- shift
- ;;
- *)
- set fnord "$@" "$arg"
- shift # fnord
- shift # $arg
- ;;
- esac
- done
-
- "$@" -E |
- sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
- -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
- sed '$ s: \\$::' > "$tmpdepfile"
- rm -f "$depfile"
- echo "$object : \\" > "$depfile"
- cat < "$tmpdepfile" >> "$depfile"
- sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-msvisualcpp)
- # Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout, regardless of -o,
- # because we must use -o when running libtool.
- "$@" || exit $?
- IFS=" "
- for arg
- do
- case "$arg" in
- "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
- set fnord "$@"
- shift
- shift
- ;;
- *)
- set fnord "$@" "$arg"
- shift
- shift
- ;;
- esac
- done
- "$@" -E |
- sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
- rm -f "$depfile"
- echo "$object : \\" > "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
- echo " " >> "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-none)
- exec "$@"
- ;;
-
-*)
- echo "Unknown depmode $depmode" 1>&2
- exit 1
- ;;
-esac
-
-exit 0
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/qpid/cpp/build-aux/install-sh b/qpid/cpp/build-aux/install-sh
deleted file mode 100755
index 4fbbae7b7f..0000000000
--- a/qpid/cpp/build-aux/install-sh
+++ /dev/null
@@ -1,507 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2006-10-14.15
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" "" $nl"
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-if test -z "$doit"; then
- doit_exec=exec
-else
- doit_exec=$doit
-fi
-
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-posix_glob=
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chmodcmd=$chmodprog
-chowncmd=
-chgrpcmd=
-stripcmd=
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=
-dst=
-dir_arg=
-dstarg=
-no_target_directory=
-
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
- or: $0 [OPTION]... SRCFILES... DIRECTORY
- or: $0 [OPTION]... -t DIRECTORY SRCFILES...
- or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
--c (ignored)
--d create directories instead of installing files.
--g GROUP $chgrpprog installed files to GROUP.
--m MODE $chmodprog installed files to MODE.
--o USER $chownprog installed files to USER.
--s $stripprog installed files.
--t DIRECTORY install into DIRECTORY.
--T report an error if DSTFILE is a directory.
---help display this help and exit.
---version display version info and exit.
-
-Environment variables override the default commands:
- CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
- case $1 in
- -c) shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- --help) echo "$usage"; exit $?;;
-
- -m) mode=$2
- shift
- shift
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t) dstarg=$2
- shift
- shift
- continue;;
-
- -T) no_target_directory=true
- shift
- continue;;
-
- --version) echo "$0 $scriptversion"; exit $?;;
-
- --) shift
- break;;
-
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
-
- *) break;;
- esac
-done
-
-if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
- # When -d is used, all remaining arguments are directories to create.
- # When -t is used, the destination is already specified.
- # Otherwise, the last argument is the destination. Remove it from $@.
- for arg
- do
- if test -n "$dstarg"; then
- # $@ is not empty: it contains at least $arg.
- set fnord "$@" "$dstarg"
- shift # fnord
- fi
- shift # arg
- dstarg=$arg
- done
-fi
-
-if test $# -eq 0; then
- if test -z "$dir_arg"; then
- echo "$0: no input file specified." >&2
- exit 1
- fi
- # It's OK to call `install-sh -d' without argument.
- # This can happen when creating conditional directories.
- exit 0
-fi
-
-if test -z "$dir_arg"; then
- trap '(exit $?); exit' 1 2 13 15
-
- # Set umask so as not to create temps with too-generous modes.
- # However, 'strip' requires both read and write access to temps.
- case $mode in
- # Optimize common cases.
- *644) cp_umask=133;;
- *755) cp_umask=22;;
-
- *[0-7])
- if test -z "$stripcmd"; then
- u_plus_rw=
- else
- u_plus_rw='% 200'
- fi
- cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
- *)
- if test -z "$stripcmd"; then
- u_plus_rw=
- else
- u_plus_rw=,u+rw
- fi
- cp_umask=$mode$u_plus_rw;;
- esac
-fi
-
-for src
-do
- # Protect names starting with `-'.
- case $src in
- -*) src=./$src ;;
- esac
-
- if test -n "$dir_arg"; then
- dst=$src
- dstdir=$dst
- test -d "$dstdir"
- dstdir_status=$?
- else
-
- # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
- # might cause directories to be created, which would be especially bad
- # if $src (and thus $dsttmp) contains '*'.
- if test ! -f "$src" && test ! -d "$src"; then
- echo "$0: $src does not exist." >&2
- exit 1
- fi
-
- if test -z "$dstarg"; then
- echo "$0: no destination specified." >&2
- exit 1
- fi
-
- dst=$dstarg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst ;;
- esac
-
- # If destination is a directory, append the input filename; won't work
- # if double slashes aren't ignored.
- if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dstarg: Is a directory" >&2
- exit 1
- fi
- dstdir=$dst
- dst=$dstdir/`basename "$src"`
- dstdir_status=0
- else
- # Prefer dirname, but fall back on a substitute if dirname fails.
- dstdir=`
- (dirname "$dst") 2>/dev/null ||
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$dst" : 'X\(//\)[^/]' \| \
- X"$dst" : 'X\(//\)$' \| \
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
- echo X"$dst" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'
- `
-
- test -d "$dstdir"
- dstdir_status=$?
- fi
- fi
-
- obsolete_mkdir_used=false
-
- if test $dstdir_status != 0; then
- case $posix_mkdir in
- '')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
- else
- mkdir_mode=
- fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writeable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
- esac
-
- if
- $posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
- )
- then :
- else
-
- # The umask is ridiculous, or mkdir does not conform to POSIX,
- # or it failed possibly due to a race condition. Create the
- # directory the slow way, step by step, checking for races as we go.
-
- case $dstdir in
- /*) prefix=/ ;;
- -*) prefix=./ ;;
- *) prefix= ;;
- esac
-
- case $posix_glob in
- '')
- if (set -f) 2>/dev/null; then
- posix_glob=true
- else
- posix_glob=false
- fi ;;
- esac
-
- oIFS=$IFS
- IFS=/
- $posix_glob && set -f
- set fnord $dstdir
- shift
- $posix_glob && set +f
- IFS=$oIFS
-
- prefixes=
-
- for d
- do
- test -z "$d" && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
- done
-
- if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
- fi
- fi
- fi
-
- if test -n "$dir_arg"; then
- { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
- { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
- test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
- else
-
- # Make a couple of temp file names in the proper directory.
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
-
- # Trap to clean up those temp files at exit.
- trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
- # Copy the file name to the temp name.
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
- # and set any options; do chmod last to preserve setuid bits.
- #
- # If any of these fail, we abort the whole thing. If we want to
- # ignore errors from any of these, just make sure not to ignore
- # errors from the above "$doit $cpprog $src $dsttmp" command.
- #
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
- && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
- && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
- # Now rename the file to the real destination.
- { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
- || {
- # The rename failed, perhaps because mv can't rename something else
- # to itself, or perhaps because mv is so ancient that it does not
- # support -f.
-
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- if test -f "$dst"; then
- $doit $rmcmd -f "$dst" 2>/dev/null \
- || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
- && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
- || {
- echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- else
- :
- fi
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
- }
- } || exit 1
-
- trap '' 0
- fi
-done
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/qpid/cpp/build-aux/ltmain.sh b/qpid/cpp/build-aux/ltmain.sh
deleted file mode 100755
index c715b59412..0000000000
--- a/qpid/cpp/build-aux/ltmain.sh
+++ /dev/null
@@ -1,6871 +0,0 @@
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-basename="s,^.*/,,g"
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# The name of this program:
-progname=`echo "$progpath" | $SED $basename`
-modename="$progname"
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION="1.5.22 Debian 1.5.22-4"
-TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
-
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
-fi
-
-# Check that we have a working $echo.
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
- # Yippee, $echo works!
- :
-else
- # Restart under the correct shell, and then maybe $echo will work.
- exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-$*
-EOF
- exit $EXIT_SUCCESS
-fi
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
- # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
- SP2NL='tr \040 \012'
- NL2SP='tr \015\012 \040\040'
- ;;
- *) # EBCDIC based system
- SP2NL='tr \100 \n'
- NL2SP='tr \r\n \100\100'
- ;;
-esac
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-# We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
- save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
- save_LANG="$LANG"; LANG=C; export LANG
-fi
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS=" $lt_nl"
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- $echo "$modename: not configured to build any kind of library" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-duplicate_deps=no
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-
-#####################################
-# Shell function definitions:
-# This seems to be the best place for them
-
-# func_mktempdir [string]
-# Make a temporary directory that won't clash with other running
-# libtool processes, and avoids race conditions if possible. If
-# given, STRING is the basename for that directory.
-func_mktempdir ()
-{
- my_template="${TMPDIR-/tmp}/${1-$progname}"
-
- if test "$run" = ":"; then
- # Return a directory name, but don't create it in dry-run mode
- my_tmpdir="${my_template}-$$"
- else
-
- # If mktemp works, use that first and foremost
- my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
-
- if test ! -d "$my_tmpdir"; then
- # Failing that, at least try and use $RANDOM to avoid a race
- my_tmpdir="${my_template}-${RANDOM-0}$$"
-
- save_mktempdir_umask=`umask`
- umask 0077
- $mkdir "$my_tmpdir"
- umask $save_mktempdir_umask
- fi
-
- # If we're not in dry-run mode, bomb out on failure
- test -d "$my_tmpdir" || {
- $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
- exit $EXIT_FAILURE
- }
- fi
-
- $echo "X$my_tmpdir" | $Xsed
-}
-
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-func_win32_libid ()
-{
- win32_libid_type="unknown"
- win32_fileres=`file -L $1 2>/dev/null`
- case $win32_fileres in
- *ar\ archive\ import\ library*) # definitely import
- win32_libid_type="x86 archive import"
- ;;
- *ar\ archive*) # could be an import, or static
- if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
- $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
- win32_nmres=`eval $NM -f posix -A $1 | \
- $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
- case $win32_nmres in
- import*) win32_libid_type="x86 archive import";;
- *) win32_libid_type="x86 archive static";;
- esac
- fi
- ;;
- *DLL*)
- win32_libid_type="x86 DLL"
- ;;
- *executable*) # but shell scripts are "executable" too...
- case $win32_fileres in
- *MS\ Windows\ PE\ Intel*)
- win32_libid_type="x86 DLL"
- ;;
- esac
- ;;
- esac
- $echo $win32_libid_type
-}
-
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag ()
-{
- if test -n "$available_tags" && test -z "$tagname"; then
- CC_quoted=
- for arg in $CC; do
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- CC_quoted="$CC_quoted $arg"
- done
- case $@ in
- # Blanks in the command may have been stripped by the calling shell,
- # but not from the CC environment variable when configure was run.
- " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
- # Blanks at the start of $base_compile will cause this to fail
- # if we don't check for them as well.
- *)
- for z in $available_tags; do
- if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
- # Evaluate the configuration.
- eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
- CC_quoted=
- for arg in $CC; do
- # Double-quote args containing other shell metacharacters.
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- CC_quoted="$CC_quoted $arg"
- done
- case "$@ " in
- " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
- # The compiler in the base compile command matches
- # the one in the tagged configuration.
- # Assume this is the tagged configuration we want.
- tagname=$z
- break
- ;;
- esac
- fi
- done
- # If $tagname still isn't set, then no tagged configuration
- # was found and let the user know that the "--tag" command
- # line option must be used.
- if test -z "$tagname"; then
- $echo "$modename: unable to infer tagged configuration"
- $echo "$modename: specify a tag with \`--tag'" 1>&2
- exit $EXIT_FAILURE
-# else
-# $echo "$modename: using $tagname tagged configuration"
- fi
- ;;
- esac
- fi
-}
-
-
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
- f_ex_an_ar_dir="$1"; shift
- f_ex_an_ar_oldlib="$1"
-
- $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
- $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
- if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
- exit $EXIT_FAILURE
- fi
-}
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
- my_gentop="$1"; shift
- my_oldlibs=${1+"$@"}
- my_oldobjs=""
- my_xlib=""
- my_xabs=""
- my_xdir=""
- my_status=""
-
- $show "${rm}r $my_gentop"
- $run ${rm}r "$my_gentop"
- $show "$mkdir $my_gentop"
- $run $mkdir "$my_gentop"
- my_status=$?
- if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
- exit $my_status
- fi
-
- for my_xlib in $my_oldlibs; do
- # Extract the objects.
- case $my_xlib in
- [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
- *) my_xabs=`pwd`"/$my_xlib" ;;
- esac
- my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
- my_xdir="$my_gentop/$my_xlib"
-
- $show "${rm}r $my_xdir"
- $run ${rm}r "$my_xdir"
- $show "$mkdir $my_xdir"
- $run $mkdir "$my_xdir"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
- exit $exit_status
- fi
- case $host in
- *-darwin*)
- $show "Extracting $my_xabs"
- # Do not bother doing anything if just a dry run
- if test -z "$run"; then
- darwin_orig_dir=`pwd`
- cd $my_xdir || exit $?
- darwin_archive=$my_xabs
- darwin_curdir=`pwd`
- darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
- darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
- if test -n "$darwin_arches"; then
- darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
- darwin_arch=
- $show "$darwin_base_archive has multiple architectures $darwin_arches"
- for darwin_arch in $darwin_arches ; do
- mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
- cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- func_extract_an_archive "`pwd`" "${darwin_base_archive}"
- cd "$darwin_curdir"
- $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
- done # $darwin_arches
- ## Okay now we have a bunch of thin objects, gotta fatten them up :)
- darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
- darwin_file=
- darwin_files=
- for darwin_file in $darwin_filelist; do
- darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
- lipo -create -output "$darwin_file" $darwin_files
- done # $darwin_filelist
- ${rm}r unfat-$$
- cd "$darwin_orig_dir"
- else
- cd "$darwin_orig_dir"
- func_extract_an_archive "$my_xdir" "$my_xabs"
- fi # $darwin_arches
- fi # $run
- ;;
- *)
- func_extract_an_archive "$my_xdir" "$my_xabs"
- ;;
- esac
- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
- func_extract_archives_result="$my_oldobjs"
-}
-# End of Shell function definitions
-#####################################
-
-# Darwin sucks
-eval std_shrext=\"$shrext_cmds\"
-
-disable_libs=no
-
-# Parse our command line options once, thoroughly.
-while test "$#" -gt 0
-do
- arg="$1"
- shift
-
- case $arg in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- execute_dlfiles)
- execute_dlfiles="$execute_dlfiles $arg"
- ;;
- tag)
- tagname="$arg"
- preserve_args="${preserve_args}=$arg"
-
- # Check whether tagname contains only valid characters
- case $tagname in
- *[!-_A-Za-z0-9,/]*)
- $echo "$progname: invalid tag name: $tagname" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $tagname in
- CC)
- # Don't test for the "default" C tag, as we know, it's there, but
- # not specially marked.
- ;;
- *)
- if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
- taglist="$taglist $tagname"
- # Evaluate the configuration.
- eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
- else
- $echo "$progname: ignoring unknown tag $tagname" 1>&2
- fi
- ;;
- esac
- ;;
- *)
- eval "$prev=\$arg"
- ;;
- esac
-
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case $arg in
- --help)
- show_help=yes
- ;;
-
- --version)
- $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
- $echo
- $echo "Copyright (C) 2005 Free Software Foundation, Inc."
- $echo "This is free software; see the source for copying conditions. There is NO"
- $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
- exit $?
- ;;
-
- --config)
- ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
- # Now print the configurations for the tags.
- for tagname in $taglist; do
- ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
- done
- exit $?
- ;;
-
- --debug)
- $echo "$progname: enabling shell trace mode"
- set -x
- preserve_args="$preserve_args $arg"
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- $echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- $echo "enable shared libraries"
- else
- $echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- $echo "enable static libraries"
- else
- $echo "disable static libraries"
- fi
- exit $?
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- --preserve-dup-deps) duplicate_deps="yes" ;;
-
- --quiet | --silent)
- show=:
- preserve_args="$preserve_args $arg"
- ;;
-
- --tag)
- prevopt="--tag"
- prev=tag
- preserve_args="$preserve_args --tag"
- ;;
- --tag=*)
- set tag "$optarg" ${1+"$@"}
- shift
- prev=tag
- preserve_args="$preserve_args --tag"
- ;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
- ;;
-
- -*)
- $echo "$modename: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-if test -n "$prevopt"; then
- $echo "$modename: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
-fi
-
-case $disable_libs in
-no)
- ;;
-shared)
- build_libtool_libs=no
- build_old_libs=yes
- ;;
-static)
- build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
- ;;
-esac
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end. This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
- $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
- case $nonopt in
- *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
- mode=link
- for arg
- do
- case $arg in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *db | *dbx | *strace | *truss)
- mode=execute
- ;;
- *install*|cp|mv)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
-
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- $echo "$modename: unrecognized option \`-dlopen'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$modename --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case $mode in
- # libtool compile mode
- compile)
- modename="$modename: compile"
- # Get the compilation command and the source file.
- base_compile=
- srcfile="$nonopt" # always keep a non-empty value in "srcfile"
- suppress_opt=yes
- suppress_output=
- arg_mode=normal
- libobj=
- later=
-
- for arg
- do
- case $arg_mode in
- arg )
- # do not "continue". Instead, add this to base_compile
- lastarg="$arg"
- arg_mode=normal
- ;;
-
- target )
- libobj="$arg"
- arg_mode=normal
- continue
- ;;
-
- normal )
- # Accept any command-line options.
- case $arg in
- -o)
- if test -n "$libobj" ; then
- $echo "$modename: you cannot specify \`-o' more than once" 1>&2
- exit $EXIT_FAILURE
- fi
- arg_mode=target
- continue
- ;;
-
- -static | -prefer-pic | -prefer-non-pic)
- later="$later $arg"
- continue
- ;;
-
- -no-suppress)
- suppress_opt=no
- continue
- ;;
-
- -Xcompiler)
- arg_mode=arg # the next one goes into the "base_compile" arg list
- continue # The current "srcfile" will either be retained or
- ;; # replaced later. I would guess that would be a bug.
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
- lastarg=
- save_ifs="$IFS"; IFS=','
- for arg in $args; do
- IFS="$save_ifs"
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- lastarg="$lastarg $arg"
- done
- IFS="$save_ifs"
- lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
-
- # Add the arguments to base_compile.
- base_compile="$base_compile $lastarg"
- continue
- ;;
-
- * )
- # Accept the current argument as the source file.
- # The previous "srcfile" becomes the current argument.
- #
- lastarg="$srcfile"
- srcfile="$arg"
- ;;
- esac # case $arg
- ;;
- esac # case $arg_mode
-
- # Aesthetically quote the previous argument.
- lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
-
- case $lastarg in
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, and some SunOS ksh mistreat backslash-escaping
- # in scan sets (worked around with variable expansion),
- # and furthermore cannot handle '|' '&' '(' ')' in scan sets
- # at all, so we specify them separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- lastarg="\"$lastarg\""
- ;;
- esac
-
- base_compile="$base_compile $lastarg"
- done # for arg
-
- case $arg_mode in
- arg)
- $echo "$modename: you must specify an argument for -Xcompile"
- exit $EXIT_FAILURE
- ;;
- target)
- $echo "$modename: you must specify a target with \`-o'" 1>&2
- exit $EXIT_FAILURE
- ;;
- *)
- # Get the name of the library object.
- [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
- ;;
- esac
-
- # Recognize several different file suffixes.
- # If the user specifies -o file.o, it is replaced with file.lo
- xform='[cCFSifmso]'
- case $libobj in
- *.ada) xform=ada ;;
- *.adb) xform=adb ;;
- *.ads) xform=ads ;;
- *.asm) xform=asm ;;
- *.c++) xform=c++ ;;
- *.cc) xform=cc ;;
- *.ii) xform=ii ;;
- *.class) xform=class ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.f90) xform=f90 ;;
- *.for) xform=for ;;
- *.java) xform=java ;;
- esac
-
- libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
- case $libobj in
- *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
- *)
- $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- func_infer_tag $base_compile
-
- for arg in $later; do
- case $arg in
- -static)
- build_old_libs=yes
- continue
- ;;
-
- -prefer-pic)
- pic_mode=yes
- continue
- ;;
-
- -prefer-non-pic)
- pic_mode=no
- continue
- ;;
- esac
- done
-
- qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
- case $qlibobj in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qlibobj="\"$qlibobj\"" ;;
- esac
- test "X$libobj" != "X$qlibobj" \
- && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
- && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
- objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
- xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$obj"; then
- xdir=
- else
- xdir=$xdir/
- fi
- lobj=${xdir}$objdir/$objname
-
- if test -z "$base_compile"; then
- $echo "$modename: you must specify a compilation command" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- removelist="$obj $lobj $libobj ${libobj}T"
- else
- removelist="$lobj $libobj ${libobj}T"
- fi
-
- $run $rm $removelist
- trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
-
- # On Cygwin there's no "real" PIC flag so we must build both object types
- case $host_os in
- cygwin* | mingw* | pw32* | os2*)
- pic_mode=default
- ;;
- esac
- if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
- # non-PIC code in shared libraries is not supported
- pic_mode=default
- fi
-
- # Calculate the filename of the output object if compiler does
- # not support -o with -c
- if test "$compiler_c_o" = no; then
- output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
- lockfile="$output_obj.lock"
- removelist="$removelist $output_obj $lockfile"
- trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
- else
- output_obj=
- need_locks=no
- lockfile=
- fi
-
- # Lock this critical section if it is needed
- # We use this script file to make the link, it avoids creating a new file
- if test "$need_locks" = yes; then
- until $run ln "$progpath" "$lockfile" 2>/dev/null; do
- $show "Waiting for $lockfile to be removed"
- sleep 2
- done
- elif test "$need_locks" = warn; then
- if test -f "$lockfile"; then
- $echo "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
- $echo "$srcfile" > "$lockfile"
- fi
-
- if test -n "$fix_srcfile_path"; then
- eval srcfile=\"$fix_srcfile_path\"
- fi
- qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
- case $qsrcfile in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qsrcfile="\"$qsrcfile\"" ;;
- esac
-
- $run $rm "$libobj" "${libobj}T"
-
- # Create a libtool object file (analogous to a ".la" file),
- # but don't create it if we're doing a dry run.
- test -z "$run" && cat > ${libobj}T <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- if test "$pic_mode" != no; then
- command="$base_compile $qsrcfile $pic_flag"
- else
- # Don't build PIC code
- command="$base_compile $qsrcfile"
- fi
-
- if test ! -d "${xdir}$objdir"; then
- $show "$mkdir ${xdir}$objdir"
- $run $mkdir ${xdir}$objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
- exit $exit_status
- fi
- fi
-
- if test -z "$output_obj"; then
- # Place PIC objects in $objdir
- command="$command -o $lobj"
- fi
-
- $run $rm "$lobj" "$output_obj"
-
- $show "$command"
- if $run eval "$command"; then :
- else
- test -n "$output_obj" && $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- if test "$need_locks" = warn &&
- test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- # Just move the object if needed, then go on to compile the next one
- if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
- $show "$mv $output_obj $lobj"
- if $run $mv $output_obj $lobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Append the name of the PIC object to the libtool object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
- # Allow error messages only from the first compilation.
- if test "$suppress_opt" = yes; then
- suppress_output=' >/dev/null 2>&1'
- fi
- else
- # No PIC object so indicate it doesn't exist in the libtool
- # object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- if test "$pic_mode" != yes; then
- # Don't build PIC code
- command="$base_compile $qsrcfile"
- else
- command="$base_compile $qsrcfile $pic_flag"
- fi
- if test "$compiler_c_o" = yes; then
- command="$command -o $obj"
- fi
-
- # Suppress compiler output if we already did a PIC compilation.
- command="$command$suppress_output"
- $run $rm "$obj" "$output_obj"
- $show "$command"
- if $run eval "$command"; then :
- else
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- if test "$need_locks" = warn &&
- test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- # Just move the object if needed
- if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
- $show "$mv $output_obj $obj"
- if $run $mv $output_obj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
-
-EOF
- else
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
-
-EOF
- fi
-
- $run $mv "${libobj}T" "${libobj}"
-
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $run $rm "$lockfile"
- fi
-
- exit $EXIT_SUCCESS
- ;;
-
- # libtool link mode
- link | relink)
- modename="$modename: link"
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # It is impossible to link a dll without this setting, and
- # we shouldn't force the makefile maintainer to figure out
- # which system we are compiling for in order to pass an extra
- # flag for every libtool invocation.
- # allow_undefined=no
-
- # FIXME: Unfortunately, there are problems with the above when trying
- # to make a dll which has undefined symbols, in which case not
- # even a static library is built. For now, we need to specify
- # -no-undefined on the libtool link line when we can be certain
- # that all symbols are satisfied, otherwise we get a static library.
- allow_undefined=yes
- ;;
- *)
- allow_undefined=yes
- ;;
- esac
- libtool_args="$nonopt"
- base_compile="$nonopt $@"
- compile_command="$nonopt"
- finalize_command="$nonopt"
-
- compile_rpath=
- finalize_rpath=
- compile_shlibpath=
- finalize_shlibpath=
- convenience=
- old_convenience=
- deplibs=
- old_deplibs=
- compiler_flags=
- linker_flags=
- dllsearchpath=
- lib_search_path=`pwd`
- inst_prefix_dir=
-
- avoid_version=no
- dlfiles=
- dlprefiles=
- dlself=no
- export_dynamic=no
- export_symbols=
- export_symbols_regex=
- generated=
- libobjs=
- ltlibs=
- module=no
- no_install=no
- objs=
- non_pic_objects=
- notinst_path= # paths that contain not-installed libtool libraries
- precious_files_regex=
- prefer_static_libs=no
- preload=no
- prev=
- prevarg=
- release=
- rpath=
- xrpath=
- perm_rpath=
- temp_rpath=
- thread_safe=no
- vinfo=
- vinfo_number=no
-
- func_infer_tag $base_compile
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case $arg in
- -all-static | -static)
- if test "X$arg" = "X-all-static"; then
- if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
- fi
- if test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- prefer_static_libs=yes
- else
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- prefer_static_libs=built
- fi
- build_libtool_libs=no
- build_old_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- while test "$#" -gt 0; do
- arg="$1"
- shift
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
- ;;
- *) qarg=$arg ;;
- esac
- libtool_args="$libtool_args $qarg"
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- ;;
- esac
-
- case $prev in
- dlfiles|dlprefiles)
- if test "$preload" = no; then
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- preload=yes
- fi
- case $arg in
- *.la | *.lo) ;; # We handle these cases below.
- force)
- if test "$dlself" = no; then
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- self)
- if test "$prev" = dlprefiles; then
- dlself=yes
- elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
- dlself=yes
- else
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- *)
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- else
- dlprefiles="$dlprefiles $arg"
- fi
- prev=
- continue
- ;;
- esac
- ;;
- expsyms)
- export_symbols="$arg"
- if test ! -f "$arg"; then
- $echo "$modename: symbol file \`$arg' does not exist"
- exit $EXIT_FAILURE
- fi
- prev=
- continue
- ;;
- expsyms_regex)
- export_symbols_regex="$arg"
- prev=
- continue
- ;;
- inst_prefix)
- inst_prefix_dir="$arg"
- prev=
- continue
- ;;
- precious_regex)
- precious_files_regex="$arg"
- prev=
- continue
- ;;
- release)
- release="-$arg"
- prev=
- continue
- ;;
- objectlist)
- if test -f "$arg"; then
- save_arg=$arg
- moreargs=
- for fil in `cat $save_arg`
- do
-# moreargs="$moreargs $fil"
- arg=$fil
- # A libtool-controlled object.
-
- # Check to see that this really is a libtool object.
- if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- pic_object=
- non_pic_object=
-
- # Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$pic_object" || \
- test -z "$non_pic_object" ||
- test "$pic_object" = none && \
- test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- if test "$pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- pic_object="$xdir$pic_object"
-
- if test "$prev" = dlfiles; then
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $pic_object"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- # CHECK ME: I think I busted this. -Ossama
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles $pic_object"
- prev=
- fi
-
- # A PIC object.
- libobjs="$libobjs $pic_object"
- arg="$pic_object"
- fi
-
- # Non-PIC object.
- if test "$non_pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- non_pic_object="$xdir$non_pic_object"
-
- # A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
- if test -z "$pic_object" || test "$pic_object" = none ; then
- arg="$non_pic_object"
- fi
- else
- # If the PIC object exists, use it instead.
- # $xdir was prepended to $pic_object above.
- non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- else
- # Only an error if not doing a dry-run.
- if test -z "$run"; then
- $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
- exit $EXIT_FAILURE
- else
- # Dry-run case.
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
- non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
- libobjs="$libobjs $pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- fi
- done
- else
- $echo "$modename: link input file \`$save_arg' does not exist"
- exit $EXIT_FAILURE
- fi
- arg=$save_arg
- prev=
- continue
- ;;
- rpath | xrpath)
- # We need an absolute path.
- case $arg in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- if test "$prev" = rpath; then
- case "$rpath " in
- *" $arg "*) ;;
- *) rpath="$rpath $arg" ;;
- esac
- else
- case "$xrpath " in
- *" $arg "*) ;;
- *) xrpath="$xrpath $arg" ;;
- esac
- fi
- prev=
- continue
- ;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
- prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
- continue
- ;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $wl$qarg"
- prev=
- compile_command="$compile_command $wl$qarg"
- finalize_command="$finalize_command $wl$qarg"
- continue
- ;;
- xcclinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $qarg"
- prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
- continue
- ;;
- shrext)
- shrext_cmds="$arg"
- prev=
- continue
- ;;
- darwin_framework|darwin_framework_skip)
- test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- prev=
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi # test -n "$prev"
-
- prevarg="$arg"
-
- case $arg in
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -allow-undefined)
- # FIXME: remove this flag sometime in the future.
- $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
- continue
- ;;
-
- -avoid-version)
- avoid_version=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- export_dynamic=yes
- continue
- ;;
-
- -export-symbols | -export-symbols-regex)
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: more than one -exported-symbols argument is not allowed"
- exit $EXIT_FAILURE
- fi
- if test "X$arg" = "X-export-symbols"; then
- prev=expsyms
- else
- prev=expsyms_regex
- fi
- continue
- ;;
-
- -framework|-arch|-isysroot)
- case " $CC " in
- *" ${arg} ${1} "* | *" ${arg} ${1} "*)
- prev=darwin_framework_skip ;;
- *) compiler_flags="$compiler_flags $arg"
- prev=darwin_framework ;;
- esac
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- continue
- ;;
-
- -inst-prefix-dir)
- prev=inst_prefix
- continue
- ;;
-
- # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
- # so, if we see these flags be careful not to treat them like -L
- -L[A-Z][A-Z]*:*)
- case $with_gcc/$host in
- no/*-*-irix* | /*-*-irix*)
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- ;;
- esac
- continue
- ;;
-
- -L*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
- absdir="$dir"
- notinst_path="$notinst_path $dir"
- fi
- dir="$absdir"
- ;;
- esac
- case "$deplibs " in
- *" -L$dir "*) ;;
- *)
- deplibs="$deplibs -L$dir"
- lib_search_path="$lib_search_path $dir"
- ;;
- esac
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
- case :$dllsearchpath: in
- *":$dir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$dir";;
- esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$testbindir";;
- esac
- ;;
- esac
- continue
- ;;
-
- -l*)
- if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
- # These systems don't actually have a C or math library (as such)
- continue
- ;;
- *-*-os2*)
- # These systems don't actually have a C library (as such)
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc due to us having libc/libc_r.
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C and math libraries are in the System framework
- deplibs="$deplibs -framework System"
- continue
- ;;
- *-*-sco3.2v5* | *-*-sco5v6*)
- # Causes problems with __ctype
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
- # Compiler inserts libc in the correct place for threads to work
- test "X$arg" = "X-lc" && continue
- ;;
- esac
- elif test "X$arg" = "X-lc_r"; then
- case $host in
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc_r directly, use -pthread flag.
- continue
- ;;
- esac
- fi
- deplibs="$deplibs $arg"
- continue
- ;;
-
- # Tru64 UNIX uses -model [arg] to determine the layout of C++
- # classes, name mangling, and exception handling.
- -model)
- compile_command="$compile_command $arg"
- compiler_flags="$compiler_flags $arg"
- finalize_command="$finalize_command $arg"
- prev=xcompiler
- continue
- ;;
-
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
- compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- continue
- ;;
-
- -module)
- module=yes
- continue
- ;;
-
- # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
- # -r[0-9][0-9]* specifies the processor on the SGI compiler
- # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
- # +DA*, +DD* enable 64-bit mode on the HP compiler
- # -q* pass through compiler args for the IBM compiler
- # -m* pass through architecture-specific compiler args for GCC
- # -m*, -t[45]*, -txscale* pass through architecture-specific
- # compiler args for GCC
- # -pg pass through profiling flag for GCC
- # @file GCC response files
- -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
- -t[45]*|-txscale*|@*)
-
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- compiler_flags="$compiler_flags $arg"
- continue
- ;;
-
- -shrext)
- prev=shrext
- continue
- ;;
-
- -no-fast-install)
- fast_install=no
- continue
- ;;
-
- -no-install)
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # The PATH hackery in wrapper scripts is required on Windows
- # in order for the loader to find any dlls it needs.
- $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
- $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
- fast_install=no
- ;;
- *) no_install=yes ;;
- esac
- continue
- ;;
-
- -no-undefined)
- allow_undefined=no
- continue
- ;;
-
- -objectlist)
- prev=objectlist
- continue
- ;;
-
- -o) prev=output ;;
-
- -precious-files-regex)
- prev=precious_regex
- continue
- ;;
-
- -release)
- prev=release
- continue
- ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -R)
- prev=xrpath
- continue
- ;;
-
- -R*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- continue
- ;;
-
- -static)
- # The effects of -static are defined in a previous loop.
- # We used to do the same as -all-static on platforms that
- # didn't have a PIC flag, but the assumption that the effects
- # would be equivalent was wrong. It would break on at least
- # Digital Unix and AIX.
- continue
- ;;
-
- -thread-safe)
- thread_safe=yes
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
- -version-number)
- prev=vinfo
- vinfo_number=yes
- continue
- ;;
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Wl,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $wl$flag"
- linker_flags="$linker_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Xcompiler)
- prev=xcompiler
- continue
- ;;
-
- -Xlinker)
- prev=xlinker
- continue
- ;;
-
- -XCClinker)
- prev=xcclinker
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
-
- *.$objext)
- # A standard object.
- objs="$objs $arg"
- ;;
-
- *.lo)
- # A libtool-controlled object.
-
- # Check to see that this really is a libtool object.
- if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- pic_object=
- non_pic_object=
-
- # Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$pic_object" || \
- test -z "$non_pic_object" ||
- test "$pic_object" = none && \
- test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- if test "$pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- pic_object="$xdir$pic_object"
-
- if test "$prev" = dlfiles; then
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $pic_object"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- # CHECK ME: I think I busted this. -Ossama
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles $pic_object"
- prev=
- fi
-
- # A PIC object.
- libobjs="$libobjs $pic_object"
- arg="$pic_object"
- fi
-
- # Non-PIC object.
- if test "$non_pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- non_pic_object="$xdir$non_pic_object"
-
- # A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
- if test -z "$pic_object" || test "$pic_object" = none ; then
- arg="$non_pic_object"
- fi
- else
- # If the PIC object exists, use it instead.
- # $xdir was prepended to $pic_object above.
- non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- else
- # Only an error if not doing a dry-run.
- if test -z "$run"; then
- $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
- exit $EXIT_FAILURE
- else
- # Dry-run case.
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
- non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
- libobjs="$libobjs $pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- fi
- ;;
-
- *.$libext)
- # An archive.
- deplibs="$deplibs $arg"
- old_deplibs="$old_deplibs $arg"
- continue
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- if test "$prev" = dlfiles; then
- # This library was specified with -dlopen.
- dlfiles="$dlfiles $arg"
- prev=
- elif test "$prev" = dlprefiles; then
- # The library was specified with -dlpreopen.
- dlprefiles="$dlprefiles $arg"
- prev=
- else
- deplibs="$deplibs $arg"
- fi
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
- esac # arg
-
- # Now actually substitute the argument into the commands.
- if test -n "$arg"; then
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
- done # argument parsing loop
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
- eval arg=\"$export_dynamic_flag_spec\"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
-
- oldlibs=
- # calculate the name of the file, without its directory
- outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
- libobjs_save="$libobjs"
-
- if test -n "$shlibpath_var"; then
- # get the directories listed in $shlibpath_var
- eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
- else
- shlib_search_path=
- fi
- eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
- eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
- output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$output_objdir" = "X$output"; then
- output_objdir="$objdir"
- else
- output_objdir="$output_objdir/$objdir"
- fi
- # Create the object directory.
- if test ! -d "$output_objdir"; then
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
- exit $exit_status
- fi
- fi
-
- # Determine the type of output
- case $output in
- "")
- $echo "$modename: you must specify an output file" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- *.$libext) linkmode=oldlib ;;
- *.lo | *.$objext) linkmode=obj ;;
- *.la) linkmode=lib ;;
- *) linkmode=prog ;; # Anything else should be a program.
- esac
-
- case $host in
- *cygwin* | *mingw* | *pw32*)
- # don't eliminate duplications in $postdeps and $predeps
- duplicate_compiler_generated_deps=yes
- ;;
- *)
- duplicate_compiler_generated_deps=$duplicate_deps
- ;;
- esac
- specialdeplibs=
-
- libs=
- # Find all interdependent deplibs by searching for libraries
- # that are linked more than once (e.g. -la -lb -la)
- for deplib in $deplibs; do
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- libs="$libs $deplib"
- done
-
- if test "$linkmode" = lib; then
- libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
- # Compute libraries that are listed more than once in $predeps
- # $postdeps and mark them as special (i.e., whose duplicates are
- # not to be eliminated).
- pre_post_deps=
- if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
- for pre_post_dep in $predeps $postdeps; do
- case "$pre_post_deps " in
- *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
- esac
- pre_post_deps="$pre_post_deps $pre_post_dep"
- done
- fi
- pre_post_deps=
- fi
-
- deplibs=
- newdependency_libs=
- newlib_search_path=
- need_relink=no # whether we're linking any uninstalled libtool libraries
- notinst_deplibs= # not-installed libtool libraries
- case $linkmode in
- lib)
- passes="conv link"
- for file in $dlfiles $dlprefiles; do
- case $file in
- *.la) ;;
- *)
- $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- done
- ;;
- prog)
- compile_deplibs=
- finalize_deplibs=
- alldeplibs=no
- newdlfiles=
- newdlprefiles=
- passes="conv scan dlopen dlpreopen link"
- ;;
- *) passes="conv"
- ;;
- esac
- for pass in $passes; do
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan"; then
- libs="$deplibs"
- deplibs=
- fi
- if test "$linkmode" = prog; then
- case $pass in
- dlopen) libs="$dlfiles" ;;
- dlpreopen) libs="$dlprefiles" ;;
- link)
- libs="$deplibs %DEPLIBS%"
- test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
- ;;
- esac
- fi
- if test "$pass" = dlopen; then
- # Collect dlpreopened libraries
- save_deplibs="$deplibs"
- deplibs=
- fi
- for deplib in $libs; do
- lib=
- found=no
- case $deplib in
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- compiler_flags="$compiler_flags $deplib"
- fi
- continue
- ;;
- -l*)
- if test "$linkmode" != lib && test "$linkmode" != prog; then
- $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
- continue
- fi
- name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
- for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
- for search_ext in .la $std_shrext .so .a; do
- # Search the libtool library
- lib="$searchdir/lib${name}${search_ext}"
- if test -f "$lib"; then
- if test "$search_ext" = ".la"; then
- found=yes
- else
- found=no
- fi
- break 2
- fi
- done
- done
- if test "$found" != yes; then
- # deplib doesn't seem to be a libtool library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- else # deplib is a libtool library
- # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
- # We need to do some special things here, and not later.
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $deplib "*)
- if (${SED} -e '2q' $lib |
- grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- library_names=
- old_library=
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
- for l in $old_library $library_names; do
- ll="$l"
- done
- if test "X$ll" = "X$old_library" ; then # only static version available
- found=no
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
- lib=$ladir/$old_library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- fi
- fi
- ;;
- *) ;;
- esac
- fi
- fi
- ;; # -l
- -L*)
- case $linkmode in
- lib)
- deplibs="$deplib $deplibs"
- test "$pass" = conv && continue
- newdependency_libs="$deplib $newdependency_libs"
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- prog)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- if test "$pass" = scan; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- *)
- $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
- ;;
- esac # linkmode
- continue
- ;; # -L
- -R*)
- if test "$pass" = link; then
- dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
- # Make sure the xrpath contains only unique directories.
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- fi
- deplibs="$deplib $deplibs"
- continue
- ;;
- *.la) lib="$deplib" ;;
- *.$libext)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- case $linkmode in
- lib)
- valid_a_lib=no
- case $deplibs_check_method in
- match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- if eval $echo \"$deplib\" 2>/dev/null \
- | $SED 10q \
- | $EGREP "$match_pattern_regex" > /dev/null; then
- valid_a_lib=yes
- fi
- ;;
- pass_all)
- valid_a_lib=yes
- ;;
- esac
- if test "$valid_a_lib" != yes; then
- $echo
- $echo "*** Warning: Trying to link with static lib archive $deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because the file extensions .$libext of this argument makes me believe"
- $echo "*** that it is just a static archive that I should not used here."
- else
- $echo
- $echo "*** Warning: Linking the shared library $output against the"
- $echo "*** static library $deplib is not portable!"
- deplibs="$deplib $deplibs"
- fi
- continue
- ;;
- prog)
- if test "$pass" != link; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- continue
- ;;
- esac # linkmode
- ;; # *.$libext
- *.lo | *.$objext)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- elif test "$linkmode" = prog; then
- if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlopen support or we're linking statically,
- # we need to preload.
- newdlprefiles="$newdlprefiles $deplib"
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- newdlfiles="$newdlfiles $deplib"
- fi
- fi
- continue
- ;;
- %DEPLIBS%)
- alldeplibs=yes
- continue
- ;;
- esac # case $deplib
- if test "$found" = yes || test -f "$lib"; then :
- else
- $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
-
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
-
- dlname=
- dlopen=
- dlpreopen=
- libdir=
- library_names=
- old_library=
- # If the library was installed with an old release of libtool,
- # it will not redefine variables installed, or shouldnotlink
- installed=yes
- shouldnotlink=no
- avoidtemprpath=
-
-
- # Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
-
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan" ||
- { test "$linkmode" != prog && test "$linkmode" != lib; }; then
- test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
- test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
- fi
-
- if test "$pass" = conv; then
- # Only check for convenience libraries
- deplibs="$lib $deplibs"
- if test -z "$libdir"; then
- if test -z "$old_library"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- # It is a libtool convenience library, so add in its objects.
- convenience="$convenience $ladir/$objdir/$old_library"
- old_convenience="$old_convenience $ladir/$objdir/$old_library"
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
- elif test "$linkmode" != prog && test "$linkmode" != lib; then
- $echo "$modename: \`$lib' is not a convenience library" 1>&2
- exit $EXIT_FAILURE
- fi
- continue
- fi # $pass = conv
-
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
- if test -z "$linklib"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # This library was specified with -dlopen.
- if test "$pass" = dlopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- if test -z "$dlname" ||
- test "$dlopen_support" != yes ||
- test "$build_libtool_libs" = no; then
- # If there is no dlname, no dlopen support or we're linking
- # statically, we need to preload. We also need to preload any
- # dependent libraries so libltdl's deplib preloader doesn't
- # bomb out in the load deplibs phase.
- dlprefiles="$dlprefiles $lib $dependency_libs"
- else
- newdlfiles="$newdlfiles $lib"
- fi
- continue
- fi # $pass = dlopen
-
- # We need an absolute path.
- case $ladir in
- [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
- *)
- abs_ladir=`cd "$ladir" && pwd`
- if test -z "$abs_ladir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
- $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
- abs_ladir="$ladir"
- fi
- ;;
- esac
- laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-
- # Find the relevant object directory and library name.
- if test "X$installed" = Xyes; then
- if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- $echo "$modename: warning: library \`$lib' was moved." 1>&2
- dir="$ladir"
- absdir="$abs_ladir"
- libdir="$abs_ladir"
- else
- dir="$libdir"
- absdir="$libdir"
- fi
- test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
- else
- if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- dir="$ladir"
- absdir="$abs_ladir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- fi
- fi # $installed = yes
- name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-
- # This library was specified with -dlpreopen.
- if test "$pass" = dlpreopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- newdlprefiles="$newdlprefiles $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- newdlprefiles="$newdlprefiles $dir/$dlname"
- else
- newdlprefiles="$newdlprefiles $dir/$linklib"
- fi
- fi # $pass = dlpreopen
-
- if test -z "$libdir"; then
- # Link the convenience library
- if test "$linkmode" = lib; then
- deplibs="$dir/$old_library $deplibs"
- elif test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$dir/$old_library $compile_deplibs"
- finalize_deplibs="$dir/$old_library $finalize_deplibs"
- else
- deplibs="$lib $deplibs" # used for prog,scan pass
- fi
- continue
- fi
-
-
- if test "$linkmode" = prog && test "$pass" != link; then
- newlib_search_path="$newlib_search_path $ladir"
- deplibs="$lib $deplibs"
-
- linkalldeplibs=no
- if test "$link_all_deplibs" != no || test -z "$library_names" ||
- test "$build_libtool_libs" = no; then
- linkalldeplibs=yes
- fi
-
- tmp_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
- esac
- # Need to link against all dependency_libs?
- if test "$linkalldeplibs" = yes; then
- deplibs="$deplib $deplibs"
- else
- # Need to hardcode shared library paths
- # or/and link against static libraries
- newdependency_libs="$deplib $newdependency_libs"
- fi
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done # for deplib
- continue
- fi # $linkmode = prog...
-
- if test "$linkmode,$pass" = "prog,link"; then
- if test -n "$library_names" &&
- { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
- # We need to hardcode the library path
- if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath " in
- *" $dir "*) ;;
- *" $absdir "*) ;;
- *) temp_rpath="$temp_rpath $absdir" ;;
- esac
- fi
-
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- fi # $linkmode,$pass = prog,link...
-
- if test "$alldeplibs" = yes &&
- { test "$deplibs_check_method" = pass_all ||
- { test "$build_libtool_libs" = yes &&
- test -n "$library_names"; }; }; then
- # We only need to search for static libraries
- continue
- fi
- fi
-
- link_static=no # Whether the deplib will be linked statically
- use_static_libs=$prefer_static_libs
- if test "$use_static_libs" = built && test "$installed" = yes ; then
- use_static_libs=no
- fi
- if test -n "$library_names" &&
- { test "$use_static_libs" = no || test -z "$old_library"; }; then
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
- # This is a shared library
-
- # Warn about portability, can't link against -module's on
- # some systems (darwin)
- if test "$shouldnotlink" = yes && test "$pass" = link ; then
- $echo
- if test "$linkmode" = prog; then
- $echo "*** Warning: Linking the executable $output against the loadable module"
- else
- $echo "*** Warning: Linking the shared library $output against the loadable module"
- fi
- $echo "*** $linklib is not portable!"
- fi
- if test "$linkmode" = lib &&
- test "$hardcode_into_libs" = yes; then
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- fi
-
- if test -n "$old_archive_from_expsyms_cmds"; then
- # figure out the soname
- set dummy $library_names
- realname="$2"
- shift; shift
- libname=`eval \\$echo \"$libname_spec\"`
- # use dlname if we got it. it's perfectly good, no?
- if test -n "$dlname"; then
- soname="$dlname"
- elif test -n "$soname_spec"; then
- # bleh windows
- case $host in
- *cygwin* | mingw*)
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
- esac
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
-
- # Make a new name for the extract_expsyms_cmds to use
- soroot="$soname"
- soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
- newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
-
- # If the library has no export list, then create one now
- if test -f "$output_objdir/$soname-def"; then :
- else
- $show "extracting exported symbol list from \`$soname'"
- save_ifs="$IFS"; IFS='~'
- cmds=$extract_expsyms_cmds
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Create $newlib
- if test -f "$output_objdir/$newlib"; then :; else
- $show "generating import library for \`$soname'"
- save_ifs="$IFS"; IFS='~'
- cmds=$old_archive_from_expsyms_cmds
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
- # make sure the library variables are pointing to the new library
- dir=$output_objdir
- linklib=$newlib
- fi # test -n "$old_archive_from_expsyms_cmds"
-
- if test "$linkmode" = prog || test "$mode" != relink; then
- add_shlibpath=
- add_dir=
- add=
- lib_linked=yes
- case $hardcode_action in
- immediate | unsupported)
- if test "$hardcode_direct" = no; then
- add="$dir/$linklib"
- case $host in
- *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
- *-*-sysv4*uw2*) add_dir="-L$dir" ;;
- *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
- *-*-unixware7*) add_dir="-L$dir" ;;
- *-*-darwin* )
- # if the lib is a module then we can not link against
- # it, someone is ignoring the new warnings I added
- if /usr/bin/file -L $add 2> /dev/null |
- $EGREP ": [^:]* bundle" >/dev/null ; then
- $echo "** Warning, lib $linklib is a module, not a shared library"
- if test -z "$old_library" ; then
- $echo
- $echo "** And there doesn't seem to be a static archive available"
- $echo "** The link will probably fail, sorry"
- else
- add="$dir/$old_library"
- fi
- fi
- esac
- elif test "$hardcode_minus_L" = no; then
- case $host in
- *-*-sunos*) add_shlibpath="$dir" ;;
- esac
- add_dir="-L$dir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- relink)
- if test "$hardcode_direct" = yes; then
- add="$dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$dir"
- # Try looking first in the location we're being installed to.
- if test -n "$inst_prefix_dir"; then
- case $libdir in
- [\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
- ;;
- esac
- fi
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- *) lib_linked=no ;;
- esac
-
- if test "$lib_linked" != yes; then
- $echo "$modename: configuration error: unsupported hardcode properties"
- exit $EXIT_FAILURE
- fi
-
- if test -n "$add_shlibpath"; then
- case :$compile_shlibpath: in
- *":$add_shlibpath:"*) ;;
- *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
- esac
- fi
- if test "$linkmode" = prog; then
- test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
- test -n "$add" && compile_deplibs="$add $compile_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- if test "$hardcode_direct" != yes && \
- test "$hardcode_minus_L" != yes && \
- test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- fi
- fi
- fi
-
- if test "$linkmode" = prog || test "$mode" = relink; then
- add_shlibpath=
- add_dir=
- add=
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
- add="$libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$libdir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- add="-l$name"
- elif test "$hardcode_automatic" = yes; then
- if test -n "$inst_prefix_dir" &&
- test -f "$inst_prefix_dir$libdir/$linklib" ; then
- add="$inst_prefix_dir$libdir/$linklib"
- else
- add="$libdir/$linklib"
- fi
- else
- # We cannot seem to hardcode it, guess we'll fake it.
- add_dir="-L$libdir"
- # Try looking first in the location we're being installed to.
- if test -n "$inst_prefix_dir"; then
- case $libdir in
- [\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
- ;;
- esac
- fi
- add="-l$name"
- fi
-
- if test "$linkmode" = prog; then
- test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
- test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- fi
- fi
- elif test "$linkmode" = prog; then
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_deplibs="$dir/$linklib $compile_deplibs"
- finalize_deplibs="$dir/$linklib $finalize_deplibs"
- else
- compile_deplibs="-l$name -L$dir $compile_deplibs"
- finalize_deplibs="-l$name -L$dir $finalize_deplibs"
- fi
- elif test "$build_libtool_libs" = yes; then
- # Not a shared library
- if test "$deplibs_check_method" != pass_all; then
- # We're trying link a shared library against a static one
- # but the system doesn't support it.
-
- # Just print a warning and add the library to dependency_libs so
- # that the program can be linked against the static library.
- $echo
- $echo "*** Warning: This system can not link to static lib archive $lib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have."
- if test "$module" = yes; then
- $echo "*** But as you try to build a module library, libtool will still create "
- $echo "*** a static module, that should work as long as the dlopening application"
- $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
- if test -z "$global_symbol_pipe"; then
- $echo
- $echo "*** However, this would only work if libtool was able to extract symbol"
- $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- $echo "*** not find such a program. So, this module is probably useless."
- $echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- else
- deplibs="$dir/$old_library $deplibs"
- link_static=yes
- fi
- fi # link shared/static library?
-
- if test "$linkmode" = lib; then
- if test -n "$dependency_libs" &&
- { test "$hardcode_into_libs" != yes ||
- test "$build_old_libs" = yes ||
- test "$link_static" = yes; }; then
- # Extract -R from dependency_libs
- temp_deplibs=
- for libdir in $dependency_libs; do
- case $libdir in
- -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
- case " $xrpath " in
- *" $temp_xrpath "*) ;;
- *) xrpath="$xrpath $temp_xrpath";;
- esac;;
- *) temp_deplibs="$temp_deplibs $libdir";;
- esac
- done
- dependency_libs="$temp_deplibs"
- fi
-
- newlib_search_path="$newlib_search_path $absdir"
- # Link against this library
- test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
- # ... and its dependency_libs
- tmp_libs=
- for deplib in $dependency_libs; do
- newdependency_libs="$deplib $newdependency_libs"
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
-
- if test "$link_all_deplibs" != no; then
- # Add the search paths of all dependency libraries
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) path="$deplib" ;;
- *.la)
- dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$deplib" && dir="."
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
- absdir="$dir"
- fi
- ;;
- esac
- if grep "^installed=no" $deplib > /dev/null; then
- path="$absdir/$objdir"
- else
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- if test "$absdir" != "$libdir"; then
- $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
- fi
- path="$absdir"
- fi
- depdepl=
- case $host in
- *-*-darwin*)
- # we do not want to link against static libs,
- # but need to link against shared
- eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
- if test -n "$deplibrary_names" ; then
- for tmp in $deplibrary_names ; do
- depdepl=$tmp
- done
- if test -f "$path/$depdepl" ; then
- depdepl="$path/$depdepl"
- fi
- # do not add paths which are already there
- case " $newlib_search_path " in
- *" $path "*) ;;
- *) newlib_search_path="$newlib_search_path $path";;
- esac
- fi
- path=""
- ;;
- *)
- path="-L$path"
- ;;
- esac
- ;;
- -l*)
- case $host in
- *-*-darwin*)
- # Again, we only want to link against shared libraries
- eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
- for tmp in $newlib_search_path ; do
- if test -f "$tmp/lib$tmp_libs.dylib" ; then
- eval depdepl="$tmp/lib$tmp_libs.dylib"
- break
- fi
- done
- path=""
- ;;
- *) continue ;;
- esac
- ;;
- *) continue ;;
- esac
- case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$path $deplibs" ;;
- esac
- case " $deplibs " in
- *" $depdepl "*) ;;
- *) deplibs="$depdepl $deplibs" ;;
- esac
- done
- fi # link_all_deplibs != no
- fi # linkmode = lib
- done # for deplib in $libs
- dependency_libs="$newdependency_libs"
- if test "$pass" = dlpreopen; then
- # Link the dlpreopened libraries before other libraries
- for deplib in $save_deplibs; do
- deplibs="$deplib $deplibs"
- done
- fi
- if test "$pass" != dlopen; then
- if test "$pass" != conv; then
- # Make sure lib_search_path contains only unique directories.
- lib_search_path=
- for dir in $newlib_search_path; do
- case "$lib_search_path " in
- *" $dir "*) ;;
- *) lib_search_path="$lib_search_path $dir" ;;
- esac
- done
- newlib_search_path=
- fi
-
- if test "$linkmode,$pass" != "prog,link"; then
- vars="deplibs"
- else
- vars="compile_deplibs finalize_deplibs"
- fi
- for var in $vars dependency_libs; do
- # Add libraries to $var in reverse order
- eval tmp_libs=\"\$$var\"
- new_libs=
- for deplib in $tmp_libs; do
- # FIXME: Pedantically, this is the right thing to do, so
- # that some nasty dependency loop isn't accidentally
- # broken:
- #new_libs="$deplib $new_libs"
- # Pragmatically, this seems to cause very few problems in
- # practice:
- case $deplib in
- -L*) new_libs="$deplib $new_libs" ;;
- -R*) ;;
- *)
- # And here is the reason: when a library appears more
- # than once as an explicit dependence of a library, or
- # is implicitly linked in more than once by the
- # compiler, it is considered special, and multiple
- # occurrences thereof are not removed. Compare this
- # with having the same library being listed as a
- # dependency of multiple other libraries: in this case,
- # we know (pedantically, we assume) the library does not
- # need to be listed more than once, so we keep only the
- # last copy. This is not always right, but it is rare
- # enough that we require users that really mean to play
- # such unportable linking tricks to link the library
- # using -Wl,-lname, so that libtool does not consider it
- # for duplicate removal.
- case " $specialdeplibs " in
- *" $deplib "*) new_libs="$deplib $new_libs" ;;
- *)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$deplib $new_libs" ;;
- esac
- ;;
- esac
- ;;
- esac
- done
- tmp_libs=
- for deplib in $new_libs; do
- case $deplib in
- -L*)
- case " $tmp_libs " in
- *" $deplib "*) ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- done
- eval $var=\"$tmp_libs\"
- done # for var
- fi
- # Last step: remove runtime libs from dependency_libs
- # (they stay in deplibs)
- tmp_libs=
- for i in $dependency_libs ; do
- case " $predeps $postdeps $compiler_lib_search_path " in
- *" $i "*)
- i=""
- ;;
- esac
- if test -n "$i" ; then
- tmp_libs="$tmp_libs $i"
- fi
- done
- dependency_libs=$tmp_libs
- done # for pass
- if test "$linkmode" = prog; then
- dlfiles="$newdlfiles"
- dlprefiles="$newdlprefiles"
- fi
-
- case $linkmode in
- oldlib)
- if test -n "$deplibs"; then
- $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
- fi
-
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
- fi
-
- # Now set the variables for building old libraries.
- build_libtool_libs=no
- oldlibs="$output"
- objs="$objs$old_deplibs"
- ;;
-
- lib)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case $outputname in
- lib*)
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
- eval shared_ext=\"$shrext_cmds\"
- eval libname=\"$libname_spec\"
- ;;
- *)
- if test "$module" = no; then
- $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
- if test "$need_lib_prefix" != no; then
- # Add the "lib" prefix for modules if required
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- eval shared_ext=\"$shrext_cmds\"
- eval libname=\"$libname_spec\"
- else
- libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- fi
- ;;
- esac
-
- if test -n "$objs"; then
- if test "$deplibs_check_method" != pass_all; then
- $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
- exit $EXIT_FAILURE
- else
- $echo
- $echo "*** Warning: Linking the shared library $output against the non-libtool"
- $echo "*** objects $objs is not portable!"
- libobjs="$libobjs $objs"
- fi
- fi
-
- if test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
- fi
-
- set dummy $rpath
- if test "$#" -gt 2; then
- $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
- fi
- install_libdir="$2"
-
- oldlibs=
- if test -z "$rpath"; then
- if test "$build_libtool_libs" = yes; then
- # Building a libtool convenience library.
- # Some compilers have problems with a `.al' extension so
- # convenience libraries should have the same extension an
- # archive normally would.
- oldlibs="$output_objdir/$libname.$libext $oldlibs"
- build_libtool_libs=convenience
- build_old_libs=yes
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
- fi
- else
-
- # Parse the version information argument.
- save_ifs="$IFS"; IFS=':'
- set dummy $vinfo 0 0 0
- IFS="$save_ifs"
-
- if test -n "$8"; then
- $echo "$modename: too many parameters to \`-version-info'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # convert absolute version numbers to libtool ages
- # this retains compatibility with .la files and attempts
- # to make the code below a bit more comprehensible
-
- case $vinfo_number in
- yes)
- number_major="$2"
- number_minor="$3"
- number_revision="$4"
- #
- # There are really only two kinds -- those that
- # use the current revision as the major version
- # and those that subtract age and use age as
- # a minor version. But, then there is irix
- # which has an extra 1 added just for fun
- #
- case $version_type in
- darwin|linux|osf|windows)
- current=`expr $number_major + $number_minor`
- age="$number_minor"
- revision="$number_revision"
- ;;
- freebsd-aout|freebsd-elf|sunos)
- current="$number_major"
- revision="$number_minor"
- age="0"
- ;;
- irix|nonstopux)
- current=`expr $number_major + $number_minor - 1`
- age="$number_minor"
- revision="$number_minor"
- ;;
- *)
- $echo "$modename: unknown library version type \`$version_type'" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- ;;
- no)
- current="$2"
- revision="$3"
- age="$4"
- ;;
- esac
-
- # Check that each of the things are valid numbers.
- case $current in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $revision in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $age in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- if test "$age" -gt "$current"; then
- $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Calculate the version variables.
- major=
- versuffix=
- verstring=
- case $version_type in
- none) ;;
-
- darwin)
- # Like Linux, but with the current version available in
- # verstring for coding it into the library header
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- # Darwin ld doesn't like 0 for these options...
- minor_current=`expr $current + 1`
- verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
- ;;
-
- freebsd-aout)
- major=".$current"
- versuffix=".$current.$revision";
- ;;
-
- freebsd-elf)
- major=".$current"
- versuffix=".$current";
- ;;
-
- irix | nonstopux)
- major=`expr $current - $age + 1`
-
- case $version_type in
- nonstopux) verstring_prefix=nonstopux ;;
- *) verstring_prefix=sgi ;;
- esac
- verstring="$verstring_prefix$major.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$revision
- while test "$loop" -ne 0; do
- iface=`expr $revision - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring_prefix$major.$iface:$verstring"
- done
-
- # Before this point, $major must not contain `.'.
- major=.$major
- versuffix="$major.$revision"
- ;;
-
- linux)
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- major=.`expr $current - $age`
- versuffix=".$current.$age.$revision"
- verstring="$current.$age.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test "$loop" -ne 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- major=".$current"
- versuffix=".$current.$revision"
- ;;
-
- windows)
- # Use '-' rather than '.', since we only want one
- # extension on DOS 8.3 filesystems.
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
-
- *)
- $echo "$modename: unknown library version type \`$version_type'" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- # Clear the version info if we defaulted, and they specified a release.
- if test -z "$vinfo" && test -n "$release"; then
- major=
- case $version_type in
- darwin)
- # we can't check for "0.0" in archive_cmds due to quoting
- # problems, so we reset it completely
- verstring=
- ;;
- *)
- verstring="0.0"
- ;;
- esac
- if test "$need_version" = no; then
- versuffix=
- else
- versuffix=".0.0"
- fi
- fi
-
- # Remove version info from name if versioning should be avoided
- if test "$avoid_version" = yes && test "$need_version" = no; then
- major=
- versuffix=
- verstring=""
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Don't allow undefined symbols.
- allow_undefined_flag="$no_undefined_flag"
- fi
- fi
-
- if test "$mode" != relink; then
- # Remove our outputs, but don't remove object files since they
- # may have been created when compiling PIC objects.
- removelist=
- tempremovelist=`$echo "$output_objdir/*"`
- for p in $tempremovelist; do
- case $p in
- *.$objext)
- ;;
- $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
- if test "X$precious_files_regex" != "X"; then
- if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
- then
- continue
- fi
- fi
- removelist="$removelist $p"
- ;;
- *) ;;
- esac
- done
- if test -n "$removelist"; then
- $show "${rm}r $removelist"
- $run ${rm}r $removelist
- fi
- fi
-
- # Now set the variables for building old libraries.
- if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
- # Transform .lo files to .o files.
- oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
- fi
-
- # Eliminate all temporary directories.
- for path in $notinst_path; do
- lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
- deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
- dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
- done
-
- if test -n "$xrpath"; then
- # If the user specified any rpath flags, then add them.
- temp_xrpath=
- for libdir in $xrpath; do
- temp_xrpath="$temp_xrpath -R$libdir"
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
- dependency_libs="$temp_xrpath $dependency_libs"
- fi
- fi
-
- # Make sure dlfiles contains only unique files that won't be dlpreopened
- old_dlfiles="$dlfiles"
- dlfiles=
- for lib in $old_dlfiles; do
- case " $dlprefiles $dlfiles " in
- *" $lib "*) ;;
- *) dlfiles="$dlfiles $lib" ;;
- esac
- done
-
- # Make sure dlprefiles contains only unique files
- old_dlprefiles="$dlprefiles"
- dlprefiles=
- for lib in $old_dlprefiles; do
- case "$dlprefiles " in
- *" $lib "*) ;;
- *) dlprefiles="$dlprefiles $lib" ;;
- esac
- done
-
- if test "$build_libtool_libs" = yes; then
- if test -n "$rpath"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
- # these systems don't actually have a c library (as such)!
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C library is in the System framework
- deplibs="$deplibs -framework System"
- ;;
- *-*-netbsd*)
- # Don't link with libc until the a.out ld.so is fixed.
- ;;
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc due to us having libc/libc_r.
- ;;
- *-*-sco3.2v5* | *-*-sco5v6*)
- # Causes problems with __ctype
- ;;
- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
- # Compiler inserts libc in the correct place for threads to work
- ;;
- *)
- # Add libc to deplibs on all other systems if necessary.
- if test "$build_libtool_need_lc" = "yes"; then
- deplibs="$deplibs -lc"
- fi
- ;;
- esac
- fi
-
- # Transform deplibs into only deplibs that can be linked in shared.
- name_save=$name
- libname_save=$libname
- release_save=$release
- versuffix_save=$versuffix
- major_save=$major
- # I'm not sure if I'm treating the release correctly. I think
- # release should show up in the -l (ie -lgmp5) so we don't want to
- # add it in twice. Is that correct?
- release=""
- versuffix=""
- major=""
- newdeplibs=
- droppeddeps=no
- case $deplibs_check_method in
- pass_all)
- # Don't check for shared/static. Everything works.
- # This might be a little naive. We might want to check
- # whether the library exists or not. But this is on
- # osf3 & osf4 and I'm not really sure... Just
- # implementing what was already the behavior.
- newdeplibs=$deplibs
- ;;
- test_compile)
- # This code stresses the "libraries are programs" paradigm to its
- # limits. Maybe even breaks it. We compile a program, linking it
- # against the deplibs as a proxy for the library. Then we can check
- # whether they linked in statically or dynamically with ldd.
- $rm conftest.c
- cat > conftest.c <<EOF
- int main() { return 0; }
-EOF
- $rm conftest
- $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
- if test "$?" -eq 0 ; then
- ldd_output=`ldd conftest`
- for i in $deplibs; do
- name=`expr $i : '-l\(.*\)'`
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" -ne "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $i "*)
- newdeplibs="$newdeplibs $i"
- i=""
- ;;
- esac
- fi
- if test -n "$i" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning: dynamic linker does not accept needed library $i."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which I believe you do not have"
- $echo "*** because a test_compile did reveal that the linker did not use it for"
- $echo "*** its dynamic dependency list that programs get resolved with at runtime."
- fi
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- else
- # Error occurred in the first compile. Let's try to salvage
- # the situation: Compile a separate program for each library.
- for i in $deplibs; do
- name=`expr $i : '-l\(.*\)'`
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" != "0"; then
- $rm conftest
- $LTCC $LTCFLAGS -o conftest conftest.c $i
- # Did it work?
- if test "$?" -eq 0 ; then
- ldd_output=`ldd conftest`
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $i "*)
- newdeplibs="$newdeplibs $i"
- i=""
- ;;
- esac
- fi
- if test -n "$i" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning: dynamic linker does not accept needed library $i."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because a test_compile did reveal that the linker did not use this one"
- $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
- fi
- fi
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning! Library $i is needed by this library but I was not able to"
- $echo "*** make it link in! You will probably need to install it or some"
- $echo "*** library that it depends on before this library will be fully"
- $echo "*** functional. Installing it before continuing would be even better."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- fi
- ;;
- file_magic*)
- set dummy $deplibs_check_method
- file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name=`expr $a_deplib : '-l\(.*\)'`
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" != "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $a_deplib "*)
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- ;;
- esac
- fi
- if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- # Follow soft links.
- if ls -lLd "$potent_lib" 2>/dev/null \
- | grep " -> " >/dev/null; then
- continue
- fi
- # The statement above tries to avoid entering an
- # endless loop below, in case of cyclic links.
- # We might still enter an endless loop, since a link
- # loop can be closed while we follow links,
- # but so what?
- potlib="$potent_lib"
- while test -h "$potlib" 2>/dev/null; do
- potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
- case $potliblink in
- [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
- esac
- done
- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
- | ${SED} 10q \
- | $EGREP "$file_magic_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- fi
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- $echo
- $echo "*** Warning: linker path does not have real file for library $a_deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- $echo "*** with $libname but no candidates were found. (...for file magic test)"
- else
- $echo "*** with $libname and none of the candidates passed a file format test"
- $echo "*** using a file magic. Last file checked: $potlib"
- fi
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name=`expr $a_deplib : '-l\(.*\)'`
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $a_deplib "*)
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- ;;
- esac
- fi
- if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- potlib="$potent_lib" # see symlink-check above in file_magic test
- if eval $echo \"$potent_lib\" 2>/dev/null \
- | ${SED} 10q \
- | $EGREP "$match_pattern_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- fi
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- $echo
- $echo "*** Warning: linker path does not have real file for library $a_deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
- else
- $echo "*** with $libname and none of the candidates passed a file format test"
- $echo "*** using a regex pattern. Last file checked: $potlib"
- fi
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- none | unknown | *)
- newdeplibs=""
- tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
- -e 's/ -[LR][^ ]*//g'`
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- for i in $predeps $postdeps ; do
- # can't use Xsed below, because $i might contain '/'
- tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
- done
- fi
- if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
- | grep . >/dev/null; then
- $echo
- if test "X$deplibs_check_method" = "Xnone"; then
- $echo "*** Warning: inter-library dependencies are not supported in this platform."
- else
- $echo "*** Warning: inter-library dependencies are not known to be supported."
- fi
- $echo "*** All declared inter-library dependencies are being dropped."
- droppeddeps=yes
- fi
- ;;
- esac
- versuffix=$versuffix_save
- major=$major_save
- release=$release_save
- libname=$libname_save
- name=$name_save
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- if test "$droppeddeps" = yes; then
- if test "$module" = yes; then
- $echo
- $echo "*** Warning: libtool could not satisfy all declared inter-library"
- $echo "*** dependencies of module $libname. Therefore, libtool will create"
- $echo "*** a static module, that should work as long as the dlopening"
- $echo "*** application is linked with the -dlopen flag."
- if test -z "$global_symbol_pipe"; then
- $echo
- $echo "*** However, this would only work if libtool was able to extract symbol"
- $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- $echo "*** not find such a program. So, this module is probably useless."
- $echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- else
- $echo "*** The inter-library dependencies that have been dropped here will be"
- $echo "*** automatically added whenever a program is linked with this library"
- $echo "*** or is declared to -dlopen it."
-
- if test "$allow_undefined" = no; then
- $echo
- $echo "*** Since this library must not contain undefined symbols,"
- $echo "*** because either the platform does not support them or"
- $echo "*** it was explicitly requested with -no-undefined,"
- $echo "*** libtool will only create a static version of it."
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- fi
- fi
- # Done checking deplibs!
- deplibs=$newdeplibs
- fi
-
-
- # move library search paths that coincide with paths to not yet
- # installed libraries to the beginning of the library search list
- new_libs=
- for path in $notinst_path; do
- case " $new_libs " in
- *" -L$path/$objdir "*) ;;
- *)
- case " $deplibs " in
- *" -L$path/$objdir "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- deplibs="$new_libs"
-
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
-
- # Test again, we may have decided not to build it any more
- if test "$build_libtool_libs" = yes; then
- if test "$hardcode_into_libs" = yes; then
- # Hardcode the library paths
- hardcode_libdirs=
- dep_rpath=
- rpath="$finalize_rpath"
- test "$mode" != relink && rpath="$compile_rpath$rpath"
- for libdir in $rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- dep_rpath="$dep_rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- if test -n "$hardcode_libdir_flag_spec_ld"; then
- eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
- else
- eval dep_rpath=\"$hardcode_libdir_flag_spec\"
- fi
- fi
- if test -n "$runpath_var" && test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
- fi
- test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
- fi
-
- shlibpath="$finalize_shlibpath"
- test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
- if test -n "$shlibpath"; then
- eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
- fi
-
- # Get the real and link names of the library.
- eval shared_ext=\"$shrext_cmds\"
- eval library_names=\"$library_names_spec\"
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
- if test -z "$dlname"; then
- dlname=$soname
- fi
-
- lib="$output_objdir/$realname"
- linknames=
- for link
- do
- linknames="$linknames $link"
- done
-
- # Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
- cmds=$export_symbols_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- if len=`expr "X$cmd" : ".*"` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- $show "$cmd"
- $run eval "$cmd" || exit $?
- skipped_export=false
- else
- # The command line is too long to execute in one step.
- $show "using reloadable object file for export list..."
- skipped_export=:
- # Break out early, otherwise skipped_export may be
- # set to false by a later but shorter cmd.
- break
- fi
- done
- IFS="$save_ifs"
- if test -n "$export_symbols_regex"; then
- $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
- $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- $show "$mv \"${export_symbols}T\" \"$export_symbols\""
- $run eval '$mv "${export_symbols}T" "$export_symbols"'
- fi
- fi
- fi
-
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
- fi
-
- tmp_deplibs=
- for test_deplib in $deplibs; do
- case " $convenience " in
- *" $test_deplib "*) ;;
- *)
- tmp_deplibs="$tmp_deplibs $test_deplib"
- ;;
- esac
- done
- deplibs="$tmp_deplibs"
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- save_libobjs=$libobjs
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $convenience
- libobjs="$libobjs $func_extract_archives_result"
- fi
- fi
-
- if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
- eval flag=\"$thread_safe_flag_spec\"
- linker_flags="$linker_flags $flag"
- fi
-
- # Make a backup of the uninstalled library when relinking
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
- fi
-
- # Do each of the archive commands.
- if test "$module" = yes && test -n "$module_cmds" ; then
- if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- eval test_cmds=\"$module_expsym_cmds\"
- cmds=$module_expsym_cmds
- else
- eval test_cmds=\"$module_cmds\"
- cmds=$module_cmds
- fi
- else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval test_cmds=\"$archive_expsym_cmds\"
- cmds=$archive_expsym_cmds
- else
- eval test_cmds=\"$archive_cmds\"
- cmds=$archive_cmds
- fi
- fi
-
- if test "X$skipped_export" != "X:" &&
- len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- :
- else
- # The command line is too long to link in one step, link piecewise.
- $echo "creating reloadable object files..."
-
- # Save the value of $output and $libobjs because we want to
- # use them later. If we have whole_archive_flag_spec, we
- # want to use save_libobjs as it was before
- # whole_archive_flag_spec was expanded, because we can't
- # assume the linker understands whole_archive_flag_spec.
- # This may have to be revisited, in case too many
- # convenience libraries get linked in and end up exceeding
- # the spec.
- if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
- save_libobjs=$libobjs
- fi
- save_output=$output
- output_la=`$echo "X$output" | $Xsed -e "$basename"`
-
- # Clear the reloadable object creation command queue and
- # initialize k to one.
- test_cmds=
- concat_cmds=
- objlist=
- delfiles=
- last_robj=
- k=1
- output=$output_objdir/$output_la-${k}.$objext
- # Loop over the list of objects to be linked.
- for obj in $save_libobjs
- do
- eval test_cmds=\"$reload_cmds $objlist $last_robj\"
- if test "X$objlist" = X ||
- { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len"; }; then
- objlist="$objlist $obj"
- else
- # The command $test_cmds is almost too long, add a
- # command to the queue.
- if test "$k" -eq 1 ; then
- # The first file doesn't have a previous command to add.
- eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
- else
- # All subsequent reloadable object files will link in
- # the last one created.
- eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
- fi
- last_robj=$output_objdir/$output_la-${k}.$objext
- k=`expr $k + 1`
- output=$output_objdir/$output_la-${k}.$objext
- objlist=$obj
- len=1
- fi
- done
- # Handle the remaining objects by creating one last
- # reloadable object file. All subsequent reloadable object
- # files will link in the last one created.
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
-
- if ${skipped_export-false}; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
- libobjs=$output
- # Append the command to create the export file.
- eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
- fi
-
- # Set up a command to remove the reloadable object files
- # after they are used.
- i=0
- while test "$i" -lt "$k"
- do
- i=`expr $i + 1`
- delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
- done
-
- $echo "creating a temporary reloadable object file: $output"
-
- # Loop through the commands generated above and execute them.
- save_ifs="$IFS"; IFS='~'
- for cmd in $concat_cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- libobjs=$output
- # Restore the value of output.
- output=$save_output
-
- if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- fi
- # Expand the library linking commands again to reset the
- # value of $libobjs for piecewise linking.
-
- # Do each of the archive commands.
- if test "$module" = yes && test -n "$module_cmds" ; then
- if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- cmds=$module_expsym_cmds
- else
- cmds=$module_cmds
- fi
- else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- cmds=$archive_expsym_cmds
- else
- cmds=$archive_cmds
- fi
- fi
-
- # Append the command to remove the reloadable object files
- # to the just-reset $cmds.
- eval cmds=\"\$cmds~\$rm $delfiles\"
- fi
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
- fi
-
- exit $lt_exit
- }
- done
- IFS="$save_ifs"
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
-
- if test -n "$convenience"; then
- if test -z "$whole_archive_flag_spec"; then
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- fi
- fi
-
- exit $EXIT_SUCCESS
- fi
-
- # Create links to the real library.
- for linkname in $linknames; do
- if test "$realname" != "$linkname"; then
- $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
- fi
- done
-
- # If -module or -export-dynamic was specified, set the dlname.
- if test "$module" = yes || test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- obj)
- if test -n "$deplibs"; then
- $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
- fi
-
- case $output in
- *.lo)
- if test -n "$objs$old_deplibs"; then
- $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit $EXIT_FAILURE
- fi
- libobj="$output"
- obj=`$echo "X$output" | $Xsed -e "$lo2o"`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Objects from convenience libraries. This assumes
- # single-version convenience libraries. Whenever we create
- # different ones for PIC/non-PIC, this we'll have to duplicate
- # the extraction.
- reload_conv_objs=
- gentop=
- # reload_cmds runs $LD directly, so let us get rid of
- # -Wl from whole_archive_flag_spec
- wl=
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${obj}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $convenience
- reload_conv_objs="$reload_objs $func_extract_archives_result"
- fi
- fi
-
- # Create the old-style object.
- reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
- output="$obj"
- cmds=$reload_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- if test -z "$libobj"; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit $EXIT_SUCCESS
- fi
-
- if test "$build_libtool_libs" != yes; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- # $show "echo timestamp > $libobj"
- # $run eval "echo timestamp > $libobj" || exit $?
- exit $EXIT_SUCCESS
- fi
-
- if test -n "$pic_flag" || test "$pic_mode" != default; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs $reload_conv_objs"
- output="$libobj"
- cmds=$reload_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit $EXIT_SUCCESS
- ;;
-
- prog)
- case $host in
- *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
- esac
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
- fi
-
- if test "$preload" = yes; then
- if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
- test "$dlopen_self_static" = unknown; then
- $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
- fi
- fi
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- case $host in
- *darwin*)
- # Don't allow lazy linking, it breaks C++ global constructors
- if test "$tagname" = CXX ; then
- compile_command="$compile_command ${wl}-bind_at_load"
- finalize_command="$finalize_command ${wl}-bind_at_load"
- fi
- ;;
- esac
-
-
- # move library search paths that coincide with paths to not yet
- # installed libraries to the beginning of the library search list
- new_libs=
- for path in $notinst_path; do
- case " $new_libs " in
- *" -L$path/$objdir "*) ;;
- *)
- case " $compile_deplibs " in
- *" -L$path/$objdir "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $compile_deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- compile_deplibs="$new_libs"
-
-
- compile_command="$compile_command $compile_deplibs"
- finalize_command="$finalize_command $finalize_deplibs"
-
- if test -n "$rpath$xrpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath $xrpath; do
- # This is the magic to use -rpath.
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- fi
-
- # Now hardcode the library paths
- rpath=
- hardcode_libdirs=
- for libdir in $compile_rpath $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
- case :$dllsearchpath: in
- *":$libdir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$libdir";;
- esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$testbindir";;
- esac
- ;;
- esac
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- compile_rpath="$rpath"
-
- rpath=
- hardcode_libdirs=
- for libdir in $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$finalize_perm_rpath " in
- *" $libdir "*) ;;
- *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- finalize_rpath="$rpath"
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- fi
-
- dlsyms=
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- if test -n "$NM" && test -n "$global_symbol_pipe"; then
- dlsyms="${outputname}S.c"
- else
- $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
- fi
- fi
-
- if test -n "$dlsyms"; then
- case $dlsyms in
- "") ;;
- *.c)
- # Discover the nlist of each of the dlfiles.
- nlist="$output_objdir/${outputname}.nm"
-
- $show "$rm $nlist ${nlist}S ${nlist}T"
- $run $rm "$nlist" "${nlist}S" "${nlist}T"
-
- # Parse the name list into a source file.
- $show "creating $output_objdir/$dlsyms"
-
- test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
-/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define lt_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */\
-"
-
- if test "$dlself" = yes; then
- $show "generating symbol list for \`$output'"
-
- test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
-
- # Add our own program objects to the symbol list.
- progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- for arg in $progfiles; do
- $show "extracting global C symbols from \`$arg'"
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -n "$exclude_expsyms"; then
- $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- if test -n "$export_symbols_regex"; then
- $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$outputname.exp"
- $run $rm $export_symbols
- $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- else
- $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
- $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
- $run eval 'mv "$nlist"T "$nlist"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- fi
- fi
-
- for arg in $dlprefiles; do
- $show "extracting global C symbols from \`$arg'"
- name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
- $run eval '$echo ": $name " >> "$nlist"'
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -z "$run"; then
- # Make sure we have at least an empty file.
- test -f "$nlist" || : > "$nlist"
-
- if test -n "$exclude_expsyms"; then
- $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
- $mv "$nlist"T "$nlist"
- fi
-
- # Try sorting and uniquifying the output.
- if grep -v "^: " < "$nlist" |
- if sort -k 3 </dev/null >/dev/null 2>&1; then
- sort -k 3
- else
- sort +2
- fi |
- uniq > "$nlist"S; then
- :
- else
- grep -v "^: " < "$nlist" > "$nlist"S
- fi
-
- if test -f "$nlist"S; then
- eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
- else
- $echo '/* NONE */' >> "$output_objdir/$dlsyms"
- fi
-
- $echo >> "$output_objdir/$dlsyms" "\
-
-#undef lt_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define lt_ptr void *
-#else
-# define lt_ptr char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-"
-
- case $host in
- *cygwin* | *mingw* )
- $echo >> "$output_objdir/$dlsyms" "\
-/* DATA imports from DLLs on WIN32 can't be const, because
- runtime relocations are performed -- see ld's documentation
- on pseudo-relocs */
-struct {
-"
- ;;
- * )
- $echo >> "$output_objdir/$dlsyms" "\
-const struct {
-"
- ;;
- esac
-
-
- $echo >> "$output_objdir/$dlsyms" "\
- const char *name;
- lt_ptr address;
-}
-lt_preloaded_symbols[] =
-{\
-"
-
- eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
-
- $echo >> "$output_objdir/$dlsyms" "\
- {0, (lt_ptr) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
- fi
-
- pic_flag_for_symtable=
- case $host in
- # compiling the symbol table file with pic_flag works around
- # a FreeBSD bug that causes programs to crash when -lm is
- # linked before any other PIC object. But we must not use
- # pic_flag when linking with -static. The problem exists in
- # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
- esac;;
- *-*-hpux*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag";;
- esac
- esac
-
- # Now compile the dynamic symbol file.
- $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
-
- # Clean up the generated files.
- $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
- $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
-
- # Transform the symbol file into the correct name.
- case $host in
- *cygwin* | *mingw* )
- if test -f "$output_objdir/${outputname}.def" ; then
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
- else
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- fi
- ;;
- * )
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- ;;
- esac
- ;;
- *)
- $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- else
- # We keep going just in case the user didn't refer to
- # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
-
- # Nullify the symbol file.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
- fi
-
- if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- link_command="$compile_command$compile_rpath"
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$link_command"
- $run eval "$link_command"
- exit_status=$?
-
- # Delete the generated files.
- if test -n "$dlsyms"; then
- $show "$rm $output_objdir/${outputname}S.${objext}"
- $run $rm "$output_objdir/${outputname}S.${objext}"
- fi
-
- exit $exit_status
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- if test -n "$compile_shlibpath$finalize_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- compile_var=
- finalize_var=
- if test -n "$runpath_var"; then
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- if test -n "$finalize_perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $finalize_perm_rpath; do
- rpath="$rpath$dir:"
- done
- finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- fi
-
- if test "$no_install" = yes; then
- # We don't need to create a wrapper script.
- link_command="$compile_var$compile_command$compile_rpath"
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- # Delete the old output file.
- $run $rm $output
- # Link the executable and exit
- $show "$link_command"
- $run eval "$link_command" || exit $?
- exit $EXIT_SUCCESS
- fi
-
- if test "$hardcode_action" = relink; then
- # Fast installation is not supported
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
-
- $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
- $echo "$modename: \`$output' will be relinked during installation" 1>&2
- else
- if test "$fast_install" != no; then
- link_command="$finalize_var$compile_command$finalize_rpath"
- if test "$fast_install" = yes; then
- relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
- else
- # fast_install is set to needless
- relink_command=
- fi
- else
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
- fi
- fi
-
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
- # Delete the old output files.
- $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
- $show "$link_command"
- $run eval "$link_command" || exit $?
-
- # Now create the wrapper script.
- $show "creating $output"
-
- # Quote the relink command for shipping.
- if test -n "$relink_command"; then
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Quote $echo for shipping.
- if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
- case $progpath in
- [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
- *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
- esac
- qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
- else
- qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- # win32 will think the script is a binary if it has
- # a .exe suffix, so we strip it off here.
- case $output in
- *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
- esac
- # test for cygwin because mv fails w/o .exe extensions
- case $host in
- *cygwin*)
- exeext=.exe
- outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
- *) exeext= ;;
- esac
- case $host in
- *cygwin* | *mingw* )
- output_name=`basename $output`
- output_path=`dirname $output`
- cwrappersource="$output_path/$objdir/lt-$output_name.c"
- cwrapper="$output_path/$output_name.exe"
- $rm $cwrappersource $cwrapper
- trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
- cat > $cwrappersource <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
- Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-
- The $output program cannot be directly executed until all the libtool
- libraries that it depends on are installed.
-
- This wrapper executable should never be moved out of the build directory.
- If it is, it will not operate correctly.
-
- Currently, it simply execs the wrapper *script* "/bin/sh $output",
- but could eventually absorb all of the scripts functionality and
- exec $objdir/$outputname directly.
-*/
-EOF
- cat >> $cwrappersource<<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
- defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# ifndef DIR_SEPARATOR_2
-# define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-# define PATH_SEPARATOR_2 ';'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
- (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
-#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
- if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-/* -DDEBUG is fairly common in CFLAGS. */
-#undef DEBUG
-#if defined DEBUGWRAPPER
-# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
-#else
-# define DEBUG(format, ...)
-#endif
-
-const char *program_name = NULL;
-
-void * xmalloc (size_t num);
-char * xstrdup (const char *string);
-const char * base_name (const char *name);
-char * find_executable(const char *wrapper);
-int check_executable(const char *path);
-char * strendzap(char *str, const char *pat);
-void lt_fatal (const char *message, ...);
-
-int
-main (int argc, char *argv[])
-{
- char **newargz;
- int i;
-
- program_name = (char *) xstrdup (base_name (argv[0]));
- DEBUG("(main) argv[0] : %s\n",argv[0]);
- DEBUG("(main) program_name : %s\n",program_name);
- newargz = XMALLOC(char *, argc+2);
-EOF
-
- cat >> $cwrappersource <<EOF
- newargz[0] = (char *) xstrdup("$SHELL");
-EOF
-
- cat >> $cwrappersource <<"EOF"
- newargz[1] = find_executable(argv[0]);
- if (newargz[1] == NULL)
- lt_fatal("Couldn't find %s", argv[0]);
- DEBUG("(main) found exe at : %s\n",newargz[1]);
- /* we know the script has the same name, without the .exe */
- /* so make sure newargz[1] doesn't end in .exe */
- strendzap(newargz[1],".exe");
- for (i = 1; i < argc; i++)
- newargz[i+1] = xstrdup(argv[i]);
- newargz[argc+1] = NULL;
-
- for (i=0; i<argc+1; i++)
- {
- DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
- ;
- }
-
-EOF
-
- case $host_os in
- mingw*)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",(char const **)newargz);
-EOF
- ;;
- *)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",newargz);
-EOF
- ;;
- esac
-
- cat >> $cwrappersource <<"EOF"
- return 127;
-}
-
-void *
-xmalloc (size_t num)
-{
- void * p = (void *) malloc (num);
- if (!p)
- lt_fatal ("Memory exhausted");
-
- return p;
-}
-
-char *
-xstrdup (const char *string)
-{
- return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
-;
-}
-
-const char *
-base_name (const char *name)
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over the disk name in MSDOS pathnames. */
- if (isalpha ((unsigned char)name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- if (IS_DIR_SEPARATOR (*name))
- base = name + 1;
- return base;
-}
-
-int
-check_executable(const char * path)
-{
- struct stat st;
-
- DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
- if ((!path) || (!*path))
- return 0;
-
- if ((stat (path, &st) >= 0) &&
- (
- /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
-#if defined (S_IXOTH)
- ((st.st_mode & S_IXOTH) == S_IXOTH) ||
-#endif
-#if defined (S_IXGRP)
- ((st.st_mode & S_IXGRP) == S_IXGRP) ||
-#endif
- ((st.st_mode & S_IXUSR) == S_IXUSR))
- )
- return 1;
- else
- return 0;
-}
-
-/* Searches for the full path of the wrapper. Returns
- newly allocated full path name if found, NULL otherwise */
-char *
-find_executable (const char* wrapper)
-{
- int has_slash = 0;
- const char* p;
- const char* p_next;
- /* static buffer for getcwd */
- char tmp[LT_PATHMAX + 1];
- int tmp_len;
- char* concat_name;
-
- DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
-
- if ((wrapper == NULL) || (*wrapper == '\0'))
- return NULL;
-
- /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
- {
- concat_name = xstrdup (wrapper);
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
- else
- {
-#endif
- if (IS_DIR_SEPARATOR (wrapper[0]))
- {
- concat_name = xstrdup (wrapper);
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- }
-#endif
-
- for (p = wrapper; *p; p++)
- if (*p == '/')
- {
- has_slash = 1;
- break;
- }
- if (!has_slash)
- {
- /* no slashes; search PATH */
- const char* path = getenv ("PATH");
- if (path != NULL)
- {
- for (p = path; *p; p = p_next)
- {
- const char* q;
- size_t p_len;
- for (q = p; *q; q++)
- if (IS_PATH_SEPARATOR(*q))
- break;
- p_len = q - p;
- p_next = (*q == '\0' ? q : q + 1);
- if (p_len == 0)
- {
- /* empty path: current directory */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal ("getcwd failed");
- tmp_len = strlen(tmp);
- concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
- }
- else
- {
- concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, p, p_len);
- concat_name[p_len] = '/';
- strcpy (concat_name + p_len + 1, wrapper);
- }
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
- }
- /* not found in PATH; assume curdir */
- }
- /* Relative path | not found in path: prepend cwd */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal ("getcwd failed");
- tmp_len = strlen(tmp);
- concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
-
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- return NULL;
-}
-
-char *
-strendzap(char *str, const char *pat)
-{
- size_t len, patlen;
-
- assert(str != NULL);
- assert(pat != NULL);
-
- len = strlen(str);
- patlen = strlen(pat);
-
- if (patlen <= len)
- {
- str += len - patlen;
- if (strcmp(str, pat) == 0)
- *str = '\0';
- }
- return str;
-}
-
-static void
-lt_error_core (int exit_status, const char * mode,
- const char * message, va_list ap)
-{
- fprintf (stderr, "%s: %s: ", program_name, mode);
- vfprintf (stderr, message, ap);
- fprintf (stderr, ".\n");
-
- if (exit_status >= 0)
- exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
- va_list ap;
- va_start (ap, message);
- lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
- va_end (ap);
-}
-EOF
- # we should really use a build-platform specific compiler
- # here, but OTOH, the wrappers (shell script and this C one)
- # are only useful if you want to execute the "real" binary.
- # Since the "real" binary is built for $host, then this
- # wrapper might as well be built for $host, too.
- $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
- ;;
- esac
- $rm $output
- trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
-
- $echo > $output "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variable:
- notinst_deplibs='$notinst_deplibs'
-else
- # When we are sourced in execute mode, \$file and \$echo are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- echo=\"$qecho\"
- file=\"\$0\"
- # Make sure echo works.
- if test \"X\$1\" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
- elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
- # Yippee, \$echo works!
- :
- else
- # Restart under the correct shell, and then maybe \$echo will work.
- exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
- fi
- fi\
-"
- $echo >> $output "\
-
- # Find the directory that this script lives in.
- thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
- done
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- $echo >> $output "\
- program=lt-'$outputname'$exeext
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" || \\
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $mkdir \"\$progdir\"
- else
- $rm \"\$progdir/\$file\"
- fi"
-
- $echo >> $output "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if relink_command_output=\`eval \$relink_command 2>&1\`; then :
- else
- $echo \"\$relink_command_output\" >&2
- $rm \"\$progdir/\$file\"
- exit $EXIT_FAILURE
- fi
- fi
-
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $rm \"\$progdir/\$program\";
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $rm \"\$progdir/\$file\"
- fi"
- else
- $echo >> $output "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- $echo >> $output "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $echo >> $output "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 sed
- $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- # fixup the dll searchpath if we need to.
- if test -n "$dllsearchpath"; then
- $echo >> $output "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- $echo >> $output "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
-"
- case $host in
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2*)
- $echo >> $output "\
- exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
- ;;
-
- *)
- $echo >> $output "\
- exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
- ;;
- esac
- $echo >> $output "\
- \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
- exit $EXIT_FAILURE
- fi
- else
- # The program doesn't exist.
- \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
- \$echo \"This script is just a wrapper for \$program.\" 1>&2
- $echo \"See the $PACKAGE documentation for more information.\" 1>&2
- exit $EXIT_FAILURE
- fi
-fi\
-"
- chmod +x $output
- fi
- exit $EXIT_SUCCESS
- ;;
- esac
-
- # See if we need to build an old-fashioned archive.
- for oldlib in $oldlibs; do
-
- if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save"
- addlibs="$convenience"
- build_libtool_libs=no
- else
- if test "$build_libtool_libs" = module; then
- oldobjs="$libobjs_save"
- build_libtool_libs=no
- else
- oldobjs="$old_deplibs $non_pic_objects"
- fi
- addlibs="$old_convenience"
- fi
-
- if test -n "$addlibs"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $addlibs
- oldobjs="$oldobjs $func_extract_archives_result"
- fi
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- cmds=$old_archive_from_new_cmds
- else
- # POSIX demands no paths to be encoded in archives. We have
- # to avoid creating archives with duplicate basenames if we
- # might have to extract them afterwards, e.g., when creating a
- # static archive out of a convenience library, or when linking
- # the entirety of a libtool archive into another (currently
- # not supported by libtool).
- if (for obj in $oldobjs
- do
- $echo "X$obj" | $Xsed -e 's%^.*/%%'
- done | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "copying selected object files to avoid basename conflicts..."
-
- if test -z "$gentop"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
- exit $exit_status
- fi
- fi
-
- save_oldobjs=$oldobjs
- oldobjs=
- counter=1
- for obj in $save_oldobjs
- do
- objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
- case " $oldobjs " in
- " ") oldobjs=$obj ;;
- *[\ /]"$objbase "*)
- while :; do
- # Make sure we don't pick an alternate name that also
- # overlaps.
- newobj=lt$counter-$objbase
- counter=`expr $counter + 1`
- case " $oldobjs " in
- *[\ /]"$newobj "*) ;;
- *) if test ! -f "$gentop/$newobj"; then break; fi ;;
- esac
- done
- $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
- $run ln "$obj" "$gentop/$newobj" ||
- $run cp "$obj" "$gentop/$newobj"
- oldobjs="$oldobjs $gentop/$newobj"
- ;;
- *) oldobjs="$oldobjs $obj" ;;
- esac
- done
- fi
-
- eval cmds=\"$old_archive_cmds\"
-
- if len=`expr "X$cmds" : ".*"` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- cmds=$old_archive_cmds
- else
- # the command line is too long to link in one step, link in parts
- $echo "using piecewise archive linking..."
- save_RANLIB=$RANLIB
- RANLIB=:
- objlist=
- concat_cmds=
- save_oldobjs=$oldobjs
-
- # Is there a better way of finding the last object in the list?
- for obj in $save_oldobjs
- do
- last_oldobj=$obj
- done
- for obj in $save_oldobjs
- do
- oldobjs="$objlist $obj"
- objlist="$objlist $obj"
- eval test_cmds=\"$old_archive_cmds\"
- if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len"; then
- :
- else
- # the above command should be used before it gets too long
- oldobjs=$objlist
- if test "$obj" = "$last_oldobj" ; then
- RANLIB=$save_RANLIB
- fi
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
- objlist=
- fi
- done
- RANLIB=$save_RANLIB
- oldobjs=$objlist
- if test "X$oldobjs" = "X" ; then
- eval cmds=\"\$concat_cmds\"
- else
- eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
- fi
- fi
- fi
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- eval cmd=\"$cmd\"
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$generated"; then
- $show "${rm}r$generated"
- $run ${rm}r$generated
- fi
-
- # Now create the libtool archive.
- case $output in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.$libext"
- $show "creating $output"
-
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- # Quote the link command for shipping.
- relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- if test "$hardcode_automatic" = yes ; then
- relink_command=
- fi
-
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- for installed in no yes; do
- if test "$installed" = yes; then
- if test -z "$install_libdir"; then
- break
- fi
- output="$output_objdir/$outputname"i
- # Replace all uninstalled libtool libraries with the installed ones
- newdependency_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- *.la)
- name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdependency_libs="$newdependency_libs $libdir/$name"
- ;;
- *) newdependency_libs="$newdependency_libs $deplib" ;;
- esac
- done
- dependency_libs="$newdependency_libs"
- newdlfiles=
- for lib in $dlfiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdlfiles="$newdlfiles $libdir/$name"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdlprefiles="$newdlprefiles $libdir/$name"
- done
- dlprefiles="$newdlprefiles"
- else
- newdlfiles=
- for lib in $dlfiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlfiles="$newdlfiles $abs"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlprefiles="$newdlprefiles $abs"
- done
- dlprefiles="$newdlprefiles"
- fi
- $rm $output
- # place dlname in correct position for cygwin
- tdlname=$dlname
- case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
- esac
- $echo > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
- if test "$installed" = no && test "$need_relink" = yes; then
- $echo >> $output "\
-relink_command=\"$relink_command\""
- fi
- done
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
- $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
- ;;
- esac
- exit $EXIT_SUCCESS
- ;;
-
- # libtool install mode
- install)
- modename="$modename: install"
-
- # There may be an optional sh(1) argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
- # Allow the use of GNU shtool's install command.
- $echo "X$nonopt" | grep shtool > /dev/null; then
- # Aesthetically quote it.
- arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- install_prog="$arg "
- arg="$1"
- shift
- else
- install_prog=
- arg=$nonopt
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog$arg"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest=$arg
- continue
- fi
-
- case $arg in
- -d) isdir=yes ;;
- -f)
- case " $install_prog " in
- *[\\\ /]cp\ *) ;;
- *) prev=$arg ;;
- esac
- ;;
- -g | -m | -o) prev=$arg ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*)
- ;;
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest=$arg
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- $echo "$modename: you must specify an install program" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prev' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- $echo "$modename: no file or destination specified" 1>&2
- else
- $echo "$modename: you must specify a destination" 1>&2
- fi
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Strip any trailing slash from the destination.
- dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test "$isdir" = yes; then
- destdir="$dest"
- destname=
- else
- destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
- test "X$destdir" = "X$dest" && destdir=.
- destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test "$#" -gt 2; then
- $echo "$modename: \`$dest' is not a directory" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
- fi
- case $destdir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- for file in $files; do
- case $file in
- *.lo) ;;
- *)
- $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case $file in
- *.$libext)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- library_names=
- old_library=
- relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
- test "X$dir" = "X$file/" && dir=
- dir="$dir$objdir"
-
- if test -n "$relink_command"; then
- # Determine the prefix the user has applied to our future dir.
- inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
-
- # Don't allow the user to place us outside of our expected
- # location b/c this prevents finding dependent libraries that
- # are installed to the same prefix.
- # At present, this check doesn't affect windows .dll's that
- # are installed into $libdir/../bin (currently, that works fine)
- # but it's something to keep an eye on.
- if test "$inst_prefix_dir" = "$destdir"; then
- $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -n "$inst_prefix_dir"; then
- # Stick the inst_prefix_dir data into the link command.
- relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
- else
- relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
- fi
-
- $echo "$modename: warning: relinking \`$file'" 1>&2
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- exit $EXIT_FAILURE
- fi
- fi
-
- # See the names of the shared library.
- set dummy $library_names
- if test -n "$2"; then
- realname="$2"
- shift
- shift
-
- srcname="$realname"
- test -n "$relink_command" && srcname="$realname"T
-
- # Install the shared library and build the symlinks.
- $show "$install_prog $dir/$srcname $destdir/$realname"
- $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
- if test -n "$stripme" && test -n "$striplib"; then
- $show "$striplib $destdir/$realname"
- $run eval "$striplib $destdir/$realname" || exit $?
- fi
-
- if test "$#" -gt 0; then
- # Delete the old symlinks, and create new ones.
- # Try `ln -sf' first, because the `ln' binary might depend on
- # the symlink we replace! Solaris /bin/ln does not understand -f,
- # so we also need to try rm && ln -s.
- for linkname
- do
- if test "$linkname" != "$realname"; then
- $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
- $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
- fi
- done
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- cmds=$postinstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
- fi
-
- exit $lt_exit
- }
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- instname="$dir/$name"i
- $show "$install_prog $instname $destdir/$name"
- $run eval "$install_prog $instname $destdir/$name" || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case $destfile in
- *.lo)
- staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
- ;;
- *.$objext)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run eval "$install_prog $file $destfile" || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
-
- $show "$install_prog $staticobj $staticdest"
- $run eval "$install_prog \$staticobj \$staticdest" || exit $?
- fi
- exit $EXIT_SUCCESS
- ;;
-
- *)
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # If the file is missing, and there is a .exe on the end, strip it
- # because it is most likely a libtool script we actually want to
- # install
- stripped_ext=""
- case $file in
- *.exe)
- if test ! -f "$file"; then
- file=`$echo $file|${SED} 's,.exe$,,'`
- stripped_ext=".exe"
- fi
- ;;
- esac
-
- # Do a test to see if this is really a libtool program.
- case $host in
- *cygwin*|*mingw*)
- wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
- ;;
- *)
- wrapper=$file
- ;;
- esac
- if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
- notinst_deplibs=
- relink_command=
-
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
- # If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${wrapper} ;;
- *) . ./${wrapper} ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$notinst_deplibs"; then
- $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- finalize=yes
- for lib in $notinst_deplibs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- # If there is no directory component, then add one.
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
- fi
- libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
- if test -n "$libdir" && test ! -f "$libfile"; then
- $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- relink_command=
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
- # If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${wrapper} ;;
- *) . ./${wrapper} ;;
- esac
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- if test "$finalize" = yes && test -z "$run"; then
- tmpdir=`func_mktempdir`
- file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- ${rm}r "$tmpdir"
- continue
- fi
- file="$outputname"
- else
- $echo "$modename: warning: cannot relink \`$file'" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- # remove .exe since cygwin /usr/bin/install will append another
- # one anyway
- case $install_prog,$host in
- */usr/bin/install*,*cygwin*)
- case $file:$destfile in
- *.exe:*.exe)
- # this is ok
- ;;
- *.exe:*)
- destfile=$destfile.exe
- ;;
- *:*.exe)
- destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
- ;;
- esac
- ;;
- esac
- $show "$install_prog$stripme $file $destfile"
- $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
- test -n "$outputname" && ${rm}r "$tmpdir"
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run eval "$install_prog \$file \$oldlib" || exit $?
-
- if test -n "$stripme" && test -n "$old_striplib"; then
- $show "$old_striplib $oldlib"
- $run eval "$old_striplib $oldlib" || exit $?
- fi
-
- # Do each command in the postinstall commands.
- cmds=$old_postinstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
- else
- exit $EXIT_SUCCESS
- fi
- ;;
-
- # libtool finish mode
- finish)
- modename="$modename: finish"
- libdirs="$nonopt"
- admincmds=
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- if test -n "$finish_cmds"; then
- # Do each command in the finish commands.
- cmds=$finish_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || admincmds="$admincmds
- $cmd"
- done
- IFS="$save_ifs"
- fi
- if test -n "$finish_eval"; then
- # Do the single finish_eval.
- eval cmds=\"$finish_eval\"
- $run eval "$cmds" || admincmds="$admincmds
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- test "$show" = : && exit $EXIT_SUCCESS
-
- $echo "X----------------------------------------------------------------------" | $Xsed
- $echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- $echo " $libdir"
- done
- $echo
- $echo "If you ever happen to want to link against installed libraries"
- $echo "in a given directory, LIBDIR, you must either use libtool, and"
- $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
- $echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- $echo " during execution"
- fi
- if test -n "$runpath_var"; then
- $echo " - add LIBDIR to the \`$runpath_var' environment variable"
- $echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- $echo " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- $echo " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- $echo
- $echo "See any operating system documentation about shared libraries for"
- $echo "more information, such as the ld(1) and ld.so(8) manual pages."
- $echo "X----------------------------------------------------------------------" | $Xsed
- exit $EXIT_SUCCESS
- ;;
-
- # libtool execute mode
- execute)
- modename="$modename: execute"
-
- # The first argument is the command name.
- cmd="$nonopt"
- if test -z "$cmd"; then
- $echo "$modename: you must specify a COMMAND" 1>&2
- $echo "$help"
- exit $EXIT_FAILURE
- fi
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- if test ! -f "$file"; then
- $echo "$modename: \`$file' is not a file" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- dir=
- case $file in
- *.la)
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Read the libtool library.
- dlname=
- library_names=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit $EXIT_FAILURE
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- ;;
-
- *)
- $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case $file in
- -*) ;;
- *)
- # Do a test to see if this is really a libtool program.
- if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
- args="$args \"$file\""
- done
-
- if test -z "$run"; then
- if test -n "$shlibpath_var"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
- fi
-
- # Restore saved environment variables
- if test "${save_LC_ALL+set}" = set; then
- LC_ALL="$save_LC_ALL"; export LC_ALL
- fi
- if test "${save_LANG+set}" = set; then
- LANG="$save_LANG"; export LANG
- fi
-
- # Now prepare to actually exec the command.
- exec_cmd="\$cmd$args"
- else
- # Display what would be done.
- if test -n "$shlibpath_var"; then
- eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
- $echo "export $shlibpath_var"
- fi
- $echo "$cmd$args"
- exit $EXIT_SUCCESS
- fi
- ;;
-
- # libtool clean and uninstall mode
- clean | uninstall)
- modename="$modename: $mode"
- rm="$nonopt"
- files=
- rmforce=
- exit_status=0
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- for arg
- do
- case $arg in
- -f) rm="$rm $arg"; rmforce=yes ;;
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$modename: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- rmdirs=
-
- origobjdir="$objdir"
- for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$file"; then
- dir=.
- objdir="$origobjdir"
- else
- objdir="$dir/$origobjdir"
- fi
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- test "$mode" = uninstall && objdir="$dir"
-
- # Remember objdir for removal later, being careful to avoid duplicates
- if test "$mode" = clean; then
- case " $rmdirs " in
- *" $objdir "*) ;;
- *) rmdirs="$rmdirs $objdir" ;;
- esac
- fi
-
- # Don't error if the file doesn't exist and rm -f was used.
- if (test -L "$file") >/dev/null 2>&1 \
- || (test -h "$file") >/dev/null 2>&1 \
- || test -f "$file"; then
- :
- elif test -d "$file"; then
- exit_status=1
- continue
- elif test "$rmforce" = yes; then
- continue
- fi
-
- rmfiles="$file"
-
- case $name in
- *.la)
- # Possibly a libtool archive, so verify it.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $objdir/$n"
- done
- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-
- case "$mode" in
- clean)
- case " $library_names " in
- # " " in the beginning catches empty $dlname
- *" $dlname "*) ;;
- *) rmfiles="$rmfiles $objdir/$dlname" ;;
- esac
- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
- ;;
- uninstall)
- if test -n "$library_names"; then
- # Do each command in the postuninstall commands.
- cmds=$postuninstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd"
- if test "$?" -ne 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$old_library"; then
- # Do each command in the old_postuninstall commands.
- cmds=$old_postuninstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd"
- if test "$?" -ne 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
- # FIXME: should reinstall the best remaining shared library.
- ;;
- esac
- fi
- ;;
-
- *.lo)
- # Possibly a libtool object, so verify it.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-
- # Read the .lo file
- . $dir/$name
-
- # Add PIC object to the list of files to remove.
- if test -n "$pic_object" \
- && test "$pic_object" != none; then
- rmfiles="$rmfiles $dir/$pic_object"
- fi
-
- # Add non-PIC object to the list of files to remove.
- if test -n "$non_pic_object" \
- && test "$non_pic_object" != none; then
- rmfiles="$rmfiles $dir/$non_pic_object"
- fi
- fi
- ;;
-
- *)
- if test "$mode" = clean ; then
- noexename=$name
- case $file in
- *.exe)
- file=`$echo $file|${SED} 's,.exe$,,'`
- noexename=`$echo $name|${SED} 's,.exe$,,'`
- # $file with .exe has already been added to rmfiles,
- # add $file without .exe
- rmfiles="$rmfiles $file"
- ;;
- esac
- # Do a test to see if this is a libtool program.
- if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- relink_command=
- . $dir/$noexename
-
- # note $name still contains .exe if it was in $file originally
- # as does the version of $file that was added into $rmfiles
- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
- if test "$fast_install" = yes && test -n "$relink_command"; then
- rmfiles="$rmfiles $objdir/lt-$name"
- fi
- if test "X$noexename" != "X$name" ; then
- rmfiles="$rmfiles $objdir/lt-${noexename}.c"
- fi
- fi
- fi
- ;;
- esac
- $show "$rm $rmfiles"
- $run $rm $rmfiles || exit_status=1
- done
- objdir="$origobjdir"
-
- # Try to remove the ${objdir}s in the directories where we deleted files
- for dir in $rmdirs; do
- if test -d "$dir"; then
- $show "rmdir $dir"
- $run rmdir $dir >/dev/null 2>&1
- fi
- done
-
- exit $exit_status
- ;;
-
- "")
- $echo "$modename: you must specify a MODE" 1>&2
- $echo "$generic_help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- if test -z "$exec_cmd"; then
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$generic_help" 1>&2
- exit $EXIT_FAILURE
- fi
-fi # test -z "$show_help"
-
-if test -n "$exec_cmd"; then
- eval exec $exec_cmd
- exit $EXIT_FAILURE
-fi
-
-# We need to display help for each of the modes.
-case $mode in
-"") $echo \
-"Usage: $modename [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
- --config show all configuration variables
- --debug enable verbose shell tracing
--n, --dry-run display commands without modifying any files
- --features display basic configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --quiet same as \`--silent'
- --silent don't print informational messages
- --tag=TAG use configuration variables from tag TAG
- --version print version information
-
-MODE must be one of the following:
-
- clean remove files from the build directory
- compile compile a source file into a libtool object
- execute automatically set library path, then run a program
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
-a more detailed description of MODE.
-
-Report bugs to <bug-libtool@gnu.org>."
- exit $EXIT_SUCCESS
- ;;
-
-clean)
- $echo \
-"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
- ;;
-
-compile)
- $echo \
-"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
- -o OUTPUT-FILE set the output file name to OUTPUT-FILE
- -prefer-pic try to building PIC objects only
- -prefer-non-pic try to building non-PIC objects only
- -static always build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
- ;;
-
-execute)
- $echo \
-"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
- ;;
-
-finish)
- $echo \
-"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed."
- ;;
-
-install)
- $echo \
-"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
- ;;
-
-link)
- $echo \
-"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -avoid-version do not add a version suffix if possible
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
- -export-symbols-regex REGEX
- try to export only the symbols matching REGEX
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -module build a library that can dlopened
- -no-fast-install disable the fast-install mode
- -no-install link a not-installable executable
- -no-undefined declare that a library does not refer to external symbols
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -objectlist FILE Use a list of object files found in FILE to specify objects
- -precious-files-regex REGEX
- don't remove output files matching REGEX
- -release RELEASE specify package release information
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -static do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
- ;;
-
-uninstall)
- $echo \
-"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
- ;;
-
-*)
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
-esac
-
-$echo
-$echo "Try \`$modename --help' for more information about other modes."
-
-exit $?
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries. Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them. This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration. But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-disable_libs=shared
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-disable_libs=static
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/qpid/cpp/build-aux/mdate-sh b/qpid/cpp/build-aux/mdate-sh
deleted file mode 100755
index cd916c0a34..0000000000
--- a/qpid/cpp/build-aux/mdate-sh
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/bin/sh
-# Get modification time of a file or directory and pretty-print it.
-
-scriptversion=2005-06-29.22
-
-# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software
-# Foundation, Inc.
-# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# This file is maintained in Automake, please report
-# bugs to <bug-automake@gnu.org> or send patches to
-# <automake-patches@gnu.org>.
-
-case $1 in
- '')
- echo "$0: No file. Try \`$0 --help' for more information." 1>&2
- exit 1;
- ;;
- -h | --h*)
- cat <<\EOF
-Usage: mdate-sh [--help] [--version] FILE
-
-Pretty-print the modification time of FILE.
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
- exit $?
- ;;
- -v | --v*)
- echo "mdate-sh $scriptversion"
- exit $?
- ;;
-esac
-
-# Prevent date giving response in another language.
-LANG=C
-export LANG
-LC_ALL=C
-export LC_ALL
-LC_TIME=C
-export LC_TIME
-
-# GNU ls changes its time format in response to the TIME_STYLE
-# variable. Since we cannot assume `unset' works, revert this
-# variable to its documented default.
-if test "${TIME_STYLE+set}" = set; then
- TIME_STYLE=posix-long-iso
- export TIME_STYLE
-fi
-
-save_arg1=$1
-
-# Find out how to get the extended ls output of a file or directory.
-if ls -L /dev/null 1>/dev/null 2>&1; then
- ls_command='ls -L -l -d'
-else
- ls_command='ls -l -d'
-fi
-
-# A `ls -l' line looks as follows on OS/2.
-# drwxrwx--- 0 Aug 11 2001 foo
-# This differs from Unix, which adds ownership information.
-# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
-#
-# To find the date, we split the line on spaces and iterate on words
-# until we find a month. This cannot work with files whose owner is a
-# user named `Jan', or `Feb', etc. However, it's unlikely that `/'
-# will be owned by a user whose name is a month. So we first look at
-# the extended ls output of the root directory to decide how many
-# words should be skipped to get the date.
-
-# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
-set x`ls -l -d /`
-
-# Find which argument is the month.
-month=
-command=
-until test $month
-do
- shift
- # Add another shift to the command.
- command="$command shift;"
- case $1 in
- Jan) month=January; nummonth=1;;
- Feb) month=February; nummonth=2;;
- Mar) month=March; nummonth=3;;
- Apr) month=April; nummonth=4;;
- May) month=May; nummonth=5;;
- Jun) month=June; nummonth=6;;
- Jul) month=July; nummonth=7;;
- Aug) month=August; nummonth=8;;
- Sep) month=September; nummonth=9;;
- Oct) month=October; nummonth=10;;
- Nov) month=November; nummonth=11;;
- Dec) month=December; nummonth=12;;
- esac
-done
-
-# Get the extended ls output of the file or directory.
-set dummy x`eval "$ls_command \"\$save_arg1\""`
-
-# Remove all preceding arguments
-eval $command
-
-# Because of the dummy argument above, month is in $2.
-#
-# On a POSIX system, we should have
-#
-# $# = 5
-# $1 = file size
-# $2 = month
-# $3 = day
-# $4 = year or time
-# $5 = filename
-#
-# On Darwin 7.7.0 and 7.6.0, we have
-#
-# $# = 4
-# $1 = day
-# $2 = month
-# $3 = year or time
-# $4 = filename
-
-# Get the month.
-case $2 in
- Jan) month=January; nummonth=1;;
- Feb) month=February; nummonth=2;;
- Mar) month=March; nummonth=3;;
- Apr) month=April; nummonth=4;;
- May) month=May; nummonth=5;;
- Jun) month=June; nummonth=6;;
- Jul) month=July; nummonth=7;;
- Aug) month=August; nummonth=8;;
- Sep) month=September; nummonth=9;;
- Oct) month=October; nummonth=10;;
- Nov) month=November; nummonth=11;;
- Dec) month=December; nummonth=12;;
-esac
-
-case $3 in
- ???*) day=$1;;
- *) day=$3; shift;;
-esac
-
-# Here we have to deal with the problem that the ls output gives either
-# the time of day or the year.
-case $3 in
- *:*) set `date`; eval year=\$$#
- case $2 in
- Jan) nummonthtod=1;;
- Feb) nummonthtod=2;;
- Mar) nummonthtod=3;;
- Apr) nummonthtod=4;;
- May) nummonthtod=5;;
- Jun) nummonthtod=6;;
- Jul) nummonthtod=7;;
- Aug) nummonthtod=8;;
- Sep) nummonthtod=9;;
- Oct) nummonthtod=10;;
- Nov) nummonthtod=11;;
- Dec) nummonthtod=12;;
- esac
- # For the first six month of the year the time notation can also
- # be used for files modified in the last year.
- if (expr $nummonth \> $nummonthtod) > /dev/null;
- then
- year=`expr $year - 1`
- fi;;
- *) year=$3;;
-esac
-
-# The result.
-echo $day $month $year
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/qpid/cpp/build-aux/missing b/qpid/cpp/build-aux/missing
deleted file mode 100755
index 1c8ff7049d..0000000000
--- a/qpid/cpp/build-aux/missing
+++ /dev/null
@@ -1,367 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2006-05-10.23
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
-fi
-
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
- configure_ac=configure.ac
-else
- configure_ac=configure.in
-fi
-
-msg="missing on your system"
-
-case $1 in
---run)
- # Try to run requested program, and just exit if it succeeds.
- run=
- shift
- "$@" && exit 0
- # Exit code 63 means version mismatch. This often happens
- # when the user try to use an ancient version of a tool on
- # a file that requires a minimum version. In this case we
- # we should proceed has if the program had been absent, or
- # if --run hadn't been passed.
- if test $? = 63; then
- run=:
- msg="probably too old"
- fi
- ;;
-
- -h|--h|--he|--hel|--help)
- echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
- -h, --help display this help and exit
- -v, --version output version information and exit
- --run try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- autom4te touch the output file, or create a stub one
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
- help2man touch the output file
- lex create \`lex.yy.c', if possible, from existing .c
- makeinfo touch the output file
- tar try tar, gnutar, gtar, then tar without non-portable flags
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
-
-Send bug reports to <bug-automake@gnu.org>."
- exit $?
- ;;
-
- -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing $scriptversion (GNU Automake)"
- exit $?
- ;;
-
- -*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
- ;;
-
-esac
-
-# Now exit if we have it, but it failed. Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).
-case $1 in
- lex|yacc)
- # Not GNU programs, they don't have --version.
- ;;
-
- tar)
- if test -n "$run"; then
- echo 1>&2 "ERROR: \`tar' requires --run"
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- exit 1
- fi
- ;;
-
- *)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- # Could not run --version or --help. This is probably someone
- # running `$TOOL --version' or `$TOOL --help' to check whether
- # $TOOL exists and not knowing $TOOL uses missing.
- exit 1
- fi
- ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $1 in
- aclocal*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`${configure_ac}'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
- test -z "$files" && files="config.h"
- touch_files=
- for f in $files; do
- case $f in
- *:*) touch_files="$touch_files "`echo "$f" |
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
- *) touch_files="$touch_files $f.in";;
- esac
- done
- touch $touch_files
- ;;
-
- automake*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print |
- sed 's/\.am$/.in/' |
- while read f; do touch "$f"; done
- ;;
-
- autom4te)
- echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
- You might have modified some files without having the
- proper tools for further handling them.
- You can get \`$1' as part of \`Autoconf' from any GNU
- archive site."
-
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo "#! /bin/sh"
- echo "# Created by GNU Automake missing as a replacement of"
- echo "# $ $@"
- echo "exit 0"
- chmod +x $file
- exit 1
- fi
- ;;
-
- bison|yacc)
- echo 1>&2 "\
-WARNING: \`$1' $msg. You should only need it if
- you modified a \`.y' file. You may need the \`Bison' package
- in order for those modifications to take effect. You can get
- \`Bison' from any GNU archive site."
- rm -f y.tab.c y.tab.h
- if test $# -ne 1; then
- eval LASTARG="\${$#}"
- case $LASTARG in
- *.y)
- SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" y.tab.c
- fi
- SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" y.tab.h
- fi
- ;;
- esac
- fi
- if test ! -f y.tab.h; then
- echo >y.tab.h
- fi
- if test ! -f y.tab.c; then
- echo 'main() { return 0; }' >y.tab.c
- fi
- ;;
-
- lex|flex)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.l' file. You may need the \`Flex' package
- in order for those modifications to take effect. You can get
- \`Flex' from any GNU archive site."
- rm -f lex.yy.c
- if test $# -ne 1; then
- eval LASTARG="\${$#}"
- case $LASTARG in
- *.l)
- SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" lex.yy.c
- fi
- ;;
- esac
- fi
- if test ! -f lex.yy.c; then
- echo 'main() { return 0; }' >lex.yy.c
- fi
- ;;
-
- help2man)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a dependency of a manual page. You may need the
- \`Help2man' package in order for those modifications to take
- effect. You can get \`Help2man' from any GNU archive site."
-
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo ".ab help2man is required to generate this page"
- exit 1
- fi
- ;;
-
- makeinfo)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- # The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -z "$file"; then
- # ... or it is the one specified with @setfilename ...
- infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '
- /^@setfilename/{
- s/.* \([^ ]*\) *$/\1/
- p
- q
- }' $infile`
- # ... or it is derived from the source name (dir/f.texi becomes f.info)
- test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
- fi
- # If the file does not exist, the user really needs makeinfo;
- # let's fail without touching anything.
- test -f $file || exit 1
- touch $file
- ;;
-
- tar)
- shift
-
- # We have already tried tar in the generic part.
- # Look for gnutar/gtar before invocation to avoid ugly error
- # messages.
- if (gnutar --version > /dev/null 2>&1); then
- gnutar "$@" && exit 0
- fi
- if (gtar --version > /dev/null 2>&1); then
- gtar "$@" && exit 0
- fi
- firstarg="$1"
- if shift; then
- case $firstarg in
- *o*)
- firstarg=`echo "$firstarg" | sed s/o//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- case $firstarg in
- *h*)
- firstarg=`echo "$firstarg" | sed s/h//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- fi
-
- echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
- You may want to install GNU tar or Free paxutils, or check the
- command line arguments."
- exit 1
- ;;
-
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
- You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequisites for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
- ;;
-esac
-
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/qpid/cpp/configure.ac b/qpid/cpp/configure.ac
deleted file mode 100644
index c17051d431..0000000000
--- a/qpid/cpp/configure.ac
+++ /dev/null
@@ -1,181 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-dnl
-dnl This file is free software; as a special exception the author gives
-dnl unlimited permission to copy and/or distribute it, with or without
-dnl modifications, as long as this notice is preserved.
-dnl
-dnl This program is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
-dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-AC_INIT([qpidc], [0.2], [qpid-dev@incubator.apache.org])
-AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
-
-# Minimum Autoconf version required.
-AC_PREREQ(2.59)
-
-AC_CONFIG_HEADERS([src/config.h])
-AC_CONFIG_SRCDIR([qpidc.spec.in])
-
-AC_PROG_CC_STDC
-AM_PROG_CC_C_O
-AC_PROG_CXX
-AC_USE_SYSTEM_EXTENSIONS
-AC_LANG([C++])
-
-# AM_MISSING_PROG([HELP2MAN], [help2man])
-AC_CHECK_PROG([HELP2MAN], [help2man], [help2man])
-test -z "$HELP2MAN" && AC_MSG_ERROR([Missing help2man installation (try "yum install help2man").])
-
-AC_ARG_ENABLE(warnings,
-[ --enable-warnings turn on lots of compiler warnings (recommended)],
-[case "${enableval}" in
- yes|no) ;;
- *) AC_MSG_ERROR([bad value ${enableval} for warnings option]) ;;
- esac],
- [enableval=yes])
-
-# Warnings: Enable as many as possible, keep the code clean. Please
-# do not disable warnings or remove -Werror without discussing on
-# qpid-dev list.
-#
-# The following warnings are deliberately omitted, they warn on valid code.
-# -Wunreachable-code -Wpadded -Winline
-# -Wshadow - warns about boost headers.
-
-if test "${enableval}" = yes; then
- gl_COMPILER_FLAGS(-Werror)
- gl_COMPILER_FLAGS(-pedantic)
- gl_COMPILER_FLAGS(-Wall)
- gl_COMPILER_FLAGS(-Wextra)
- gl_COMPILER_FLAGS(-Wno-shadow)
- gl_COMPILER_FLAGS(-Wpointer-arith)
- gl_COMPILER_FLAGS(-Wcast-qual)
- gl_COMPILER_FLAGS(-Wcast-align)
- gl_COMPILER_FLAGS(-Wno-long-long)
- gl_COMPILER_FLAGS(-Wvolatile-register-var)
- gl_COMPILER_FLAGS(-Winvalid-pch)
- gl_COMPILER_FLAGS(-Wno-system-headers)
- gl_COMPILER_FLAGS(-Woverloaded-virtual)
- AC_SUBST([WARNING_CFLAGS], [$COMPILER_FLAGS])
- AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
- COMPILER_FLAGS=
-fi
-
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
-AC_SUBST([LIBTOOL_DEPS])
-
-# For libraries (libcommon) that use dlopen, dlerror, etc.,
-# test whether we need to link with -ldl.
-gl_saved_libs=$LIBS
- AC_SEARCH_LIBS(dlopen, [dl],
- [test "$ac_cv_search_dlopen" = "none required" ||
- LIB_DLOPEN=$ac_cv_search_dlopen])
- AC_SUBST([LIB_DLOPEN])
-LIBS=$gl_saved_libs
-
-# Set the argument to be used in "libtool -version-info ARG".
-QPID_CURRENT=1
-QPID_REVISION=0
-QPID_AGE=1
-LIBTOOL_VERSION_INFO_ARG=$QPID_CURRENT:$QPID_REVISION:$QPID_AGE
-AC_SUBST(LIBTOOL_VERSION_INFO_ARG)
-
-gl_CLOCK_TIME
-
-# Check for cppunit support.
-CPPUNIT_MINIMUM_VERSION=1.10.2
-AM_PATH_CPPUNIT([$CPPUNIT_MINIMUM_VERSION], , [CPPUNIT_LIBS=-lcppunit])
-CPPUNIT_CXXFLAGS=$CPPUNIT_CFLAGS
-AC_SUBST(CPPUNIT_LIBS)
-AC_SUBST(CPPUNIT_CXXFLAGS)
-
-# Enable Valgrind
-AC_ARG_ENABLE([valgrind],
- [AS_HELP_STRING([--enable-valgrind],
- [run valgrind memory checker on tests, if available (default yes)])],
- [case $enableval in
- yes|no) enable_VALGRIND=$enableval;;
- *) AC_MSG_ERROR([Invalid value for --enable-valgrind: $enableval]);;
- esac],
- [enable_VALGRIND=yes]
-)
-
-# We use valgrind for the tests. See if it's available.
-# Check for it unconditionally, so we don't have to duplicate its
-# use of AC_SUBST([VALGRIND]).
-AC_CHECK_PROG([VALGRIND], [valgrind], [valgrind])
-test "$enable_VALGRIND" = no && VALGRIND=
-
-# If rpmlint is availalbe we'll run it when building RPMs.
-AC_CHECK_PROG([RPMLINT], [rpmlint], [rpmlint])
-AM_CONDITIONAL([HAS_RPMLINT], [test -n "$RPMLINT"])
-
-# Code generation: generated code is included in the distribution
-# so code generation is only required in an svn checkout.
-# It requires several external tools and files, which we check for here.
-
-AC_CHECK_PROG([RUBY], [ruby], [ruby])
-test -n "$RUBY" && generate=yes
-test -z "$RUBY" && AC_MSG_ERROR([Missing ruby installation (try "yum install ruby").])
-
-specdir=`pwd`/$srcdir/../specs
-AMQP_PREVIEW_XML=$specdir/amqp.0-10-preview.xml
-AMQP_FINAL_XML=$specdir/amqp.0-10.xml
-AC_SUBST(AMQP_PREVIEW_XML)
-AC_SUBST(AMQP_FINAL_XML)
-AM_CONDITIONAL([GENERATE], [ls $AMQP_FINAL_XML >/dev/null])
-
-# URL and download URL for the package.
-URL=http://rhm.et.redhat.com/qpidc
-AC_SUBST(URL)
-DOWNLOAD_URL=http://rhm.et.redhat.com/download
-AC_SUBST(DOWNLOAD_URL)
-
-# Check for headers from required devel kits.
-AC_CHECK_HEADERS([boost/shared_ptr.hpp uuid/uuid.h],,
- AC_MSG_ERROR([Missing required header files.]))
-
-# Check for optional CPG requirement.
-LDFLAGS="$LDFLAGS -L/usr/lib/openais -L/usr/lib64/openais"
-
-AC_ARG_WITH([cpg],
- [AS_HELP_STRING([--with-cpg], [Build with CPG support])],
- [case "${withval}" in
- yes) # yes - enable
- with_CPG=yes
- AC_CHECK_LIB([cpg],[cpg_initialize],,[AC_MSG_ERROR([libcpg not found, install openais])])
- AC_CHECK_HEADERS([openais/cpg.h],,[AC_MSG_ERROR([openais/cpg.h not found, install openais-devel])])
- ;;
- no) # no -disable
- with_CPG=no
- ;;
- *) AC_MSG_ERROR([Bad value ${withval} for --with-cpg option]) ;;
- esac],
- [ # not specified - enable if libs/headers available.
- with_CPG=yes
- AC_CHECK_HEADERS([openais/cpg.h],,[with_CPG=no])
- AC_CHECK_LIB([cpg],[cpg_initialize],,[with_CPG=no])
- ]
-)
-AM_CONDITIONAL([CPG], [test x$with_CPG = xyes])
-if test x$with_CPG = xyes; then
- CPPFLAGS+=" -DCPG"
-fi
-
-# Files to generate
-AC_CONFIG_FILES([
- qpidc.spec
- Makefile
- examples/Makefile
- src/Makefile
- src/tests/Makefile
- docs/man/Makefile
- docs/api/Makefile
- docs/api/user.doxygen
- docs/api/developer.doxygen
- ])
-AC_OUTPUT
-
diff --git a/qpid/cpp/docs/api/Makefile.am b/qpid/cpp/docs/api/Makefile.am
deleted file mode 100644
index bde8b5fa3d..0000000000
--- a/qpid/cpp/docs/api/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Run doxygen to generate HTML doc.
-# Generate dependency files so its rebuilt only when needed.
-#
-
-# TODO aconway 2007-04-12: html should have a
-# dependency on source/header files.
-
-EXTRA_DIST = html user.doxygen developer.doxygen html.timestamp
-
-html: html.timestamp
-
-html.timestamp:
- doxygen user.doxygen
- touch $@
-
-clean-local:
- rm -rf html html-dev html.timestamp
diff --git a/qpid/cpp/docs/api/developer.doxygen.in b/qpid/cpp/docs/api/developer.doxygen.in
deleted file mode 100644
index b267b12b90..0000000000
--- a/qpid/cpp/docs/api/developer.doxygen.in
+++ /dev/null
@@ -1,1241 +0,0 @@
- # ----------------------------------------------------------------
-# Doxygen settings for Qpid developer documentation.
-#
-# ----------------------------------------------------------------
-
-# Doxyfile 1.4.6
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = Qpid
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = .
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
-# Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
-# include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = NO
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from the
-# version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE = doxygen.log
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = @abs_top_srcdir@/src
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-
-
-FILE_PATTERNS = *.h *.cpp
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = test
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html-dev
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = NO
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = YES
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = YES
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that a graph may be further truncated if the graph's
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
-# the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, which results in a white background.
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = YES
diff --git a/qpid/cpp/docs/api/user.doxygen.in b/qpid/cpp/docs/api/user.doxygen.in
deleted file mode 100644
index cc1a2cf0ff..0000000000
--- a/qpid/cpp/docs/api/user.doxygen.in
+++ /dev/null
@@ -1,1244 +0,0 @@
-# ----------------------------------------------------------------
-# Doxygen settings for Qpid user documentation.
-#
-# Note: Only public members of classes that are part of the public API
-# should be documented here. For complete developer documentation use
-# the developer.doxygen configuration.
-# ----------------------------------------------------------------
-
-# Doxyfile 1.4.6
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = Qpid
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = .
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
-# Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
-# include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = NO
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = YES
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = YES
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = YES
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = NO
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from the
-# version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE = doxygen.log
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = @abs_top_srcdir@/src @abs_top_builddir@/src/gen
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-
-
-FILE_PATTERNS = *.h
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = test
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = YES
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = YES
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that a graph may be further truncated if the graph's
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
-# the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, which results in a white background.
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = YES
diff --git a/qpid/cpp/docs/man/Makefile.am b/qpid/cpp/docs/man/Makefile.am
deleted file mode 100644
index c8df4eab6a..0000000000
--- a/qpid/cpp/docs/man/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-dist_man_MANS = qpidd.1
-
-man_aux = $(dist_man_MANS:.1=.x)
-EXTRA_DIST = $(man_aux)
-DISTCLEANFILES = $(dist_man_MANS)
-
-dist-hook: $(man_aux)
-
-qpidd.1: $(srcdir)/qpidd.x $(top_builddir)/src/qpidd
-
-# Depend on configure.ac to get version number changes.
-$(dist_man_MANS): $(top_srcdir)/configure.ac
-
-SUFFIXES = .x .1
-.x.1:
- @rm -f $@
- @echo "Updating man page $@"
- $(HELP2MAN) --no-info --include=$(srcdir)/$*.x --output=$@-t ../../src/$*
- @chmod a-w $@-t
- @mv $@-t $@
diff --git a/qpid/cpp/docs/man/qpidd.x b/qpid/cpp/docs/man/qpidd.x
deleted file mode 100644
index 2a5b071eab..0000000000
--- a/qpid/cpp/docs/man/qpidd.x
+++ /dev/null
@@ -1,46 +0,0 @@
-[NAME]
-
-qpidd \- the Qpid AMQP Broker Daemon
-
-[SYNOPSIS]
-
-qpidd [options]
-
-[DESCRIPTION]
-
-An AMQP broker daemon that stores, routes and forwards messages using
-the Advanced Message Queueing Protocol (AMQP).
-
-[OPTIONS]
-
-Options may be specified via command line, environment variable or configuration file. See FILES and ENVIRONMENT below for details.
-
-[FILES]
-.I /etc/qpidd.conf
-.RS
-Default configuration file.
-.RE
-
-Configuration file settings are over-ridden by command line or environment variable settings. '--config <file>' or 'export QPID_CONFIG=<file>' specifies an alternate file.
-
-Each line is a name=value pair. Blank lines and lines beginning with # are ignored. For example:
-
- # My qpidd configuration file.
- port=6000
- max-connections=10
- log.output=stdout
- log.output=/tmp/qpidd.log
-
-[ENVIRONMENT]
-.I QPID_<option>
-.RS
-There is an environment variable for each option.
-.RE
-
-The environment variable is the option name in uppercase, prefixed with QPID_ and '.' or '-' are replaced with '_'. Environment settings are over-ridden by command line settings. For example:
-
- export QPID_PORT=6000
- export QPID_MAX_CONNECTIONS=10
- export QPID_LOG_OUTPUT=/tmp/qpidd.log
-
-
diff --git a/qpid/cpp/etc/qpidd b/qpid/cpp/etc/qpidd
deleted file mode 100755
index 821e50a9a2..0000000000
--- a/qpid/cpp/etc/qpidd
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/bash
-#
-# qpidd Startup script for the Qpid messaging daemon.
-#
-
-### BEGIN INIT INFO
-# Provides: qpidd
-# Required-Start: $local_fs
-# Required-Stop: $local_fs
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: start or stop qpidd
-# Description: Qpidd is an AMQP broker. It receives, stores, routes and forwards messages using the AMQP protcol.
-### END INIT INFO
-
-# chkconfig: - 85 15
-# description: Qpidd is an AMQP broker. It receives, stores, routes and forwards messages using the AMQP protcol.
-# processname: qpidd
-
-prog=qpidd
-lockfile=/var/lock/subsys/$prog
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-if [ -f /etc/sysconfig/$prog ] ; then
- . /etc/sysconfig/$prog
-fi
-
-RETVAL=0
-
-start() {
- echo -n $"Starting Qpid AMQP daemon: "
- daemon --check $prog $prog --daemon $QPIDD_OPTIONS
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && touch $lockfile
- return $RETVAL
-}
-
-stop() {
- echo -n $"Stopping Qpid AMQP daemon: "
- killproc $prog
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && rm -f $lockfile
-}
-
-reload() {
- echo 1>&2 $"$0: reload not supported"
- exit 3
-}
-
-restart() {
- stop
- start
-}
-
-# See how we were called.
-case "$1" in
- start|stop|restart|reload)
- $1
- ;;
- status)
- status $prog
- RETVAL=$?
- ;;
- force-reload)
- restart
- ;;
- try-restart)
- [ -e $lockfile ] && restart || :
- ;;
- *)
- echo 1>&2 $"Usage: $0 {start|stop|restart|condrestart|status}"
- exit 1
-esac
-
-exit $RETVAL
diff --git a/qpid/cpp/etc/qpidd.conf b/qpid/cpp/etc/qpidd.conf
deleted file mode 100644
index 8064767e78..0000000000
--- a/qpid/cpp/etc/qpidd.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-# Configuration file for qpidd.
-# Using default settings, qpidd --help to see defaults.
diff --git a/qpid/cpp/examples/Makefile.am b/qpid/cpp/examples/Makefile.am
deleted file mode 100644
index 21363ea8e4..0000000000
--- a/qpid/cpp/examples/Makefile.am
+++ /dev/null
@@ -1,76 +0,0 @@
-
-# List all example files here
-nobase_pkgdata_DATA= \
- examples/Makefile \
- examples/request-response/client.cpp \
- examples/request-response/server.cpp \
- examples/request-response/Makefile \
- examples/fanout/Makefile \
- examples/fanout/listener.cpp \
- examples/fanout/fanout_producer.cpp \
- examples/pub-sub/Makefile \
- examples/pub-sub/topic_publisher.cpp \
- examples/pub-sub/topic_listener.cpp \
- examples/direct/Makefile \
- examples/direct/direct_producer.cpp \
- examples/direct/listener.cpp \
- examples/direct/declare_queues.cpp
-
-VERIFY_FILES= verify verify_all \
- examples/request-response/verify \
- examples/request-response/verify.in \
- examples/request-response/verify_cpp_python \
- examples/request-response/verify_cpp_python.in \
- examples/request-response/verify_python_cpp \
- examples/request-response/verify_python_cpp.in \
- examples/fanout/verify \
- examples/fanout/verify.in \
- examples/fanout/verify_cpp_python \
- examples/fanout/verify_cpp_python.in \
- examples/fanout/verify_python_cpp \
- examples/fanout/verify_python_cpp.in \
- examples/pub-sub/verify \
- examples/pub-sub/verify.in \
- examples/pub-sub/verify_cpp_python \
- examples/pub-sub/verify_cpp_python.in \
- examples/pub-sub/verify_python_cpp \
- examples/pub-sub/verify_python_cpp.in \
- examples/direct/verify \
- examples/direct/verify.in \
- examples/direct/verify_cpp_python \
- examples/direct/verify_cpp_python.in \
- examples/direct/verify_python_cpp \
- examples/direct/verify_python_cpp.in
-
-EXTRA_DIST=$(nobase_pkgdata_DATA) $(VERIFY_FILES)
-
-# Note: we don't use normal automake SUBDIRS because the example
-# makefiles don't understand all the recursive automake targets.
-
-clean-local:
- cd examples; $(MAKE) clean
- rm -f examples/*/*.out examples/*/*.wait
-
-abs_top_builddir=@abs_top_builddir@
-abs_top_srcdir=@abs_top_srcdir@
-
-# Build the examples - copy sources to the build tree in VPATH build.
-all-local:
- test -d examples || cp -R $(srcdir)/examples .
- cd examples && $(MAKE) CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS) -I../../$(top_srcdir)/src -I../../$(top_srcdir)/src/gen -I../../$(top_builddir)/src/gen -L../../$(top_builddir)/src/.libs -Wl,-rpath,$(abs_top_builddir)/src/.libs" all
-
-# Verify the examples in the buid tree.
-check-local: all-local verify
- $(srcdir)/verify_all $(abs_top_srcdir)/..
-
-# TODO:
-# create a tarball for testing installed examples.
-# installcheck-local to use the tarball on installed example and clean up after.
-# Build and verify installed C++ examples, clean up to avoid rpmbuild warnings.
-# EXAMPLE_FLAGS=-I$(DESTDIR)$(includedir) -L$(DESTDIR)$(libdir) -Wl,-rpath,$(DESTDIR)$(libdir)
-# EXAMPLE_DIR=$(DESTDIR)$(pkgdatadir)/examples/cpp
-# installcheck-local:
-# cd $(EXAMPLE_DIR) && $(MAKE) CXX="$(CXX)" CXXFLAGS="$(EXAMPLE_FLAGS)" all
-# cd $(EXAMPLE_DIR) && QPIDD=$(sbindir)/qpidd $(srcdir)/verify *
-# cd $(EXAMPLE_DIR) && $(MAKE) clean
-
diff --git a/qpid/cpp/examples/examples/Makefile b/qpid/cpp/examples/examples/Makefile
deleted file mode 100644
index 8591bd3361..0000000000
--- a/qpid/cpp/examples/examples/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-SUBDIRS=direct fanout pub-sub request-response
-all:
- for d in $(SUBDIRS); do ( cd $$d; $(MAKE) $@; ) ; done
-clean:
- for d in $(SUBDIRS); do ( cd $$d; $(MAKE) $@; ) ; done
-
diff --git a/qpid/cpp/examples/examples/direct/Makefile b/qpid/cpp/examples/examples/direct/Makefile
deleted file mode 100644
index 380b5cfcb4..0000000000
--- a/qpid/cpp/examples/examples/direct/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-CXX=g++
-CXXFLAGS=
-LDFLAGS=-lqpidclient
-
-PROGRAMS=declare_queues direct_producer listener
-
-all: $(PROGRAMS)
-
-clean:
- rm -f $(PROGRAMS)
diff --git a/qpid/cpp/examples/examples/direct/declare_queues.cpp b/qpid/cpp/examples/examples/direct/declare_queues.cpp
deleted file mode 100644
index de7eff0490..0000000000
--- a/qpid/cpp/examples/examples/direct/declare_queues.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/**
- * declare_queues.cpp
- *
- * This program is one of three programs designed to be used
- * together. These programs use the "amq.direct" exchange.
- *
- * direct_config_queues.cpp (this program):
- *
- * Creates a queue on a broker, binding a routing key to route
- * messages to that queue.
- *
- * direct_producer.cpp:
- *
- * Publishes to a broker, specifying a routing key.
- *
- * listener.cpp
- *
- * Reads from a queue on the broker using a message listener.
- *
- */
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-using std::string;
-
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- Message msg;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
-
- //--------- Main body of program --------------------------------------------
-
- // Create a queue named "message_queue", and route all messages whose
- // routing key is "routing_key to this newly created queue.
-
- session.queueDeclare(arg::queue="message_queue");
- session.queueBind(arg::exchange="amq.direct", arg::queue="message_queue", arg::routingKey="routing_key");
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-
-}
-
-
-
diff --git a/qpid/cpp/examples/examples/direct/direct_producer.cpp b/qpid/cpp/examples/examples/direct/direct_producer.cpp
deleted file mode 100644
index 9b40f733c2..0000000000
--- a/qpid/cpp/examples/examples/direct/direct_producer.cpp
+++ /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.
- *
- */
-
-
-/**
- * direct_producer.cpp:
- *
- * This program is one of three programs designed to be used
- * together. These programs do not specify the exchange type - the
- * default exchange type is the direct exchange.
- *
- * create_queues.cpp:
- *
- * Creates a queue on a broker, binding a routing key to route
- * messages to that queue.
- *
- * direct_producer.cpp (this program):
- *
- * Publishes to a broker, specifying a routing key.
- *
- * listener.cpp
- *
- * Reads from a queue on the broker using a message listener.
- *
- */
-
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/Message.h>
-
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-#include <sstream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-using std::stringstream;
-using std::string;
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- Message message;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
- //--------- Main body of program --------------------------------------------
-
- // The routing key is a message property. We will use the same
- // routing key for each message, so we'll set this property
- // just once. (In most simple cases, there is no need to set
- // other message properties.)
-
- message.getDeliveryProperties().setRoutingKey("routing_key");
-
- // Now send some messages ...
-
- for (int i=0; i<10; i++) {
- stringstream message_data;
- message_data << "Message " << i;
-
- message.setData(message_data.str());
- session.messageTransfer(arg::content=message, arg::destination="amq.direct");
- }
-
- // And send a final message to indicate termination.
-
- message.setData("That's all, folks!");
- session.messageTransfer(arg::content=message, arg::destination="amq.direct");
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/examples/examples/direct/listener.cpp b/qpid/cpp/examples/examples/direct/listener.cpp
deleted file mode 100644
index ae6a7699f1..0000000000
--- a/qpid/cpp/examples/examples/direct/listener.cpp
+++ /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.
- *
- */
-
-/**
- * listener.cpp: This program reads messages fro a queue on
- * the broker using a message listener.
- */
-
-#include <qpid/client/Dispatcher.h>
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/Message.h>
-#include <qpid/client/SubscriptionManager.h>
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-
-class Listener : public MessageListener{
- private:
- SubscriptionManager& subscriptions;
- public:
- Listener(SubscriptionManager& subscriptions);
- virtual void received(Message& message);
-};
-
-Listener::Listener(SubscriptionManager& subs) : subscriptions(subs)
-{}
-
-void Listener::received(Message& message) {
- std::cout << "Message: " << message.getData() << std::endl;
- if (message.getData() == "That's all, folks!") {
- std::cout << "Shutting down listener for " << message.getDestination()
- << std::endl;
- subscriptions.cancel(message.getDestination());
- }
-}
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- Message msg;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
- //--------- Main body of program --------------------------------------------
-
- SubscriptionManager subscriptions(session);
- // Create a listener and subscribe it to the queue named "message_queue"
- Listener listener(subscriptions);
- subscriptions.subscribe(listener, "message_queue");
- // Deliver messages until the subscription is cancelled
- // by Listener::received()
- subscriptions.run();
-
- //---------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/examples/examples/direct/verify b/qpid/cpp/examples/examples/direct/verify
deleted file mode 100644
index ac0464ef80..0000000000
--- a/qpid/cpp/examples/examples/direct/verify
+++ /dev/null
@@ -1,3 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-clients ./declare_queues ./direct_producer ./listener
-outputs ./declare_queues.out ./direct_producer.out ./listener.out
diff --git a/qpid/cpp/examples/examples/direct/verify.in b/qpid/cpp/examples/examples/direct/verify.in
deleted file mode 100644
index d1e95f1151..0000000000
--- a/qpid/cpp/examples/examples/direct/verify.in
+++ /dev/null
@@ -1,15 +0,0 @@
-==== declare_queues.out
-==== direct_producer.out
-==== listener.out
-Message: Message 0
-Message: Message 1
-Message: Message 2
-Message: Message 3
-Message: Message 4
-Message: Message 5
-Message: Message 6
-Message: Message 7
-Message: Message 8
-Message: Message 9
-Message: That's all, folks!
-Shutting down listener for message_queue
diff --git a/qpid/cpp/examples/examples/direct/verify_cpp_python b/qpid/cpp/examples/examples/direct/verify_cpp_python
deleted file mode 100644
index 4dc445ba27..0000000000
--- a/qpid/cpp/examples/examples/direct/verify_cpp_python
+++ /dev/null
@@ -1,4 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=$PYTHON_EXAMPLES/direct
-clients ./declare_queues ./direct_producer $py/direct_consumer.py
-outputs ./declare_queues.out ./direct_producer.out $py/direct_consumer.py.out
diff --git a/qpid/cpp/examples/examples/direct/verify_cpp_python.in b/qpid/cpp/examples/examples/direct/verify_cpp_python.in
deleted file mode 100644
index 1a329be59a..0000000000
--- a/qpid/cpp/examples/examples/direct/verify_cpp_python.in
+++ /dev/null
@@ -1,14 +0,0 @@
-==== declare_queues.out
-==== direct_producer.out
-==== direct_consumer.py.out
-Message 0
-Message 1
-Message 2
-Message 3
-Message 4
-Message 5
-Message 6
-Message 7
-Message 8
-Message 9
-That's all, folks!
diff --git a/qpid/cpp/examples/examples/direct/verify_python_cpp b/qpid/cpp/examples/examples/direct/verify_python_cpp
deleted file mode 100644
index fe4893e120..0000000000
--- a/qpid/cpp/examples/examples/direct/verify_python_cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=$PYTHON_EXAMPLES/direct
-clients $py/declare_queues.py $py/direct_producer.py ./listener
-outputs $py/declare_queues.py.out $py/direct_producer.py.out ./listener.out
-
diff --git a/qpid/cpp/examples/examples/direct/verify_python_cpp.in b/qpid/cpp/examples/examples/direct/verify_python_cpp.in
deleted file mode 100644
index 6f35255b18..0000000000
--- a/qpid/cpp/examples/examples/direct/verify_python_cpp.in
+++ /dev/null
@@ -1,15 +0,0 @@
-==== declare_queues.py.out
-==== direct_producer.py.out
-==== listener.out
-Message: message 0
-Message: message 1
-Message: message 2
-Message: message 3
-Message: message 4
-Message: message 5
-Message: message 6
-Message: message 7
-Message: message 8
-Message: message 9
-Message: That's all, folks!
-Shutting down listener for message_queue
diff --git a/qpid/cpp/examples/examples/fanout/Makefile b/qpid/cpp/examples/examples/fanout/Makefile
deleted file mode 100644
index 7963af7ddf..0000000000
--- a/qpid/cpp/examples/examples/fanout/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-CXX=g++
-CXXFLAGS=
-LDFLAGS=-lqpidclient
-
-PROGRAMS=fanout_producer listener
-
-all: $(PROGRAMS)
-
-clean:
- rm -f $(PROGRAMS)
diff --git a/qpid/cpp/examples/examples/fanout/fanout_producer.cpp b/qpid/cpp/examples/examples/fanout/fanout_producer.cpp
deleted file mode 100644
index 8ae6bbc242..0000000000
--- a/qpid/cpp/examples/examples/fanout/fanout_producer.cpp
+++ /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.
- *
- */
-
-
-/**
- * fanout_producer.cpp:
- *
- * This program is one of three programs designed to be used
- * together. These programs do not specify the exchange type - the
- * default exchange type is the direct exchange.
- *
- * declare_queues.cpp:
- *
- * Creates a queue on a broker, binding a routing key to route
- * messages to that queue.
- *
- * fanout_producer.cpp (this program):
- *
- * Publishes to a broker, specifying a routing key.
- *
- * listener.cpp
- *
- * Reads from a queue on the broker using a message listener.
- *
- */
-
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/Message.h>
-
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-#include <sstream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-using std::stringstream;
-using std::string;
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- Message message;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
- //--------- Main body of program --------------------------------------------
-
- // Unlike topic exchanges and direct exchanges, a fanout
- // exchange need not set a routing key.
-
- Message message;
-
- // Now send some messages ...
-
- for (int i=0; i<10; i++) {
- stringstream message_data;
- message_data << "Message " << i;
-
- message.setData(message_data.str());
- session.messageTransfer(arg::content=message, arg::destination="amq.fanout");
- }
-
- // And send a final message to indicate termination.
-
- message.setData("That's all, folks!");
- session.messageTransfer(arg::content=message, arg::destination="amq.fanout");
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/examples/examples/fanout/listener.cpp b/qpid/cpp/examples/examples/fanout/listener.cpp
deleted file mode 100644
index 2860528b1f..0000000000
--- a/qpid/cpp/examples/examples/fanout/listener.cpp
+++ /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.
- *
- */
-
-/**
- * listener.cpp: This program reads messages fro a queue on
- * the broker using a message listener.
- */
-
-#include <qpid/client/Dispatcher.h>
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/Message.h>
-#include <qpid/client/SubscriptionManager.h>
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-
-class Listener : public MessageListener{
- private:
- SubscriptionManager& subscriptions;
- public:
- Listener(SubscriptionManager& subscriptions);
- virtual void received(Message& message);
-};
-
-Listener::Listener(SubscriptionManager& subs) : subscriptions(subs)
-{}
-
-void Listener::received(Message& message) {
- std::cout << "Message: " << message.getData() << std::endl;
- if (message.getData() == "That's all, folks!") {
- std::cout << "Shutting down listener for " << message.getDestination()
- << std::endl;
- subscriptions.cancel(message.getDestination());
- }
-}
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- Message msg;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
- //--------- Main body of program --------------------------------------------
-
- // Unique name for private queue:
- std::string myQueue=session.getId().str();
- // Declear my queue.
- session.queueDeclare(arg::queue=myQueue, arg::exclusive=true,
- arg::autoDelete=true);
- // Bind my queue to the fanout exchange.
- // Note no routingKey required, the fanout exchange delivers
- // all messages to all bound queues unconditionally.
- session.queueBind(arg::exchange="amq.fanout", arg::queue=myQueue);
-
- // Create a listener and subscribe it to my queue.
- SubscriptionManager subscriptions(session);
- Listener listener(subscriptions);
- subscriptions.subscribe(listener, myQueue);
-
- // Wait for the broker to indicate that our queues have been created.
- session.sync();
-
- // Deliver messages until the subscription is cancelled
- // by Listener::received()
- std::cout << "Listening" << std::endl;
- subscriptions.run();
-
- //---------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/examples/examples/fanout/verify b/qpid/cpp/examples/examples/fanout/verify
deleted file mode 100644
index ace4a6dfee..0000000000
--- a/qpid/cpp/examples/examples/fanout/verify
+++ /dev/null
@@ -1,6 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-background "Listening" ./listener
-background "Listening" ./listener
-background "Listening" ./listener
-clients ./fanout_producer
-outputs ./fanout_producer.out "./listener.out | remove_uuid" "./listenerX.out | remove_uuid" "./listenerXX.out | remove_uuid"
diff --git a/qpid/cpp/examples/examples/fanout/verify.in b/qpid/cpp/examples/examples/fanout/verify.in
deleted file mode 100644
index 8f8612ce67..0000000000
--- a/qpid/cpp/examples/examples/fanout/verify.in
+++ /dev/null
@@ -1,43 +0,0 @@
-==== fanout_producer.out
-==== listener.out | remove_uuid
-Listening
-Message: Message 0
-Message: Message 1
-Message: Message 2
-Message: Message 3
-Message: Message 4
-Message: Message 5
-Message: Message 6
-Message: Message 7
-Message: Message 8
-Message: Message 9
-Message: That's all, folks!
-Shutting down listener for
-==== listenerX.out | remove_uuid
-Listening
-Message: Message 0
-Message: Message 1
-Message: Message 2
-Message: Message 3
-Message: Message 4
-Message: Message 5
-Message: Message 6
-Message: Message 7
-Message: Message 8
-Message: Message 9
-Message: That's all, folks!
-Shutting down listener for
-==== listenerXX.out | remove_uuid
-Listening
-Message: Message 0
-Message: Message 1
-Message: Message 2
-Message: Message 3
-Message: Message 4
-Message: Message 5
-Message: Message 6
-Message: Message 7
-Message: Message 8
-Message: Message 9
-Message: That's all, folks!
-Shutting down listener for
diff --git a/qpid/cpp/examples/examples/fanout/verify_cpp_python b/qpid/cpp/examples/examples/fanout/verify_cpp_python
deleted file mode 100644
index e840e68f91..0000000000
--- a/qpid/cpp/examples/examples/fanout/verify_cpp_python
+++ /dev/null
@@ -1,7 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=$PYTHON_EXAMPLES/fanout
-background "Subscribed" $py/fanout_consumer.py
-background "Subscribed" $py/fanout_consumer.py
-clients ./fanout_producer
-outputs ./fanout_producer.out "$py/fanout_consumer.py.out | remove_uuid64" "$py/fanout_consumer.pyX.out | remove_uuid64"
-
diff --git a/qpid/cpp/examples/examples/fanout/verify_cpp_python.in b/qpid/cpp/examples/examples/fanout/verify_cpp_python.in
deleted file mode 100644
index fac2b365d3..0000000000
--- a/qpid/cpp/examples/examples/fanout/verify_cpp_python.in
+++ /dev/null
@@ -1,31 +0,0 @@
-==== fanout_producer.out
-==== fanout_consumer.py.out | remove_uuid64
-Messages queue:
-Subscribed to queue
-Response: Message 0
-Response: Message 1
-Response: Message 2
-Response: Message 3
-Response: Message 4
-Response: Message 5
-Response: Message 6
-Response: Message 7
-Response: Message 8
-Response: Message 9
-Response: That's all, folks!
-No more messages!
-==== fanout_consumer.pyX.out | remove_uuid64
-Messages queue:
-Subscribed to queue
-Response: Message 0
-Response: Message 1
-Response: Message 2
-Response: Message 3
-Response: Message 4
-Response: Message 5
-Response: Message 6
-Response: Message 7
-Response: Message 8
-Response: Message 9
-Response: That's all, folks!
-No more messages!
diff --git a/qpid/cpp/examples/examples/fanout/verify_python_cpp b/qpid/cpp/examples/examples/fanout/verify_python_cpp
deleted file mode 100644
index d9b3361523..0000000000
--- a/qpid/cpp/examples/examples/fanout/verify_python_cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=$PYTHON_EXAMPLES/fanout
-background "Listening" ./listener
-background "Listening" ./listener
-clients $py/fanout_producer.py
-outputs $py/fanout_producer.py.out "./listener.out | remove_uuid" "./listenerX.out | remove_uuid"
-
diff --git a/qpid/cpp/examples/examples/fanout/verify_python_cpp.in b/qpid/cpp/examples/examples/fanout/verify_python_cpp.in
deleted file mode 100644
index 8f9e959053..0000000000
--- a/qpid/cpp/examples/examples/fanout/verify_python_cpp.in
+++ /dev/null
@@ -1,29 +0,0 @@
-==== fanout_producer.py.out
-==== listener.out | remove_uuid
-Listening
-Message: message 0
-Message: message 1
-Message: message 2
-Message: message 3
-Message: message 4
-Message: message 5
-Message: message 6
-Message: message 7
-Message: message 8
-Message: message 9
-Message: That's all, folks!
-Shutting down listener for
-==== listenerX.out | remove_uuid
-Listening
-Message: message 0
-Message: message 1
-Message: message 2
-Message: message 3
-Message: message 4
-Message: message 5
-Message: message 6
-Message: message 7
-Message: message 8
-Message: message 9
-Message: That's all, folks!
-Shutting down listener for
diff --git a/qpid/cpp/examples/examples/pub-sub/Makefile b/qpid/cpp/examples/examples/pub-sub/Makefile
deleted file mode 100644
index 4b2dd52efd..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-CXX=g++
-CXXFLAGS=
-LDFLAGS=-lqpidclient
-
-PROGRAMS=topic_listener topic_publisher
-
-all: $(PROGRAMS)
-
-clean:
- rm -f $(PROGRAMS)
diff --git a/qpid/cpp/examples/examples/pub-sub/topic_listener.cpp b/qpid/cpp/examples/examples/pub-sub/topic_listener.cpp
deleted file mode 100644
index e5292db703..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/topic_listener.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/**
- * topic_listener.cpp:
- *
- * This program is one of three programs designed to be used
- * together. These programs use the topic exchange.
- *
- * topic_config_queues.cpp:
- *
- * Creates a queue on a broker, binding a routing key to route
- * messages to that queue.
- *
- * topic_publisher.cpp:
- *
- * Publishes to a broker, specifying a routing key.
- *
- * topic_listener.cpp (this program):
- *
- * Reads from a queue on the broker using a message listener.
- *
- */
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/Message.h>
-#include <qpid/client/MessageListener.h>
-#include <qpid/client/Queue.h>
-#include <qpid/client/SubscriptionManager.h>
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-#include <set>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-
-class Listener : public MessageListener {
- private:
- Session& session;
- SubscriptionManager subscriptions;
- public:
- Listener(Session& session);
- virtual void prepareQueue(std::string queue, std::string routing_key);
- virtual void received(Message& message);
- virtual void listen();
- ~Listener() { };
-};
-
-
-/*
- * Listener::Listener
- *
- * Subscribe to the queue, route it to a client destination for the
- * listener. (The destination name merely identifies the destination
- * in the listener, you can use any name as long as you use the same
- * name for the listener).
- */
-
-Listener::Listener(Session& session) :
- session(session),
- subscriptions(session)
-{
-}
-
-
-void Listener::prepareQueue(std::string queue, std::string routing_key) {
-
- /* Create a unique queue name for this consumer by concatenating
- * the queue name parameter with the Session ID.
- */
-
- queue += session.getId().str();
- std::cout << "Declaring queue: " << queue << std::endl;
-
- /* Declare an exclusive queue on the broker
- */
-
- session.queueDeclare(arg::queue=queue, arg::exclusive=true);
-
- /* Route messages to the new queue if they match the routing key.
- *
- * Also route any messages to with the "control" routing key to
- * this queue so we know when it's time to stop. A publisher sends
- * a message with the content "That's all, Folks!", using the
- * "control" routing key, when it is finished.
- */
-
- session.queueBind(arg::exchange="amq.topic", arg::queue=queue, arg::routingKey=routing_key);
- session.queueBind(arg::exchange="amq.topic", arg::queue=queue, arg::routingKey="control");
-
- /*
- * subscribe to the queue using the subscription manager.
- */
-
- std::cout << "Subscribing to queue " << queue << std::endl;
- subscriptions.subscribe(*this, queue);
-}
-
-void Listener::received(Message& message) {
- std::cout << "Message: " << message.getData() << " from " << message.getDestination() << std::endl;
-
- if (message.getData() == "That's all, folks!") {
- std::cout << "Shutting down listener for " << message.getDestination() << std::endl;
- subscriptions.cancel(message.getDestination());
- }
-}
-
-void Listener::listen() {
- // Receive messages
- subscriptions.run();
-}
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
- //--------- Main body of program --------------------------------------------
-
- // Create a listener for the session
-
- Listener listener(session);
-
- // Subscribe to messages on the queues we are interested in
-
- listener.prepareQueue("usa", "usa.#");
- listener.prepareQueue("europe", "europe.#");
- listener.prepareQueue("news", "#.news");
- listener.prepareQueue("weather", "#.weather");
-
- // Wait for the broker to indicate that our queues have been created.
- session.sync();
-
- std::cout << "Listening for messages ..." << std::endl;
-
- // Give up control and receive messages
- listener.listen();
-
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/examples/examples/pub-sub/topic_publisher.cpp b/qpid/cpp/examples/examples/pub-sub/topic_publisher.cpp
deleted file mode 100644
index 94cd3a0f56..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/topic_publisher.cpp
+++ /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.
- *
- */
-
-
-/**
- * topic_publisher.cpp:
- *
- * This program is one of three programs designed to be used
- * together. These programs use the topic exchange.
- *
- * topic_config_queues.cpp:
- *
- * Creates a queue on a broker, binding a routing key to route
- * messages to that queue.
- *
- * topic_publisher.cpp (this program):
- *
- * Publishes to a broker, specifying a routing key.
- *
- * topic_listener.cpp
- *
- * Reads from a queue on the broker using a message listener.
- *
- */
-
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/Message.h>
-
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-#include <sstream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-using std::stringstream;
-using std::string;
-
-void publish_messages(Session& session, string routing_key)
-{
- Message message;
-
- // Set the routing key once, we'll use the same routing key for all
- // messages.
-
- message.getDeliveryProperties().setRoutingKey(routing_key);
- for (int i=0; i<5; i++) {
- stringstream message_data;
- message_data << "Message " << i;
-
- message.setData(message_data.str());
- session.messageTransfer(arg::content=message, arg::destination="amq.topic");
- }
-
-}
-
-/*
- * no_more_messages()
- *
- * Send a message to indicate that no more messages are coming.
- * Use the 'control' routing key (see comments in topic_config_queues.cpp).
- *
- */
-
-void no_more_messages(Session& session)
-{
- Message message;
-
- message.getDeliveryProperties().setRoutingKey("control");
- message.setData("That's all, folks!");
- session.messageTransfer(arg::content=message, arg::destination="amq.topic");
-}
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- Message message;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
- //--------- Main body of program --------------------------------------------
-
- publish_messages(session, "usa.news");
- publish_messages(session, "usa.weather");
- publish_messages(session, "europe.news");
- publish_messages(session, "europe.weather");
-
- no_more_messages(session);
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/examples/examples/pub-sub/verify b/qpid/cpp/examples/examples/pub-sub/verify
deleted file mode 100644
index 3589a4c9da..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/verify
+++ /dev/null
@@ -1,4 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-background "Listening" ./topic_listener
-clients ./topic_publisher
-outputs ./topic_publisher.out "topic_listener.out | remove_uuid | sort"
diff --git a/qpid/cpp/examples/examples/pub-sub/verify.in b/qpid/cpp/examples/examples/pub-sub/verify.in
deleted file mode 100644
index 6413c5c788..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/verify.in
+++ /dev/null
@@ -1,59 +0,0 @@
-==== topic_publisher.out
-==== topic_listener.out | remove_uuid | sort
-Declaring queue: europe
-Declaring queue: news
-Declaring queue: usa
-Declaring queue: weather
-Listening for messages ...
-Message: Message 0 from europe
-Message: Message 0 from europe
-Message: Message 0 from news
-Message: Message 0 from news
-Message: Message 0 from usa
-Message: Message 0 from usa
-Message: Message 0 from weather
-Message: Message 0 from weather
-Message: Message 1 from europe
-Message: Message 1 from europe
-Message: Message 1 from news
-Message: Message 1 from news
-Message: Message 1 from usa
-Message: Message 1 from usa
-Message: Message 1 from weather
-Message: Message 1 from weather
-Message: Message 2 from europe
-Message: Message 2 from europe
-Message: Message 2 from news
-Message: Message 2 from news
-Message: Message 2 from usa
-Message: Message 2 from usa
-Message: Message 2 from weather
-Message: Message 2 from weather
-Message: Message 3 from europe
-Message: Message 3 from europe
-Message: Message 3 from news
-Message: Message 3 from news
-Message: Message 3 from usa
-Message: Message 3 from usa
-Message: Message 3 from weather
-Message: Message 3 from weather
-Message: Message 4 from europe
-Message: Message 4 from europe
-Message: Message 4 from news
-Message: Message 4 from news
-Message: Message 4 from usa
-Message: Message 4 from usa
-Message: Message 4 from weather
-Message: Message 4 from weather
-Message: That's all, folks! from europe
-Message: That's all, folks! from news
-Message: That's all, folks! from usa
-Message: That's all, folks! from weather
-Shutting down listener for europe
-Shutting down listener for news
-Shutting down listener for usa
-Shutting down listener for weather
-Subscribing to queue europe
-Subscribing to queue news
-Subscribing to queue usa
-Subscribing to queue weather
diff --git a/qpid/cpp/examples/examples/pub-sub/verify_cpp_python b/qpid/cpp/examples/examples/pub-sub/verify_cpp_python
deleted file mode 100644
index ecc573eed3..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/verify_cpp_python
+++ /dev/null
@@ -1,6 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=$PYTHON_EXAMPLES/pubsub
-background "Queues created" $py/topic_subscriber.py
-clients ./topic_publisher
-outputs ./topic_publisher.out "$py/topic_subscriber.py.out | remove_uuid64 | sort"
-
diff --git a/qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in b/qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in
deleted file mode 100644
index b3c9e750f5..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in
+++ /dev/null
@@ -1,51 +0,0 @@
-==== topic_publisher.out
-==== topic_subscriber.py.out | remove_uuid64 | sort
-Message 0
-Message 0
-Message 0
-Message 0
-Message 0
-Message 0
-Message 0
-Message 0
-Message 1
-Message 1
-Message 1
-Message 1
-Message 1
-Message 1
-Message 1
-Message 1
-Message 2
-Message 2
-Message 2
-Message 2
-Message 2
-Message 2
-Message 2
-Message 2
-Message 3
-Message 3
-Message 3
-Message 3
-Message 3
-Message 3
-Message 3
-Message 3
-Message 4
-Message 4
-Message 4
-Message 4
-Message 4
-Message 4
-Message 4
-Message 4
-Messages queue: europe
-Messages queue: news
-Messages queue: usa
-Messages queue: weather
-Queues created - please start the topic producer
-That's all, folks!
-That's all, folks!
-That's all, folks!
-That's all, folks!
diff --git a/qpid/cpp/examples/examples/pub-sub/verify_python_cpp b/qpid/cpp/examples/examples/pub-sub/verify_python_cpp
deleted file mode 100644
index 2ddaad58c2..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/verify_python_cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=$PYTHON_EXAMPLES/pubsub
-background "Listening" ./topic_listener
-clients $py/topic_publisher.py
-outputs $py/topic_publisher.py.out "topic_listener.out | remove_uuid | sort"
-
diff --git a/qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in b/qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in
deleted file mode 100644
index 97fccf0a32..0000000000
--- a/qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in
+++ /dev/null
@@ -1,59 +0,0 @@
-==== topic_publisher.py.out
-==== topic_listener.out | remove_uuid | sort
-Declaring queue: europe
-Declaring queue: news
-Declaring queue: usa
-Declaring queue: weather
-Listening for messages ...
-Message: message 0 from europe
-Message: message 0 from europe
-Message: message 0 from news
-Message: message 0 from news
-Message: message 0 from usa
-Message: message 0 from usa
-Message: message 0 from weather
-Message: message 0 from weather
-Message: message 1 from europe
-Message: message 1 from europe
-Message: message 1 from news
-Message: message 1 from news
-Message: message 1 from usa
-Message: message 1 from usa
-Message: message 1 from weather
-Message: message 1 from weather
-Message: message 2 from europe
-Message: message 2 from europe
-Message: message 2 from news
-Message: message 2 from news
-Message: message 2 from usa
-Message: message 2 from usa
-Message: message 2 from weather
-Message: message 2 from weather
-Message: message 3 from europe
-Message: message 3 from europe
-Message: message 3 from news
-Message: message 3 from news
-Message: message 3 from usa
-Message: message 3 from usa
-Message: message 3 from weather
-Message: message 3 from weather
-Message: message 4 from europe
-Message: message 4 from europe
-Message: message 4 from news
-Message: message 4 from news
-Message: message 4 from usa
-Message: message 4 from usa
-Message: message 4 from weather
-Message: message 4 from weather
-Message: That's all, folks! from europe
-Message: That's all, folks! from news
-Message: That's all, folks! from usa
-Message: That's all, folks! from weather
-Shutting down listener for europe
-Shutting down listener for news
-Shutting down listener for usa
-Shutting down listener for weather
-Subscribing to queue europe
-Subscribing to queue news
-Subscribing to queue usa
-Subscribing to queue weather
diff --git a/qpid/cpp/examples/examples/request-response/Makefile b/qpid/cpp/examples/examples/request-response/Makefile
deleted file mode 100644
index e7ef2590d3..0000000000
--- a/qpid/cpp/examples/examples/request-response/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-CXX=g++
-CXXFLAGS=
-LDFLAGS=-lqpidclient
-
-PROGRAMS=client server
-
-all: $(PROGRAMS)
-
-clean:
- rm -f $(PROGRAMS)
diff --git a/qpid/cpp/examples/examples/request-response/client.cpp b/qpid/cpp/examples/examples/request-response/client.cpp
deleted file mode 100644
index 9f82bd9d9e..0000000000
--- a/qpid/cpp/examples/examples/request-response/client.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-/**
- * client.cpp
- *
- * This program is one of two programs that illustrate the
- * request/response pattern.
- *
- * client.cpp (this program)
- *
- * Make requests of a service, print the response.
- *
- * service.cpp
- *
- * Accept requests, reverse the letters in each message, and
- * return it as a response.
- *
- */
-
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Dispatcher.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/Message.h>
-#include <qpid/client/MessageListener.h>
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-#include <sstream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-class Listener : public MessageListener{
-private:
- Session session;
- std::string destination_name;
- Dispatcher dispatcher;
- int counter;
-public:
- Listener(Session& session, string destination_name):
- destination_name(destination_name),
- dispatcher(session),
- session(session),
- counter(0)
- {};
-
- virtual void listen();
- virtual void wait();
- virtual void received(Message& message);
- ~Listener() { };
-};
-
-
-void Listener::listen() {
- std::cout << "Activating response queue listener for: " <<destination_name << std::endl;
-
- session.messageSubscribe(arg::queue=destination_name, arg::destination=destination_name);
-
- session.messageFlow(arg::destination=destination_name, arg::unit=0, arg::value=1);//messages ### Define a constant?
- session.messageFlow(arg::destination=destination_name, arg::unit=1, arg::value=0xFFFFFFFF);//bytes ###### Define a constant?
-
-
- dispatcher.listen(destination_name, this);
-}
-
-
-void Listener::wait() {
- std::cout << "Waiting for all responses to arrive ..." << std::endl;
- dispatcher.run();
-}
-
-
-void Listener::received(Message& message) {
- std::cout << "Response: " << message.getData() << std::endl;
-
- ++ counter;
- if (counter > 3) {
- std::cout << "Shutting down listener for " << destination_name << std::endl;
- dispatcher.stop();
- }
-}
-
-
-using std::stringstream;
-using std::string;
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- Message request;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
- //--------- Main body of program --------------------------------------------
-
- // Create a response queue so the server can send us responses
- // to our requests. Use the client's session ID as the name
- // of the response queue.
-
- stringstream response_queue;
- response_queue << "client" << session.getId();
-
- // Use the name of the response queue as the routing key
-
- session.queueDeclare(arg::queue=response_queue.str());
- session.queueBind(arg::exchange="amq.direct", arg::queue=response_queue.str(), arg::routingKey=response_queue.str());
-
- // Create a listener for the response queue and start listening.
-
- Listener listener(session, response_queue.str());
- listener.listen();
-
-
- // The routing key for the request queue is simply
- // "request", and all clients use the same routing key.
- //
- // Each client sends the name of their own response queue so
- // the service knows where to route messages.
-
- request.getDeliveryProperties().setRoutingKey("request");
- request.getMessageProperties().setReplyTo(ReplyTo("amq.direct", response_queue.str()));
-
- // Now send some requests ...
-
- string s[] = {
- "Twas brillig, and the slithy toves",
- "Did gire and gymble in the wabe.",
- "All mimsy were the borogroves,",
- "And the mome raths outgrabe."
- };
-
-
- for (int i=0; i<4; i++) {
- request.setData(s[i]);
- session.messageTransfer(arg::content=request, arg::destination="amq.direct");
- std::cout << "Request: " << s[i] << std::endl;
- }
-
- // And wait for any outstanding responses to arrive
-
- listener.wait();
-
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/examples/examples/request-response/server.cpp b/qpid/cpp/examples/examples/request-response/server.cpp
deleted file mode 100644
index 0de2ce5234..0000000000
--- a/qpid/cpp/examples/examples/request-response/server.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-/**
- * server.cpp
- *
- * This program is one of two programs that illustrate the
- * request/response pattern.
- *
- * client.cpp
- *
- * Make requests of a service, print the response.
- *
- * server.cpp (this program)
- *
- * Accept requests, reverse the letters in each message, and
- * return it as a response.
- *
- */
-
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Dispatcher.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/Message.h>
-#include <qpid/client/MessageListener.h>
-
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-#include <algorithm>
-
-#include <sstream>
-#include <string>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-using std::stringstream;
-using std::string;
-
-class Listener : public MessageListener{
-private:
- std::string destination_name;
- Dispatcher dispatcher;
- Session session;
-public:
- Listener(Session& session, string destination_name):
- destination_name(destination_name),
- dispatcher(session),
- session(session)
- {};
-
- virtual void listen();
- virtual void received(Message& message);
- virtual void wait();
- ~Listener() { };
-};
-
-
-void Listener::listen() {
- std::cout << "Activating request queue listener for: " <<destination_name << std::endl;
-
- session.messageSubscribe(arg::queue=destination_name, arg::destination=destination_name);
-
- // ##### Should not be needed. Sigh.
- session.messageFlow(arg::destination=destination_name, arg::unit=0, arg::value=1);//messages ### Define a constant?
- session.messageFlow(arg::destination=destination_name, arg::unit=1, arg::value=0xFFFFFFFF);//bytes ###### Define a constant?
-
- dispatcher.listen(destination_name, this);
-}
-
-
-void Listener::wait() {
- std::cout << "Waiting for requests" << std::endl;
- dispatcher.run();
-}
-
-
-void Listener::received(Message& request) {
-
- Message response;
-
- // Get routing key for response from the request's replyTo property
-
- string routingKey;
-
- if (request.getMessageProperties().hasReplyTo()) {
- routingKey = request.getMessageProperties().getReplyTo().getRoutingKey();
- } else {
- std::cout << "Error: " << "No routing key for request (" << request.getData() << ")" << std::endl;
- return;
- }
-
- std::cout << "Request: " << request.getData() << " (" <<routingKey << ")" << std::endl;
-
- // Transform message content to upper case
- std::string s = request.getData();
- std::transform (s.begin(), s.end(), s.begin(), toupper);
- response.setData(s);
-
- // Send it back to the user
- response.getDeliveryProperties().setRoutingKey(routingKey);
- session.messageTransfer(arg::content=response, arg::destination="amq.direct");
-}
-
-
-int main(int argc, char** argv) {
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
- Connection connection;
- Message message;
- try {
- connection.open(host, port);
- Session session = connection.newSession(ASYNC);
-
- //--------- Main body of program --------------------------------------------
-
- // Create a request queue for clients to use when making
- // requests.
-
- string request_queue = "request";
-
- // Use the name of the request queue as the routing key
-
- session.queueDeclare(arg::queue=request_queue);
- session.queueBind(arg::exchange="amq.direct", arg::queue=request_queue, arg::routingKey=request_queue);
-
- // Create a listener for the request queue and start listening.
-
- Listener listener(session, request_queue);
- listener.listen();
- listener.wait();
-
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/examples/examples/request-response/verify b/qpid/cpp/examples/examples/request-response/verify
deleted file mode 100644
index 76007ff8d2..0000000000
--- a/qpid/cpp/examples/examples/request-response/verify
+++ /dev/null
@@ -1,5 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-background "Waiting" ./server
-clients ./client
-kill %% # Must kill the server.
-outputs "./client.out | remove_uuid" "server.out | remove_uuid"
diff --git a/qpid/cpp/examples/examples/request-response/verify.in b/qpid/cpp/examples/examples/request-response/verify.in
deleted file mode 100644
index 7925dc5671..0000000000
--- a/qpid/cpp/examples/examples/request-response/verify.in
+++ /dev/null
@@ -1,19 +0,0 @@
-==== client.out | remove_uuid
-Activating response queue listener for: client
-Request: Twas brillig, and the slithy toves
-Request: Did gire and gymble in the wabe.
-Request: All mimsy were the borogroves,
-Request: And the mome raths outgrabe.
-Waiting for all responses to arrive ...
-Response: TWAS BRILLIG, AND THE SLITHY TOVES
-Response: DID GIRE AND GYMBLE IN THE WABE.
-Response: ALL MIMSY WERE THE BOROGROVES,
-Response: AND THE MOME RATHS OUTGRABE.
-Shutting down listener for client
-==== server.out | remove_uuid
-Activating request queue listener for: request
-Waiting for requests
-Request: Twas brillig, and the slithy toves (client)
-Request: Did gire and gymble in the wabe. (client)
-Request: All mimsy were the borogroves, (client)
-Request: And the mome raths outgrabe. (client)
diff --git a/qpid/cpp/examples/examples/request-response/verify_cpp_python b/qpid/cpp/examples/examples/request-response/verify_cpp_python
deleted file mode 100644
index 9d71d51c37..0000000000
--- a/qpid/cpp/examples/examples/request-response/verify_cpp_python
+++ /dev/null
@@ -1,5 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-background "Request server running" $PYTHON_EXAMPLES/request-response/server.py
-clients ./client
-kill %% # Must kill the server.
-outputs "./client.out | remove_uuid" "$PYTHON_EXAMPLES/request-response/server.py.out | remove_uuid64"
diff --git a/qpid/cpp/examples/examples/request-response/verify_cpp_python.in b/qpid/cpp/examples/examples/request-response/verify_cpp_python.in
deleted file mode 100644
index 280484bd2a..0000000000
--- a/qpid/cpp/examples/examples/request-response/verify_cpp_python.in
+++ /dev/null
@@ -1,15 +0,0 @@
-==== client.out | remove_uuid
-Activating response queue listener for: client
-Request: Twas brillig, and the slithy toves
-Request: Did gire and gymble in the wabe.
-Request: All mimsy were the borogroves,
-Request: And the mome raths outgrabe.
-Waiting for all responses to arrive ...
-Response: TWAS BRILLIG, AND THE SLITHY TOVES
-Response: DID GIRE AND GYMBLE IN THE WABE.
-Response: ALL MIMSY WERE THE BOROGROVES,
-Response: AND THE MOME RATHS OUTGRABE.
-Shutting down listener for client
-==== server.py.out | remove_uuid64
-Request server running - run your client now.
-(Times out after 100 seconds ...)
diff --git a/qpid/cpp/examples/examples/request-response/verify_python_cpp b/qpid/cpp/examples/examples/request-response/verify_python_cpp
deleted file mode 100644
index 9f3f1caaf4..0000000000
--- a/qpid/cpp/examples/examples/request-response/verify_python_cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-background "Waiting" ./server
-clients $PYTHON_EXAMPLES/request-response/client.py
-kill %% # Must kill the server.
-outputs "$PYTHON_EXAMPLES/request-response/client.py.out | remove_uuid64" "server.out | remove_uuid64"
diff --git a/qpid/cpp/examples/examples/request-response/verify_python_cpp.in b/qpid/cpp/examples/examples/request-response/verify_python_cpp.in
deleted file mode 100644
index 7718d54973..0000000000
--- a/qpid/cpp/examples/examples/request-response/verify_python_cpp.in
+++ /dev/null
@@ -1,18 +0,0 @@
-==== client.py.out | remove_uuid64
-Request: Twas brilling, and the slithy toves
-Request: Did gyre and gimble in the wabe.
-Request: All mimsy were the borogroves,
-Request: And the mome raths outgrabe.
-Messages queue: ReplyTo:
-Response: TWAS BRILLING, AND THE SLITHY TOVES
-Response: DID GYRE AND GIMBLE IN THE WABE.
-Response: ALL MIMSY WERE THE BOROGROVES,
-Response: AND THE MOME RATHS OUTGRABE.
-No more messages!
-==== server.out | remove_uuid64
-Activating request queue listener for: request
-Waiting for requests
-Request: Twas brilling, and the slithy toves (ReplyTo:)
-Request: Did gyre and gimble in the wabe. (ReplyTo:)
-Request: All mimsy were the borogroves, (ReplyTo:)
-Request: And the mome raths outgrabe. (ReplyTo:)
diff --git a/qpid/cpp/examples/verify b/qpid/cpp/examples/verify
deleted file mode 100755
index 251097930e..0000000000
--- a/qpid/cpp/examples/verify
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh
-# Driver script to verify installed examples (also used for build tests.)
-#
-# Usage: verify example_dir [ example_dir ...]
-# Where each example_dir must contain a verify sub-script to include.
-#
-# If $QPIDD is set, run a private QPIDD and use it.
-# If $QPID_HOST or $QPID_PORT are set, use them to connect.
-#
-
-export QPID_DATA_DIR=
-
-cleanup() {
- test -n "$QPIDD" && $QPIDD -q # Private broker
- kill %% > /dev/null 2>&1 # Leftover background jobs
-}
-
-trap cleanup EXIT
-
-ARGS="${QPID_HOST:-localhost} $QPID_PORT"
-
-outfile() {
- file=$1
- while [ -f $file.out ]; do file="${file}X"; done
- echo $file.out
- }
-
-fail() { test -n "$*" && echo $* 1>&2 ; FAIL=1; return 1; }
-
-client() { "$@" $ARGS > `outfile $*` || fail; }
-
-clients() { for cmd in "$@"; do client $cmd; done; }
-
-waitfor() { until grep -a -l "$2" $1 >/dev/null 2>&1 ; do sleep 1 ; done ; }
-
-background() {
- pattern=$1; shift
- out=`outfile $*`
- eval "$* $ARGS > $out &" || { fail; return 1; }
- waitfor $out "$pattern"
-}
-
-name() {
- for x in $*; do name="$name `basename $x`"; done
- echo $name;
-}
-
-outputs() {
- wait 2> /dev/null # Wait for all backgroud processes to complete
- rm -f $script.out
- for f in "$@"; do
- { echo "==== `name $f`"; eval "cat $f"; } >> $script.out || fail
- done
-}
-
-verify() {
- FAIL=
- if [ -d $1 ]; then dir=$1; script=verify;
- else dir=`dirname $1`; script=`basename $1`; fi
- cd $dir || return 1
- rm -f *.out
- { source ./$script && diff -ac $script.out $script.in ; } || fail
- test -z "$FAIL" && rm -f *.out
- return $FAIL
-}
-
-HEX="[a-fA-F0-9]"
-remove_uuid() {
- sed "s/$HEX\{8\}-$HEX\{4\}-$HEX\{4\}-$HEX\{4\}-$HEX\{12\}//g" $*
-}
-remove_uuid64() {
- sed 's/[-A-Za-z0-9_]\{22\}==//g' $*
-}
-
-# Start private broker if QPIDD is set.
-if [ -n "$QPIDD" ] ; then
- export QPID_PORT=`$QPIDD -dp0` || { echo "Cannot start $QPIDD" ; exit 1; }
- trap "$QPIDD -q" EXIT
-fi
-
-for example in "$@"; do
- echo "== $example "
- if ( verify $example; ) then echo "PASS"; else echo "FAIL"; RET=1; fi
- done
-exit $RET
diff --git a/qpid/cpp/examples/verify_all b/qpid/cpp/examples/verify_all
deleted file mode 100755
index 5501239021..0000000000
--- a/qpid/cpp/examples/verify_all
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-# Verify all C++/python example combinations.
-#
-
-srcdir=$1 ;
-verify=`dirname $0`/verify
-qpidd=../src/qpidd
-python=$srcdir/python
-
-trap "$qpidd -q" exit
-export QPID_PORT=`$qpidd -dp0 --data-dir ""`
-export PYTHON_EXAMPLES=$python/examples
-export PYTHONPATH=$python:$PYTHONPATH
-export AMQP_SPEC=$srcdir/specs/amqp.0-10-preview.xml
-
-test -d $PYTHON_EXAMPLES || echo "Warning: not verifying python examples, $PYTHON_EXAMPLES not found"
-find="find examples"
-test -d $PYTHON_EXAMPLES && find="$find $PYTHON_EXAMPLES"
-find="$find -name verify"
-test -d $PYTHON_EXAMPLES && \
- find="$find -o -name verify_cpp_python -o -name verify_python_cpp"
-$verify `$find`
-
diff --git a/qpid/cpp/m4/clock_time.m4 b/qpid/cpp/m4/clock_time.m4
deleted file mode 100644
index 227a5978e5..0000000000
--- a/qpid/cpp/m4/clock_time.m4
+++ /dev/null
@@ -1,30 +0,0 @@
-# clock_time.m4 serial 8
-dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
-# For a program named, say foo, you should add a line like the following
-# in the corresponding Makefile.am file:
-# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
-
-AC_DEFUN([gl_CLOCK_TIME],
-[
- dnl Persuade glibc and Solaris <time.h> to declare these functions.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
- # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
-
- # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
- # programs in the package would end up linked with that potentially-shared
- # library, inducing unnecessary run-time overhead.
- gl_saved_libs=$LIBS
- AC_SEARCH_LIBS(clock_gettime, [rt posix4],
- [test "$ac_cv_search_clock_gettime" = "none required" ||
- LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
- AC_SUBST([LIB_CLOCK_GETTIME])
- AC_CHECK_FUNCS(clock_gettime clock_settime)
- LIBS=$gl_saved_libs
-])
diff --git a/qpid/cpp/m4/compiler-flags.m4 b/qpid/cpp/m4/compiler-flags.m4
deleted file mode 100644
index 01cb728f02..0000000000
--- a/qpid/cpp/m4/compiler-flags.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-# serial 3
-# Find valid warning flags for the C Compiler. -*-Autoconf-*-
-dnl Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-dnl Written by Jesse Thilo.
-
-AC_DEFUN([gl_COMPILER_FLAGS],
- [AC_MSG_CHECKING(whether compiler accepts $1)
- AC_SUBST(COMPILER_FLAGS)
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $1"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $1"
- AC_TRY_COMPILE(,
- [int x;],
- COMPILER_FLAGS="$COMPILER_FLAGS $1"
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no))
- CFLAGS="$ac_save_CFLAGS"
- CXXFLAGS="$ac_save_CXXFLAGS"
- ])
diff --git a/qpid/cpp/m4/cppunit.m4 b/qpid/cpp/m4/cppunit.m4
deleted file mode 100644
index f009086f9d..0000000000
--- a/qpid/cpp/m4/cppunit.m4
+++ /dev/null
@@ -1,89 +0,0 @@
-dnl
-dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl
-AC_DEFUN([AM_PATH_CPPUNIT],
-[
-
-AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
- cppunit_config_prefix="$withval", cppunit_config_prefix="")
-AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
- cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
-
- if test x$cppunit_config_exec_prefix != x ; then
- cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
- if test x${CPPUNIT_CONFIG+set} != xset ; then
- CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
- fi
- fi
- if test x$cppunit_config_prefix != x ; then
- cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
- if test x${CPPUNIT_CONFIG+set} != xset ; then
- CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
- fi
- fi
-
- AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
- cppunit_version_min=$1
-
- AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
- no_cppunit=""
- if test "$CPPUNIT_CONFIG" = "no" ; then
- AC_MSG_RESULT(no)
- no_cppunit=yes
- else
- CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
- CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
- cppunit_version=`$CPPUNIT_CONFIG --version`
-
- cppunit_major_version=`echo $cppunit_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- cppunit_minor_version=`echo $cppunit_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- cppunit_micro_version=`echo $cppunit_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-
- cppunit_major_min=`echo $cppunit_version_min | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- if test "x${cppunit_major_min}" = "x" ; then
- cppunit_major_min=0
- fi
-
- cppunit_minor_min=`echo $cppunit_version_min | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- if test "x${cppunit_minor_min}" = "x" ; then
- cppunit_minor_min=0
- fi
-
- cppunit_micro_min=`echo $cppunit_version_min | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x${cppunit_micro_min}" = "x" ; then
- cppunit_micro_min=0
- fi
-
- cppunit_version_proper=`expr \
- $cppunit_major_version \> $cppunit_major_min \| \
- $cppunit_major_version \= $cppunit_major_min \& \
- $cppunit_minor_version \> $cppunit_minor_min \| \
- $cppunit_major_version \= $cppunit_major_min \& \
- $cppunit_minor_version \= $cppunit_minor_min \& \
- $cppunit_micro_version \>= $cppunit_micro_min `
-
- if test "$cppunit_version_proper" = "1" ; then
- AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
- else
- AC_MSG_RESULT(no)
- no_cppunit=yes
- fi
- fi
-
- if test "x$no_cppunit" = x ; then
- ifelse([$2], , :, [$2])
- else
- CPPUNIT_CFLAGS=""
- CPPUNIT_LIBS=""
- ifelse([$3], , :, [$3])
- fi
-
- AC_SUBST(CPPUNIT_CFLAGS)
- AC_SUBST(CPPUNIT_LIBS)
-])
diff --git a/qpid/cpp/m4/extensions.m4 b/qpid/cpp/m4/extensions.m4
deleted file mode 100644
index 143a9e5403..0000000000
--- a/qpid/cpp/m4/extensions.m4
+++ /dev/null
@@ -1,58 +0,0 @@
-# serial 4 -*- Autoconf -*-
-# Enable extensions on systems that normally disable them.
-
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
-# Autoconf. Perhaps we can remove this once we can assume Autoconf
-# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly
-# enough in this area it's likely we'll need to redefine
-# AC_USE_SYSTEM_EXTENSIONS for quite some time.
-
-# AC_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-[
- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
- AC_BEFORE([$0], [AC_RUN_IFELSE])
-
- AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([AC_AIX])
- AC_REQUIRE([AC_MINIX])
-
- AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif])
- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
- [ac_cv_safe_to_define___extensions__],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
-# define __EXTENSIONS__ 1
- AC_INCLUDES_DEFAULT])],
- [ac_cv_safe_to_define___extensions__=yes],
- [ac_cv_safe_to_define___extensions__=no])])
- test $ac_cv_safe_to_define___extensions__ = yes &&
- AC_DEFINE([__EXTENSIONS__])
- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
- AC_DEFINE([_TANDEM_SOURCE])
-])
-
-# gl_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
- [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
diff --git a/qpid/cpp/make-dist b/qpid/cpp/make-dist
deleted file mode 100755
index c23cad63a1..0000000000
--- a/qpid/cpp/make-dist
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-#
-# Temporary hack for producing a binary dev distribution.
-# Includes regular stuff from 'make install' + examples and headers.
-#
-# TODO: Also include debug libraries.
-#
-
-Usage() {
- echo "usage: $0 [release-version]
- release-version e.g. 1.0M1 (defaults to the svn revision)" >&2
- exit 2
-}
-
-if [[ $# -eq 1 ]]; then
- [[ $1 == "-?" ]] && Usage
- version=$1
-elif [[ $# -ne 0 ]]; then
- Usage
-else
- # Default the version to the svn revision
- if which svn >/dev/null 2>&1; then
- svnRevision=$(svn info | grep ^Revision: | awk '{print $2}')
- version=r${svnRevision}
- else
- echo "You need to have svn in your PATH or specify a release-version"
- exit 2
- fi
-fi
-
-releaseName=qpid-cpp-dev-${version}-$(uname -s)-$(uname -p)
-releaseDir=release/$releaseName
-
-if [[ -d $releaseDir ]]; then
- echo "$releaseDir already exists"
- exit 2
-fi
-
-# Copy bin.
-mkdir -p $releaseDir/bin
-cp -r src/.libs/* ${releaseDir}/bin
-
-# Copy libs.
-mkdir -p $releaseDir/lib
-cp lib/broker/.libs/lib* lib/common/.libs/lib* lib/client/.libs/lib* \
- $releaseDir/lib
-
-# Copy gen include files.
-find gen -name \*.h | while read file; do
- destFile=${releaseDir}/include/$file
- baseDir=$(dirname $destFile)
- mkdir -p $baseDir
- cp $file $destFile
-done
-
-# Copy in lib include files.
-(
- cd lib; find . -name \*.h | while read file; do
- destFile=../${releaseDir}/include/$file
- baseDir=$(dirname $destFile)
- mkdir -p $baseDir
- cp $file $destFile
- done
-)
-
-# Copy non-cppunit tests as examples.
-mkdir -p $releaseDir/examples
-for file in tests/*.cpp; do
- if grep CppUnit $file >/dev/null; then
- echo Skipping cppunit file $file
- else
- cp $file $releaseDir/examples
- fi
-done
-
-# Copy Makefile and README for examples.
-cp tests/examples.Makefile $releaseDir/examples/Makefile
-cp tests/examples.README $releaseDir/examples/README
-
-cd release
-tar=$releaseName.tar
-tar cvf $tar $releaseName
-bzip2 $tar
diff --git a/qpid/cpp/managementgen/generate.py b/qpid/cpp/managementgen/generate.py
deleted file mode 100755
index 4c042bd3f6..0000000000
--- a/qpid/cpp/managementgen/generate.py
+++ /dev/null
@@ -1,253 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http:#www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-from xml.dom.minidom import parse, parseString, Node
-from cStringIO import StringIO
-from stat import *
-from errno import *
-import os
-import os.path
-import filecmp
-
-class Template:
- """
- Expandable File Template - This class is instantiated each time a
- template is to be expanded. It is instantiated with the "filename"
- which is the full path to the template file and the "handler" which
- is an object that is responsible for storing variables (setVariable)
- and expanding tags (substHandler).
- """
- def __init__ (self, filename, handler):
- self.filename = filename
- self.handler = handler
- self.handler.initExpansion ()
-
- def expandLine (self, line, stream, object):
- cursor = 0
- while 1:
- sub = line.find ("/*MGEN:", cursor)
- if sub == -1:
- stream.write (line[cursor:len (line)])
- return
-
- subend = line.find("*/", sub)
- stream.write (line[cursor:sub])
- cursor = subend + 2
-
- tag = line[sub:subend]
- equalPos = tag.find ("=")
- if equalPos == -1:
- dotPos = tag.find (".")
- if dotPos == -1:
- raise ValueError ("Invalid tag: %s" % tag)
- tagObject = tag[7:dotPos]
- tagName = tag[dotPos + 1:len (tag)]
- self.handler.substHandler (object, stream, tagObject, tagName)
- else:
- tagKey = tag[7:equalPos]
- tagVal = tag[equalPos + 1:len (tag)]
- self.handler.setVariable (tagKey, tagVal)
-
- def expand (self, object):
- fd = open (self.filename)
- stream = StringIO ()
-
- for line in fd:
- self.expandLine (line, stream, object)
- fd.close ()
-
- return stream
-
-
-class Makefile:
- """ Object representing a makefile fragment """
- def __init__ (self, filelists, templateFiles):
- self.filelists = filelists
- self.templateFiles = templateFiles
-
- def genGenSources (self, stream, variables):
- mdir = variables["mgenDir"]
- sdir = variables["specDir"]
- stream.write (mdir + "/main.py \\\n")
- stream.write (" " + mdir + "/generate.py \\\n")
- stream.write (" " + mdir + "/schema.py \\\n")
- stream.write (" " + sdir + "/management-types.xml \\\n")
- stream.write (" " + sdir + "/management-schema.xml \\\n")
- first = True
- for template in self.templateFiles:
- if first:
- first = False
- stream.write (" ")
- else:
- stream.write (" \\\n ")
- stream.write (mdir + "/templates/" + template)
-
- def genGenCppFiles (self, stream, variables):
- first = True
- for file in self.filelists["cpp"]:
- if first:
- first = False
- else:
- stream.write (" \\\n ")
- stream.write (file)
-
- def genGenHFiles (self, stream, variables):
- first = True
- for file in self.filelists["h"]:
- if first:
- first = False
- else:
- stream.write (" \\\n ")
- stream.write (file)
-
-
-class Generator:
- """
- This class manages code generation using template files. It is instantiated
- once for an entire code generation session.
- """
- def createPath (self, path):
- exists = True
- try:
- mode = os.stat (path)[ST_MODE]
- except OSError, (err,text):
- if err == ENOENT:
- exists = False
- else:
- raise
- if exists and not S_ISDIR (mode):
- raise ValueError ("path is not directory: %s" % path)
- if not exists:
- pair = os.path.split (path)
- self.createPath (pair[0])
- os.mkdir (path)
-
- def normalize (self, path):
- newpath = os.path.normcase (os.path.normpath (path))
- self.createPath (newpath)
- return newpath + "/"
-
- def __init__ (self, destDir, templateDir):
- self.dest = self.normalize (destDir)
- self.input = self.normalize (templateDir)
- self.filelists = {}
- self.filelists["h"] = []
- self.filelists["cpp"] = []
- self.filelists["mk"] = []
- self.templateFiles = []
- self.variables = {}
-
- def genDisclaimer (self, stream, variables):
- prefix = variables["commentPrefix"]
- stream.write (prefix + " This source file was created by a code generator.\n")
- stream.write (prefix + " Please do not edit.")
-
- def fileExt (self, path):
- dot = path.rfind (".")
- if dot == -1:
- return ""
- return path[dot + 1:]
-
- def writeIfChanged (self, stream, target, force=False):
- ext = self.fileExt (target)
- self.filelists[ext].append (target)
- tempFile = self.dest + "gen.tmp"
- fd = open (tempFile, "w")
- fd.write (stream.getvalue ())
- fd.close ()
-
- try:
- if not force and filecmp.cmp (target, tempFile):
- os.remove (tempFile)
- return
- except:
- pass
-
- try:
- os.remove (target)
- except:
- pass
-
- os.rename (tempFile, target)
- print "Generated:", target
-
- def targetClassFile (self, _class, templateFile):
- dot = templateFile.find(".")
- if dot == -1:
- raise ValueError ("Invalid template file name %s" % templateFile)
- extension = templateFile[dot:len (templateFile)]
- path = self.dest + _class.getName ().capitalize () + extension
- return path
-
- def targetMethodFile (self, method, templateFile):
- """ Return the file name for a method file """
- dot = templateFile.rfind(".")
- if dot == -1:
- raise ValueError ("Invalid template file name %s" % templateFile)
- extension = templateFile[dot:]
- path = self.dest + "Args" + method.getFullName () + extension
- return path
-
- def initExpansion (self):
- self.variables = {}
-
- def substHandler (self, object, stream, tagObject, tag):
- if tagObject == "Root":
- obj = "self"
- else:
- obj = "object" # MUST be the same as the 2nd formal parameter
-
- call = obj + ".gen" + tag + "(stream, self.variables)"
- eval (call)
-
- def setVariable (self, key, value):
- self.variables[key] = value
-
- def makeClassFiles (self, templateFile, schema, force=False):
- """ Generate an expanded template per schema class """
- classes = schema.getClasses ()
- template = Template (self.input + templateFile, self)
- self.templateFiles.append (templateFile)
- for _class in classes:
- target = self.targetClassFile (_class, templateFile)
- stream = template.expand (_class)
- self.writeIfChanged (stream, target, force)
-
- def makeMethodFiles (self, templateFile, schema, force=False):
- """ Generate an expanded template per method-with-arguments """
- classes = schema.getClasses ()
- template = Template (self.input + templateFile, self)
- self.templateFiles.append (templateFile)
- for _class in classes:
- methods = _class.getMethods ()
- for method in methods:
- if method.getArgCount () > 0:
- target = self.targetMethodFile (method, templateFile)
- stream = template.expand (method)
- self.writeIfChanged (stream, target, force)
-
- def makeSingleFile (self, templateFile, target, force=False):
- """ Generate a single expanded template """
- makefile = Makefile (self.filelists, self.templateFiles)
- template = Template (self.input + templateFile, self)
- self.templateFiles.append (templateFile)
- stream = template.expand (makefile)
- self.writeIfChanged (stream, target, force)
diff --git a/qpid/cpp/managementgen/main.py b/qpid/cpp/managementgen/main.py
deleted file mode 100755
index de8ce4cbe6..0000000000
--- a/qpid/cpp/managementgen/main.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http:#www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-from schema import PackageSchema, SchemaClass
-from generate import Generator
-from optparse import OptionParser
-
-# Set command line options
-usage = "usage: %prog [options] schema-document type-document template-directory out-directory"
-parser = OptionParser (usage=usage)
-parser.add_option ("-m", "--makefile", dest="makefile", metavar="FILE",
- help="Makefile fragment")
-
-(opts, args) = parser.parse_args ()
-
-if len (args) < 4:
- parser.error ("Too few arguments")
-
-schemafile = args[0]
-typefile = args[1]
-templatedir = args[2]
-outdir = args[3]
-
-gen = Generator (outdir, templatedir)
-schema = PackageSchema (typefile, schemafile)
-
-gen.makeClassFiles ("Class.h", schema)
-gen.makeClassFiles ("Class.cpp", schema)
-gen.makeMethodFiles ("Args.h", schema)
-
-if opts.makefile != None:
- gen.makeSingleFile ("Makefile.mk", opts.makefile, force=True)
diff --git a/qpid/cpp/managementgen/schema.py b/qpid/cpp/managementgen/schema.py
deleted file mode 100755
index a459db7a47..0000000000
--- a/qpid/cpp/managementgen/schema.py
+++ /dev/null
@@ -1,822 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http:#www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-from xml.dom.minidom import parse, parseString, Node
-from cStringIO import StringIO
-
-#=====================================================================================
-#
-#=====================================================================================
-class SchemaType:
- def __init__ (self, node):
- self.name = None
- self.base = None
- self.cpp = None
- self.encode = None
- self.decode = None
- self.style = "normal"
- self.accessor = None
- self.init = "0"
-
- attrs = node.attributes
- for idx in range (attrs.length):
- key = attrs.item(idx).nodeName
- val = attrs.item(idx).nodeValue
- if key == 'name':
- self.name = val
-
- elif key == 'base':
- self.base = val
-
- elif key == 'cpp':
- self.cpp = val
-
- elif key == 'encode':
- self.encode = val
-
- elif key == 'decode':
- self.decode = val
-
- elif key == 'style':
- self.style = val
-
- elif key == 'accessor':
- self.accessor = val
-
- elif key == 'init':
- self.init = val
-
- else:
- raise ValueError ("Unknown attribute in type '%s'" % key)
-
- if self.name == None or self.base == None or self.cpp == None or \
- self.encode == None or self.decode == None:
- raise ValueError ("Missing required attribute(s) in type")
-
- def getName (self):
- return self.name
-
- def genAccessor (self, stream, varName, changeFlag = None):
- if self.accessor == "direct":
- stream.write (" inline void set_" + varName + " (" + self.cpp + " val){\n");
- if self.style != "mma":
- stream.write (" " + varName + " = val;\n");
- if self.style == "wm":
- stream.write (" if (" + varName + "Low > val)\n")
- stream.write (" " + varName + "Low = val;\n")
- stream.write (" if (" + varName + "High < val)\n")
- stream.write (" " + varName + "High = val;\n")
- if self.style == "mma":
- stream.write (" " + varName + "Count++;\n")
- stream.write (" " + varName + "Total += val;\n")
- stream.write (" if (" + varName + "Min > val)\n")
- stream.write (" " + varName + "Min = val;\n")
- stream.write (" if (" + varName + "Max < val)\n")
- stream.write (" " + varName + "Max = val;\n")
- if changeFlag != None:
- stream.write (" " + changeFlag + " = true;\n")
- stream.write (" }\n");
- elif self.accessor == "counter":
- stream.write (" inline void inc_" + varName + " (" + self.cpp + " by = 1){\n");
- stream.write (" " + varName + " += by;\n")
- if self.style == "wm":
- stream.write (" if (" + varName + "High < " + varName + ")\n")
- stream.write (" " + varName + "High = " + varName + ";\n")
- if changeFlag != None:
- stream.write (" " + changeFlag + " = true;\n")
- stream.write (" }\n");
- stream.write (" inline void dec_" + varName + " (" + self.cpp + " by = 1){\n");
- stream.write (" " + varName + " -= by;\n")
- if self.style == "wm":
- stream.write (" if (" + varName + "Low > " + varName + ")\n")
- stream.write (" " + varName + "Low = " + varName + ";\n")
- if changeFlag != None:
- stream.write (" " + changeFlag + " = true;\n")
- stream.write (" }\n");
-
- def genHiLoStatResets (self, stream, varName):
- if self.style == "wm":
- stream.write (" " + varName + "High = " + varName + ";\n")
- stream.write (" " + varName + "Low = " + varName + ";\n")
- if self.style == "mma":
- stream.write (" " + varName + "Count = 0;\n")
- stream.write (" " + varName + "Total = 0;\n")
- stream.write (" " + varName + "Min = -1;\n")
- stream.write (" " + varName + "Max = 0;\n")
-
- def genWrite (self, stream, varName):
- if self.style != "mma":
- stream.write (" " + self.encode.replace ("@", "buf").replace ("#", varName) + ";\n")
- if self.style == "wm":
- stream.write (" " + self.encode.replace ("@", "buf") \
- .replace ("#", varName + "High") + ";\n")
- stream.write (" " + self.encode.replace ("@", "buf") \
- .replace ("#", varName + "Low") + ";\n")
- if self.style == "mma":
- stream.write (" " + self.encode.replace ("@", "buf") \
- .replace ("#", varName + "Count") + ";\n")
- stream.write (" " + self.encode.replace ("@", "buf") \
- .replace ("#", varName + "Count ? " + varName + "Min : 0") + ";\n")
- stream.write (" " + self.encode.replace ("@", "buf") \
- .replace ("#", varName + "Max") + ";\n")
- stream.write (" " + self.encode.replace ("@", "buf") \
- .replace ("#", varName + "Count ? " + varName + "Total / " +
- varName + "Count : 0") + ";\n")
-
-
- def getReadCode (self, varName, bufName):
- result = self.decode.replace ("@", bufName).replace ("#", varName)
- return result
-
- def getWriteCode (self, varName, bufName):
- result = self.encode.replace ("@", bufName).replace ("#", varName)
- return result
-
-#=====================================================================================
-#
-#=====================================================================================
-class TypeSpec:
- def __init__ (self, file):
- self.types = {}
- dom = parse (file)
- document = dom.documentElement
- if document.tagName != 'schema-types':
- raise ValueError ("Expected 'schema-types' in type file")
-
- for child in document.childNodes:
- if child.nodeType == Node.ELEMENT_NODE:
- if child.nodeName == 'type':
- stype = SchemaType (child)
- self.types[stype.getName ()] = stype
- else:
- raise ValueError ("Unknown type tag '%s'" % child.nodeName)
-
- def getType (self, name):
- return self.types[name]
-
-
-#=====================================================================================
-#
-#=====================================================================================
-class Type:
- def __init__ (self, name, typespec):
- self.type = typespec.getType (name)
-
-#=====================================================================================
-#
-#=====================================================================================
-class SchemaConfig:
- def __init__ (self, node, typespec):
- self.name = None
- self.type = None
- self.access = "RO"
- self.isIndex = 0
- self.isParentRef = 0
- self.unit = None
- self.min = None
- self.max = None
- self.maxLen = None
- self.desc = None
-
- attrs = node.attributes
- for idx in range (attrs.length):
- key = attrs.item(idx).nodeName
- val = attrs.item(idx).nodeValue
- if key == 'name':
- self.name = val
-
- elif key == 'type':
- self.type = Type (val, typespec)
-
- elif key == 'access':
- self.access = val
-
- elif key == 'index':
- if val != 'y':
- raise ValueError ("Expected 'y' in index attribute")
- self.isIndex = 1
-
- elif key == 'parentRef':
- if val != 'y':
- raise ValueError ("Expected 'y' in parentRef attribute")
- self.isParentRef = 1
-
- elif key == 'unit':
- self.unit = val
-
- elif key == 'min':
- self.min = val
-
- elif key == 'max':
- self.max = val
-
- elif key == 'maxlen':
- self.maxLen = val
-
- elif key == 'desc':
- self.desc = val
-
- else:
- raise ValueError ("Unknown attribute in configElement '%s'" % key)
-
- if self.name == None:
- raise ValueError ("Missing 'name' attribute in configElement")
- if self.type == None:
- raise ValueError ("Missing 'type' attribute in configElement")
-
- def getName (self):
- return self.name
-
- def isConstructorArg (self):
- if self.access == "RC" and self.isParentRef == 0:
- return 1
- return 0
-
- def genDeclaration (self, stream):
- stream.write (" " + self.type.type.cpp + " " + self.name + ";\n")
-
- def genFormalParam (self, stream):
- stream.write (self.type.type.cpp + " _" + self.name)
-
- def genAccessor (self, stream):
- self.type.type.genAccessor (stream, self.name, "configChanged")
-
- def genSchema (self, stream):
- stream.write (" ft = FieldTable ();\n")
- stream.write (" ft.setString (NAME, \"" + self.name + "\");\n")
- stream.write (" ft.setInt (TYPE, TYPE_" + self.type.type.base +");\n")
- stream.write (" ft.setInt (ACCESS, ACCESS_" + self.access + ");\n")
- stream.write (" ft.setInt (INDEX, " + str (self.isIndex) + ");\n")
- if self.unit != None:
- stream.write (" ft.setString (UNIT, \"" + self.unit + "\");\n")
- if self.min != None:
- stream.write (" ft.setInt (MIN, " + self.min + ");\n")
- if self.max != None:
- stream.write (" ft.setInt (MAX, " + self.max + ");\n")
- if self.maxLen != None:
- stream.write (" ft.setInt (MAXLEN, " + self.maxLen + ");\n")
- if self.desc != None:
- stream.write (" ft.setString (DESC, \"" + self.desc + "\");\n")
- stream.write (" buf.put (ft);\n\n")
-
- def genWrite (self, stream):
- self.type.type.genWrite (stream, self.name)
-
-
-#=====================================================================================
-#
-#=====================================================================================
-class SchemaInst:
- def __init__ (self, node, typespec):
- self.name = None
- self.type = None
- self.unit = None
- self.desc = None
-
- attrs = node.attributes
- for idx in range (attrs.length):
- key = attrs.item(idx).nodeName
- val = attrs.item(idx).nodeValue
- if key == 'name':
- self.name = val
-
- elif key == 'type':
- self.type = Type (val, typespec)
-
- elif key == 'unit':
- self.unit = val
-
- elif key == 'desc':
- self.desc = val
-
- else:
- raise ValueError ("Unknown attribute in instElement '%s'" % key)
-
- if self.name == None:
- raise ValueError ("Missing 'name' attribute in instElement")
- if self.type == None:
- raise ValueError ("Missing 'type' attribute in instElement")
-
- def getName (self):
- return self.name
-
- def genDeclaration (self, stream):
- if self.type.type.style != "mma":
- stream.write (" " + self.type.type.cpp + " " + self.name + ";\n")
- if self.type.type.style == 'wm':
- stream.write (" " + self.type.type.cpp + " " + self.name + "High;\n")
- stream.write (" " + self.type.type.cpp + " " + self.name + "Low;\n")
- if self.type.type.style == "mma":
- stream.write (" " + self.type.type.cpp + " " + self.name + "Count;\n")
- stream.write (" uint64_t " + self.name + "Total;\n")
- stream.write (" " + self.type.type.cpp + " " + self.name + "Min;\n")
- stream.write (" " + self.type.type.cpp + " " + self.name + "Max;\n")
-
- def genAccessor (self, stream):
- self.type.type.genAccessor (stream, self.name, "instChanged")
-
- def genHiLoStatResets (self, stream):
- self.type.type.genHiLoStatResets (stream, self.name)
-
- def genSchemaText (self, stream, name, desc):
- stream.write (" ft = FieldTable ();\n")
- stream.write (" ft.setString (NAME, \"" + name + "\");\n")
- stream.write (" ft.setInt (TYPE, TYPE_" + self.type.type.base +");\n")
- if self.unit != None:
- stream.write (" ft.setString (UNIT, \"" + self.unit + "\");\n")
- if desc != None:
- stream.write (" ft.setString (DESC, \"" + desc + "\");\n")
- stream.write (" buf.put (ft);\n\n")
-
- def genSchema (self, stream):
- if self.type.type.style != "mma":
- self.genSchemaText (stream, self.name, self.desc)
- if self.type.type.style == "wm":
- descHigh = self.desc
- descLow = self.desc
- if self.desc != None:
- descHigh = descHigh + " (High)"
- descLow = descLow + " (Low)"
- self.genSchemaText (stream, self.name + "High", descHigh)
- self.genSchemaText (stream, self.name + "Low", descLow)
- if self.type.type.style == "mma":
- descCount = self.desc
- descMin = self.desc
- descMax = self.desc
- descAverage = self.desc
- if self.desc != None:
- descCount = descCount + " (Samples)"
- descMin = descMin + " (Min)"
- descMax = descMax + " (Max)"
- descAverage = descAverage + " (Average)"
- self.genSchemaText (stream, self.name + "Samples", descCount)
- self.genSchemaText (stream, self.name + "Min", descMin)
- self.genSchemaText (stream, self.name + "Max", descMax)
- self.genSchemaText (stream, self.name + "Average", descAverage)
-
- def genWrite (self, stream):
- self.type.type.genWrite (stream, self.name)
-
- def genInitialize (self, stream):
- val = self.type.type.init
- if self.type.type.style != "mma":
- stream.write (" " + self.name + " = " + val + ";\n")
- if self.type.type.style == "wm":
- stream.write (" " + self.name + "High = " + val + ";\n")
- stream.write (" " + self.name + "Low = " + val + ";\n")
- if self.type.type.style == "mma":
- stream.write (" " + self.name + "Count = 0;\n")
- stream.write (" " + self.name + "Min = -1;\n")
- stream.write (" " + self.name + "Max = 0;\n")
- stream.write (" " + self.name + "Total = 0;\n")
-
-
-#=====================================================================================
-#
-#=====================================================================================
-class SchemaArg:
- def __init__ (self, node, typespec):
- self.name = None
- self.type = None
- self.unit = None
- self.dir = "I"
- self.min = None
- self.max = None
- self.maxLen = None
- self.desc = None
- self.default = None
-
- attrs = node.attributes
- for idx in range (attrs.length):
- key = attrs.item(idx).nodeName
- val = attrs.item(idx).nodeValue
- if key == 'name':
- self.name = val
-
- elif key == 'type':
- self.type = Type (val, typespec)
-
- elif key == 'unit':
- self.unit = val
-
- elif key == 'dir':
- self.dir = val.upper ()
-
- elif key == 'min':
- self.min = val
-
- elif key == 'max':
- self.max = val
-
- elif key == 'maxlen':
- self.maxLen = val
-
- elif key == 'desc':
- self.desc = val
-
- elif key == 'default':
- self.default = val
-
- else:
- raise ValueError ("Unknown attribute in arg '%s'" % key)
-
- if self.name == None:
- raise ValueError ("Missing 'name' attribute in arg")
- if self.type == None:
- raise ValueError ("Missing 'type' attribute in arg")
-
- def getName (self):
- return self.name
-
- def getDir (self):
- return self.dir
-
- def genSchema (self, stream):
- stream.write (" ft = FieldTable ();\n")
- stream.write (" ft.setString (NAME, \"" + self.name + "\");\n")
- stream.write (" ft.setInt (TYPE, TYPE_" + self.type.type.base +");\n")
- stream.write (" ft.setString (DIR, \"" + self.dir + "\");\n")
- if self.unit != None:
- stream.write (" ft.setString (UNIT, \"" + self.unit + "\");\n")
- if self.min != None:
- stream.write (" ft.setInt (MIN, " + self.min + ");\n")
- if self.max != None:
- stream.write (" ft.setInt (MAX, " + self.max + ");\n")
- if self.maxLen != None:
- stream.write (" ft.setInt (MAXLEN, " + self.maxLen + ");\n")
- if self.desc != None:
- stream.write (" ft.setString (DESC, \"" + self.desc + "\");\n")
- if self.default != None:
- stream.write (" ft.setString (DEFAULT, \"" + self.default + "\");\n")
- stream.write (" buf.put (ft);\n\n")
-
-#=====================================================================================
-#
-#=====================================================================================
-class SchemaMethod:
- def __init__ (self, parent, node, typespec):
- self.parent = parent
- self.name = None
- self.desc = None
- self.args = []
-
- attrs = node.attributes
- for idx in range (attrs.length):
- key = attrs.item(idx).nodeName
- val = attrs.item(idx).nodeValue
- if key == 'name':
- self.name = val
-
- elif key == 'desc':
- self.desc = val
-
- else:
- raise ValueError ("Unknown attribute in method '%s'" % key)
-
- for child in node.childNodes:
- if child.nodeType == Node.ELEMENT_NODE:
- if child.nodeName == 'arg':
- arg = SchemaArg (child, typespec)
- self.args.append (arg)
- else:
- raise ValueError ("Unknown method tag '%s'" % child.nodeName)
-
- def getName (self):
- return self.name
-
- def getFullName (self):
- return self.parent.getName().capitalize() + self.name[0:1].upper() +\
- self.name[1:]
-
- def getArgCount (self):
- return len (self.args)
-
- #===================================================================================
- # Code Generation Functions. The names of these functions (minus the leading "gen")
- # match the substitution keywords in the template files.
- #===================================================================================
- def genNameUpper (self, stream, variables):
- stream.write (self.getFullName ().upper ())
-
- def genNameCamel (self, stream, variables):
- stream.write (self.getFullName ())
-
- def genArguments (self, stream, variables):
- for arg in self.args:
- ctype = arg.type.type.cpp
- dirTag = arg.dir.lower() + "_"
- stream.write (" " + ctype + " " + dirTag + arg.getName () + ";\n")
-
- def genSchema (self, stream, variables):
- stream.write (" ft = FieldTable ();\n")
- stream.write (" ft.setString (NAME, \"" + self.name + "\");\n")
- stream.write (" ft.setInt (ARGCOUNT, " + str (len (self.args)) + ");\n")
- if self.desc != None:
- stream.write (" ft.setString (DESC, \"" + self.desc + "\");\n")
- stream.write (" buf.put (ft);\n\n")
- for arg in self.args:
- arg.genSchema (stream)
-
-#=====================================================================================
-#
-#=====================================================================================
-class SchemaEvent:
- def __init__ (self, parent, node, typespec):
- self.parent = parent
- self.name = None
- self.desc = None
- self.args = []
-
- attrs = node.attributes
- for idx in range (attrs.length):
- key = attrs.item(idx).nodeName
- val = attrs.item(idx).nodeValue
- if key == 'name':
- self.name = val
-
- elif key == 'desc':
- self.desc = val
-
- else:
- raise ValueError ("Unknown attribute in event '%s'" % key)
-
- for child in node.childNodes:
- if child.nodeType == Node.ELEMENT_NODE:
- if child.nodeName == 'arg':
- arg = SchemaArg (child, typespec)
- self.args.append (arg)
- else:
- raise ValueError ("Unknown event tag '%s'" % child.nodeName)
-
- def getName (self):
- return self.name
-
- def getFullName (self):
- return self.parent.getName ().capitalize() + self.name.capitalize ()
-
- def getArgCount (self):
- return len (self.args)
-
-#=====================================================================================
-#
-#=====================================================================================
-class SchemaClass:
- def __init__ (self, node, typespec):
- self.configElements = []
- self.instElements = []
- self.methods = []
- self.events = []
-
- attrs = node.attributes
- self.name = attrs['name'].nodeValue
-
- children = node.childNodes
- for child in children:
- if child.nodeType == Node.ELEMENT_NODE:
- if child.nodeName == 'configElement':
- sub = SchemaConfig (child, typespec)
- self.configElements.append (sub)
-
- elif child.nodeName == 'instElement':
- sub = SchemaInst (child, typespec)
- self.instElements.append (sub)
-
- elif child.nodeName == 'method':
- sub = SchemaMethod (self, child, typespec)
- self.methods.append (sub)
-
- elif child.nodeName == 'event':
- sub = SchemaEvent (self, child, typespec)
- self.events.append (sub)
-
- else:
- raise ValueError ("Unknown class tag '%s'" % child.nodeName)
-
- def getName (self):
- return self.name
-
- def getMethods (self):
- return self.methods
-
- def getEvents (self):
- return self.events
-
- #===================================================================================
- # Code Generation Functions. The names of these functions (minus the leading "gen")
- # match the substitution keywords in the template files.
- #===================================================================================
- def genAccessorMethods (self, stream, variables):
- for config in self.configElements:
- if config.access != "RC":
- config.genAccessor (stream)
- for inst in self.instElements:
- inst.genAccessor (stream)
-
- def genConfigCount (self, stream, variables):
- stream.write ("%d" % len (self.configElements))
-
- def genConfigDeclarations (self, stream, variables):
- for element in self.configElements:
- element.genDeclaration (stream)
-
- def genConfigElementSchema (self, stream, variables):
- for config in self.configElements:
- config.genSchema (stream)
-
- def genConstructorArgs (self, stream, variables):
- # Constructor args are config elements with read-create access
- result = ""
- first = 1
- for element in self.configElements:
- if element.isConstructorArg ():
- if first == 1:
- first = 0
- else:
- stream.write (", ")
- element.genFormalParam (stream)
-
- def genConstructorInits (self, stream, variables):
- for element in self.configElements:
- if element.isConstructorArg ():
- stream.write ("," + element.getName () + "(_" + element.getName () + ")")
-
- def genDoMethodArgs (self, stream, variables):
- methodCount = 0
- inArgCount = 0
- for method in self.methods:
- methodCount = methodCount + 1
- for arg in method.args:
- if arg.getDir () == "I" or arg.getDir () == "IO":
- inArgCount = inArgCount + 1
-
- if methodCount == 0:
- stream.write ("string, Buffer&, Buffer& outBuf")
- else:
- if inArgCount == 0:
- stream.write ("string methodName, Buffer&, Buffer& outBuf")
- else:
- stream.write ("string methodName, Buffer& inBuf, Buffer& outBuf")
-
- def genEventCount (self, stream, variables):
- stream.write ("%d" % len (self.events))
-
- def genEventSchema (self, stream, variables):
- pass ###########################################################################
-
- def genHiLoStatResets (self, stream, variables):
- for inst in self.instElements:
- inst.genHiLoStatResets (stream)
-
- def genInitializeElements (self, stream, variables):
- for inst in self.instElements:
- inst.genInitialize (stream)
-
- def genInstChangedStub (self, stream, variables):
- if len (self.instElements) == 0:
- stream.write (" // Stub for getInstChanged. There are no inst elements\n")
- stream.write (" bool getInstChanged (void) { return false; }\n")
-
- def genInstCount (self, stream, variables):
- count = 0
- for inst in self.instElements:
- count = count + 1
- if inst.type.type.style == "wm":
- count = count + 2
- if inst.type.type.style == "mma":
- count = count + 3
- stream.write ("%d" % count)
-
- def genInstDeclarations (self, stream, variables):
- for element in self.instElements:
- element.genDeclaration (stream)
-
- def genInstElementSchema (self, stream, variables):
- for inst in self.instElements:
- inst.genSchema (stream)
-
- def genMethodArgIncludes (self, stream, variables):
- for method in self.methods:
- if method.getArgCount () > 0:
- stream.write ("#include \"qpid/management/Args" +\
- method.getFullName () + ".h\"\n")
-
- def genMethodCount (self, stream, variables):
- stream.write ("%d" % len (self.methods))
-
- def genMethodHandlers (self, stream, variables):
- for method in self.methods:
- stream.write ("\n if (methodName == \"" + method.getName () + "\")\n {\n")
- if method.getArgCount () == 0:
- stream.write (" ArgsNone ioArgs;\n")
- else:
- stream.write (" Args" + method.getFullName () + " ioArgs;\n")
- for arg in method.args:
- if arg.getDir () == "I" or arg.getDir () == "IO":
- stream.write (" " +\
- arg.type.type.getReadCode ("ioArgs." +\
- arg.dir.lower () + "_" +\
- arg.name, "inBuf") + ";\n")
-
- stream.write (" status = coreObject->ManagementMethod (METHOD_" +\
- method.getName().upper() + ", ioArgs);\n")
- stream.write (" outBuf.putLong (status);\n")
- stream.write (" outBuf.putShortString (Manageable::StatusText (status));\n")
- for arg in method.args:
- if arg.getDir () == "O" or arg.getDir () == "IO":
- stream.write (" " +\
- arg.type.type.getWriteCode ("ioArgs." +\
- arg.dir.lower () + "_" +\
- arg.name, "outBuf") + ";\n")
- stream.write (" return;\n }\n")
-
-
- def genMethodIdDeclarations (self, stream, variables):
- number = 1
- for method in self.methods:
- stream.write (" static const uint32_t METHOD_" + method.getName().upper() +\
- " = %d;\n" % number)
- number = number + 1
-
- def genMethodSchema (self, stream, variables):
- for method in self.methods:
- method.genSchema (stream, variables)
-
- def genNameCap (self, stream, variables):
- stream.write (self.name.capitalize ())
-
- def genNameLower (self, stream, variables):
- stream.write (self.name.lower ())
-
- def genNameUpper (self, stream, variables):
- stream.write (self.name.upper ())
-
- def genParentArg (self, stream, variables):
- for config in self.configElements:
- if config.isParentRef == 1:
- stream.write (" _parent")
- return
-
- def genParentRefAssignment (self, stream, variables):
- for config in self.configElements:
- if config.isParentRef == 1:
- stream.write (config.getName () + \
- " = _parent->GetManagementObject ()->getObjectId ();")
- return
-
- def genWriteConfig (self, stream, variables):
- for config in self.configElements:
- config.genWrite (stream);
-
- def genWriteInst (self, stream, variables):
- for inst in self.instElements:
- inst.genWrite (stream);
-
-
-#=====================================================================================
-#
-#=====================================================================================
-class PackageSchema:
- def __init__ (self, typefile, schemafile):
-
- self.classes = []
- self.typespec = TypeSpec (typefile)
-
- dom = parse (schemafile)
- document = dom.documentElement
- if document.tagName != 'schema':
- raise ValueError ("Expected 'schema' node")
- attrs = document.attributes
- self.packageName = attrs['package'].nodeValue
-
- children = document.childNodes
- for child in children:
- if child.nodeType == Node.ELEMENT_NODE:
- if child.nodeName == 'class':
- cls = SchemaClass (child, self.typespec)
- self.classes.append (cls)
- else:
- raise ValueError ("Unknown schema tag '%s'" % child.nodeName)
-
- def getPackageName (self):
- return self.packageName
-
- def getClasses (self):
- return self.classes
diff --git a/qpid/cpp/managementgen/templates/Args.h b/qpid/cpp/managementgen/templates/Args.h
deleted file mode 100644
index 576d891a3f..0000000000
--- a/qpid/cpp/managementgen/templates/Args.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*MGEN:commentPrefix=//*/
-#ifndef _ARGS_/*MGEN:Method.NameUpper*/_
-#define _ARGS_/*MGEN:Method.NameUpper*/_
-
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-/*MGEN:Root.Disclaimer*/
-
-#include "qpid/management/Args.h"
-#include <string>
-
-namespace qpid {
-namespace management {
-
-class Args/*MGEN:Method.NameCamel*/ : public Args
-{
- public:
-/*MGEN:Method.Arguments*/
-};
-
-}}
-
-#endif /*!_ARGS_/*MGEN:Method.NameUpper*/_*/
diff --git a/qpid/cpp/managementgen/templates/Class.cpp b/qpid/cpp/managementgen/templates/Class.cpp
deleted file mode 100644
index d87d11f767..0000000000
--- a/qpid/cpp/managementgen/templates/Class.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*MGEN:commentPrefix=//*/
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-/*MGEN:Root.Disclaimer*/
-
-#include "qpid/log/Statement.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/management/Manageable.h"
-#include "/*MGEN:Class.NameCap*/.h"
-/*MGEN:Class.MethodArgIncludes*/
-
-using namespace qpid::management;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using std::string;
-
-bool /*MGEN:Class.NameCap*/::schemaNeeded = true;
-
-/*MGEN:Class.NameCap*/::/*MGEN:Class.NameCap*/ (Manageable* _core, Manageable*/*MGEN:Class.ParentArg*/,
- /*MGEN:Class.ConstructorArgs*/) :
- ManagementObject(_core, "/*MGEN:Class.NameLower*/")
- /*MGEN:Class.ConstructorInits*/
-{
- /*MGEN:Class.ParentRefAssignment*/
-/*MGEN:Class.InitializeElements*/
-}
-
-/*MGEN:Class.NameCap*/::~/*MGEN:Class.NameCap*/ () {}
-
-namespace {
- const string NAME("name");
- const string TYPE("type");
- const string ACCESS("access");
- const string INDEX("index");
- const string UNIT("unit");
- const string MIN("min");
- const string MAX("max");
- const string MAXLEN("maxlen");
- const string DESC("desc");
- const string ARGCOUNT("argCount");
- const string ARGS("args");
- const string DIR("dir");
- const string DEFAULT("default");
-}
-
-void /*MGEN:Class.NameCap*/::writeSchema (Buffer& buf)
-{
- FieldTable ft;
-
- schemaNeeded = false;
-
- // Schema class header:
- buf.putShortString (className); // Class Name
- buf.putShort (/*MGEN:Class.ConfigCount*/); // Config Element Count
- buf.putShort (/*MGEN:Class.InstCount*/); // Inst Element Count
- buf.putShort (/*MGEN:Class.MethodCount*/); // Method Count
- buf.putShort (/*MGEN:Class.EventCount*/); // Event Count
-
- // Config Elements
-/*MGEN:Class.ConfigElementSchema*/
- // Inst Elements
-/*MGEN:Class.InstElementSchema*/
- // Methods
-/*MGEN:Class.MethodSchema*/
- // Events
-/*MGEN:Class.EventSchema*/
-}
-
-void /*MGEN:Class.NameCap*/::writeConfig (Buffer& buf)
-{
- configChanged = false;
-
- writeTimestamps (buf);
-/*MGEN:Class.WriteConfig*/
-}
-
-void /*MGEN:Class.NameCap*/::writeInstrumentation (Buffer& buf)
-{
- instChanged = false;
-
- writeTimestamps (buf);
-/*MGEN:Class.WriteInst*/
-
- // Maintenance of hi-lo statistics
-/*MGEN:Class.HiLoStatResets*/
-}
-
-void /*MGEN:Class.NameCap*/::doMethod (/*MGEN:Class.DoMethodArgs*/)
-{
- Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
-/*MGEN:Class.MethodHandlers*/
- outBuf.putLong (status);
- outBuf.putShortString (Manageable::StatusText (status));
-}
-
diff --git a/qpid/cpp/managementgen/templates/Class.h b/qpid/cpp/managementgen/templates/Class.h
deleted file mode 100644
index ba6a1183e2..0000000000
--- a/qpid/cpp/managementgen/templates/Class.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*MGEN:commentPrefix=//*/
-#ifndef _MANAGEMENT_/*MGEN:Class.NameUpper*/_
-#define _MANAGEMENT_/*MGEN:Class.NameUpper*/_
-
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-/*MGEN:Root.Disclaimer*/
-
-#include "qpid/sys/Mutex.h"
-#include "qpid/management/ManagementObject.h"
-
-namespace qpid {
-namespace management {
-
-class /*MGEN:Class.NameCap*/ : public ManagementObject
-{
- private:
-
- static bool schemaNeeded;
-
- // Configuration Elements
-/*MGEN:Class.ConfigDeclarations*/
- // Instrumentation Elements
-/*MGEN:Class.InstDeclarations*/
- // Private Methods
- std::string getObjectName (void) { return "/*MGEN:Class.NameLower*/"; }
- void writeSchema (qpid::framing::Buffer& buf);
- void writeConfig (qpid::framing::Buffer& buf);
- void writeInstrumentation (qpid::framing::Buffer& buf);
- bool getSchemaNeeded (void) { return schemaNeeded; }
- void setSchemaNeeded (void) { schemaNeeded = true; }
- void doMethod (std::string methodName,
- qpid::framing::Buffer& inBuf,
- qpid::framing::Buffer& outBuf);
-
-/*MGEN:Class.InstChangedStub*/
- public:
-
- typedef boost::shared_ptr</*MGEN:Class.NameCap*/> shared_ptr;
- qpid::sys::Mutex accessorLock;
-
- /*MGEN:Class.NameCap*/ (Manageable* coreObject, Manageable* parentObject,
- /*MGEN:Class.ConstructorArgs*/);
- ~/*MGEN:Class.NameCap*/ (void);
-
- // Method IDs
-/*MGEN:Class.MethodIdDeclarations*/
- // Accessor Methods
-/*MGEN:Class.AccessorMethods*/
-};
-
-}}
-
-
-#endif /*!_MANAGEMENT_/*MGEN:Class.NameUpper*/_*/
diff --git a/qpid/cpp/managementgen/templates/Makefile.mk b/qpid/cpp/managementgen/templates/Makefile.mk
deleted file mode 100644
index 0e6454c13a..0000000000
--- a/qpid/cpp/managementgen/templates/Makefile.mk
+++ /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.
-#
-/*MGEN:commentPrefix=#*/
-/*MGEN:mgenDir=$(mgen_dir)*/
-/*MGEN:specDir=$(top_srcdir)/../specs*/
-/*MGEN:Root.Disclaimer*/
-
-mgen_generator=/*MGEN:Makefile.GenSources*/
-
-mgen_broker_cpp=/*MGEN:Makefile.GenCppFiles*/
-
-# Header file install rules.
-qpid_managementdir = $(includedir)/qpid/management
-dist_qpid_management_HEADERS = /*MGEN:Makefile.GenHFiles*/
-
-if GENERATE
-$(srcdir)/managementgen.mk: $(mgen_generator)
- $(mgen_cmd)
-
-$(mgen_generator):
-endif
diff --git a/qpid/cpp/qpid-autotools-install b/qpid/cpp/qpid-autotools-install
deleted file mode 100755
index 7fab3d0e9d..0000000000
--- a/qpid/cpp/qpid-autotools-install
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/bin/sh
-# Written by Jim Meyering
-
-VERSION='2007-07-10 09:09' # UTC
-
-prog_name=`basename $0`
-die () { echo "$prog_name: $*" >&2; exit 1; }
-
-tarballs='
- http://pkgconfig.freedesktop.org/releases/pkg-config-0.21.tar.gz
- ftp://ftp.gnu.org/gnu/m4/m4-1.4.10.tar.gz
- ftp://ftp.gnu.org/gnu/automake/automake-1.10.tar.gz
- ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz
- ftp://ftp.gnu.org/gnu/libtool/libtool-1.5.24.tar.gz
-'
-
-usage() {
- echo >&2 "\
-Usage: $0 [OPTION]...
-Download, build, and install some tools.
-
-Options:
- --prefix=PREFIX install tools under specified directory
- --skip-check do not run "make check" (this can save 50+ min)
- --help display this help and exit
-
-For example, to install programs into \$HOME/qpid-tools/bin, run this command:
-
- $prog_name --prefix=\$HOME/qpid-tools
-
-If you've already verified that your system/environment can build working
-versions of these tools, you can make this script complete in just a
-minute or two (rather than about an hour if you let all "make check"
-tests run) by invoking it like this:
-
- $prog_name --prefix=\$HOME/qpid-tools --skip-check
-
-"
-}
-
-# Get the listed tarballs into the current directory.
-get_sources()
-{
- case `wget --help` in
- *'--no-cache'*)
- WGET_COMMAND='wget -nv --no-cache';;
- *'--cache=on/off'*)
- WGET_COMMAND='wget -nv --cache=off';;
- *'--non-verbose'*)
- WGET_COMMAND='wget -nv';;
- *)
- die 'no wget program found; please install it and try again';;
- esac
-
- # Download the each tar-ball along with its signature, if there is one.
- pkgs=
- for t in $(echo $tarballs); do
- base=$(basename $t)
- pkgs="$pkgs $base"
- test -f $base || $WGET_COMMAND $t
-
- # pkg-config has no .sig file.
- case $base in pkg-config*) continue;; esac
-
- test -f $base.sig || $WGET_COMMAND $t.sig
- # Verify each signature.
- gpg --quiet --verify --trust-model=always \
- --trusted-key=32419B785D0CDCFC \
- --trusted-key=3859C03B2E236E47 \
- --trusted-key=B93F60C6B5C4CE13 \
- --trusted-key=F382AE19F4850180 \
- $base.sig > /dev/null 2>&1 \
- || echo "info: not verifying GPG signature for $base" 1>&2
- done
-
- printf 'verifying package SHA1 checksums...' 1>&2
- sha1sum -c --warn --status <<EOF || die "checksum mismatch"
-69f37c509a4757d747b6f4c091d209ab3984d62f autoconf-2.61.tar.gz
-69dc02b083b9a609b28fc4db129fef6a83ed2339 automake-1.10.tar.gz
-b4c994f1bf4a76d2b0c1d0a6f54d16598c15f3db libtool-1.5.24.tar.gz
-26d47c893722d683308f5d9fc172a11d5b2ad8a9 m4-1.4.10.tar.gz
-b2508ba8404cad46ec42f6f58cbca43ae59d715f pkg-config-0.21.tar.gz
-EOF
- printf 'ok\n' 1>&2
- echo $pkgs
-}
-
-#################################################################
-set -e
-
-# Parse options.
-
-make_check=yes
-prefix=
-
-for option
-do
- case $option in
- --help) usage; exit;;
- --skip-check) make_check=no;;
- --prefix=*) prefix=`expr "$option" : '--prefix=\(.*\)'`;;
- *) die "$option: unknown option";;
- esac
-done
-
-test -n "$prefix" \
- || die "you must specify a --prefix"
-
-case $prefix in
- /*) ;;
- *) die 'invalid prefix: '"$prefix"': it must be an absolute name';;
-esac
-
-# Don't run as root.
-# Make sure id -u succeeds.
-my_uid=`id -u`
-test $? = 0 || {
- echo "$0: cannot run \`id -u'" 1>&2
- (exit 1); exit 1
-}
-test $my_uid = 0 && die "please don't run this program as root"
-
-# Ensure that prefix is not /usr/bin or /bin, /sbin, etc.
-case $prefix in
- /bin|/sbin|/usr/bin|/usr/sbin)
- die "don't set PREFIX to a system directory";;
- *) ;;
-esac
-
-# Create a build directory, then cd into it for the rest....
-tmpdir=.build-auto-tools
-mkdir -p $tmpdir
-cd $tmpdir
-
-pkgs=$(get_sources)
-
-for pkg in $pkgs; do
- echo building/installing $pkg...
- dir=$(basename $pkg .tar.gz)
- rm -rf dir
- gzip -dc $pkg|tar xf -
- cd $dir
- ./configure CFLAGS=-O2 LDFLAGS=-s --prefix=$prefix > makerr-config 2>&1
- make -j1 > makerr-build 2>&1
- if test "$make_check" = yes; then
- case $pkg in
- automake*) expected_duration_minutes=40;;
- autoconf*) expected_duration_minutes=15;;
- # libtool*) expected_duration_minutes=3;;
- *);;
- esac
- test -n "$expected_duration_minutes" \
- && echo "running 'make check' for $pkg; NB: this can take over" \
- "$expected_duration_minutes minutes"
- case $pkg in
- # In this package, the check-requires-private test fails.
- # Change the Makefile so it skips that test.
- pkg-config-0.21.tar.gz)
- perl -pi.bak -e 's/check-requires-private //' check/Makefile;;
-
- esac
- make -j1 check > makerr-check 2>&1
- fi
- make -j1 install > makerr-install 2>&1
- echo done at $(date +%Y-%m-%d.%T)
- cd ..
-done
-
-# Without checks (and with existing tarballs), it takes just one minute.
-# Including all checks, it takes nearly an hour on an AMD64/3400+
-
-case $PKG_CONFIG_PATH in
- $prefix/lib/pkgconfig:/usr/lib/pkgconfig)
- echo 'Good! your PKG_CONFIG_PATH envvar is already set';;
- *) cat <<EOF;;
-**************************************************************************
-Be sure that PKG_CONFIG_PATH is set in your environment, e.g.,
-PKG_CONFIG_PATH=$prefix/lib/pkgconfig:/usr/lib/pkgconfig
-**************************************************************************
-EOF
-esac
-
-case $PATH in
- "$prefix/bin:"*) echo 'Good! your PATH is fine';;
- *) cat <<EOF;;
-**************************************************************************
-Be sure that "$prefix/bin" is earlier in your PATH than /bin, /usr/bin, etc.
-**************************************************************************
-EOF
-esac
-
-cat <<EOF
-**************************************************************************
-You may want to remove the tool build directory:
-rm -rf $tmpdir
-**************************************************************************
-EOF
-
-## Local Variables:
-## eval: (add-hook 'write-file-hooks 'time-stamp)
-## time-stamp-start: "VERSION='"
-## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
-## time-stamp-time-zone: "UTC"
-## time-stamp-end: "' # UTC"
-## End:
diff --git a/qpid/cpp/qpid-config.in b/qpid/cpp/qpid-config.in
deleted file mode 100755
index 5a65767a8c..0000000000
--- a/qpid/cpp/qpid-config.in
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/sh
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-exec_prefix_set=no
-includedir=@includedir@
-
-usage()
-{
- cat <<EOF
-Usage: qpid-config [OPTION] ...
-
-Generic options
- --version output Qpid version information.
- --help display this help and exit.
-
-Compilation support options
- --cflags print pre-processor and compiler flags
- --libs print library linking information
-
-Install directories Qpid was configured to
- --prefix[=DIR]
- --exec-prefix[=DIR]
-
-EOF
- exit $1
-}
-
-if test $# -eq 0; then
- usage 1 1>&2
-fi
-
-while test $# -gt 0; do
- case "$1" in
- -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- case $1 in
- --prefix=*)
- prefix=$optarg
- if test $exec_prefix_set = no ; then
- exec_prefix=$optarg
- fi
- ;;
- --prefix)
- echo_prefix=yes
- ;;
- --exec-prefix=*)
- exec_prefix=$optarg
- exec_prefix_set=yes
- ;;
- --exec-prefix)
- echo_exec_prefix=yes
- ;;
- --version)
- echo @QPID_VERSION@
- ;;
- --help)
- usage 0
- ;;
- --cflags)
- echo_cflags=yes
- ;;
- --libs)
- echo_libs=yes
- ;;
- *)
- usage 1 1>&2
- ;;
- esac
- shift
-done
-
-if test "$echo_prefix" = "yes"; then
- echo $prefix
-fi
-
-if test "$echo_exec_prefix" = "yes"; then
- echo $exec_prefix
-fi
-
-if test "$echo_cflags" = "yes"; then
- if test "$includedir" != "/usr/include" ; then
- echo -I$includedir
- fi
-fi
-
-if test "$echo_libs" = "yes"; then
- if test @libdir@ != /usr/lib ; then
- my_linker_flags="-L@libdir@"
- fi
- echo ${my_linker_flags} -lqpidcommon
-fi
-
-
-
-
diff --git a/qpid/cpp/qpidc.spec.in b/qpid/cpp/qpidc.spec.in
deleted file mode 100644
index fd4a24b2e5..0000000000
--- a/qpid/cpp/qpidc.spec.in
+++ /dev/null
@@ -1,243 +0,0 @@
-#
-# Spec file for Qpid C++ packages: qpidc qpidc-devel, qpidd, qpidd-devel
-#
-%define qpidd qpidd
-
-Name: @PACKAGE@
-Version: @VERSION@
-Release: 24%{?dist}
-Summary: Libraries for Qpid C++ client applications
-Group: System Environment/Libraries
-License: Apache Software License
-URL: @URL@
-Source0: @DOWNLOAD_URL@/%{name}-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-ExclusiveArch: i386 x86_64
-
-BuildRequires: boost-devel
-BuildRequires: cppunit-devel
-BuildRequires: doxygen
-BuildRequires: e2fsprogs-devel
-BuildRequires: graphviz
-BuildRequires: help2man
-BuildRequires: libtool
-BuildRequires: pkgconfig
-BuildRequires: ruby
-
-Requires: boost
-
-Requires(post):/sbin/chkconfig
-Requires(preun):/sbin/chkconfig
-Requires(preun):/sbin/service
-Requires(postun):/sbin/service
-
-%description
-Run-time libraries for AMQP client applications developed using Qpid
-C++. Clients exchange messages with an AMQP message broker using
-the AMQP protocol.
-
-%package devel
-Summary: Header files and documentation for developing Qpid C++ clients
-Group: Development/System
-Requires: %name = %version-%release
-Requires: boost-devel
-Requires: e2fsprogs-devel
-
-%description devel
-Libraries, header files and documentation for developing AMQP clients
-in C++ using Qpid. Qpid implements the AMQP messaging specification.
-
-%package -n %{qpidd}
-Summary: An AMQP message broker daemon
-Group: System Environment/Daemons
-Requires: %name = %version-%release
-Requires: openais
-
-%description -n %{qpidd}
-A message broker daemon that receives stores and routes messages using
-the open AMQP messaging protocol.
-
-%package -n %{qpidd}-devel
-Summary: Libraries and header files for developing Qpid broker extensions
-Group: Development/System
-Requires: %name-devel = %version-%release
-Requires: %{qpidd} = %version-%release
-Requires: openais-devel
-
-%description -n %{qpidd}-devel
-Libraries and header files for developing extensions to the
-Qpid broker daemon.
-
-%prep
-%setup -q
-
-%build
-%configure --disable-static --without-cpg CXXFLAGS="-g -O3 -DNDEBUG"
-make %{?_smp_mflags}
-# Remove this generated perl file, we don't need it and it upsets rpmlint.
-rm docs/api/html/installdox
-
-%install
-rm -rf %{buildroot}
-make install-strip DESTDIR=%{buildroot}
-install -Dp -m0755 etc/qpidd %{buildroot}%{_initrddir}/qpidd
-install -d -m0755 %{buildroot}%{_localstatedir}/lib/qpidd
-rm -f %{buildroot}%_libdir/*.a
-rm -f %{buildroot}%_libdir/*.la
-
-%clean
-rm -rf %{buildroot}
-
-%check
-make check
-
-%files
-%defattr(-,root,root,-)
-%doc LICENSE NOTICE README
-%_libdir/libqpidcommon.so.0
-%_libdir/libqpidcommon.so.0.1.0
-%_libdir/libqpidclient.so.0
-%_libdir/libqpidclient.so.0.1.0
-%config(noreplace) %_sysconfdir/qpidd.conf
-
-%files devel
-%defattr(-,root,root,-)
-%_includedir/qpid/*.h
-%_includedir/qpid/amqp_0_10
-%_includedir/qpid/client
-%_includedir/qpid/framing
-%_includedir/qpid/sys
-%_includedir/qpid/log
-%_includedir/qpid/management
-%_libdir/libqpidcommon.so
-%_libdir/libqpidclient.so
-%doc %_datadir/%{name}/examples
-%doc docs/api/html
-
-%files -n %{qpidd}
-%defattr(-,root,root,-)
-%_libdir/libqpidbroker.so.0
-%_libdir/libqpidbroker.so.0.1.0
-%_libdir/libqpidcluster.so.0
-%_libdir/libqpidcluster.so.0.1.0
-%_sbindir/%{qpidd}
-%{_initrddir}/%{qpidd}
-%_localstatedir/lib/qpidd
-%doc %_mandir/man1/%{qpidd}.*
-
-%files -n %{qpidd}-devel
-%defattr(-,root,root,-)
-%doc rpm/README.qpidd-devel
-%defattr(-,root,root,-)
-%_libdir/libqpidbroker.so
-%_libdir/libqpidcluster.so
-%_includedir/qpid/broker
-
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
-%post -n %{qpidd}
-# This adds the proper /etc/rc*.d links for the script
-/sbin/chkconfig --add qpidd
-/sbin/ldconfig
-
-%preun -n %{qpidd}
-# Check that this is actual deinstallation, not just removing for upgrade.
-if [ $1 = 0 ]; then
- /sbin/service qpidd stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del qpidd
-fi
-
-%postun -n %{qpidd}
-if [ "$1" -ge "1" ]; then
- /sbin/service qpidd condrestart >/dev/null 2>&1 || :
-fi
-/sbin/ldconfig
-
-%changelog
-* Mon Feb 18 2008 Rafael Schloming <rafaels@redhat.com> - 0.2-24
-- Bug fix for TCK issue in Beta 3
-
-* Thu Feb 14 2008 Rafael Schloming <rafaels@redhat.com> - 0.2-23
-- Bumped to pull in fixes for Beta 3
-
-* Tue Feb 12 2008 Alan Conway <aconway@redhat.com> - 0.2-22
-- Added -g to compile flags for debug symbols.
-
-* Tue Feb 12 2008 Alan Conway <aconway@redhat.com> - 0.2-21
-- Create /var/lib/qpidd correctly.
-
-* Mon Feb 11 2008 Rafael Schloming <rafaels@redhat.com> - 0.2-20
-- bumped for Beta 3
-
-* Mon Jan 21 2008 Gordon Sim <gsim@redhat.com> - 0.2-18
-- bump up rev for recent changes to plugin modules & mgmt
-
-* Thu Jan 03 2008 Nuno Santos <nsantos@redhat.com> - 0.2-17
-- add missing header file SessionManager.h
-
-* Thu Jan 03 2008 Nuno Santos <nsantos@redhat.com> - 0.2-16
-- limit builds to i386 and x86_64 archs
-
-* Thu Jan 03 2008 Nuno Santos <nsantos@redhat.com> - 0.2-15
-- add ruby as a build dependency
-
-* Tue Dec 18 2007 Nuno Santos <nsantos@redhat.com> - 0.2-14
-- include fixes from Gordon Sim (fragmentation, lazy-loading, staging)
- and Alan Conway (exception handling in the client).
-
-* Thu Dec 6 2007 Alan Conway <aconway@redhat.com> - 0.2-13
-- installcheck target to build examples in installation.
-
-* Thu Nov 8 2007 Alan Conway <aconway@redhat.com> - 0.2-10
-- added examples to RPM package.
-
-* Thu Oct 9 2007 Alan Conway <aconway@redhat.com> - 0.2-9
-- added config(noreplace) for qpidd.conf
-
-* Thu Oct 4 2007 Alan Conway <aconway@redhat.com> - 0.2-8
-- Added qpidd.conf configuration file.
-- Updated man page to detail configuration options.
-
-* Thu Sep 20 2007 Alan Conway <aconway@redhat.com> - 0.2-7
-- Removed apr dependency.
-
-* Wed Aug 1 2007 Alan Conway <aconway@redhat.com> - 0.2-6
-- added --disable-cluster flag
-
-* Tue Apr 17 2007 Alan Conway <aconway@redhat.com> - 0.2-5
-- Add missing Requires: e2fsprogs-devel for qpidc-devel.
-
-* Tue Apr 17 2007 Alan Conway <aconway@redhat.com> - 0.2-4
-- longer broker_start timeout to avoid failures in plague builds.
-
-* Tue Apr 17 2007 Alan Conway <aconway@redhat.com> - 0.2-3
-- Add missing Requires: apr in qpidc.
-
-* Mon Apr 16 2007 Alan Conway <aconway@redhat.com> - 0.2-2
-- Bugfix for memory errors on x86_64.
-
-* Thu Apr 12 2007 Alan Conway <aconway@redhat.com> - 0.2-1
-- Bumped version number for rhm dependencies.
-
-* Wed Apr 11 2007 Alan Conway <aconway@redhat.com> - 0.1-5
-- Add qpidd-devel sub-package.
-
-* Mon Feb 19 2007 Jim Meyering <meyering@redhat.com> - 0.1-4
-- Address http://bugzilla.redhat.com/220630:
-- Remove redundant "cppunit" build-requires.
-- Add --disable-static.
-
-* Thu Jan 25 2007 Alan Conway <aconway@redhat.com> - 0.1-3
-- Applied Jim Meyerings fixes from http://mail-archives.apache.org/mod_mbox/incubator-qpid-dev/200701.mbox/<87hcugzmyp.fsf@rho.meyering.net>
-
-* Mon Dec 22 2006 Alan Conway <aconway@redhat.com> - 0.1-1
-- Fixed all rpmlint complaints (with help from David Lutterkort)
-- Added qpidd --daemon behaviour, fix init.rc scripts
-
-* Fri Dec 8 2006 David Lutterkort <dlutter@redhat.com> - 0.1-1
-- Initial version based on Jim Meyering's sketch and discussions with Alan
- Conway
-
diff --git a/qpid/cpp/rpm/README.qpidd-devel b/qpid/cpp/rpm/README.qpidd-devel
deleted file mode 100644
index f64a9de3b3..0000000000
--- a/qpid/cpp/rpm/README.qpidd-devel
+++ /dev/null
@@ -1,7 +0,0 @@
-
-This package provides header files needed to implement extensions to
-the Qpid broker daemon. This feature is experimental and undocumented,
-it is not require for normal use of qpid.
-
-See http://cwiki.apache.org/qpid/ for more information about the qpid project.
-
diff --git a/qpid/cpp/rubygen/0-10/specification.rb b/qpid/cpp/rubygen/0-10/specification.rb
deleted file mode 100755
index 026b49e1a9..0000000000
--- a/qpid/cpp/rubygen/0-10/specification.rb
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/usr/bin/env ruby
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class Specification < CppGen
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @ns="qpid::amqp_#{@amqp.version.bars}"
- @dir="qpid/amqp_#{@amqp.version.bars}"
- end
-
- # domains
-
- def domain_h(d)
- genl
- typename=d.name.typename
- if d.enum
- scope("enum #{typename} {", "};") {
- genl d.enum.choices.map { |c|
- "#{c.name.constname} = #{c.value}" }.join(",\n")
- }
- elsif (d.type_ == "array")
- genl "typedef Array<#{ArrayTypes[d.name].amqp2cpp}> #{typename};"
- else
- genl "typedef #{d.type_.amqp2cpp} #{typename};"
- end
- end
-
- # class constants
-
- def class_h(c)
- genl "const uint8_t CODE=#{c.code};"
- genl "extern const char* NAME;"
- end
-
- def class_cpp(c)
- genl "const char* NAME=\"#{c.fqname}\";"
- end
-
- # Used by structs, commands and controls.
- def action_struct_h(x, base, consts, &block)
- genl
- struct(x.classname, "public #{base}") {
- x.fields.each { |f| genl "#{f.type_.amqp2cpp} #{f.cppname};" }
- genl
- genl "static const char* NAME;"
- consts.each { |c| genl "static const uint8_t #{c.upcase}=#{x.send c or 0};"}
- genl "static const uint8_t CLASS_CODE=#{x.containing_class.nsname}::CODE;"
- genl
- genl "#{x.classname}();"
- scope("#{x.classname}(",");") { genl x.parameters } unless x.fields.empty?
- genl
- genl "void accept(Visitor&) const;"
- genl
- yield if block
- }
- end
-
- def action_struct_cpp(x)
- genl
- genl "const char* #{x.classname}::NAME=\"#{x.fqname}\";"
- genl
- genl "#{x.classname}::#{x.classname}() {}";
- genl
- if not x.fields.empty?
- scope("#{x.classname}::#{x.classname}(",") :") { genl x.parameters }
- indent() { genl x.initializers }
- genl "{}"
- genl
- end
- scope("void #{x.classname}::accept(Visitor&) const {","}") {
- genl "// FIXME aconway 2008-02-27: todo"
- }
- end
-
- # structs
-
- def struct_h(s) action_struct_h(s, "Struct", ["size","pack","code"]); end
- def struct_cpp(s) action_struct_cpp(s) end
-
- # command and control
-
- def action_h(a)
- action_struct_h(a, a.base, ["code"]) {
- scope("template <class T> void invoke(T& target) {","}") {
- scope("target.#{a.funcname}(", ");") { genl a.values }
- }
- genl
- scope("template <class S> void serialize(S& s) {","}") {
- gen "s"
- a.fields.each { |f| gen "(#{f.cppname})"}
- genl ";"
- } unless a.fields.empty?
- }
- end
-
- def action_cpp(a) action_struct_cpp(a); end
-
- # Types that must be generated early because they are used by other types.
- def pregenerate?(x) not @amqp.used_by[x.fqname].empty?; end
-
- # Generate the log
- def gen_specification()
- h_file("#{@dir}/specification") {
- include "#{@dir}/built_in_types"
- include "#{@dir}/helpers"
- include "<boost/call_traits.hpp>"
- genl "using boost::call_traits;"
- namespace(@ns) {
- # Top level
- @amqp.domains.each { |d|
- # segment-type and track are are built in
- domain_h d unless ["track","segment-type"].include?(d.name)
- }
- puts @amqp.used_by.inspect
-
- # Domains and structs that must be generated early because
- # they are used by other definitions:
- each_class_ns { |c|
- class_h c
- c.domains.each { |d| domain_h d if pregenerate? d }
- c.structs.each { |s| struct_h s if pregenerate? s }
- }
- # Now dependent domains/structs and actions
- each_class_ns { |c|
- c.domains.each { |d| domain_h d if not pregenerate? d }
- c.structs.each { |s| struct_h s if not pregenerate? s }
- c.actions.each { |a| action_h a }
- }
- }
- }
-
- cpp_file("#{@dir}/specification") {
- include "#{@dir}/specification"
- namespace(@ns) {
- each_class_ns { |c|
- class_cpp c
- c.actions.each { |a| action_cpp a}
- c.structs.each { |s| struct_cpp s }
- }
- }
- }
- end
-
- def gen_proxy()
- h_file("#{@dir}/Proxy.h") {
- include "#{@dir}/specification"
- namespace(@ns) {
- genl "template <class F, class R=F::result_type>"
- cpp_class("ProxyTemplate") {
- public
- genl "ProxyTemplate(F f) : functor(f) {}"
- @amqp.classes.each { |c|
- c.actions.each { |a|
- scope("R #{a.funcname}(", ")") { genl a.parameters }
- scope() {
- var=a.name.funcname
- scope("#{a.classname} #{var}(",");") { genl a.arguments }
- genl "return functor(#{var});"
- }
- }
- }
- private
- genl "F functor;"
- }
- }
- }
- end
-
- def generate
- gen_specification
- gen_proxy
- end
-end
-
-Specification.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/99-0/MethodBodyConstVisitor.rb b/qpid/cpp/rubygen/99-0/MethodBodyConstVisitor.rb
deleted file mode 100755
index f9ef95f5a0..0000000000
--- a/qpid/cpp/rubygen/99-0/MethodBodyConstVisitor.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env ruby
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class MethodBodyConstVisitorGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @namespace="qpid::framing"
- @classname="MethodBodyConstVisitor"
- @filename="qpid/framing/MethodBodyConstVisitor"
- end
-
- def generate()
- h_file("#{@filename}") {
- namespace(@namespace) {
- @amqp.methods_.each { |m| genl "class #{m.body_name};" }
- cpp_class("MethodBodyConstVisitor") {
- genl "public:"
- genl "virtual ~MethodBodyConstVisitor() {}"
- @amqp.methods_.each { |m| genl "virtual void visit(const #{m.body_name}&) = 0;" }
- }}}
- end
-end
-
-MethodBodyConstVisitorGen.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/99-0/MethodBodyDefaultVisitor.rb b/qpid/cpp/rubygen/99-0/MethodBodyDefaultVisitor.rb
deleted file mode 100755
index a74b0c06d6..0000000000
--- a/qpid/cpp/rubygen/99-0/MethodBodyDefaultVisitor.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env ruby
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class MethodBodyDefaultVisitorGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @namespace, @classname, @filename = parse_classname("qpid::framing::MethodBodyDefaultVisitor")
- end
-
- def generate()
- h_file(@filename) {
- include "qpid/framing/MethodBodyConstVisitor"
- namespace(@namespace) {
- genl "class AMQMethodBody;"
- cpp_class(@classname, "public MethodBodyConstVisitor") {
- genl "public:"
- genl "virtual void defaultVisit(const AMQMethodBody&) = 0;"
- @amqp.methods_.each { |m|
- genl "virtual void visit(const #{m.body_name}&);" }
- }}}
-
- cpp_file(@filename) {
- include(@filename)
- include("all_method_bodies.h")
- namespace(@namespace) {
- @amqp.methods_.each { |m|
- genl "void #{@classname}::visit(const #{m.body_name}& b) { defaultVisit(b); }"
- }}}
- end
-end
-
-MethodBodyDefaultVisitorGen.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/99-0/MethodHolder.rb b/qpid/cpp/rubygen/99-0/MethodHolder.rb
deleted file mode 100755
index a708db6676..0000000000
--- a/qpid/cpp/rubygen/99-0/MethodHolder.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env ruby
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class MethodHolderGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @namespace="qpid::framing"
- @classname="BodyHolder"
- @filename="qpid/framing/BodyHolder"
- end
-
- def gen_max_size()
- # Generate program to generate MaxSize.h
- cpp_file("generate_MaxMethodBodySize_h") {
- include "qpid/framing/AMQHeaderBody"
- include "qpid/framing/AMQContentBody"
- include "qpid/framing/AMQHeartbeatBody"
- @amqp.methods_.each { |m| include "qpid/framing/#{m.body_name}" }
- genl
- include "<algorithm>"
- include "<fstream>"
- genl
- genl "using namespace std;"
- genl "using namespace qpid::framing;"
- genl
- scope("int main(int, char** argv) {") {
- genl "size_t maxSize=0;"
- genl "maxSize=max(maxSize, sizeof(AMQHeaderBody));"
- genl "maxSize=max(maxSize, sizeof(AMQContentBody));"
- genl "maxSize=max(maxSize, sizeof(AMQHeartbeatBody));"
- @amqp.methods_.each { |m|
- genl "maxSize=max(maxSize, sizeof(#{m.body_name}));" }
- gen <<EOS
-ofstream out("qpid/framing/MaxMethodBodySize.h");
-out << "// GENERATED CODE: generated by " << argv[0] << endl;
-out << "namespace qpid{ namespace framing { " << endl;
-out << "const size_t MAX_METHOD_BODY_SIZE=" << maxSize << ";" << endl;
-out << "}}" << endl;
-EOS
- }
- }
- end
-
- def gen_construct
- cpp_file(@filename+"_gen") {
- include @filename
- include "qpid/framing/AMQHeaderBody"
- include "qpid/framing/AMQContentBody"
- include "qpid/framing/AMQHeartbeatBody"
- @amqp.methods_.each { |m| include "qpid/framing/#{m.body_name}" }
- include "qpid/framing/FrameDefaultVisitor.h"
- include "qpid/Exception.h"
- genl
- namespace(@namespace) {
- scope("void #{@classname}::setMethod(ClassId c, MethodId m) {") {
- scope("switch (c) {") {
- @amqp.classes.each { |c|
- scope("case #{c.index}: switch(m) {") {
- c.methods_.each { |m|
- genl "case #{m.index}: blob = in_place<#{m.body_name}>(); break;"
- }
- genl "default: throw Exception(QPID_MSG(\"Invalid method id \" << int(m) << \" for class #{c.name} \"));"
- }
- genl "break;"
- }
- genl "default: throw Exception(QPID_MSG(\"Invalid class id \" << int(c)));"
- }
- }
-
- struct("CopyVisitor", "public FrameDefaultVisitor") {
- genl "using FrameDefaultVisitor::visit;"
- genl "using FrameDefaultVisitor::defaultVisit;"
- genl "BodyHolder& holder;"
- genl "CopyVisitor(BodyHolder& h) : holder(h) {}"
- ["Header", "Content", "Heartbeat"].each { |type|
- genl "void visit(const AMQ#{type}Body& x) { holder=x; }"
- }
- @amqp.methods_.each { |m|
- genl "void visit(const #{m.body_name}& x) { holder=x; }"
- }
- genl "void defaultVisit(const AMQBody&) { assert(0); }"
- }
- genl
-
- scope("void BodyHolder::setBody(const AMQBody& b) {") {
- genl "CopyVisitor cv(*this); b.accept(cv);"
- }
- }}
- end
-
- def generate
- gen_max_size
- gen_construct
- end
-end
-
-MethodHolderGen.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/99-0/Operations.rb b/qpid/cpp/rubygen/99-0/Operations.rb
deleted file mode 100755
index c985bb6105..0000000000
--- a/qpid/cpp/rubygen/99-0/Operations.rb
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env ruby
-# Usage: output_directory xml_spec_file [xml_spec_file...]
-#
-$: << '..'
-require 'cppgen'
-require 'fileutils'
-require 'etc'
-require 'pathname'
-
-class OperationsGen < CppGen
-
- def initialize(chassis, outdir, amqp)
- super(outdir, amqp)
- @chassis=chassis
- @classname="AMQP_#{@chassis.caps}Operations"
- end
-
- def handler_method (m)
- return_type = m.result ? m.result.cpptype.ret : "void"
- gen "\nvirtual #{return_type} #{m.cppname}("
- gen m.signature.join(",\n")
- gen ") = 0;\n"
- end
-
- def handler_classname(c) c.name.caps+"Handler"; end
-
- def handler_class(c)
- if (!c.methods_on(@chassis).empty?)
- handlerclass=handler_classname c
- gen <<EOS
-// ==================== class #{handlerclass} ====================
-class #{handlerclass} {
- // Constructors and destructors
- public:
- class Invoker; // Declared in #{@chassis.caps}Invoker
-
- #{handlerclass}(){};
- virtual ~#{handlerclass}() {}
- // Protocol methods
-EOS
- c.methods_on(@chassis).each { |m| handler_method(m) if !m.content() }
- gen <<EOS
-}; // class #{handlerclass}
-
-
-EOS
- end
- end
-
- def handler_get(c)
- if (!c.methods_on(@chassis).empty?)
- handlerclass=handler_classname c
- gen "virtual #{handlerclass}* get#{handlerclass}() = 0;\n"
- end
- end
-
- def generate()
- h_file("qpid/framing/#{@classname}.h") {
- gen <<EOS
-#include <sstream>
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/framing/amqp_structs.h"
-
-namespace qpid {
-namespace framing {
-
-class AMQMethodBody;
-
-class #{@classname} {
- public:
- class Invoker; // Declared in #{@chassis.caps}Invoker
-
- virtual ~#{@classname}() {}
-
- virtual ProtocolVersion getVersion() const = 0;
-
- // Inner classes
-EOS
- indent { @amqp.classes.each { |c| handler_class(c) } }
- gen <<EOS
-
- // Method handler get methods
-
-EOS
- indent { @amqp.classes.each { |c| handler_get(c) } }
- gen <<EOS
-}; /* class #{@classname} */
-}}
-EOS
-}
- end
-end
-
-OperationsGen.new("client",ARGV[0], $amqp).generate()
-OperationsGen.new("server",ARGV[0], $amqp).generate()
-
diff --git a/qpid/cpp/rubygen/99-0/OperationsInvoker.rb b/qpid/cpp/rubygen/99-0/OperationsInvoker.rb
deleted file mode 100755
index 642f98ce8e..0000000000
--- a/qpid/cpp/rubygen/99-0/OperationsInvoker.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env ruby
-# Usage: output_directory xml_spec_file [xml_spec_file...]
-#
-$: << '..'
-require 'cppgen'
-
-class OperationsInvokerGen < CppGen
- def initialize(chassis, outdir, amqp)
- super(outdir, amqp)
- @chassis=chassis
- @ops="AMQP_#{@chassis.caps}Operations"
- @classname="#{@ops}::Invoker"
- @filename="qpid/framing/#{@chassis.caps}Invoker"
- end
-
- def handler(c) "#{@ops}::#{c.cppname}Handler"; end
- def getter(c) "get#{c.cppname}Handler"; end
- def invoker(c) "#{handler(c)}::Invoker"; end
- def visit_methods(c) c.methods_on(@chassis).select { |m| !m.content } end
-
- def handler_visits_cpp(c)
- visit_methods(c).each { |m|
- scope("void #{invoker(c)}::visit(const #{m.body_name}& body) {") {
- if (m.result)
- genl "this->encode(body.invoke(target), result.result);"
- else
- genl "body.invoke(target);"
- end
- genl "result.handled=true;"
- }
- }
- end
-
- def ops_visits_cpp()
- @amqp.classes.each { |c|
- visit_methods(c).each { |m|
- scope("void #{@classname}::visit(const #{m.body_name}& body) {") {
- genl "#{handler(c)}::Invoker invoker(*target.#{getter(c)}());"
- genl "body.accept(invoker);"
- genl "result=invoker.getResult();"
- }
- }
- }
- end
-
- def invoker_h(invoker, target, methods)
- return if methods.empty?
- genl
- cpp_class(invoker, "public qpid::framing::Invoker") {
- genl "#{target}& target;"
- public
- genl("Invoker(#{target}& target_) : target(target_) {}")
- genl "using MethodBodyDefaultVisitor::visit;"
- methods.each { |m| genl "void visit(const #{m.body_name}& body);" }
- }
- end
-
- def generate()
- h_file(@filename) {
- include "qpid/framing/#{@ops}"
- include "qpid/framing/Invoker.h"
- namespace("qpid::framing") {
- # AMQP_*Operations invoker.
- methods=@amqp.classes.map { |c| visit_methods(c).to_a }.flatten
- invoker_h(@classname, @ops, methods)
-
- # AMQP_*Operations::*Handler invokers.
- @amqp.classes.each { |c|
- invoker_h(invoker(c), handler(c), visit_methods(c))
- }
- }
- }
-
- cpp_file(@filename) {
- include @filename
- @amqp.classes.each { |c|
- visit_methods(c).each { |m|
- include "qpid/framing/#{m.body_name}"
- }}
- namespace("qpid::framing") {
- ops_visits_cpp
- @amqp.classes.each { |c|
- next if visit_methods(c).empty?
- handler_visits_cpp(c)
- }
- }
- }
- end
-end
-
-OperationsInvokerGen.new("client",ARGV[0], $amqp).generate()
-OperationsInvokerGen.new("server",ARGV[0], $amqp).generate()
diff --git a/qpid/cpp/rubygen/99-0/Proxy.rb b/qpid/cpp/rubygen/99-0/Proxy.rb
deleted file mode 100755
index 2829884673..0000000000
--- a/qpid/cpp/rubygen/99-0/Proxy.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env ruby
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class ProxyGen < CppGen
-
- def initialize(chassis, outdir, amqp)
- super(outdir, amqp)
- @chassis=chassis
- @classname="AMQP_#{@chassis.caps}Proxy"
- @filename="qpid/framing/#{@classname}"
- end
-
- def proxy_member(c) c.name.lcaps+"Proxy"; end
-
- def inner_class_decl(c)
- cname=c.name.caps
- cpp_class(cname, "Proxy") {
- gen <<EOS
-public:
-#{cname}(FrameHandler& f) : Proxy(f) {}
-static #{cname}& get(#{@classname}& proxy) { return proxy.get#{cname}(); }
-EOS
- c.methods_on(@chassis).each { |m|
- genl "virtual void #{m.cppname}(#{m.signature.join(",\n ")});"
- genl
- }}
- end
-
- def inner_class_defn(c)
- cname=c.cppname
- c.methods_on(@chassis).each { |m|
- genl "void #{@classname}::#{cname}::#{m.cppname}(#{m.signature.join(", ")})"
- scope {
- params=(["getVersion()"]+m.param_names).join(", ")
- genl "send(#{m.body_name}(#{params}));"
- }}
- end
-
- def generate
- # .h file
- h_file(@filename) {
- include "qpid/framing/Proxy.h"
- include "qpid/framing/amqp_types.h"
- namespace("qpid::framing") {
- cpp_class(@classname, "public Proxy") {
- public
- genl "#{@classname}(FrameHandler& out);"
- genl
- @amqp.classes.each { |c|
- inner_class_decl(c)
- genl
- genl "#{c.cppname}& get#{c.cppname}() { return #{proxy_member(c)}; }"
- genl
- }
- private
- @amqp.classes.each{ |c| gen c.cppname+" "+proxy_member(c)+";\n" }
- }}}
-
- # .cpp file
- cpp_file(@filename) {
- include "<sstream>"
- include "#{@classname}.h"
- include "qpid/framing/amqp_types_full.h"
- @amqp.methods_on(@chassis).each {
- |m| include "qpid/framing/"+m.body_name
- }
- genl
- namespace("qpid::framing") {
- genl "#{@classname}::#{@classname}(FrameHandler& f) :"
- gen " Proxy(f)"
- @amqp.classes.each { |c| gen ",\n "+proxy_member(c)+"(f)" }
- genl "{}\n"
- @amqp.classes.each { |c| inner_class_defn(c) }
- }}
- end
-end
-
-
-ProxyGen.new("client", $outdir, $amqp).generate;
-ProxyGen.new("server", $outdir, $amqp).generate;
-
diff --git a/qpid/cpp/rubygen/99-0/Session.rb b/qpid/cpp/rubygen/99-0/Session.rb
deleted file mode 100644
index e01a28a62d..0000000000
--- a/qpid/cpp/rubygen/99-0/Session.rb
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/env ruby
-# Usage: output_directory xml_spec_file [xml_spec_file...]
-#
-$: << '..'
-require 'cppgen'
-
-class CppGen
- def session_methods
- excludes = ["channel", "connection", "session", "execution"]
- gen_methods=@amqp.methods_on(@chassis).reject { |m|
- excludes.include? m.parent.name
- }
- end
-
- def doxygen(m)
- doxygen_comment {
- genl m.doc
- genl
- m.fields_c.each { |f|
- genl "@param #{f.cppname}"
- genl f.doc if f.doc
- genl
- }
- }
- end
-end
-
-class ContentField # For extra content parameters
- def cppname() "content" end
- def signature() "const MethodContent& content" end
- def sig_default() signature+"="+"DefaultContent(std::string())" end
- def unpack() "p[arg::content|DefaultContent(std::string())]"; end
- def doc() "Message content"; end
-end
-
-class AmqpField
- def unpack() "p[arg::#{cppname}|#{cpptype.default_value}]"; end
- def sig_default() signature+"="+cpptype.default_value; end
-end
-
-class AmqpMethod
- def fields_c() content ? fields+[ContentField.new] : fields end
- def param_names_c() fields_c.map { |f| f.cppname} end
- def signature_c() fields_c.map { |f| f.signature }; end
- def sig_c_default() fields_c.map { |f| f.sig_default }; end
- def argpack_name() "#{parent.cppname}#{name.caps}Parameters"; end
- def argpack_type()
- "boost::parameter::parameters<" +
- fields_c.map { |f| "arg::keyword_tags::"+f.cppname }.join(',') +
- ">"
- end
- def return_type()
- return "TypedResult<qpid::framing::#{result.cpptype.ret}>" if (result)
- return "Response" if (not responses().empty?)
- return "Completion"
- end
- def session_function() "#{parent.name.lcaps}#{name.caps}"; end
-end
-
-class SessionNoKeywordGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @chassis="server"
- @namespace,@classname,@file=
- parse_classname "qpid::client::no_keyword::Session_#{@amqp.version.bars}"
- end
-
- def generate()
- h_file(@file) {
- include "qpid/client/SessionBase.h"
-
- namespace("qpid::client") {
- genl "using std::string;"
- genl "using framing::Content;"
- genl "using framing::FieldTable;"
- genl "using framing::MethodContent;"
- genl "using framing::SequenceNumberSet;"
- genl "using framing::Uuid;"
- genl
- namespace("no_keyword") {
- doxygen_comment {
- genl "AMQP #{@amqp.version} session API."
- genl @amqp.class_("session").doc
- }
- cpp_class(@classname, "public SessionBase") {
- public
- genl "Session_#{@amqp.version.bars}() {}"
- genl "Session_#{@amqp.version.bars}(shared_ptr<SessionCore> core) : SessionBase(core) {}"
- session_methods.each { |m|
- genl
- doxygen(m)
- args=m.sig_c_default.join(", ")
- genl "#{m.return_type} #{m.session_function}(#{args});"
- }
- }}}}
-
- cpp_file(@file) {
- include @classname
- include "qpid/framing/all_method_bodies.h"
- namespace(@namespace) {
- genl "using namespace framing;"
- session_methods.each { |m|
- genl
- sig=m.signature_c.join(", ")
- func="#{@classname}::#{m.session_function}"
- scope("#{m.return_type} #{func}(#{sig}) {") {
- args=(["ProtocolVersion()"]+m.param_names).join(", ")
- body="#{m.body_name}(#{args})"
- sendargs=body
- sendargs << ", content" if m.content
- genl "return #{m.return_type}(impl->send(#{sendargs}), impl);"
- }}}}
- end
-end
-
-class SessionGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @chassis="server"
- session="Session_#{@amqp.version.bars}"
- @base="no_keyword::#{session}"
- @fqclass=FqClass.new "qpid::client::#{session}"
- @classname=@fqclass.name
- @fqbase=FqClass.new("qpid::client::#{@base}")
- end
-
- def gen_keyword_decl(m, prefix)
- return if m.fields_c.empty? # Inherited function will do.
- scope("BOOST_PARAMETER_MEMFUN(#{m.return_type}, #{m.session_function}, 0, #{m.fields_c.size}, #{m.argpack_name}) {") {
- scope("return #{prefix}#{m.session_function}(",");") {
- gen m.fields_c.map { |f| f.unpack() }.join(",\n")
- }
- }
- genl
- end
-
- def generate()
- keyword_methods=session_methods.reject { |m| m.fields_c.empty? }
- max_arity = keyword_methods.map{ |m| m.fields_c.size }.max
-
- h_file(@fqclass.file) {
- include @fqbase.file
- genl
- genl "#define BOOST_PARAMETER_MAX_ARITY #{max_arity}"
- include "<boost/parameter.hpp>"
- genl
- namespace("qpid::client") {
- # Generate keyword tag declarations.
- namespace("arg") {
- keyword_methods.map{ |m| m.param_names_c }.flatten.uniq.each { |k|
- genl "BOOST_PARAMETER_KEYWORD(keyword_tags, #{k})"
- }}
- genl
- # Doxygen comment.
- doxygen_comment {
- genl "AMQP #{@amqp.version} session API with keyword arguments."
- genl <<EOS
-This class provides the same set of functions as #{@base}, but also
-allows parameters be passed using keywords. The keyword is the
-parameter name in the namespace "arg".
-
-For example given the normal function "foo(int x=0, int y=0, int z=0)"
-you could call it in either of the following ways:
-
-@code
-session.foo(1,2,3); // Normal no keywords
-session.foo(arg::z=3, arg::x=1); // Keywords and a default
-@endcode
-
-The keyword functions are easy to use but their declarations are hard
-to read. You may find it easier to read the documentation for #{@base}
-which provides the same set of functions using normal non-keyword
-declarations.
-
-\\ingroup clientapi
-EOS
- }
- # Session class.
- cpp_class(@classname,"public #{@base}") {
- private
- genl "#{@classname}(shared_ptr<SessionCore> core) : #{ @base}(core) {}"
- keyword_methods.each { |m| typedef m.argpack_type, m.argpack_name }
- genl "friend class Connection;"
- public
- genl "#{@classname}() {}"
- keyword_methods.each { |m| gen_keyword_decl(m,@base+"::") }
- }}}
- end
-end
-
-SessionNoKeywordGen.new(ARGV[0], $amqp).generate()
-SessionGen.new(ARGV[0], $amqp).generate()
-
diff --git a/qpid/cpp/rubygen/99-0/all_method_bodies.rb b/qpid/cpp/rubygen/99-0/all_method_bodies.rb
deleted file mode 100755
index 5971d49189..0000000000
--- a/qpid/cpp/rubygen/99-0/all_method_bodies.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env ruby
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class AllMethodBodiesGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @namespace="qpid::framing"
- @filename="qpid/framing/all_method_bodies"
- end
-
- def generate()
- h_file(@filename) {
- @amqp.methods_.each { |m| include "qpid/framing/"+m.body_name }
- }
- end
-end
-
-AllMethodBodiesGen.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/99-0/constants.rb b/qpid/cpp/rubygen/99-0/constants.rb
deleted file mode 100755
index b5f559d504..0000000000
--- a/qpid/cpp/rubygen/99-0/constants.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env ruby
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class ConstantsGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @namespace="qpid::framing"
- @dir="qpid/framing"
- end
-
- def constants_h()
- h_file("#{@dir}/constants") {
- namespace(@namespace) {
- scope("enum AmqpConstant {","};") {
- l=[]
- l.concat @amqp.constants.map { |c| "#{c.name.shout}=#{c.value}" }
- @amqp.classes.each { |c|
- l << "#{c.name.shout}_CLASS_ID=#{c.index}"
- l.concat c.methods_.map { |m|
- "#{c.name.shout}_#{m.name.shout}_METHOD_ID=#{m.index}" }
- }
- genl l.join(",\n")
- }}}
- end
-
- def exbase(c)
- case c.class_
- when "soft-error" then "ChannelException"
- when "hard-error" then "ConnectionException"
- end
- end
-
- def reply_exceptions_h()
- h_file("#{@dir}/reply_exceptions") {
- include "qpid/Exception"
- namespace(@namespace) {
- @amqp.constants.each { |c|
- base = exbase c
- if base
- genl
- struct(c.name.caps+"Exception", base) {
- genl "#{c.name.caps}Exception(const std::string& msg=std::string()) : #{base}(#{c.value}, \"#{c.name}: \"+msg) {}"
- }
- end
- }
- genl
- genl "void throwReplyException(int code, const std::string& text);"
- }
- }
- end
-
- def reply_exceptions_cpp()
- cpp_file("#{@dir}/reply_exceptions") {
- include "#{@dir}/reply_exceptions"
- include "<sstream>"
- namespace("qpid::framing") {
- scope("void throwReplyException(int code, const std::string& text) {"){
- scope("switch (code) {") {
- genl "case 200: break; // No exception"
- @amqp.constants.each { |c|
- if exbase c
- genl "case #{c.value}: throw #{c.name.caps}Exception(text);"
- end
- }
- scope("default:","") {
- genl "std::ostringstream msg;"
- genl 'msg << "Invalid reply code " << code << ": " << text;'
- genl 'throw InvalidArgumentException(msg.str());'
- }}}}}
- end
-
- def generate()
- constants_h
- reply_exceptions_h
- reply_exceptions_cpp
- end
-end
-
-ConstantsGen.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/99-0/frame_body_lists.rb b/qpid/cpp/rubygen/99-0/frame_body_lists.rb
deleted file mode 100644
index b20e4550f3..0000000000
--- a/qpid/cpp/rubygen/99-0/frame_body_lists.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class FrameBodyListsGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp);
- end
-
- def generate
- h_file("qpid/framing/frame_body_lists.h") {
- gen <<EOS
-/**@file
- * Macro lists of frame body classes, used to generate Visitors
- */
-EOS
- gen "#define METHOD_BODIES() "
- @amqp.methods_.each { |m| gen "\\\n (#{m.body_name}) " }
- gen <<EOS
-
-
-#define OTHER_BODIES() (AMQContentBody)(AMQHeaderBody)(AMQHeartbeatBody))
-
-EOS
- }
- end
-end
-
-FrameBodyListsGen.new(ARGV[0], $amqp).generate;
-
-
diff --git a/qpid/cpp/rubygen/99-0/structs.rb b/qpid/cpp/rubygen/99-0/structs.rb
deleted file mode 100644
index 336591be00..0000000000
--- a/qpid/cpp/rubygen/99-0/structs.rb
+++ /dev/null
@@ -1,538 +0,0 @@
-#!/usr/bin/env ruby
-# Usage: output_directory xml_spec_file [xml_spec_file...]
-#
-$: << '..'
-require 'cppgen'
-
-class StructGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- end
-
- EncodingMap={
- "octet"=>"Octet",
- "short"=>"Short",
- "long"=>"Long",
- "longlong"=>"LongLong",
- "longstr"=>"LongString",
- "shortstr"=>"ShortString",
- "timestamp"=>"LongLong",
- "table"=>"FieldTable",
- "content"=>"Content",
- "long-struct"=>"LongString"
- }
- SizeMap={
- "octet"=>1,
- "short"=>2,
- "long"=>4,
- "longlong"=>8,
- "timestamp"=>8
- }
-
- ValueTypes=["octet", "short", "long", "longlong", "timestamp"]
-
- def is_packed(s)
- s.kind_of? AmqpStruct
- end
-
- def execution_header?(s)
- false and s.kind_of? AmqpMethod and s.parent.l4?
- end
-
- def has_bitfields_only(s)
- s.fields.select {|f| f.domain.type_ != "bit"}.empty?
- end
-
- def default_initialisation(s)
- params = s.fields.select {|f| ValueTypes.include?(f.domain.type_) || (!is_packed(s) && f.domain.type_ == "bit")}
- strings = params.collect {|f| "#{f.cppname}(0)"}
- strings << "flags(0)" if (is_packed(s))
- if strings.empty?
- return ""
- else
- return " : " + strings.join(", ")
- end
- end
-
- def printable_form(f)
- if (f.cpptype.name == "uint8_t")
- return "(int) " + f.cppname
- elsif (f.domain.type_ == "bit")
- return "get#{f.name.caps}()"
- else
- return f.cppname
- end
- end
-
- def flag_mask(s, i)
- pos = SizeMap[s.pack]*8 - 8 - (i/8)*8 + (i % 8)
- return "(1 << #{pos})"
- end
-
- def encode_packed_struct(s)
- genl s.cpp_pack_type.encode('flags', 'buffer')
- process_packed_fields(s) { |f, i| encode_packed_field(s, f, i) unless f.domain.type_ == "bit" }
- end
-
- def decode_packed_struct(s)
- genl "#{s.cpp_pack_type.decode('flags', 'buffer')}"
- process_packed_fields(s) { |f, i| decode_packed_field(s, f, i) unless f.domain.type_ == "bit" }
- end
-
- def size_packed_struct(s)
- genl "total += #{SizeMap[s.pack]};"
- process_packed_fields(s) { |f, i| size_packed_field(s, f, i) unless f.domain.type_ == "bit" }
- end
-
- def print_packed_struct(s)
- process_packed_fields(s) { |f, i| print_packed_field(s, f, i) }
- end
-
- def encode_packed_field(s, f, i)
- genl "if (flags & #{flag_mask(s, i)})"
- indent { genl f.domain.cpptype.encode(f.cppname,"buffer") }
- end
-
- def decode_packed_field(s, f, i)
- genl "if (flags & #{flag_mask(s, i)})"
- indent { genl f.domain.cpptype.decode(f.cppname,"buffer") }
- end
-
- def size_packed_field(s, f, i)
- genl "if (flags & #{flag_mask(s, i)})"
- indent { generate_size(f, []) }
- end
-
- def print_packed_field(s, f, i)
- genl "if (flags & #{flag_mask(s, i)})"
- indent {
- genl "out << \"#{f.name}=\" << #{printable_form(f)} << \"; \";"
- }
- end
-
- def generate_encode(f, combined)
- if (f.domain.type_ == "bit")
- genl "uint8_t #{f.cppname}_bits = #{f.cppname};"
- count = 0
- combined.each { |c| genl "#{f.cppname}_bits |= #{c.cppname} << #{count += 1};" }
- genl "buffer.putOctet(#{f.cppname}_bits);"
- else
- genl f.domain.cpptype.encode(f.cppname,"buffer")
- end
- end
-
- def generate_decode(f, combined)
- if (f.domain.type_ == "bit")
- genl "uint8_t #{f.cppname}_bits = buffer.getOctet();"
- genl "#{f.cppname} = 1 & #{f.cppname}_bits;"
- count = 0
- combined.each { |c| genl "#{c.cppname} = (1 << #{count += 1}) & #{f.cppname}_bits;" }
- else
- genl f.domain.cpptype.decode(f.cppname,"buffer")
- end
- end
-
- def generate_size(f, combined)
- if (f.domain.type_ == "bit")
- names = ([f] + combined).collect {|g| g.cppname}
- genl "total += 1;//#{names.join(", ")}"
- else
- size = SizeMap[f.domain.type_]
- if (size)
- genl "total += #{size};//#{f.cppname}"
- elsif (f.cpptype.name == "SequenceNumberSet")
- genl "total += #{f.cppname}.encodedSize();"
- else
- encoded = EncodingMap[f.domain.type_]
- gen "total += ("
- gen "4 + " if encoded == "LongString"
- gen "1 + " if encoded == "ShortString"
- genl "#{f.cppname}.size());"
- end
- end
- end
-
- def process_packed_fields(s)
- s.fields.each { |f| yield f, s.fields.index(f) }
- end
-
- def process_fields(s)
- last = nil
- count = 0
- bits = []
- s.fields.each {
- |f| if (last and last.bit? and f.bit? and count < 7)
- count += 1
- bits << f
- else
- if (last and last.bit?)
- yield last, bits
- count = 0
- bits = []
- end
- if (not f.bit?)
- yield f
- end
- last = f
- end
- }
- if (last and last.bit?)
- yield last, bits
- end
- end
-
- def methodbody_extra_defs(s)
- gen <<EOS
- typedef #{s.result ? s.result.struct.cpptype.name : 'void'} ResultType;
-
- template <class T> ResultType invoke(T& invocable) const {
- return invocable.#{s.cppname}(#{s.param_names.join ", "});
- }
-
- using AMQMethodBody::accept;
- void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
-
- ClassId amqpClassId() const { return CLASS_ID; }
- MethodId amqpMethodId() const { return METHOD_ID; }
- bool isContentBearing() const { return #{s.content ? "true" : "false" }; }
- bool resultExpected() const { return #{s.result ? "true" : "false"}; }
- bool responseExpected() const { return #{s.responses().empty? ? "false" : "true"}; }
-EOS
- end
-
- def define_constructor(name, s)
- if (s.fields.size > 0)
- genl "#{name}("
- if (s.kind_of? AmqpMethod)
- indent {gen "ProtocolVersion, "}
- end
- indent { gen s.fields.collect { |f| "#{f.cpptype.param} _#{f.cppname}" }.join(",\n") }
- genl ") : "
- if (is_packed(s))
- initialisers = s.fields.select { |f| f.domain.type_ != "bit"}.collect { |f| "#{f.cppname}(_#{f.cppname})"}
-
- initialisers << "flags(0)"
- indent { gen initialisers.join(",\n") }
- genl "{"
- indent {
- process_packed_fields(s) { |f, i| genl "set#{f.name.caps}(_#{f.cppname});" if f.domain.type_ == "bit"}
- process_packed_fields(s) { |f, i| genl "flags |= #{flag_mask(s, i)};" unless f.domain.type_ == "bit"}
- }
- genl "}"
- else
- indent { gen s.fields.collect { |f| " #{f.cppname}(_#{f.cppname})" }.join(",\n") }
- genl "{}"
- end
- end
- #default constructors:
- if (s.kind_of? AmqpMethod)
- genl "#{name}(ProtocolVersion=ProtocolVersion()) {}"
- end
- if (s.kind_of? AmqpStruct)
- genl "#{name}() #{default_initialisation(s)} {}"
- end
- end
-
- def define_packed_field_accessors(s, f, i)
- if (f.domain.type_ == "bit")
- genl "void #{s.cppname}::set#{f.name.caps}(#{f.cpptype.param} _#{f.cppname}) {"
- indent {
- genl "if (_#{f.cppname}) flags |= #{flag_mask(s, i)};"
- genl "else flags &= ~#{flag_mask(s, i)};"
- }
- genl "}"
- genl "#{f.cpptype.ret} #{s.cppname}::get#{f.name.caps}() const { return flags & #{flag_mask(s, i)}; }"
- else
- genl "void #{s.cppname}::set#{f.name.caps}(#{f.cpptype.param} _#{f.cppname}) {"
- indent {
- genl "#{f.cppname} = _#{f.cppname};"
- genl "flags |= #{flag_mask(s, i)};"
- }
- genl "}"
- genl "#{f.cpptype.ret} #{s.cppname}::get#{f.name.caps}() const { return #{f.cppname}; }"
- if (f.cpptype.name == "FieldTable")
- genl "#{f.cpptype.name}& #{s.cppname}::get#{f.name.caps}() {"
- indent {
- genl "flags |= #{flag_mask(s, i)};"#treat the field table as having been 'set'
- genl "return #{f.cppname};"
- }
- genl "}"
- end
- genl "bool #{s.cppname}::has#{f.name.caps}() const { return flags & #{flag_mask(s, i)}; }"
- genl "void #{s.cppname}::clear#{f.name.caps}Flag() { flags &= ~#{flag_mask(s, i)}; }"
- end
- genl ""
- end
-
- def define_packed_accessors(s)
- process_packed_fields(s) { |f, i| define_packed_field_accessors(s, f, i) }
- end
-
- def declare_packed_accessors(f)
- genl "void set#{f.name.caps}(#{f.cpptype.param} _#{f.cppname});";
- genl "#{f.cpptype.ret} get#{f.name.caps}() const;"
- if (f.cpptype.name == "FieldTable")
- genl "#{f.cpptype.name}& get#{f.name.caps}();"
- end
- if (f.domain.type_ != "bit")
- #extra 'accessors' for packed fields:
- genl "bool has#{f.name.caps}() const;"
- genl "void clear#{f.name.caps}Flag();"
- end
- end
-
- def define_accessors(f)
- genl "void set#{f.name.caps}(#{f.cpptype.param} _#{f.cppname}) { #{f.cppname} = _#{f.cppname}; }"
- genl "#{f.cpptype.ret} get#{f.name.caps}() const { return #{f.cppname}; }"
- if (f.cpptype.name == "FieldTable")
- genl "#{f.cpptype.name}& get#{f.name.caps}() { return #{f.cppname}; }"
- end
- end
-
- def define_struct(s)
- classname = s.cppname
- inheritance = ""
- if (s.kind_of? AmqpMethod)
- classname = s.body_name
- if (execution_header?(s))
- inheritance = ": public ModelMethod"
- else
- inheritance = ": public AMQMethodBody"
- end
- end
-
- h_file("qpid/framing/#{classname}.h") {
- if (s.kind_of? AmqpMethod)
- gen <<EOS
-#include "qpid/framing/AMQMethodBody.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/MethodBodyConstVisitor.h"
-EOS
- end
- include "qpid/framing/ModelMethod.h" if (execution_header?(s))
-
- #need to include any nested struct definitions
- s.fields.each { |f| include f.cpptype.name if f.domain.struct }
-
- gen <<EOS
-
-#include <ostream>
-#include "qpid/framing/amqp_types_full.h"
-
-namespace qpid {
-namespace framing {
-
-class #{classname} #{inheritance} {
-EOS
- if (is_packed(s))
- indent { s.fields.each { |f| genl "#{f.cpptype.name} #{f.cppname};" unless f.domain.type_ == "bit"} }
- indent {
- genl "#{s.cpp_pack_type.name} flags;"
- }
- else
- indent { s.fields.each { |f| genl "#{f.cpptype.name} #{f.cppname};" } }
- end
- genl "public:"
- if (s.kind_of? AmqpMethod)
- indent { genl "static const ClassId CLASS_ID = #{s.parent.index};" }
- indent { genl "static const MethodId METHOD_ID = #{s.index};" }
- end
-
- if (s.kind_of? AmqpStruct)
- if (s.type_)
- if (s.result?)
- #as result structs have types that are only unique to the
- #class, they have a class dependent qualifier added to them
- #(this is inline with current python code but a formal
- #solution is expected from the WG)
- indent { genl "static const uint16_t TYPE = #{s.type_} + #{s.parent.parent.parent.index} * 256;" }
- else
- indent { genl "static const uint16_t TYPE = #{s.type_};" }
- end
- end
- end
-
- indent {
- define_constructor(classname, s)
- genl ""
- if (is_packed(s))
- s.fields.each { |f| declare_packed_accessors(f) }
- else
- s.fields.each { |f| define_accessors(f) }
- end
- }
- if (s.kind_of? AmqpMethod)
- methodbody_extra_defs(s)
- end
- if (s.kind_of? AmqpStruct)
- indent {genl "friend std::ostream& operator<<(std::ostream&, const #{classname}&);" }
- end
-
- gen <<EOS
- void encode(Buffer&) const;
- void decode(Buffer&, uint32_t=0);
- void encodeStructBody(Buffer&) const;
- void decodeStructBody(Buffer&, uint32_t=0);
- uint32_t size() const;
- uint32_t bodySize() const;
- void print(std::ostream& out) const;
-}; /* class #{classname} */
-
-}}
-EOS
- }
- cpp_file("qpid/framing/#{classname}.cpp") {
- if (s.fields.size > 0 || execution_header?(s))
- buffer = "buffer"
- else
- buffer = "/*buffer*/"
- end
- gen <<EOS
-#include "#{classname}.h"
-
-using namespace qpid::framing;
-
-EOS
-
- if (is_packed(s))
- define_packed_accessors(s)
- end
- gen <<EOS
-void #{classname}::encodeStructBody(Buffer& #{buffer}) const
-{
-EOS
- if (execution_header?(s))
- genl "ModelMethod::encode(buffer);"
- end
-
- if (is_packed(s))
- indent {encode_packed_struct(s)}
- else
- indent { process_fields(s) { |f, combined| generate_encode(f, combined) } }
- end
- gen <<EOS
-}
-
-void #{classname}::encode(Buffer& buffer) const
-{
-EOS
- indent {
- if (s.kind_of? AmqpStruct)
- if (s.type_)
- genl "buffer.put#{s.size.caps}(bodySize() + 2/*typecode*/);" if s.size
- genl "buffer.putShort(TYPE);"
- else
- genl "buffer.put#{s.size.caps}(size());" if s.size
- end
- end
- genl "encodeStructBody(buffer);"
- }
- gen <<EOS
-}
-
-void #{classname}::decodeStructBody(Buffer& #{buffer}, uint32_t /*size*/)
-{
-EOS
- if (execution_header?(s))
- genl "ModelMethod::decode(buffer);"
- end
-
- if (is_packed(s))
- indent {decode_packed_struct(s)}
- else
- indent { process_fields(s) { |f, combined| generate_decode(f, combined) } }
- end
- gen <<EOS
-}
-
-void #{classname}::decode(Buffer& buffer, uint32_t /*size*/)
-{
-EOS
- indent {
- if (s.kind_of? AmqpStruct)
- genl "buffer.get#{s.size.caps}();" if s.size
- genl "if (TYPE != buffer.getShort()) throw InternalErrorException(\"Bad type code for struct\");" if s.type_
- end
- genl "decodeStructBody(buffer);"
- }
- gen <<EOS
-}
-
-uint32_t #{classname}::bodySize() const
-{
- uint32_t total = 0;
-EOS
- if (execution_header?(s))
- genl "total += ModelMethod::size();"
- end
-
- if (is_packed(s))
- indent {size_packed_struct(s)}
- else
- indent { process_fields(s) { |f, combined| generate_size(f, combined) } }
- end
- gen <<EOS
- return total;
-}
-
-uint32_t #{classname}::size() const
-{
- uint32_t total = bodySize();
-EOS
- if (s.kind_of? AmqpStruct)
- genl "total += #{SizeMap[s.size]}/*size field*/;" if s.size
- genl "total += 2/*typecode*/;" if s.type_
- end
- gen <<EOS
- return total;
-}
-
-void #{classname}::print(std::ostream& out) const
-{
- out << "{#{classname}: ";
-EOS
- if (is_packed(s))
- indent {print_packed_struct(s)}
- else
- copy = Array.new(s.fields)
- f = copy.shift
-
- indent {
- genl "out << \"#{f.name}=\" << #{printable_form(f)};" if f
- copy.each { |f| genl "out << \"; #{f.name}=\" << #{printable_form(f)};" }
- }
- end
- gen <<EOS
- out << "}";
-}
-EOS
-
- if (s.kind_of? AmqpStruct)
- gen <<EOS
-namespace qpid{
-namespace framing{
-
- std::ostream& operator<<(std::ostream& out, const #{classname}& s)
- {
- s.print(out);
- return out;
- }
-
-}
-}
-EOS
- end
-}
- end
-
- def generate()
- @amqp.structs.each { |s| define_struct(s) }
- @amqp.methods_.each { |m| define_struct(m) }
- #generate a single include file containing the list of structs for convenience
- h_file("qpid/framing/amqp_structs.h") { @amqp.structs.each { |s| genl "#include \"#{s.cppname}.h\"" } }
- end
-end
-
-StructGen.new(ARGV[0], $amqp).generate()
-
diff --git a/qpid/cpp/rubygen/MethodBodyDefaultVisitor.rb b/qpid/cpp/rubygen/MethodBodyDefaultVisitor.rb
deleted file mode 100755
index 1fff1d51db..0000000000
--- a/qpid/cpp/rubygen/MethodBodyDefaultVisitor.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env ruby
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class MethodBodyDefaultVisitorGen < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- set_classname("qpid::framing::MethodBodyDefaultVisitor")
- end
-
- def generate()
- h_file(@filename) {
- include "qpid/framing/MethodBodyConstVisitor"
- namespace(@namespace) {
- genl
- cpp_class(@classname, "public MethodBodyConstVisitor") {
- genl "public:"
- genl "virtual void defaultVisit() = 0;"
- @amqp.methods_.each { |m|
- genl "virtual void visit(const #{m.body_name}&);" }
- }}}
-
- cpp_file(@filename) {
- include(@filename)
- namespace(@namespace) {
- @amqp.methods_.each { |m|
- genl "void #{@classname}::visit(const #{m.body_name}&) { defaultVisit(); }"
- }}}
- end
-end
-
-MethodBodyDefaultVisitorGen.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/README b/qpid/cpp/rubygen/README
deleted file mode 100644
index a1fd6cfec8..0000000000
--- a/qpid/cpp/rubygen/README
+++ /dev/null
@@ -1,17 +0,0 @@
-RUBY CODE GENERATOR
-
-Run ./generate for usage.
-Examples in samples/
-
-For example:
- ./generate . ../../specs/amqp.0-9.xml samples/Proxy.rb
-will generate
-
-
-
-
-
-
-
-
-
diff --git a/qpid/cpp/rubygen/amqpgen.rb b/qpid/cpp/rubygen/amqpgen.rb
deleted file mode 100755
index b1e635a27b..0000000000
--- a/qpid/cpp/rubygen/amqpgen.rb
+++ /dev/null
@@ -1,490 +0,0 @@
-#
-# Generic AMQP code generation library.
-#
-
-# TODO aconway 2008-02-21:
-#
-# The amqp_attr_reader and amqp_child_reader for each Amqp* class
-# should correspond exactly to ampq.dtd. Currently they are more
-# permissive so we can parse 0-10 preview and 0-10 final XML.
-#
-# Code marked with "# preview" should be removed/modified when final 0-10
-# is complete and we are ready to remove preview-related code.
-#
-
-require 'delegate'
-require 'rexml/document'
-require 'pathname'
-include REXML
-
-# Handy String functions for converting names.
-class String
- # Convert to CapitalizedForm.
- def caps() gsub( /(^|\W)(\w)/ ) { |m| $2.upcase } end
-
- # Convert to underbar_separated_form.
- def bars() tr('- .','_'); end
-
- # Convert to ALL_UPPERCASE_FORM
- def shout() bars.upcase!; end
-
- # Convert to lowerCaseCapitalizedForm
- def lcaps() gsub( /\W(\w)/ ) { |m| $1.upcase } end
-
- def plural() self + (/[xs]$/ === self ? 'es' : 's'); end
-end
-
-# Sort an array by name.
-module Enumerable
- def sort_by_name() sort { |a,b| a.name <=> b.name }; end
-end
-
-# Add functions similar to attr_reader for AMQP attributes/children.
-# Symbols that are ruby Object function names (e.g. class) get
-# an "_" suffix.
-class Module
- # Add trailing _ to avoid conflict with Object methods.
- def mangle(sym)
- (Object.method_defined? sym) ? (sym.to_s+"_").intern : sym
- end
-
- # Add attribute reader for XML attribute.
- def amqp_attr_reader(*attrs)
- attrs.each { |a|
- case a
- when Symbol
- define_method(mangle(a)) {
- @amqp_attr_reader||={ }
- @amqp_attr_reader[a] ||= xml.attributes[a.to_s]
- }
- when Hash
- a.each { |attr, default|
- define_method(mangle(attr)) {
- @amqp_attr_reader||={ }
- value = xml.attributes[attr.to_s]
- if value
- @amqp_attr_reader[attr] ||= value
- else
- @amqp_attr_reader[attr] ||= default
- end
- }
- }
- end
- }
- end
-
- # Add 2 child readers:
- # elname(name) == child('elname',name)
- # elnames() == children('elname')
- def amqp_child_reader(*element_names)
- element_names.each { |e|
- define_method(mangle(e)) { |name| child(e.to_s, name) }
- define_method(mangle(e.to_s.plural)) { children(e.to_s) } }
- end
-
- # When there can only be one child instance
- def amqp_single_child_reader(*element_names)
- element_names.each { |e|
- define_method(mangle(e)) { children(e.to_s)[0] } }
- end
-end
-
-
-# An AmqpElement contains an XML element and provides a convenient
-# API to access AMQP data.
-#
-# NB: AmqpElements cache values from XML, they assume that
-# the XML model does not change after the AmqpElement has
-# been created.
-class AmqpElement
-
- def wrap(xml)
- return nil if ["assert","rule"].include? xml.name
- eval("Amqp"+xml.name.caps).new(xml, self) or raise "nil wrapper"
- end
-
- public
-
- def initialize(xml, parent)
- @xml, @parent=xml, parent
- @children=xml.elements.map { |e| wrap e }.compact
- @cache_child={}
- @cache_children={}
- @cache_children[nil]=@children
- end
-
- attr_reader :parent, :xml, :children, :doc
- amqp_attr_reader :name, :label
-
- # List of children of type elname, or all children if elname
- # not specified.
- def children(elname=nil)
- if elname
- @cache_children[elname] ||= @children.select { |c| elname==c.xml.name }
- else
- @children
- end
- end
-
- def each_descendant(&block)
- yield self
- @children.each { |c| c.each_descendant(&block) }
- end
-
- # Look up child of type elname with attribute name.
- def child(elname, name)
- @cache_child[[elname,name]] ||= children(elname).find { |c| c.name==name }
- end
-
- # Fully qualified amqp dotted name of this element
- def dotted_name() (parent ? parent.dotted_name+"." : "") + name; end
-
- # The root <amqp> element.
- def root() @root ||=parent ? parent.root : self; end
-
- # Are we in preview or final 0-10
- # preview - used to make some classes behave differently for preview vs. final
- def final?() root().version == "0-10"; end
-
- def to_s() "#<#{self.class}(#{name})>"; end
- def inspect() to_s; end
-
- # Text of doc child if there is one.
- def doc() d=xml.elements["doc"]; d and d.text; end
-
- def fqname()
- throw "fqname: #{self} #{parent.fqname} has no name" unless name
- p=parent && parent.fqname
- p ? p+"."+name : name;
- end
-
- def containing_class()
- return self if is_a? AmqpClass
- return parent && parent.containing_class
- end
-
-end
-
-class AmqpResponse < AmqpElement
- def initialize(xml, parent) super; end
-end
-
-class AmqpDoc < AmqpElement
- def initialize(xml,parent) super; end
- def text() @xml.text end
-end
-
-class AmqpChoice < AmqpElement
- def initialize(xml,parent) super; end
- amqp_attr_reader :name, :value
-end
-
-class AmqpEnum < AmqpElement
- def initialize(xml,parent) super; end
- amqp_child_reader :choice
-end
-
-# 0-10 array domains are missing element type information, add it here.
-ArrayTypes={
- "str16-array" => "str-16",
- "amqp-host-array" => "connection.amqp-host-url",
- "command-fragments" => "session.command-fragment",
- "in-doubt" => "dtx.xid"
-}
-
-class AmqpDomain < AmqpElement
- def initialize(xml, parent)
- super
- root.used_by[uses].push(fqname) if uses and uses.index('.')
- end
-
- amqp_attr_reader :type
- amqp_single_child_reader :struct # preview
- amqp_single_child_reader :enum
-
- def uses() type_=="array" ? ArrayTypes[name] : type_; end
-
- def unalias()
- d=self
- while (d.type_ != d.name and root.domain(d.type_))
- d=root.domain(d.type_)
- end
- return d
- end
-end
-
-class AmqpException < AmqpElement
- def initialize(xml, amqp) super; end;
- amqp_attr_reader :error_code
-end
-
-class AmqpField < AmqpElement
- def initialize(xml, amqp)
- super;
- root.used_by[type_].push(parent.fqname) if type_ and type_.index('.')
- end
-
- def domain() root.domain(xml.attributes["domain"]); end
- amqp_single_child_reader :struct # preview
- amqp_child_reader :exception
- amqp_attr_reader :type, :default, :code, :required
-end
-
-class AmqpChassis < AmqpElement # preview
- def initialize(xml, parent) super; end
- amqp_attr_reader :implement
-end
-
-class AmqpConstant < AmqpElement
- def initialize(xml, parent) super; end
- amqp_attr_reader :value, :class
-end
-
-class AmqpResult < AmqpElement
- def initialize(xml, parent) super; end
- amqp_single_child_reader :struct # preview
- amqp_attr_reader :type
- def name() "result"; end
-end
-
-class AmqpEntry < AmqpElement
- def initialize(xml,parent) super; end
- amqp_attr_reader :type
-end
-
-class AmqpHeader < AmqpElement
- def initialize(xml,parent) super; end
- amqp_child_reader :entry
- amqp_attr_reader :required
-end
-
-class AmqpBody < AmqpElement
- def initialize(xml,parent) super; end
- amqp_attr_reader :required
-end
-
-class AmqpSegments < AmqpElement
- def initialize(xml,parent) super; end
- amqp_child_reader :header, :body
-end
-
-class AmqpStruct < AmqpElement
- def initialize(xml, parent) super; end
- amqp_attr_reader :type # preview
- amqp_attr_reader :size, :code, :pack
- amqp_child_reader :field
-
- # preview - preview code needs default "short" for pack.
- alias :raw_pack :pack
- def pack() raw_pack or (not parent.final? and "short"); end
- def result?() parent.xml.name == "result"; end
- def domain?() parent.xml.name == "domain"; end
-end
-
-class AmqpMethod < AmqpElement
- def initialize(xml, parent) super; end
-
- amqp_attr_reader :content, :index, :synchronous
- amqp_child_reader :field, :chassis,:response
- amqp_single_child_reader :result
-
- def on_chassis?(chassis) child("chassis", chassis); end
- def on_client?() on_chassis? "client"; end
- def on_server?() on_chassis? "server"; end
-end
-
-class AmqpImplement < AmqpElement
- def initialize(xml,amqp) super; end
- amqp_attr_reader :handle, :send
-end
-
-class AmqpRole < AmqpElement
- def initialize(xml,amqp) super; end
- amqp_attr_reader :implement
-end
-
-# Base class for command and control.
-class AmqpAction < AmqpElement
- def initialize(xml,amqp) super; end
- amqp_child_reader :implement, :field, :response
- amqp_attr_reader :code
-end
-
-class AmqpControl < AmqpAction
- def initialize(xml,amqp) super; end
-end
-
-class AmqpCommand < AmqpAction
- def initialize(xml,amqp) super; end
- amqp_child_reader :exception
- amqp_single_child_reader :result, :segments
-end
-
-class AmqpClass < AmqpElement
- def initialize(xml,amqp) super; end
-
- amqp_attr_reader :index # preview
- amqp_child_reader :method # preview
-
- amqp_child_reader :struct, :domain, :control, :command, :role
- amqp_attr_reader :code
-
- # chassis should be "client" or "server"
- def methods_on(chassis) # preview
- @methods_on ||= { }
- @methods_on[chassis] ||= methods_.select { |m| m.on_chassis? chassis }
- end
-
- def l4?() # preview
- !["connection", "session", "execution"].include?(name)
- end
-
- def actions() controls+commands; end
-end
-
-class AmqpType < AmqpElement
- def initialize(xml,amqp) super; end
- amqp_attr_reader :code, :fixed_width, :variable_width
-end
-
-class AmqpXref < AmqpElement
- def initialize(xml,amqp) super; end
-end
-
-# AMQP root element.
-class AmqpRoot < AmqpElement
- amqp_attr_reader :major, :minor, :port, :comment
- amqp_child_reader :doc, :type, :struct, :domain, :constant, :class
-
- def parse(filename) Document.new(File.new(filename)).root; end
-
- # Initialize with output directory and spec files from ARGV.
- def initialize(*specs)
- raise "No XML spec files." if specs.empty?
- xml=parse(specs.shift)
- specs.each { |s| xml_merge(xml, parse(s)) }
- @used_by=Hash.new{ |h,k| h[k]=[] }
- super(xml, nil)
- end
-
- attr_reader :used_by
-
- def merge(root) xml_merge(xml, root.xml); end
-
- def version() major + "-" + minor; end
-
- # preview - only struct child reader remains for new mapping
- def domain_structs() domains.map{ |d| d.struct }.compact; end
- def result_structs()
- methods_.map { |m| m.result and m.result.struct }.compact
- end
- def structs() result_structs+domain_structs; end
-
- def methods_() classes.map { |c| c.methods_ }.flatten; end
-
- # Return all methods on chassis for all classes.
- def methods_on(chassis)
- @methods_on ||= { }
- @methods_on[chassis] ||= classes.map { |c| c.methods_on(chassis) }.flatten
- end
-
- def fqname() nil; end
-
- # TODO aconway 2008-02-21: methods by role.
-
- private
-
- # Merge contents of elements.
- def xml_merge(to,from)
- from.elements.each { |from_child|
- tag,name = from_child.name, from_child.attributes["name"]
- to_child=to.elements["./#{tag}[@name='#{name}']"]
- to_child ? xml_merge(to_child, from_child) : to.add(from_child.deep_clone) }
- end
-end
-
-# Collect information about generated files.
-class GenFiles
- @@files =[]
- def GenFiles.add(f) @@files << f; end
- def GenFiles.get() @@files; end
-end
-
-# Base class for code generators.
-# Supports setting a per-line prefix, useful for e.g. indenting code.
-#
-class Generator
- # Takes directory for output or "-", meaning print file names that
- # would be generated.
- def initialize (outdir, amqp)
- @amqp=amqp
- @outdir=outdir
- @prefix=[''] # For indentation or comments.
- @indentstr=' ' # One indent level.
- @outdent=2
- Pathname.new(@outdir).mkpath unless @outdir=="-"
- end
-
- # Create a new file, set @out.
- def file(file, &block)
- GenFiles.add file
- if (@outdir != "-")
- @path=Pathname.new "#{@outdir}/#{file}"
- @path.parent.mkpath
- @out=String.new # Generate in memory first
- if block then yield; endfile; end
- end
- end
-
- def endfile()
- if @outdir != "-"
- if @path.exist? and @path.read == @out
- puts "Skipped #{@path} - unchanged" # Dont generate if unchanged
- else
- @path.open('w') { |f| f << @out }
- puts "Generated #{@path}"
- end
- end
- end
-
- # Append multi-line string to generated code, prefixing each line.
- def gen (str)
- str.each_line { |line|
- @out << @prefix.last unless @midline
- @out << line
- @midline = nil
- }
- # Note if we stopped mid-line
- @midline = /[^\n]\z/ === str
- end
-
- # Append str + '\n' to generated code.
- def genl(str="")
- gen str
- gen "\n"
- end
-
- # Generate code with added prefix.
- def prefix(add, &block)
- @prefix.push @prefix.last+add
- if block then yield; endprefix; end
- end
-
- def endprefix()
- @prefix.pop
- end
-
- # Generate indented code
- def indent(n=1,&block) prefix(@indentstr * n,&block); end
- alias :endindent :endprefix
-
- # Generate outdented code
- def outdent(&block)
- @prefix.push @prefix.last[0...-2]
- if block then yield; endprefix; end
- end
- alias :endoutdent :endprefix
-
- attr_accessor :out
-end
-
diff --git a/qpid/cpp/rubygen/cppgen.rb b/qpid/cpp/rubygen/cppgen.rb
deleted file mode 100755
index edee72e0bd..0000000000
--- a/qpid/cpp/rubygen/cppgen.rb
+++ /dev/null
@@ -1,332 +0,0 @@
-#!/usr/bin/ruby
-#
-# General purpose C++ code generation.
-#
-require 'amqpgen'
-require 'set'
-
-Copyright=<<EOS
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 was automatically generated from the AMQP specification.
-/// Do not edit.
-///
-
-
-EOS
-
-CppKeywords = Set.new(["and", "and_eq", "asm", "auto", "bitand",
- "bitor", "bool", "break", "case", "catch", "char",
- "class", "compl", "const", "const_cast", "continue",
- "default", "delete", "do", "DomainInfo", "double",
- "dynamic_cast", "else", "enum", "explicit", "extern",
- "false", "float", "for", "friend", "goto", "if",
- "inline", "int", "long", "mutable", "namespace", "new",
- "not", "not_eq", "operator", "or", "or_eq", "private",
- "protected", "public", "register", "reinterpret_cast",
- "return", "short", "signed", "sizeof", "static",
- "static_cast", "struct", "switch", "template", "this",
- "throw", "true", "try", "typedef", "typeid",
- "typename", "union", "unsigned", "using", "virtual",
- "void", "volatile", "wchar_t", "while", "xor",
- "xor_eq"])
-# Names that need a trailing "_" to avoid clashes.
-CppMangle = CppKeywords+Set.new(["string"])
-
-class String
- def cppsafe() CppMangle.include?(self) ? self+"_" : self; end
-
- def amqp2cpp()
- path=split(".")
- name=path.pop
- return name.typename if path.empty?
- path.map! { |n| n.nsname }
- return (path << name.caps).join("::")
- end
-
- alias :typename :caps
- alias :nsname :bars
- alias :constname :shout
- alias :funcname :lcaps
- alias :varname :lcaps
-end
-
-# Hold information about a C++ type.
-#
-# preview - new mapping does not use CppType,
-# Each amqp type corresponds exactly by dotted name
-# to a type, domain or struct, which in turns
-# corresponds by name to a C++ type or typedef.
-# (see String.amqp2cpp)
-#
-class CppType
- def initialize(name) @name=@param=@ret=name; end
- attr_reader :name, :param, :ret, :code
-
- def retref() @ret="#{name}&"; self; end
- def retcref() @ret="const #{name}&"; self; end
- def passcref() @param="const #{name}&"; self; end
- def code(str) @code=str; self; end
- def defval(str) @defval=str; self; end
-
- def encode(value, buffer)
- @code ? "#{buffer}.put#{@code}(#{value});" : "#{value}.encode(#{buffer});"
- end
-
- def decode(value,buffer)
- if @code
- if /&$/===param then
- "#{buffer}.get#{@code}(#{value});"
- else
- "#{value} = #{buffer}.get#{@code}();"
- end
- else
- "#{value}.decode(#{buffer});"
- end
- end
-
- def default_value()
- return @defval ||= "#{name}()"
- end
-
- def to_s() name; end;
-end
-
-class AmqpElement
- def cppfqname()
- names=parent.dotted_name.split(".")
- # Field children are moved up to method in C++b
- prefix.pop if parent.is_a? AmqpField
- prefix.push cppname
- prefix.join("::")
- end
-end
-
-class AmqpField
- def cppname() name.lcaps.cppsafe; end
- def cpptype() domain.cpptype; end
- def bit?() domain.type_ == "bit"; end
- def signature() cpptype.param+" "+cppname; end
- def paramtype() "call_traits<#{type_.amqp2cpp}>::param_type"; end
-end
-
-class AmqpMethod
- def cppname() name.lcaps.cppsafe; end
- def param_names() fields.map { |f| f.cppname }; end
- def signature() fields.map { |f| f.signature }; end
- def body_name() parent.name.caps+name.caps+"Body"; end
-end
-
-module AmqpHasFields
- def parameters()
- fields.map { |f| "#{f.paramtype} #{f.cppname}_"}.join(",\n")
- end
-
- def arguments()
- fields.map { |f| "#{f.cppname}_"}.join(",\n")
- end
-
- def values()
- fields.map { |f| "#{f.cppname}"}.join(",\n")
- end
-
- def initializers()
- fields.map { |f| "#{f.cppname}(#{f.cppname}_)"}.join(",\n")
- end
-end
-
-class AmqpAction
- def classname() name.typename; end
- def funcname() parent.name.funcname + name.caps; end
- include AmqpHasFields
-end
-
-class AmqpCommand < AmqpAction
- def base() "Command"; end
-end
-
-class AmqpControl < AmqpAction
- def base() "Control"; end
-end
-
-class AmqpClass
- def cppname() name.caps; end # preview
- def nsname() name.nsname; end
-end
-
-class AmqpDomain
- @@typemap = {
- "bit"=> CppType.new("bool").code("Octet").defval("false"),
- "octet"=>CppType.new("uint8_t").code("Octet").defval("0"),
- "short"=>CppType.new("uint16_t").code("Short").defval("0"),
- "long"=>CppType.new("uint32_t").code("Long").defval("0"),
- "longlong"=>CppType.new("uint64_t").code("LongLong").defval("0"),
- "timestamp"=>CppType.new("uint64_t").code("LongLong").defval("0"),
- "longstr"=>CppType.new("string").passcref.retcref.code("LongString"),
- "shortstr"=>CppType.new("string").passcref.retcref.code("ShortString"),
- "table"=>CppType.new("FieldTable").passcref.retcref,
- "array"=>CppType.new("Array").passcref.retcref,
- "content"=>CppType.new("Content").passcref.retcref,
- "rfc1982-long-set"=>CppType.new("SequenceNumberSet").passcref.retcref,
- "long-struct"=>CppType.new("string").passcref.retcref.code("LongString"),
- "uuid"=>CppType.new("Uuid").passcref.retcref
- }
-
- def cppname() name.caps; end
-
- def cpptype()
- d=unalias
- @cpptype ||= @@typemap[d.type_] or
- CppType.new(d.cppname).passcref.retcref or
- raise "Invalid type #{self}"
- end
-
- def AmqpDomain.lookup_type(t)
- @@typemap[t]
- end
-end
-
-class AmqpResult
- def cpptype()
- @cpptype=CppType.new(parent.parent.name.caps+parent.name.caps+"Result").passcref
- end
-end
-
-class AmqpStruct
- include AmqpHasFields
-
- def cpp_pack_type() # preview
- AmqpDomain.lookup_type(pack()) or CppType.new("uint16_t");
- end
- def cpptype() parent.cpptype; end # preview
- def cppname() cpptype.name; end # preview
-
- def classname() name.typename; end
-end
-
-class CppGen < Generator
- def initialize(outdir, *specs)
- super(outdir,*specs)
- # need to sort classes for dependencies
- @actions=[] # Stack of end-scope actions
- end
-
- # Write a header file.
- def h_file(path, &block)
- path = (/\.h$/ === path ? path : path+".h")
- guard=path.upcase.tr('./-','_')
- file(path) {
- gen "#ifndef #{guard}\n"
- gen "#define #{guard}\n"
- gen Copyright
- yield
- gen "#endif /*!#{guard}*/\n"
- }
- end
-
- # Write a .cpp file.
- def cpp_file(path, &block)
- path = (/\.cpp$/ === path ? path : path+".cpp")
- file(path) do
- gen Copyright
- yield
- end
- end
-
- def include(header)
- header+=".h" unless /(\.h|[">])$/===header
- header="\"#{header}\"" unless /(^<.*>$)|(^".*"$)/===header
- genl "#include #{header}"
- end
-
- def scope(open="{",close="}", &block)
- genl open
- indent &block
- genl close
- end
-
- def namespace(name, &block)
- genl
- names = name.split("::")
- names.each { |n| genl "namespace #{n} {" }
- genl
- yield
- genl
- genl('}'*names.size+" // namespace "+name)
- genl
- end
-
- def struct_class(type, name, bases, &block)
- gen "#{type} #{name}"
- if (!bases.empty?)
- genl ":"
- indent { gen "#{bases.join(",\n")}" }
- end
- genl
- scope("{","};", &block)
- end
-
- def struct(name, *bases, &block)
- struct_class("struct", name, bases, &block);
- end
- def cpp_class(name, *bases, &block)
- struct_class("class", name, bases, &block);
- end
-
- def typedef(type, name) genl "typedef #{type} #{name};\n"; end
-
- def variant(types) "boost::variant<#{types.join(", ")}>"; end
- def variantl(types) "boost::variant<#{types.join(", \n")}>"; end
- def blank_variant(types) variant(["boost::blank"]+types); end
- def tuple(types) "boost::tuple<#{types.join(', ')}>"; end
-
- def public() outdent { genl "public:" } end
- def private() outdent { genl "private:" } end
- def protected() outdent { genl "protected:" } end
-
- # Returns [namespace, classname, filename]
- def parse_classname(full_cname)
- names=full_cname.split("::")
- return names[0..-2].join('::'), names[-1], names.join("/")
- end
-
- def doxygen_comment(&block)
- genl "/**"
- prefix(" * ",&block)
- genl " */"
- end
-
- # Generate code in namespace for each class
- def each_class_ns()
- @amqp.classes.each { |c| namespace(c.nsname) { yield c } }
- end
-end
-
-# Fully-qualified class name
-class FqClass < Struct.new(:fqname,:namespace,:name,:file)
- def initialize(fqclass)
- names=fqclass.split "::"
- super(fqclass, names[0..-2].join('::'), names[-1], names.join("/"))
- end
-end
-
diff --git a/qpid/cpp/rubygen/generate b/qpid/cpp/rubygen/generate
deleted file mode 100755
index d094be4f41..0000000000
--- a/qpid/cpp/rubygen/generate
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env ruby
-require 'amqpgen'
-require 'pathname'
-
-#
-# Run a set of code generation templates.
-#
-if ARGV.size < 3
- puts <<EOS
-Usage: #{ARGV[0]} OUTDIR SPEC.xml [ ... ] TEMPLATE.rb [ ... ]
-or: #{ARGV[0]} OUTDIR SPEC.xml [ ... ] all [ makefragment.mk ]
-
-Parse all SPEC.xml files to create an AMQP model, run each TEMPLATE
-putting the resulting files under OUTDIR. Prints a list of files
-generated to standard output.
-
-If OUTDIR is '-' then just prints file list without generating files.
-EOS
- exit 1
-end
-
-# Create array of specs by version
-def parse_specs(specs)
- roots={ }
- specs.each { |spec|
- root=AmqpRoot.new(spec)
- ver=root.version
- if (roots[ver])
- roots[ver].merge(root)
- else
- roots[ver]=root
- end
- }
- roots
-end
-
-# Run selected templates
-if ARGV.any? { |arg| arg=="all" }
- templates=Dir["#{File.dirname __FILE__}/*/*.rb"]
-else
- templates=ARGV.grep(/\.rb$/)
-end
-
-$outdir=ARGV[0]
-$models=parse_specs(ARGV.grep(/\.xml$/))
-templates.each { |t|
- ver=Pathname.new(t).dirname.basename.to_s
- $amqp=$models[ver]
- if $amqp
- load t
- else
- puts "Warning: skipping #{t}, no spec file for version #{ver}."
- end
-}
-
-def make_continue(lines) lines.join(" \\\n "); end
-
-# Generate makefile
-makefile=ARGV.grep(/.mk$/)[0]
-if makefile
- dir=Dir.getwd
- Dir.chdir File.dirname(__FILE__)
- generator_files=Dir["**/*.rb"] << File.basename(__FILE__)
- Dir.chdir dir
- rgen_generator=generator_files.map{ |f| "$(rgen_dir)/#{f}" }
- rgen_srcs=GenFiles.get.map{ |f| "#{$outdir}/#{f}" }
-
- File.open(makefile, 'w') { |out|
- out << <<EOS
-# Generated makefile fragment.
-# Including makefile defines $(rgen_dir) $(rgen_cmd) and $(specs).
-
-rgen_generator=#{make_continue rgen_generator}
-
-rgen_client_cpp=#{make_continue(rgen_srcs.grep(%r|/qpid/client/.+\.cpp$|))}
-
-rgen_common_cpp=#{make_continue(rgen_srcs.grep(%r{qpid/(framing|amqp_.+)/.+\.cpp$}))}
-
-rgen_srcs=#{make_continue rgen_srcs}
-
-# Header file install rules.
-EOS
- ["amqp_0_10", "framing", "client/no_keyword","client", "broker"].each { |ns|
- dir="qpid/#{ns}"
- dir_ = dir.tr("/", "_")
- regex=%r|#{dir}/[^/]+\.h$|
- out << <<EOS
-#{dir_}dir = $(includedir)/#{dir}
-dist_#{dir_}_HEADERS = #{make_continue rgen_srcs.grep(regex)}
-
-EOS
- }
- out << <<EOS
-if GENERATE
-$(srcdir)/#{File.basename makefile}: $(rgen_generator) $(specs)
- $(rgen_cmd)
-
-# Empty rule in case a generator file is renamed/removed.
-$(rgen_generator):
-endif
-EOS
- }
-end
-
diff --git a/qpid/cpp/src/Makefile.am b/qpid/cpp/src/Makefile.am
deleted file mode 100644
index e3b95e045f..0000000000
--- a/qpid/cpp/src/Makefile.am
+++ /dev/null
@@ -1,470 +0,0 @@
-SUBDIRS = . tests
-
-EXTRA_DIST= $(platform_dist)
-
-## Generated code
-
-# Note: generated soure and makefiles included in distribution so a
-# distribution can be built without code generation tools and XML
-# sources.
-
-# This phony target is needed by generated makefile fragments:
-force:
-
-if GENERATE
-
-# AMQP_PREVIEW_XML and AMQP_FINAL_XML are defined in ../configure.ac
-amqp_99_0_xml=@AMQP_PREVIEW_XML@ $(top_srcdir)/xml/cluster.xml
-amqp_0_10_xml=@AMQP_FINAL_XML@
-specs=$(amqp_99_0_xml) $(amqp_0_10_xml)
-
-# Ruby generator.
-rgen_dir=$(top_srcdir)/rubygen
-rgen_cmd=ruby -I $(rgen_dir) $(rgen_dir)/generate $(srcdir)/gen $(specs) all $(srcdir)/rubygen.mk
-
-# Management generator.
-mgen_dir=$(top_srcdir)/managementgen
-mgen_cmd=$(mgen_dir)/main.py -m $(srcdir)/managementgen.mk \
- $(top_srcdir)/../specs/management-schema.xml \
- $(top_srcdir)/../specs/management-types.xml \
- $(mgen_dir)/templates $(srcdir)/gen/qpid/management
-
-endif # GENERATE
-
-include $(srcdir)/rubygen.mk
-include $(srcdir)/managementgen.mk
-
-DISTCLEANFILES=rubygen.mk managementgen.mk
-
-# Code generated by C++
-noinst_PROGRAMS=generate_MaxMethodBodySize_h
-generate_MaxMethodBodySize_h_SOURCES=gen/generate_MaxMethodBodySize_h.cpp
-qpid/framing/MaxMethodBodySize.h: generate_MaxMethodBodySize_h
- ./generate_MaxMethodBodySize_h
-BUILT_SOURCES=qpid/framing/MaxMethodBodySize.h
-DISTCLEANFILES+=qpid/framing/MaxMethodBodySize.h
-
-
-## Compiler flags
-
-AM_CXXFLAGS = $(WARNING_CFLAGS)
-AM_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO_ARG)
-INCLUDES = -Igen -I$(srcdir)/gen
-
-## Automake macros to build libraries and executables.
-
-qpidd_LDADD = \
- libqpidbroker.la \
- libqpidcommon.la
-
-sbin_PROGRAMS = qpidd
-qpidd_SOURCES = qpidd.cpp
-
-posix_plat_src = \
- qpid/sys/epoll/EpollPoller.cpp \
- qpid/sys/DeletionManager.h \
- qpid/sys/posix/Socket.cpp \
- qpid/sys/posix/AsynchIO.cpp \
- qpid/sys/posix/Time.cpp \
- qpid/sys/posix/Thread.cpp \
- qpid/sys/posix/Shlib.cpp
-
-posix_plat_hdr = \
- qpid/sys/posix/check.h \
- qpid/sys/posix/Condition.h \
- qpid/sys/posix/PrivatePosix.h \
- qpid/sys/posix/Mutex.h \
- qpid/sys/posix/Thread.h
-
-platform_src = $(posix_plat_src)
-platform_hdr = $(posix_plat_hdr)
-
-lib_LTLIBRARIES = libqpidcommon.la libqpidbroker.la libqpidclient.la
-
-include cluster.mk
-
-# The logger library uses boost::date_time to format time.
-# We have to disable the unused parameters warning to get around
-# unused parameters in boost::date_time headers. So we build it
-# in a convenience library to link into libqpid_common.
-#
-noinst_LTLIBRARIES=libLogger.la
-libLogger_la_SOURCES=qpid/log/Logger.cpp qpid/log/Logger.h
-libLogger_la_CXXFLAGS=$(AM_CXXFLAGS) -Wno-unused-parameter
-
-libqpidcommon_la_LIBADD = \
- -lboost_program_options \
- -lboost_filesystem \
- -luuid \
- libLogger.la \
- $(LIB_DLOPEN) \
- $(LIB_CLOCK_GETTIME)
-
-libqpidcommon_la_SOURCES = \
- $(rgen_common_cpp) \
- $(platform_src) \
- qpid/amqp_0_10/helpers.cpp \
- qpid/Serializer.h \
- qpid/amqp_0_10/built_in_types.h \
- qpid/amqp_0_10/Codec.h \
- qpid/amqp_0_10/Decimal.h \
- qpid/framing/AccumulatedAck.cpp \
- qpid/framing/AMQBody.cpp \
- qpid/framing/AMQMethodBody.cpp \
- qpid/framing/AMQContentBody.cpp \
- qpid/framing/AMQFrame.cpp \
- qpid/framing/AMQHeaderBody.cpp \
- qpid/framing/AMQHeartbeatBody.cpp \
- qpid/framing/Array.cpp \
- qpid/framing/BodyHolder.cpp \
- qpid/framing/BodyHandler.cpp \
- qpid/framing/Buffer.cpp \
- qpid/framing/FieldTable.cpp \
- qpid/framing/FieldValue.cpp \
- qpid/framing/FramingContent.cpp \
- qpid/framing/FrameSet.cpp \
- qpid/framing/InitiationHandler.cpp \
- qpid/framing/ProtocolInitiation.cpp \
- qpid/framing/ProtocolVersion.cpp \
- qpid/framing/SessionState.cpp \
- qpid/framing/SendContent.cpp \
- qpid/framing/SequenceNumber.cpp \
- qpid/framing/SequenceNumberSet.cpp \
- qpid/framing/Proxy.cpp \
- qpid/framing/Uuid.cpp \
- qpid/framing/AMQP_HighestVersion.h \
- qpid/framing/Blob.cpp \
- qpid/framing/MaxMethodBodySize.h \
- qpid/framing/TransferContent.cpp \
- qpid/assert.cpp qpid/assert.h \
- qpid/Exception.cpp \
- qpid/Plugin.cpp \
- qpid/Url.cpp \
- qpid/sys/AggregateOutput.cpp \
- qpid/sys/AsynchIOAcceptor.cpp \
- qpid/sys/Dispatcher.cpp \
- qpid/sys/Runnable.cpp \
- qpid/sys/SystemInfo.cpp \
- qpid/sys/Serializer.cpp \
- qpid/sys/Shlib.cpp \
- qpid/DataDir.cpp \
- qpid/Options.cpp \
- qpid/log/Options.cpp \
- qpid/log/Selector.cpp \
- qpid/log/Statement.cpp \
- qpid/IList.h \
- qpid/ISList.h \
- qpid/pointer_to_other.h
-
-libqpidbroker_la_LIBADD = libqpidcommon.la -lboost_iostreams
-libqpidbroker_la_SOURCES = \
- $(mgen_broker_cpp) \
- qpid/broker/Broker.cpp \
- qpid/broker/BrokerAdapter.cpp \
- qpid/broker/BrokerSingleton.cpp \
- qpid/broker/Exchange.cpp \
- qpid/broker/Queue.cpp \
- qpid/broker/PersistableMessage.cpp \
- qpid/broker/Bridge.cpp \
- qpid/broker/PreviewConnection.cpp \
- qpid/broker/PreviewConnectionHandler.cpp \
- qpid/broker/PreviewSessionHandler.cpp \
- qpid/broker/PreviewSessionManager.cpp \
- qpid/broker/PreviewSessionState.cpp \
- qpid/broker/Connection.cpp \
- qpid/broker/ConnectionHandler.cpp \
- qpid/broker/ConnectionFactory.cpp \
- qpid/broker/Daemon.cpp \
- qpid/broker/DeliverableMessage.cpp \
- qpid/broker/DeliveryRecord.cpp \
- qpid/broker/DirectExchange.cpp \
- qpid/broker/DtxAck.cpp \
- qpid/broker/DtxBuffer.cpp \
- qpid/broker/DtxHandlerImpl.cpp \
- qpid/broker/DtxManager.cpp \
- qpid/broker/DtxTimeout.cpp \
- qpid/broker/DtxWorkRecord.cpp \
- qpid/broker/ExchangeRegistry.cpp \
- qpid/broker/FanOutExchange.cpp \
- qpid/broker/HeadersExchange.cpp \
- qpid/broker/IncomingExecutionContext.cpp \
- qpid/broker/Message.cpp \
- qpid/broker/MessageAdapter.cpp \
- qpid/broker/MessageBuilder.cpp \
- qpid/broker/MessageDelivery.cpp \
- qpid/broker/MessageHandlerImpl.cpp \
- qpid/broker/MessageStoreModule.cpp \
- qpid/broker/MultiVersionConnectionInputHandler.cpp \
- qpid/broker/NameGenerator.cpp \
- qpid/broker/NullMessageStore.cpp \
- qpid/broker/QueueBindings.cpp \
- qpid/broker/QueuePolicy.cpp \
- qpid/broker/QueueRegistry.cpp \
- qpid/broker/RecoveryManagerImpl.cpp \
- qpid/broker/RecoveredEnqueue.cpp \
- qpid/broker/RecoveredDequeue.cpp \
- qpid/broker/SemanticState.h \
- qpid/broker/SemanticState.cpp \
- qpid/broker/SessionState.h \
- qpid/broker/SessionState.cpp \
- qpid/broker/SessionManager.h \
- qpid/broker/SessionManager.cpp \
- qpid/broker/SessionHandler.h \
- qpid/broker/SessionContext.h \
- qpid/broker/SessionHandler.cpp \
- qpid/broker/SemanticHandler.cpp \
- qpid/broker/Timer.cpp \
- qpid/broker/TopicExchange.cpp \
- qpid/broker/TxAck.cpp \
- qpid/broker/TxBuffer.cpp \
- qpid/broker/TxPublish.cpp \
- qpid/broker/Vhost.cpp \
- qpid/management/Manageable.cpp \
- qpid/management/ManagementAgent.cpp \
- qpid/management/ManagementExchange.cpp \
- qpid/management/ManagementObject.cpp
-
-libqpidclient_la_LIBADD = libqpidcommon.la
-libqpidclient_la_SOURCES = \
- $(rgen_client_cpp) \
- qpid/client/SessionBase.cpp \
- qpid/client/Connection.cpp \
- qpid/client/Channel.cpp \
- qpid/client/Exchange.cpp \
- qpid/broker/PersistableMessage.cpp \
- qpid/client/Queue.cpp \
- qpid/client/ConnectionImpl.cpp \
- qpid/client/Connector.cpp \
- qpid/client/Demux.cpp \
- qpid/client/Dispatcher.cpp \
- qpid/client/LocalQueue.cpp \
- qpid/client/MessageListener.cpp \
- qpid/client/Correlator.cpp \
- qpid/client/CompletionTracker.cpp \
- qpid/client/ConnectionHandler.cpp \
- qpid/client/ExecutionHandler.cpp \
- qpid/client/FutureCompletion.cpp \
- qpid/client/FutureResponse.cpp \
- qpid/client/FutureResult.cpp \
- qpid/client/SessionCore.cpp \
- qpid/client/StateManager.cpp \
- qpid/client/SubscriptionManager.cpp
-
-nobase_include_HEADERS = \
- $(platform_hdr) \
- qpid/amqp_0_10/helpers.h \
- qpid/assert.h \
- qpid/DataDir.h \
- qpid/Exception.h \
- qpid/Msg.h \
- qpid/Options.h \
- qpid/Plugin.h \
- qpid/ptr_map.h \
- qpid/RefCounted.h \
- qpid/SharedObject.h \
- qpid/Url.h \
- qpid/InlineVector.h \
- qpid/InlineAllocator.h \
- qpid/memory.h \
- qpid/shared_ptr.h \
- qpid/broker/Broker.h \
- qpid/broker/BrokerAdapter.h \
- qpid/broker/Exchange.h \
- qpid/broker/Queue.h \
- qpid/broker/BrokerSingleton.h \
- qpid/broker/Bridge.h \
- qpid/broker/PreviewConnection.h \
- qpid/broker/PreviewConnectionHandler.h \
- qpid/broker/PreviewSessionHandler.h \
- qpid/broker/PreviewSessionManager.h \
- qpid/broker/PreviewSessionState.h \
- qpid/broker/Connection.h \
- qpid/broker/ConnectionState.h \
- qpid/broker/ConnectionFactory.h \
- qpid/broker/ConnectionHandler.h \
- qpid/broker/ConnectionToken.h \
- qpid/broker/Consumer.h \
- qpid/broker/Daemon.h \
- qpid/broker/Deliverable.h \
- qpid/broker/DeliverableMessage.h \
- qpid/broker/DeliveryAdapter.h \
- qpid/broker/DeliveryId.h \
- qpid/broker/DeliveryRecord.h \
- qpid/broker/DeliveryToken.h \
- qpid/broker/DirectExchange.h \
- qpid/broker/DtxAck.h \
- qpid/broker/DtxBuffer.h \
- qpid/broker/DtxHandlerImpl.h \
- qpid/broker/DtxManager.h \
- qpid/broker/DtxTimeout.h \
- qpid/broker/DtxWorkRecord.h \
- qpid/broker/ExchangeRegistry.h \
- qpid/broker/FanOutExchange.h \
- qpid/broker/HandlerImpl.h \
- qpid/broker/HeadersExchange.h \
- qpid/broker/IncomingExecutionContext.h \
- qpid/broker/Message.h \
- qpid/broker/MessageAdapter.h \
- qpid/broker/MessageBuilder.h \
- qpid/broker/MessageDelivery.h \
- qpid/broker/MessageHandlerImpl.h \
- qpid/broker/MessageStore.h \
- qpid/broker/MessageStoreModule.h \
- qpid/broker/MultiVersionConnectionInputHandler.h \
- qpid/broker/NameGenerator.h \
- qpid/broker/NullMessageStore.h \
- qpid/broker/Persistable.h \
- qpid/broker/PersistableExchange.h \
- qpid/broker/PersistableMessage.h \
- qpid/broker/PersistableQueue.h \
- qpid/broker/Prefetch.h \
- qpid/broker/QueueBindings.h \
- qpid/broker/QueuePolicy.h \
- qpid/broker/QueueRegistry.h \
- qpid/broker/RecoverableExchange.h \
- qpid/broker/RecoverableMessage.h \
- qpid/broker/RecoverableQueue.h \
- qpid/broker/RecoverableTransaction.h \
- qpid/broker/RecoveredDequeue.h \
- qpid/broker/RecoveredEnqueue.h \
- qpid/broker/RecoveryManager.h \
- qpid/broker/RecoveryManagerImpl.h \
- qpid/broker/SemanticHandler.h \
- qpid/broker/SessionManager.h \
- qpid/broker/Timer.h \
- qpid/broker/TopicExchange.h \
- qpid/broker/TransactionalStore.h \
- qpid/broker/TxAck.h \
- qpid/broker/TxBuffer.h \
- qpid/broker/TxOp.h \
- qpid/broker/TxPublish.h \
- qpid/broker/Vhost.h \
- qpid/client/AckMode.h \
- qpid/client/ChainableFrameHandler.h \
- qpid/client/Channel.h \
- qpid/client/Exchange.h \
- qpid/client/Message.h \
- qpid/client/Queue.h \
- qpid/client/AckPolicy.h \
- qpid/client/Completion.h \
- qpid/client/CompletionTracker.h \
- qpid/client/Connection.h \
- qpid/client/ConnectionHandler.h \
- qpid/client/ConnectionImpl.h \
- qpid/client/Connector.h \
- qpid/client/Correlator.h \
- qpid/client/Demux.h \
- qpid/client/Dispatcher.h \
- qpid/client/LocalQueue.h \
- qpid/client/Execution.h \
- qpid/client/ExecutionHandler.h \
- qpid/client/Future.h \
- qpid/client/FutureCompletion.h \
- qpid/client/FutureResponse.h \
- qpid/client/FutureResult.h \
- qpid/client/MessageListener.h \
- qpid/client/MessageQueue.h \
- qpid/client/Response.h \
- qpid/client/SessionBase.h \
- qpid/client/Session.h \
- qpid/client/SessionCore.h \
- qpid/client/StateManager.h \
- qpid/client/SubscriptionManager.h \
- qpid/client/TypedResult.h \
- qpid/framing/AMQBody.h \
- qpid/framing/AMQContentBody.h \
- qpid/framing/AMQDataBlock.h \
- qpid/framing/AMQFrame.h \
- qpid/framing/AMQHeaderBody.h \
- qpid/framing/AMQHeartbeatBody.h \
- qpid/framing/AMQMethodBody.h \
- qpid/framing/AMQP_HighestVersion.h \
- qpid/framing/AccumulatedAck.h \
- qpid/framing/Array.h \
- qpid/framing/Blob.h \
- qpid/framing/BodyHandler.h \
- qpid/framing/Buffer.h \
- qpid/framing/ChannelHandler.h \
- qpid/framing/FieldTable.h \
- qpid/framing/FieldValue.h \
- qpid/framing/FrameDefaultVisitor.h \
- qpid/framing/FrameHandler.h \
- qpid/framing/FrameHandler.h \
- qpid/framing/FrameSet.h \
- qpid/framing/FramingContent.h \
- qpid/framing/Handler.h \
- qpid/framing/HeaderProperties.h \
- qpid/framing/InitiationHandler.h \
- qpid/framing/Invoker.h \
- qpid/framing/InputHandler.h \
- qpid/framing/MethodContent.h \
- qpid/framing/BodyHolder.h \
- qpid/framing/MaxMethodBodySize.h \
- qpid/framing/ModelMethod.h \
- qpid/framing/OutputHandler.h \
- qpid/framing/ProtocolInitiation.h \
- qpid/framing/ProtocolVersion.h \
- qpid/framing/Proxy.h \
- qpid/framing/SessionState.h \
- qpid/framing/SendContent.h \
- qpid/framing/SequenceNumber.h \
- qpid/framing/SequenceNumberSet.h \
- qpid/framing/SerializeHandler.h \
- qpid/framing/StructHelper.h \
- qpid/framing/TransferContent.h \
- qpid/framing/TypeFilter.h \
- qpid/framing/Uuid.h \
- qpid/framing/Visitor.h \
- qpid/framing/amqp_framing.h \
- qpid/framing/amqp_types.h \
- qpid/framing/amqp_types_full.h \
- qpid/framing/frame_functors.h \
- qpid/framing/variant.h \
- qpid/log/Helpers.h \
- qpid/log/Options.h \
- qpid/log/Selector.h \
- qpid/log/Statement.h \
- qpid/management/Args.h \
- qpid/management/Manageable.h \
- qpid/management/ManagementAgent.h \
- qpid/management/ManagementExchange.h \
- qpid/management/ManagementObject.h \
- qpid/sys/Acceptor.h \
- qpid/sys/AggregateOutput.h \
- qpid/sys/AsynchIO.h \
- qpid/sys/AtomicCount.h \
- qpid/sys/BlockingQueue.h \
- qpid/sys/Condition.h \
- qpid/sys/ConnectionInputHandler.h \
- qpid/sys/ConnectionInputHandlerFactory.h \
- qpid/sys/ConnectionOutputHandler.h \
- qpid/sys/Dispatcher.h \
- qpid/sys/Module.h \
- qpid/sys/Monitor.h \
- qpid/sys/Mutex.h \
- qpid/sys/OutputControl.h \
- qpid/sys/OutputTask.h \
- qpid/sys/Poller.h \
- qpid/sys/Runnable.h \
- qpid/sys/RefCountedMap.h \
- qpid/sys/ScopedIncrement.h \
- qpid/sys/Semaphore.h \
- qpid/sys/Serializer.h \
- qpid/sys/SystemInfo.h \
- qpid/sys/Shlib.h \
- qpid/sys/ShutdownHandler.h \
- qpid/sys/Socket.h \
- qpid/sys/StateMonitor.h \
- qpid/sys/Waitable.h \
- qpid/sys/Thread.h \
- qpid/sys/Time.h \
- qpid/sys/TimeoutHandler.h
-
-# Force build of qpidd during dist phase so help2man will work.
-dist-hook: $(BUILT_SOURCES)
- $(MAKE) qpidd
-
-# Create the default data directory
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)/$(localstatedir)/lib/qpidd
-
diff --git a/qpid/cpp/src/cluster.mk b/qpid/cpp/src/cluster.mk
deleted file mode 100644
index 9503845b92..0000000000
--- a/qpid/cpp/src/cluster.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Cluster library makefile fragment, to be included in Makefile.am
-#
-lib_LTLIBRARIES += libqpidcluster.la
-
-if CPG
-
-libqpidcluster_la_SOURCES = \
- qpid/cluster/Cluster.cpp \
- qpid/cluster/Cluster.h \
- qpid/cluster/Cpg.cpp \
- qpid/cluster/Cpg.h \
- qpid/cluster/Dispatchable.h \
- qpid/cluster/ClusterPlugin.cpp \
- qpid/cluster/ClassifierHandler.h \
- qpid/cluster/ClassifierHandler.cpp
-
-libqpidcluster_la_LIBADD= -lcpg libqpidbroker.la
-
-else
-# Empty stub library to satisfy rpm spec file.
-libqpidcluster_la_SOURCES =
-
-endif
diff --git a/qpid/cpp/src/generate.sh b/qpid/cpp/src/generate.sh
deleted file mode 100755
index 3582893f24..0000000000
--- a/qpid/cpp/src/generate.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-# !/bin/sh
-# Generate code from AMQP specification.
-# specs and gentools_dir are set by Makefile
-#
-set -e
-
-test -z "$JAVA" && JAVA=java ;
-test -z "$JAVAC" && JAVAC=javac ;
-
-srcdir=`dirname $0`
-checkspecs() {
- for s in $specs; do test -f $s || return 1; done
- return 0
-}
-
-# Can we generate code?
-if { test -d $gentools_dir && checkspecs &&
- which $JAVA && which $JAVAC; } > /dev/null;
-then
- echo "Generating code."
- mkdir -p gen/qpid/framing
- ( cd $gentools_dir/src && $JAVAC `find -name '*.java' -print` ; )
- $JAVA -cp $gentools_dir/src org.apache.qpid.gentools.Main \
- -c -o gen/qpid/framing -t $gentools_dir/templ.cpp $specs
- GENERATED=yes
-fi
-
-# Print a Makefile variable assignment.
-make_assign() {
- echo -n "$1 = "; shift
- prefix=$1; shift
- for f in $*; do echo "\\" ; echo -n " $prefix$f "; done
- echo
-}
-
-# Generate a Makefile fragment
-(
- make_assign "generated_cpp" "" `find gen -name '*.cpp' -print`
- make_assign "generated_h" "" `find gen -name '*.h' -print`
- if test x$GENERATED = xyes; then
- make_assign "generator" "" $specs \
- `find ../gentools \( -name '*.java' -o -name '*.tmpl' \) -print`
- fi
-) > generate.mk-t
-mv generate.mk-t $srcdir/generate.mk
-
-
-
diff --git a/qpid/cpp/src/prof b/qpid/cpp/src/prof
deleted file mode 100755
index bd889a1446..0000000000
--- a/qpid/cpp/src/prof
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-rm /var/lib/oprofile/oprofiled.log
-
-opcontrol --reset
-opcontrol --setup --no-vmlinux --separate=library
-opcontrol --start
-# -- Do stuff here --
-./qpidd
-# -- End of stuff --
-opcontrol --stop
-opcontrol --dump
-opcontrol --shutdown
-opreport -l ./.libs/lt-qpidd > stats.txt
-opannotate --source --output-dir=qpidd-prof ./.libs/lt-qpidd
-
-# clear the relusts
-#opcontrol --reset
diff --git a/qpid/cpp/src/qpid/DataDir.cpp b/qpid/cpp/src/qpid/DataDir.cpp
deleted file mode 100644
index abf9b061e4..0000000000
--- a/qpid/cpp/src/qpid/DataDir.cpp
+++ /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.
- *
- */
-
-#include "Exception.h"
-#include "DataDir.h"
-#include "qpid/log/Statement.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <cerrno>
-
-namespace qpid {
-
-DataDir::DataDir (std::string path) :
- enabled (!path.empty ()),
- dirPath (path)
-{
- if (!enabled)
- {
- QPID_LOG (info, "No data directory - Disabling persistent configuration");
- return;
- }
-
- const char *cpath = dirPath.c_str ();
- struct stat s;
-
- if (::stat (cpath, &s))
- throw Exception ("Data directory not found: " + path);
-
- std::string lockFile (path);
- lockFile = lockFile + "/lock";
- int fd = ::open (lockFile.c_str (), O_CREAT | O_EXCL,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
- if (fd == -1)
- {
- if (errno == EEXIST)
- throw Exception ("Data directory is locked by another process");
- if (errno == EACCES)
- throw Exception ("Insufficient privileges for data directory");
-
- std::ostringstream oss;
- oss << "Error locking data directory: errno=" << errno;
- throw Exception (oss.str ());
- }
-
- QPID_LOG (info, "Locked data directory: " << dirPath);
-}
-
-DataDir::~DataDir ()
-{
- if (dirPath.empty ())
- return;
-
- std::string lockFile (dirPath);
- lockFile = lockFile + "/lock";
-
- ::unlink (lockFile.c_str ());
- QPID_LOG (info, "Unlocked data directory: " << dirPath);
-}
-
-} // namespace qpid
-
diff --git a/qpid/cpp/src/qpid/DataDir.h b/qpid/cpp/src/qpid/DataDir.h
deleted file mode 100644
index 56aa4f26d7..0000000000
--- a/qpid/cpp/src/qpid/DataDir.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef QPID_DATADIR_H
-#define QPID_DATADIR_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <string>
-
-namespace qpid {
-
-/**
- * DataDir class.
- */
-class DataDir
-{
- const bool enabled;
- const std::string dirPath;
-
- public:
-
- DataDir (std::string path);
- ~DataDir ();
-
- bool isEnabled () { return enabled; }
- std::string getPath () { return dirPath; }
-};
-
-} // namespace qpid
-
-#endif /*!QPID_DATADIR_H*/
diff --git a/qpid/cpp/src/qpid/Exception.cpp b/qpid/cpp/src/qpid/Exception.cpp
deleted file mode 100644
index 17f0d5029c..0000000000
--- a/qpid/cpp/src/qpid/Exception.cpp
+++ /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.
- *
- */
-
-#include "qpid/log/Statement.h"
-#include "Exception.h"
-#include <typeinfo>
-#include <errno.h>
-#include <assert.h>
-
-namespace qpid {
-
-std::string strError(int err) {
- char buf[512];
- return std::string(strerror_r(err, buf, sizeof(buf)));
-}
-
-Exception::Exception(const std::string& msg,
- const std::string& nm,
- uint16_t cd) throw()
- : message(msg), name(nm), code(cd),
- whatStr((name.empty() ? "" : name + ": ")+ msg)
-{
- QPID_LOG(warning, "Exception: " << whatStr);
-}
-
-Exception::~Exception() throw() {}
-
-std::string Exception::getMessage() const throw() { return message; }
-
-std::string Exception::getName() const throw() {
- return name.empty() ? typeid(*this).name() : name;
-}
-
-uint16_t Exception::getCode() const throw() { return code; }
-
-const char* Exception::what() const throw() {
- if (whatStr.empty()) return typeid(*this).name();
- else return whatStr.c_str();
-}
-
-ClosedException::ClosedException(const std::string& msg)
- : Exception(msg, "ClosedException") {}
-
-} // namespace qpid
diff --git a/qpid/cpp/src/qpid/Exception.h b/qpid/cpp/src/qpid/Exception.h
deleted file mode 100644
index 00365018ba..0000000000
--- a/qpid/cpp/src/qpid/Exception.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef _Exception_
-#define _Exception_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/amqp_types.h"
-#include "qpid/Msg.h"
-
-#include <memory>
-#include <string>
-
-namespace qpid
-{
-
-/** Get the error message for a system number err, e.g. errno. */
-std::string strError(int err);
-
-/**
- * Base class for Qpid runtime exceptions.
- */
-class Exception : public std::exception
-{
- public:
- explicit Exception(const std::string& message=std::string(),
- const std::string& name=std::string(),
- uint16_t code=0) throw();
-
- virtual ~Exception() throw();
-
- // returns "name: message"
- virtual const char* what() const throw();
-
- virtual std::string getName() const throw();
- virtual std::string getMessage() const throw();
- virtual uint16_t getCode() const throw();
-
- // FIXME aconway 2008-02-21: backwards compat, remove?
- std::string str() const throw() { return getMessage(); }
-
- private:
- const std::string message;
- const std::string name;
- const uint16_t code;
- const std::string whatStr;
-};
-
-struct ChannelException : public Exception {
- const framing::ReplyCode code;
- ChannelException(framing::ReplyCode code_, const std::string& message)
- : Exception(message), code(code_) {}
-};
-
-struct ConnectionException : public Exception {
- const framing::ReplyCode code;
- ConnectionException(framing::ReplyCode code_, const std::string& message)
- : Exception(message), code(code_) {}
-};
-
-struct ClosedException : public Exception {
- ClosedException(const std::string& msg=std::string());
-};
-
-} // namespace qpid
-
-#endif /*!_Exception_*/
diff --git a/qpid/cpp/src/qpid/IList.h b/qpid/cpp/src/qpid/IList.h
deleted file mode 100644
index f5c78ced68..0000000000
--- a/qpid/cpp/src/qpid/IList.h
+++ /dev/null
@@ -1,196 +0,0 @@
-#ifndef QPID_ILIST_H
-#define QPID_ILIST_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "ISList.h"
-
-namespace qpid {
-
-template <class> class IList;
-
-/** Base class for values (nodes) in an IList.
- *@param raw or smart-pointer type to use for the "next" pointer.
- * Using a smart pointer like shared_ptr or intrusive_ptr
- * will automate memory management.
- */
-template <class Pointer> class IListNode {
- public:
- typedef Pointer pointer;
- typedef typename Pointee<Pointer>::type NodeType;
- typedef typename pointer_to_other<Pointer, const NodeType>::type const_pointer;
-
- protected:
- IListNode() : prev() {}
- IListNode(const IListNode&) {} // Don't copy next/prev pointers
-
- pointer getNext() { return next; }
- const_pointer getNext() const { return next; }
- pointer getPrev() { return prev; }
- const_pointer getPrev() const { return prev; }
-
- private:
- pointer prev, next;
- friend class IList<NodeType>;
-};
-
-
-/**
- * Intrusive doubly-linked list.
- *
- * Provides bidirectional iterator and constant time insertion
- * at front and back.
- *
- * The list itself performs no memory management. Use a smart pointer
- * as the pointer type (e.g. intrusive_ptr, shared_ptr) for automated
- * memory management.
- *
- * Unlike standard containers insert(), push_front() and push_back()
- * take const pointer& rather than const value_type&.
- *
- * Iterators can be converted to the pointer type.
- *
- * Noncopyable - intrusively linked nodes cannot be shared between
- * lists. Does provide swap()
- *
- * @param Node value type for the list, must derive from ISListNode<>.
- */
-template<class Node> class IList {
- template <class> class Iterator;
- public:
- typedef Node value_type;
- typedef typename Node::pointer pointer;
- typedef typename Node::const_pointer const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef Iterator<value_type> iterator;
- typedef Iterator<const value_type> const_iterator;
-
- IList() : begin_(), last_() {}
-
- iterator begin() { return begin_; }
- const_iterator begin() const { return begin_; }
- iterator end() { return 0; }
- const_iterator end() const { return 0; }
-
- bool empty() const { return begin() == end(); }
-
- size_type size() const {
- int s = 0;
- for (const_iterator i=begin(); i != end(); ++i)
- ++s;
- return s;
- }
-
- void swap(IList &x) { swap(begin_, x.begin_); swap(last_, x.last_); }
-
- iterator insert(iterator i, const pointer& p) {
- if (empty()) {
- begin_ = last_ = p;
- insert(0, p, 0);
- }
- else if (i) {
- insert(i->prev, p, i);
- if (i == begin_) --begin_;
- }
- else {
- insert(last_, p, 0) ;
- last_ = p;
- }
- return p;
- }
-
- void erase(iterator i) {
- if (begin_ == last_)
- begin_ = last_ = 0;
- else {
- if (i == begin_) ++begin_;
- else i->prev->next = i->next;
- if (i == last_) --last_;
- else i->next->prev = i->prev;
- }
- i->prev = i->next = pointer(0);
- }
-
- void erase(iterator i, iterator j) { while(i != j) erase(i); }
- void clear() { while (!empty()) { erase(begin()); } }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- void push_front(const pointer& p) { insert(begin(), p); }
- void pop_front() { erase(begin()); }
-
- /** Iterator to the last element in the list. */
- iterator last() { return last_; }
- const_iterator last() const { return last_; }
-
- reference back() { return *last(); }
- const_reference back() const { return *last(); }
- void push_back(const pointer& p) { insert(end(), p); }
- void pop_back() { erase(last()); }
-
- private:
- void insert(pointer a, pointer b, pointer c) {
- b->prev = a;
- if (a) a->next = b;
- b->next = c;
- if (c) c->prev = b;
- }
-
- template <class T>
- class Iterator : public boost::iterator_facade<
- Iterator<T>, T, boost::bidirectional_traversal_tag>
- {
- public:
- Iterator() : ptr() {};
-
- template <class U> Iterator(
- const Iterator<U>& i,
- typename boost::enable_if_convertible<U*, T*>::type* = 0
- ) : ptr(i.ptr) {}
-
- operator pointer() { return ptr; }
- operator const_pointer() const { return ptr; }
-
- private:
- friend class boost::iterator_core_access;
-
- Iterator(const_pointer p) : ptr(const_cast<pointer>(p)) {};
-
- T& dereference() const { return *ptr; }
- void increment() { ptr = ptr->next; }
- void decrement() { ptr = ptr->prev; }
- bool equal(const Iterator& x) const { return ptr == x.ptr; }
-
- pointer ptr;
-
- friend class IList<Node>;
- };
-
- iterator begin_, last_;
-};
-
-} // namespace qpid
-
-#endif /*!QPID_ILIST_H*/
diff --git a/qpid/cpp/src/qpid/ISList.h b/qpid/cpp/src/qpid/ISList.h
deleted file mode 100644
index 96ba3ec726..0000000000
--- a/qpid/cpp/src/qpid/ISList.h
+++ /dev/null
@@ -1,176 +0,0 @@
-#ifndef QPID_ISLIST_H
-#define QPID_ISLIST_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/iterator/iterator_adaptor.hpp>
-#include <boost/noncopyable.hpp>
-#include "pointer_to_other.h"
-
-namespace qpid {
-
-template <class Pointer> struct Pointee {
- typedef typename Pointer::element_type type;
-};
-
-template <class T> struct Pointee<T*> {
- typedef T type;
-};
-
-template <class> class ISList;
-template <class> class IList;
-
-/** Base class for values (nodes) in an ISList.
- *@param raw or smart-pointer type to use for the "next" pointer.
- * Using a smart pointer like shared_ptr or intrusive_ptr
- * will automate memory management.
- */
-template <class Pointer> class ISListNode {
- public:
- typedef Pointer pointer;
- typedef typename Pointee<Pointer>::type NodeType;
- typedef typename pointer_to_other<Pointer, const NodeType>::type const_pointer;
-
- protected:
- ISListNode() : next() {}
- ISListNode(const ISListNode&) {} // Don't copy the next pointer.
-
- pointer getNext() { return next; }
- const_pointer getNext() const { return next; }
-
- private:
- pointer next;
- friend class ISList<NodeType>;
-};
-
-
-/**
- * Intrusive singly-linked list.
- *
- * Provides forward iterator, constant time insertion and constant
- * time pop_front (but not pop_back) so makes a good queue
- * implementation.
- *
- * Unlike standard containers insert(), push_front() and push_back()
- * take const pointer& rather than const value_type&.
- *
- * Iterators can be converted to pointers.
- *
- * Noncopyable - intrusively linked nodes cannot be shared.
- *
- * @param Node value type for the list, must derive from ISListNode<T>.
- */
-template <class Node> class ISList : private boost::noncopyable {
- template <class> class Iterator;
- public:
- typedef Node value_type;
- typedef typename Node::pointer pointer;
- typedef typename Node::const_pointer const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef Iterator<value_type> iterator;
- typedef Iterator<const value_type> const_iterator;
-
- ISList() : first(pointer()), end_(&first) {}
-
- iterator begin() { return iterator(&first); }
- const_iterator begin() const { return const_iterator(&first); }
- iterator end() { return end_; }
- const_iterator end() const { return end_; }
-
- bool empty() const { return begin() == end(); }
-
- size_type size() const {
- int s = 0;
- for (const_iterator i=begin(); i != end(); ++i)
- ++s;
- return s;
- }
-
- void swap(ISList &x) { swap(first, x.first); swap(end_, x.end_); }
-
- /** Unlike standard containers, insert takes a const pointer&, not a
- * const value_type&. The value is not copied, only linked into the list.
- */
- iterator insert(iterator i, const pointer& p) {
- p->next = *(i.pptr);
- *(i.pptr) = p;
- if (i==end_) ++end_;
- return i;
- }
-
- void erase(iterator i) {
- if (&i->next == end_.pptr)
- end_ = i;
- *(i.pptr) = (**(i.pptr)).next;
- }
-
- void erase(iterator i, iterator j) { while(i != j) erase(i); }
- void clear() { while (!empty()) { erase(begin()); } }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- void pop_front() { erase(begin()); }
- void push_front(pointer x) { insert(begin(), x); }
-
- void push_back(pointer x) { insert(end(), x); }
-
- private:
- template <class T>
- class Iterator : public boost::iterator_facade <
- Iterator<T>, T, boost::forward_traversal_tag>
- {
- public:
- Iterator() {};
-
- template <class U> Iterator(
- const Iterator<U>& i,
- typename boost::enable_if_convertible<U*, T*>::type* = 0
- ) : pptr(i.pptr) {}
-
- operator pointer() { return *pptr; }
- operator const_pointer() const { return *pptr; }
-
- private:
- friend class boost::iterator_core_access;
-
- Iterator(const pointer* pp) : pptr(const_cast<pointer*>(pp)) {};
-
- T& dereference() const { return **pptr; }
- void increment() { pptr = &(**pptr).next; }
- bool equal(const Iterator& x) const { return pptr == x.pptr; }
-
- pointer* pptr;
-
- friend class ISList<Node>;
- };
-
- private:
- pointer first;
- iterator end_;
-};
-
-} // namespace qpid
-
-#endif /*!QPID_ISLIST_H*/
diff --git a/qpid/cpp/src/qpid/InlineAllocator.h b/qpid/cpp/src/qpid/InlineAllocator.h
deleted file mode 100644
index 0bb30fa1a4..0000000000
--- a/qpid/cpp/src/qpid/InlineAllocator.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef QPID_INLINEALLOCATOR_H
-#define QPID_INLINEALLOCATOR_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <memory>
-
-namespace qpid {
-
-/**
- * An allocator that has inline storage for up to Max objects
- * of type BaseAllocator::value_type.
- */
-template <class BaseAllocator, size_t Max>
-class InlineAllocator : public BaseAllocator {
- public:
- typedef typename BaseAllocator::pointer pointer;
- typedef typename BaseAllocator::size_type size_type;
- typedef typename BaseAllocator::value_type value_type;
-
- InlineAllocator() : allocated(false) {}
-
- pointer allocate(size_type n) {
- if (n <= Max && !allocated) {
- allocated=true;
- return store;
- }
- else
- return BaseAllocator::allocate(n, 0);
- }
-
- void deallocate(pointer p, size_type n) {
- if (p == store) allocated=false;
- else BaseAllocator::deallocate(p, n);
- }
-
- template<typename T1>
- struct rebind {
- typedef typename BaseAllocator::template rebind<T1>::other BaseOther;
- typedef InlineAllocator<BaseOther, Max> other;
- };
-
- private:
- value_type store[Max];
- bool allocated;
-};
-
-} // namespace qpid
-
-#endif /*!QPID_INLINEALLOCATOR_H*/
diff --git a/qpid/cpp/src/qpid/InlineVector.h b/qpid/cpp/src/qpid/InlineVector.h
deleted file mode 100644
index 551b9912e7..0000000000
--- a/qpid/cpp/src/qpid/InlineVector.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef QPID_INLINEVECTOR_H
-#define QPID_INLINEVECTOR_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "InlineAllocator.h"
-#include <vector>
-
-namespace qpid {
-
-/**
- * A vector that stores up to Max elements in inline storage,
- * otherwise uses normal vector allocation.
- *
- * NOTE: depends on some non-standard but highly probably assumptions
- * about how std::vector uses its allocator, they are true for g++.
- * - default constructor does not allocate.
- * - reserve(N) does not allocate more than N elements.
- * - vector never re-allocates when size() < capacity()
- */
-template <class T, size_t Max, class Alloc=std::allocator<T> >
-class InlineVector : public std::vector<T, InlineAllocator<Alloc, Max> >
-{
- typedef std::vector<T, InlineAllocator<Alloc, Max> > Base;
- public:
- typedef typename Base::allocator_type allocator_type;
- typedef typename Base::value_type value_type;
- typedef typename Base::size_type size_type;
-
- explicit InlineVector(const allocator_type& a=allocator_type()) : Base(a) {
- this->reserve(Max);
- }
-
- explicit InlineVector(size_type n, const value_type& x = value_type(),
- const allocator_type& a=allocator_type()) : Base(a)
- {
- this->reserve(std::max(n, Max));
- this->insert(this->end(), n, x);
- }
-
- InlineVector(const InlineVector& x) : Base() {
- this->reserve(std::max(x.size(), Max));
- *this = x;
- }
-};
-
-} // namespace qpid
-
-#endif /*!QPID_INLINEVECTOR_H*/
diff --git a/qpid/cpp/src/qpid/Msg.h b/qpid/cpp/src/qpid/Msg.h
deleted file mode 100644
index 7214db611f..0000000000
--- a/qpid/cpp/src/qpid/Msg.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef QPID_MSG_H
-#define QPID_MSG_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <sstream>
-#include <iostream>
-
-namespace qpid {
-
-/** A simple wrapper for std::ostringstream that allows
- * in place construction of a message and automatic conversion
- * to string.
- * E.g.
- *@code
- * void foo(const std::string&);
- * foo(Msg() << "hello " << 32);
- *@endcode
- * Will construct the string "hello 32" and pass it to foo()
- */
-struct Msg {
- std::ostringstream os;
- Msg() {}
- Msg(const Msg& m) : os(m.str()) {}
- std::string str() const { return os.str(); }
- operator std::string() const { return str(); }
-};
-
-template <class T> const Msg& operator<<(const Msg& m, const T& t) {
- const_cast<std::ostringstream&>(m.os)<<t; return m;
-}
-
-inline std::ostream& operator<<(std::ostream& o, const Msg& m) {
- return o<<m.str();
-}
-
-/** Construct a message using operator << and append (file:line) */
-#define QPID_MSG(message) ::qpid::Msg() << message << " (" << __FILE__ << ":" << __LINE__ << ")"
-
-} // namespace qpid
-
-#endif /*!QPID_MSG_H*/
diff --git a/qpid/cpp/src/qpid/Options.cpp b/qpid/cpp/src/qpid/Options.cpp
deleted file mode 100644
index 212171b8c5..0000000000
--- a/qpid/cpp/src/qpid/Options.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Options.h"
-#include "qpid/Exception.h"
-
-#include <boost/bind.hpp>
-
-#include <fstream>
-#include <algorithm>
-#include <iostream>
-
-namespace qpid {
-
-using namespace std;
-
-namespace {
-
-struct EnvOptMapper {
- static bool matchChar(char env, char opt) {
- return (env==toupper(opt)) || (strchr("-.", opt) && env=='_');
- }
-
- static bool matchStr(const string& env, boost::shared_ptr<po::option_description> desc) {
- return std::equal(env.begin(), env.end(), desc->long_name().begin(), &matchChar);
- }
-
- static bool matchCase(const string& env, boost::shared_ptr<po::option_description> desc) {
- return env == desc->long_name();
- }
-
- EnvOptMapper(const Options& o) : opts(o) {}
-
- string operator()(const string& envVar) {
- static const std::string prefix("QPID_");
- if (envVar.substr(0, prefix.size()) == prefix) {
- string env = envVar.substr(prefix.size());
- typedef const std::vector< boost::shared_ptr<po::option_description> > OptDescs;
- OptDescs::const_iterator i =
- find_if(opts.options().begin(), opts.options().end(), boost::bind(matchStr, env, _1));
- if (i != opts.options().end())
- return (*i)->long_name();
- }
- return string();
- }
-
- string configFileLine (string& line) {
- size_t pos = line.find ('=');
- if (pos == string::npos)
- return string();
- string key = line.substr (0, pos);
- typedef const std::vector< boost::shared_ptr<po::option_description> > OptDescs;
- OptDescs::const_iterator i =
- find_if(opts.options().begin(), opts.options().end(), boost::bind(matchCase, key, _1));
- if (i != opts.options().end())
- return string (line) + "\n";
- return string ();
- }
-
- const Options& opts;
-};
-
-}
-std::string prettyArg(const std::string& name, const std::string& value) {
- return value.empty() ? name+" " : name+" ("+value+") ";
-}
-
-Options::Options(const string& name) : po::options_description(name) {}
-
-void Options::parse(int argc, char** argv, const std::string& configFile, bool allowUnknown)
-{
- string defaultConfigFile = configFile; // May be changed by env/cmdline
- string parsing;
- try {
- po::variables_map vm;
- parsing="command line options";
- if (argc > 0 && argv != 0) {
- if (allowUnknown) {
- // This hideous workaround is required because boost 1.33 has a bug
- // that causes 'allow_unregistered' to not work.
- po::command_line_parser clp = po::command_line_parser(argc, argv).
- options(*this).allow_unregistered();
- po::parsed_options opts = clp.run();
- po::parsed_options filtopts = clp.run();
- filtopts.options.clear ();
- for (std::vector< po::basic_option<char> >::iterator i = opts.options.begin();
- i != opts.options.end(); i++)
- if (!i->unregistered)
- filtopts.options.push_back (*i);
- po::store(filtopts, vm);
- }
- else
- po::store(po::parse_command_line(argc, argv, *this), vm);
- }
- parsing="environment variables";
- po::store(po::parse_environment(*this, EnvOptMapper(*this)), vm);
- po::notify(vm); // configFile may be updated from arg/env options.
- if (!configFile.empty()) {
- parsing="configuration file "+configFile;
- ifstream conf(configFile.c_str());
- if (conf.good()) {
- // Remove this hack when we get a stable version of boost that
- // can allow unregistered options in config files.
- EnvOptMapper mapper(*this);
- stringstream filtered;
-
- while (!conf.eof()) {
- string line;
- getline (conf, line);
- filtered << mapper.configFileLine (line);
- }
-
- po::store(po::parse_config_file(filtered, *this), vm);
- // End of hack
- }
- else {
- // No error if default configfile is missing/unreadable
- // but complain for non-default config file.
- if (configFile != defaultConfigFile)
- throw Exception("cannot read configuration file "
- +configFile);
- }
- }
- po::notify(vm);
- }
- catch (const std::exception& e) {
- ostringstream msg;
- msg << "Error in " << parsing << ": " << e.what() << endl;
- if (find_nothrow("help", false))
- msg << "Use --help to see valid options" << endl;
- throw Exception(msg.str());
- }
-}
-
-CommonOptions::CommonOptions(const string& name, const string& configfile)
- : Options(name), config(configfile)
-{
- addOptions()
- ("help,h", optValue(help), "Displays the help message")
- ("version,v", optValue(version), "Displays version information")
- ("config", optValue(config, "FILE"), "Reads configuration from FILE");
-}
-
-} // namespace qpid
-
diff --git a/qpid/cpp/src/qpid/Options.h b/qpid/cpp/src/qpid/Options.h
deleted file mode 100644
index 475d8e91d5..0000000000
--- a/qpid/cpp/src/qpid/Options.h
+++ /dev/null
@@ -1,150 +0,0 @@
-#ifndef QPID_COMMONOPTIONS_H
-#define QPID_COMMONOPTIONS_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include <boost/program_options.hpp>
-#include <boost/format.hpp>
-#include <sstream>
-#include <iterator>
-#include <algorithm>
-
-namespace qpid {
-namespace po=boost::program_options;
-
-///@internal
-std::string prettyArg(const std::string&, const std::string&);
-
-/** @internal Normally only constructed by optValue() */
-template <class T>
-class OptionValue : public po::typed_value<T> {
- public:
- OptionValue(T& value, const std::string& arg)
- : po::typed_value<T>(&value), argName(arg) {}
- std::string name() const { return argName; }
-
- private:
- std::string argName;
-};
-
-
-/** Create an option value.
- * name, value appear after the option name in help like this:
- * <name> (=<value>)
- * T must support operator <<.
- *@see Options for example of use.
- */
-template<class T>
-po::value_semantic* optValue(T& value, const char* name) {
- std::string valstr(boost::lexical_cast<std::string>(value));
- return new OptionValue<T>(value, prettyArg(name, valstr));
-}
-
-/** Create a vector value. Multiple occurences of the option are
- * accumulated into the vector
- */
-template <class T>
-po::value_semantic* optValue(std::vector<T>& value, const char* name) {
- using namespace std;
- ostringstream os;
- copy(value.begin(), value.end(), ostream_iterator<T>(os, " "));
- string val=os.str();
- if (!val.empty())
- val.erase(val.end()-1); // Remove trailing " "
- return (new OptionValue<vector<T> >(value, prettyArg(name, val)));
-}
-
-/** Create a boolean switch value. Presence of the option sets the value. */
-inline po::value_semantic* optValue(bool& value) { return po::bool_switch(&value); }
-
-/**
- * Base class for options.
- * Example of use:
- @code
- struct MySubOptions : public Options {
- int x;
- string y;
- MySubOptions() : Options("Sub options") {
- addOptions()
- ("x", optValue(x,"XUNIT"), "Option X")
- ("y", optValue(y, "YUNIT"), "Option Y");
- }
- };
-
- struct MyOptions : public Options {
- bool z;
- vector<string> foo;
- MySubOptions subOptions;
- MyOptions() : Options("My Options") {
- addOptions()
- ("z", boolSwitch(z), "Option Z")
- ("foo", optValue(foo), "Multiple option foo");
- add(subOptions);
- }
-
- main(int argc, char** argv) {
- Options opts;
- opts.parse(argc, char** argv);
- // Use values
- dosomething(opts.subOptions.x);
- if (error)
- cout << opts << end; // Help message.
- }
-
- @endcode
- */
-struct Options : public po::options_description {
- struct Exception : public qpid::Exception {
- Exception(const std::string& msg) : qpid::Exception(msg) {}
- };
-
- Options(const std::string& name=std::string());
-
- boost::program_options::options_description_easy_init addOptions() {
- return add_options();
- }
-
- /**
- * Parses options from argc/argv, environment variables and config file.
- * Note the filename argument can reference an options variable that
- * is updated by argc/argv or environment variable parsing.
- */
- void parse(int argc, char** argv,
- const std::string& configfile=std::string(),
- bool allowUnknown = false);
-};
-
-/**
- * Standard options for configuration
- */
-struct CommonOptions : public Options {
- CommonOptions(const std::string& name=std::string(),
- const std::string& configfile=std::string());
- bool help;
- bool version;
- std::string config;
-};
-
-} // namespace qpid
-
-#endif /*!QPID_COMMONOPTIONS_H*/
diff --git a/qpid/cpp/src/qpid/Plugin.cpp b/qpid/cpp/src/qpid/Plugin.cpp
deleted file mode 100644
index d38b53a56e..0000000000
--- a/qpid/cpp/src/qpid/Plugin.cpp
+++ /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.
- *
- */
-
-#include "Plugin.h"
-
-namespace qpid {
-
-Plugin::Plugins Plugin::plugins;
-
-Plugin::Plugin() {
- // Register myself.
- plugins.push_back(this);
-}
-
-Plugin::~Plugin() {}
-
-Options* Plugin::getOptions() { return 0; }
-
-const Plugin::Plugins& Plugin::getPlugins() {
- return plugins;
-}
-
-} // namespace qpid
diff --git a/qpid/cpp/src/qpid/Plugin.h b/qpid/cpp/src/qpid/Plugin.h
deleted file mode 100644
index e040662866..0000000000
--- a/qpid/cpp/src/qpid/Plugin.h
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef QPID_PLUGIN_H
-#define QPID_PLUGIN_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/shared_ptr.h"
-#include <boost/noncopyable.hpp>
-#include <vector>
-#include <boost/function.hpp>
-
-
-/**@file Generic plug-in framework. */
-
-namespace qpid {
-class Options;
-
-/**
- * Plug-in base class.
- */
-class Plugin : boost::noncopyable
-{
- public:
- /**
- * Base interface for targets that receive plug-ins.
- *
- * The Broker is a plug-in target, there might be others
- * in future.
- */
- struct Target { virtual ~Target() {} };
-
- typedef std::vector<Plugin*> Plugins;
-
- /**
- * Construct registers the plug-in to appear in getPlugins().
- *
- * A concrete Plugin is instantiated as a global or static
- * member variable in a library so it is registered during static
- * initialization when the library is loaded.
- */
- Plugin();
-
- virtual ~Plugin();
-
- /**
- * Configuration options for the plugin.
- * Then will be updated during option parsing by the host program.
- *
- * @return An options group or 0 for no options. Default returns 0.
- * Plugin retains ownership of return value.
- */
- virtual Options* getOptions();
-
- /**
- * Initialize Plugin functionality on a Target.
- * Plugins should ignore targets they don't recognize.
- *
- * Called before the target itself is initialized.
- */
- virtual void earlyInitialize(Target&) = 0;
-
- /**
- * Initialize Plugin functionality on a Target.
- * Plugins should ignore targets they don't recognize.
- *
- * Called after the target is fully initialized.
- */
- virtual void initialize(Target&) = 0;
-
- /** List of registered Plugin objects.
- * Caller must not delete plugin pointers.
- */
- static const Plugins& getPlugins();
-
- private:
- static Plugins plugins;
-};
-
-} // namespace qpid
-
-#endif /*!QPID_PLUGIN_H*/
diff --git a/qpid/cpp/src/qpid/RefCounted.h b/qpid/cpp/src/qpid/RefCounted.h
deleted file mode 100644
index c325b204d4..0000000000
--- a/qpid/cpp/src/qpid/RefCounted.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef QPID_REFCOUNTED_H
-#define QPID_REFCOUNTED_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/AtomicCount.h"
-
-#include <boost/intrusive_ptr.hpp>
-
-
-namespace qpid {
-
-/** Abstract interface for reference counted objects */
-class AbstractRefCounted {
- public:
- virtual void addRef() const=0;
- virtual void release() const=0;
- protected:
- virtual ~AbstractRefCounted() {}
-};
-
-/**
- * Reference-counted base class.
- */
-class RefCounted : public AbstractRefCounted {
- public:
- RefCounted() {}
- virtual void addRef() const { ++count; }
- virtual void release() const { if (--count==0) released(); }
-
- protected:
- virtual ~RefCounted() {};
- // Copy/assign do not copy refcounts.
- RefCounted(const RefCounted&) : AbstractRefCounted() {}
- RefCounted& operator=(const RefCounted&) { return *this; }
- virtual void released() const { assert(count==0); delete this; }
-
- mutable sys::AtomicCount count;
-};
-
-/**
- * Reference-counted member of a reference-counted parent class.
- * Delegates reference counts to the parent so that the parent is
- * deleted only when there are no references to the parent or any of
- * its children.
- */
-struct RefCountedChild : public AbstractRefCounted {
- protected:
- AbstractRefCounted& parent;
- RefCountedChild(AbstractRefCounted& parent_) : parent(parent_) {}
- public:
- void addRef() const { parent.addRef(); }
- void release() const { parent.release(); }
-};
-
-using boost::intrusive_ptr;
-
-} // namespace qpid
-
-// intrusive_ptr support.
-namespace boost {
-inline void intrusive_ptr_add_ref(const qpid::AbstractRefCounted* p) { p->addRef(); }
-inline void intrusive_ptr_release(const qpid::AbstractRefCounted* p) { p->release(); }
-}
-
-
-#endif /*!QPID_REFCOUNTED_H*/
diff --git a/qpid/cpp/src/qpid/Serializer.h b/qpid/cpp/src/qpid/Serializer.h
deleted file mode 100644
index a2fbf944ae..0000000000
--- a/qpid/cpp/src/qpid/Serializer.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef QPID_SERIALIZERBASE_H
-#define QPID_SERIALIZERBASE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/cast.hpp>
-#include <boost/array.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_class.hpp>
-
-namespace qpid {
-
-/**
- * Base template for serializers, provides generic serialization for
- * conmpound types and common encode/decode/size functions.
- *
- * Derived template must provide
- * - Derived& op()(T) for primitive types.
- * - Derived& raw(void*, size_t) for raw binary data
- * - Derived& byte(char) for single bytes.
- *
- * Derived templatse may override any of the functions provided by
- * this base class.
- *
- * This class provides templates to break down compound types
- * into primitive types and delegate to the derived class.
- *
- */
-template <class Derived> class Serializer {
- public:
-
- /** Call T::serialize() for classes that have their own serialize function */
- template <class T>
- typename boost::enable_if<boost::is_class<T>, Derived>::type
- operator()(T& t) { t.serialize(self()); return self(); }
-
- template <class T, size_t N>
- Derived& operator()(boost::array<T,N>& a) {
- std::for_each(a.begin(), a.end(), self());
- return self();
- }
-
- Derived& operator()(char& x) { return self().byte((char&)x); }
- Derived& operator()(int8_t& x) { return self().byte((char&)x); }
- Derived& operator()(uint8_t& x) { return self().byte((char&)x); }
-
- protected:
- template <class T> Derived& raw(T& t) {
- return self().raw(&t, sizeof(T));
- }
-
- private:
- Derived& self() { return *static_cast<Derived*>(this); }
-};
-
-/** Like Serializer but does not modify the values passed to it. */
-template <class Derived> class ConstSerializer {
- public:
- template <class T>
- typename boost::enable_if<boost::is_class<T>, Derived>::type
- operator()(const T& t) {
- // Const cast so we don't have to write 2 serialize() functions
- // for every class.
- const_cast<T&>(t).serialize(self());
- return self();
- }
-
- template <class T, size_t N>
- Derived& operator()(const boost::array<T,N>& a) {
- std::for_each(a.begin(), a.end(), self());
- return self();
- }
-
- Derived& operator()(char x) { return self().byte(x); }
- Derived& operator()(int8_t x) { return self().byte(x); }
- Derived& operator()(uint8_t x) { return self().byte(x); }
-
- protected:
- template <class T> Derived& raw(const T& t) {
- return self().raw(&t, sizeof(T));
- }
-
- private:
- Derived& self() { return *static_cast<Derived*>(this); }
-};
-
-
-} // namespace qpid
-
-#endif /*!QPID_SERIALIZERBASE_H*/
diff --git a/qpid/cpp/src/qpid/SharedObject.h b/qpid/cpp/src/qpid/SharedObject.h
deleted file mode 100644
index 852a036ab9..0000000000
--- a/qpid/cpp/src/qpid/SharedObject.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _SharedObject_
-#define _SharedObject_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/shared_ptr.hpp>
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
- /**
- * Template to enforce shared object conventions.
- * Shared object classes should inherit : public qpid::SharedObject
- * That ensures Foo:
- * - has typedef boost::shared_ptr<T> shared_ptr
- * - has virtual destructor
- * - is boost::noncopyable (no default copy or assign)
- * - has a protected default constructor.
- *
- * Shared objects should not have public constructors.
- * Make constructors protected and provide public statc create()
- * functions that return a shared_ptr.
- */
- template <class T>
- class SharedObject : private boost::noncopyable
- {
- public:
- typedef boost::shared_ptr<T> shared_ptr;
-
- virtual ~SharedObject() {};
-
- protected:
- SharedObject() {}
- };
-}
-
-#endif /*!_SharedObject_*/
diff --git a/qpid/cpp/src/qpid/Url.cpp b/qpid/cpp/src/qpid/Url.cpp
deleted file mode 100644
index aa53d5cbe2..0000000000
--- a/qpid/cpp/src/qpid/Url.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/Url.h"
-#include "qpid/Exception.h"
-#include "qpid/Msg.h"
-
-#include <sstream>
-#include <boost/spirit.hpp>
-#include <boost/spirit/actor.hpp>
-
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <errno.h>
-
-using namespace boost::spirit;
-using namespace std;
-
-namespace qpid {
-
-std::ostream& operator<<(std::ostream& os, const TcpAddress& a) {
- return os << "tcp:" << a.host << ":" << a.port;
-}
-
-std::istream& operator>>(std::istream&, const TcpAddress&);
-
-Url Url::getHostNameUrl(uint16_t port) {
- char name[HOST_NAME_MAX];
- if (::gethostname(name, sizeof(name)) != 0)
- throw InvalidUrl(QPID_MSG("Cannot get host name: " << strError(errno)));
- return Url(TcpAddress(name, port));
-}
-
-static const string LOCALHOST("127.0.0.1");
-
-Url Url::getIpAddressesUrl(uint16_t port) {
- Url url;
- int s = socket (PF_INET, SOCK_STREAM, 0);
- for (int i=1;;i++) {
- struct ifreq ifr;
- ifr.ifr_ifindex = i;
- if (::ioctl (s, SIOCGIFNAME, &ifr) < 0)
- break;
- /* now ifr.ifr_name is set */
- if (::ioctl (s, SIOCGIFADDR, &ifr) < 0)
- continue;
- struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
- string addr(inet_ntoa(sin->sin_addr));
- if (addr != LOCALHOST)
- url.push_back(TcpAddress(addr, port));
- }
- close (s);
- return url;
-}
-
-string Url::str() const {
- if (cache.empty() && !this->empty()) {
- ostringstream os;
- os << *this;
- cache = os.str();
- }
- return cache;
-}
-
-ostream& operator<<(ostream& os, const Url& url) {
- Url::const_iterator i = url.begin();
- os << "amqp:";
- if (i!=url.end()) {
- os << *i++;
- while (i != url.end())
- os << "," << *i++;
- }
- return os;
-}
-
-// Addition to boost::spirit parsers: accept any character from a
-// string. Vastly more compile-time-efficient than long rules of the
-// form: ch_p('x') | ch_p('y') |...
-//
-struct ch_in : public char_parser<ch_in> {
- ch_in(const string& chars_) : chars(chars_) {}
- bool test(char ch_) const {
- return chars.find(ch_) != string::npos;
- }
- string chars;
-};
-
-inline ch_in ch_in_p(const string& chars) {
- return ch_in(chars);
-}
-
-/** Grammar for AMQP URLs. */
-struct UrlGrammar : public grammar<UrlGrammar>
-{
- Url& addr;
-
- UrlGrammar(Url& addr_) : addr(addr_) {}
-
- template <class ScannerT>
- struct definition {
- TcpAddress tcp;
-
- definition(const UrlGrammar& self)
- {
- first = eps_p[clear_a(self.addr)] >> amqp_url;
- amqp_url = str_p("amqp:") >> prot_addr_list >>
- !(str_p("/") >> !parameters);
- prot_addr_list = prot_addr % ',';
- prot_addr = tcp_prot_addr; // Extend for TLS etc.
-
- // TCP addresses
- tcp_prot_addr = tcp_id >> tcp_addr[push_back_a(self.addr, tcp)];
- tcp_id = !str_p("tcp:");
- tcp_addr = !(host[assign_a(tcp.host)] >> !(':' >> port));
-
- // See http://www.apps.ietf.org/rfc/rfc3986.html#sec-A
- // for real host grammar. Shortcut:
- port = uint_parser<uint16_t>()[assign_a(tcp.port)];
- host = *( unreserved | pct_encoded );
- unreserved = alnum_p | ch_in_p("-._~");
- pct_encoded = "%" >> xdigit_p >> xdigit_p;
- parameters = *anychar_p >> end_p; // Ignore, not used yet.
- }
-
- const rule<ScannerT>& start() const { return first; }
-
- rule<ScannerT> first, amqp_url, prot_addr_list, prot_addr,
- tcp_prot_addr, tcp_id, tcp_addr, host, port,
- unreserved, pct_encoded, parameters;
- };
-};
-
-void Url::parse(const char* url) {
- cache.clear();
- if (!boost::spirit::parse(url, UrlGrammar(*this)).full)
- throw InvalidUrl(string("Invalid AMQP url: ")+url);
-}
-
-void Url::parseNoThrow(const char* url) {
- cache.clear();
- if (!boost::spirit::parse(url, UrlGrammar(*this)).full)
- clear();
-}
-
-void Url::throwIfEmpty() const {
- throw InvalidUrl("URL contains no addresses");
-}
-
-std::istream& operator>>(std::istream& is, Url& url) {
- std::string s;
- is >> s;
- url.parse(s);
- return is;
-}
-
-} // namespace qpid
diff --git a/qpid/cpp/src/qpid/Url.h b/qpid/cpp/src/qpid/Url.h
deleted file mode 100644
index 20f42db0ad..0000000000
--- a/qpid/cpp/src/qpid/Url.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef QPID_URL_H
-#define QPID_URL_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include <boost/variant.hpp>
-#include <string>
-#include <vector>
-#include <new>
-#include <ostream>
-
-namespace qpid {
-
-/** TCP address of a broker - host:port */
-struct TcpAddress {
- static const uint16_t DEFAULT_PORT=5672;
- explicit TcpAddress(const std::string& host_=std::string(),
- uint16_t port_=DEFAULT_PORT)
- : host(host_), port(port_) {}
- std::string host;
- uint16_t port;
-};
-
-inline bool operator==(const TcpAddress& x, const TcpAddress& y) {
- return y.host==x.host && y.port == x.port;
-}
-
-std::ostream& operator<<(std::ostream& os, const TcpAddress& a);
-
-/** Address is a variant of all address types, more coming in future. */
-typedef boost::variant<TcpAddress> Address;
-
-/** An AMQP URL contains a list of addresses */
-struct Url : public std::vector<Address> {
-
- /** Url with the hostname as returned by gethostname(2) */
- static Url getHostNameUrl(uint16_t port);
-
- /** Url with local IP address(es), may be more than one address
- * on a multi-homed host. */
- static Url getIpAddressesUrl(uint16_t port);
-
- struct InvalidUrl : public Exception {
- InvalidUrl(const std::string& s) : Exception(s) {}
- };
-
- /** Convert to string form. */
- std::string str() const;
-
- /** Empty URL. */
- Url() {}
-
- /** URL containing a single address */
- explicit Url(const Address& addr) { push_back(addr); }
-
- /** Parse url, throw InvalidUrl if invalid. */
- explicit Url(const std::string& url) { parse(url.c_str()); }
-
- /** Parse url, throw InvalidUrl if invalid. */
- explicit Url(const char* url) { parse(url); }
-
- template<class T> Url& operator=(T s) { parse(s); return *this; }
-
- /** Throw InvalidUrl if the URL does not contain any addresses. */
- void throwIfEmpty() const;
-
- /** Replace contents with parsed URL as defined in
- * https://wiki.108.redhat.com/jira/browse/AMQP-95
- *@exception InvalidUrl if the url is invalid.
- */
- void parse(const char* url);
- void parse(const std::string& url) { parse(url.c_str()); }
-
- /** Replace contesnts with parsed URL as defined in
- * https://wiki.108.redhat.com/jira/browse/AMQP-95
- * url.empty() will be true if url is invalid.
- */
- void parseNoThrow(const char* url);
-
- private:
- mutable std::string cache; // cache string form for efficiency.
-};
-
-inline bool operator==(const Url& a, const Url& b) { return a.str()==b.str(); }
-inline bool operator!=(const Url& a, const Url& b) { return a.str()!=b.str(); }
-
-std::ostream& operator<<(std::ostream& os, const Url& url);
-std::istream& operator>>(std::istream& is, Url& url);
-
-} // namespace qpid
-
-#endif /*!QPID_URL_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Codec.h b/qpid/cpp/src/qpid/amqp_0_10/Codec.h
deleted file mode 100644
index e7f35e9288..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Codec.h
+++ /dev/null
@@ -1,187 +0,0 @@
-#ifndef QPID_AMQP_0_10_CODEC_H
-#define QPID_AMQP_0_10_CODEC_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "built_in_types.h"
-#include "qpid/Serializer.h"
-#include <boost/type_traits/is_integral.hpp>
-#include <boost/type_traits/is_float.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-#include <boost/detail/endian.hpp>
-#include <boost/ref.hpp>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-/**
- * AMQP 0-10 encoding and decoding.
- */
-struct Codec
-{
- template <class T>
- static inline void endianize(T& value) {
-
-#ifdef BOOST_LITTLE_ENDIAN
- std::reverse((char*)&value, (char*)&value+sizeof(value));
-#else
- (void)value; // Avoid unused var warnings.
-#endif
- }
- static inline void endianize(char&) {}
- static inline void endianize(uint8_t&) {}
- static inline void endianize(int8_t&) {}
-
-
- template <class Out> struct Encode : public ConstSerializer<Encode<Out> > {
- Out out;
-
- Encode(Out o) : out(o) {}
-
- using ConstSerializer<Encode<Out> >::operator();
- using ConstSerializer<Encode<Out> >::raw;
-
- template <class T>
- typename boost::enable_if<boost::is_integral<T>, Encode&>::type
- operator()(const T& x) { T xx(x); endianize(xx); return raw(xx); }
-
- // FIXME aconway 2008-02-20: correct float encoading
- template <class T>
- typename boost::enable_if<boost::is_float<T>, Encode&>::type
- operator()(const T& x) { return raw(x); }
-
-
- template<class T, class SizeType>
- Encode& operator()(const CodableString<T,SizeType>& str) {
- (*this)(SizeType(str.size()));
- std::for_each(str.begin(), str.end(), *this);
- return *this;
- }
-
- private:
- friend class ConstSerializer<Encode<Out> >;
-
- Encode& raw(const void* vp, size_t s) {
- char* p = (char*) vp;
- std::copy(p, p+s, out);
- return *this;
- }
-
- Encode& byte(char x) { out++ = x; return *this; }
- };
-
- template <class In> struct Decode : public Serializer<Decode<In> > {
- In in;
- Decode(In i) : in(i) {}
-
- using Serializer<Decode<In> >::operator();
- using Serializer<Decode<In> >::raw;
-
- template <class T>
- typename boost::enable_if<boost::is_integral<T>, Decode&>::type
- operator()(T& x) {
- raw(&x, sizeof(x));
- endianize(x);
- return *this;
- }
-
- template <class T>
- typename boost::enable_if<boost::is_float<T>, Decode&>::type
- operator()(T& x) { return raw(&x, sizeof(x)); }
-
- template<class T, class SizeType>
- Decode& operator()(CodableString<T,SizeType>& str) {
- SizeType n;
- (*this)(n);
- str.resize(n);
- std::for_each(str.begin(), str.end(), *this);
- return *this;
- }
-
- private:
- friend class Serializer<Decode<In> >;
-
- Decode& raw(void* vp, size_t s) {
- char* p=(char*)vp;
- std::copy(in, in+s, p);
- return *this;
- }
-
- Decode& byte(char& x) { x = *in++; return *this; }
- };
-
- struct Size : public ConstSerializer<Size> {
- Size() : size(0) {}
- size_t size;
- operator size_t() const { return size; }
-
- using ConstSerializer<Size>::operator();
- using ConstSerializer<Size>::raw;
-
- template <class T>
- typename boost::enable_if<boost::is_arithmetic<T>, Size&>::type
- operator()(const T&) { size += sizeof(T); return *this; }
-
- template <class T, size_t N>
- Size& operator()(const boost::array<T,N>&) {
- size += sizeof(boost::array<T,N>);
- return *this;
- }
-
- template<class T, class SizeType>
- Size& operator()(const CodableString<T,SizeType>& str) {
- size += sizeof(SizeType) + str.size()*sizeof(T);
- return *this;
- }
-
-
- private:
- friend class ConstSerializer<Size>;
-
- Size& raw(void*, size_t s) { size += s; return *this; }
-
- Size& byte(char) { ++size; return *this; }
- };
-
- template <class Out, class T>
- static void encode(Out o, const T& x) {
- Encode<Out>encode(o);
- encode(x);
- }
-
- template <class In, class T>
- static void decode(In i, T& x) {
- Decode<In> decode(i);
- decode(x);
- }
-
- template <class T>
- static size_t size(const T& x) {
- Size sz;
- sz(x);
- return sz;
- }
-};
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_CODEC_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Decimal.h b/qpid/cpp/src/qpid/amqp_0_10/Decimal.h
deleted file mode 100644
index 75cde94559..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Decimal.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef TESTS_DECIMAL_H
-#define TESTS_DECIMAL_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <ostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-template <class E, class M> struct Decimal {
- E exponent;
- M mantissa;
-
- Decimal() : exponent(0), mantissa(0) {}
-
- bool operator==(const Decimal& d) const {
- return exponent == d.exponent && mantissa == d.mantissa;
- }
-
- // TODO aconway 2008-02-20: We could provide arithmetic operators
- // if anybody really cares about this type.
-
- template <class S> void serialize(S& s) { s(exponent)(mantissa); }
-};
-
-template<class E, class M>
-inline std::ostream& operator<<(std::ostream& o, const Decimal<E,M>& d) {
- M pow10=10^d.exponent;
- return o << d.mantissa/pow10 << "." << d.mantissa%pow10;
-}
-}}
-
-#endif /*!TESTS_DECIMAL_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/built_in_types.h b/qpid/cpp/src/qpid/amqp_0_10/built_in_types.h
deleted file mode 100644
index 445f07459c..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/built_in_types.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef QPID_AMQP_0_10_BUILT_IN_TYPES_H
-#define QPID_AMQP_0_10_BUILT_IN_TYPES_H
-// FIXME aconway 2008-02-20: separate _fwd.h from full include.
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Decimal.h"
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/framing/Uuid.h"
-#include "qpid/sys/Time.h"
-#include <boost/array.hpp>
-#include <stdint.h>
-#include <string>
-#include <vector>
-
-/**@file Mapping from built-in AMQP types to C++ types */
-
-namespace qpid {
-namespace amqp_0_10 {
-
-// Fixed size types
-typedef void Void;
-
-typedef bool Bit;
-typedef bool Boolean;
-typedef char Char;
-typedef int16_t Int16;
-typedef int32_t Int32;
-typedef int64_t Int64;
-typedef int8_t Int8;
-typedef uint16_t Uint16;
-typedef uint32_t CharUtf32 ;
-typedef uint32_t Uint32;
-typedef uint64_t Uint64;
-typedef uint8_t Bin8;
-typedef uint8_t Uint8;
-
-typedef boost::array<uint8_t,128> Bin1024;
-typedef boost::array<uint8_t,16> Bin128;
-typedef boost::array<uint8_t,2> Bin16;
-typedef boost::array<uint8_t,32> Bin256;
-typedef boost::array<uint8_t,4> Bin32;
-typedef boost::array<uint8_t,5> Bin40;
-typedef boost::array<uint8_t,64> Bin512;
-typedef boost::array<uint8_t,8> Bin64;
-typedef boost::array<uint8_t,9> Bin72;
-
-typedef double Double;
-typedef float Float;
-typedef framing::SequenceNumber SequenceNo;
-using framing::Uuid;
-typedef sys::AbsTime Datetime;
-
-typedef Decimal<Uint8, Int32> Dec32;
-typedef Decimal<Uint8, Int64> Dec64;
-
-
-/** Template for length-prefixed strings/arrays. */
-template <class T, class SizeType>
-struct CodableString : public std::basic_string<T> {};
-
-// Variable width types
-typedef CodableString<Uint8, Uint8> Vbin8;
-typedef CodableString<char, Uint8> Str8Latin;
-typedef CodableString<char, Uint8> Str8;
-typedef CodableString<Uint16, Uint8> Str8Utf16;
-
-typedef CodableString<Uint8, Uint16> Vbin16;
-typedef CodableString<char, Uint16> Str16Latin;
-typedef CodableString<char, Uint16> Str16;
-typedef CodableString<Uint16, Uint16> Str16Utf16;
-
-typedef CodableString<Uint8, Uint32> Vbin32;
-
-// FIXME aconway 2008-02-26: array encoding
-template <class T> struct Array : public std::vector<T> {};
-
-// FIXME aconway 2008-02-26: Unimplemented types:
-struct ByteRanges {};
-struct SequenceSet {};
-struct Map {};
-struct List {};
-struct Struct32 {};
-
-// Top level enum definitions.
-enum SegmentType { CONTROL, COMMAND, HEADER, BODY };
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_BUILT_IN_TYPES_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/helpers.cpp b/qpid/cpp/src/qpid/amqp_0_10/helpers.cpp
deleted file mode 100644
index 4333a2cd92..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/helpers.cpp
+++ /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.
- *
- */
-#include "helpers.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-Control::~Control() {}
-Command::~Command() {}
-Struct::~Struct() {}
-
-}} // namespace qpid::amqp_0_10
diff --git a/qpid/cpp/src/qpid/amqp_0_10/helpers.h b/qpid/cpp/src/qpid/amqp_0_10/helpers.h
deleted file mode 100644
index 1769d374d9..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/helpers.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef QPID_AMQP_0_10_HELPERS_H
-#define QPID_AMQP_0_10_HELPERS_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
-n * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <string>
-
-namespace qpid {
-
-namespace amqp_0_10 {
-
-// Look up names by code
-const char* getClassName(uint8_t code);
-const char* getCommandName(uint8_t classCode, uint8_t code);
-const char* getControlName(uint8_t classCode, uint8_t code);
-const char* getStructName(uint8_t classCode, uint8_t code);
-
-struct Command {
- virtual ~Command();
- class Visitor;
- virtual void accept(Visitor&) const = 0;
-};
-
-struct Control {
- virtual ~Control();
- class Visitor;
- virtual void accept(Visitor&) const = 0;
-};
-
-struct Struct {
- virtual ~Struct();
- class Visitor;
- virtual void accept(Visitor&) const = 0;
-};
-
-/** Base class for generated enum domains.
- * Enums map to classes for type safety and to provide separate namespaces
- * for clashing values.
- */
-struct Enum {
- int value;
- Enum(int v=0) : value(v) {}
- operator int() const { return value; }
- template <class S> void serialize(S &s) { s(value); }
-};
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_HELPERS_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/visitors.h b/qpid/cpp/src/qpid/amqp_0_10/visitors.h
deleted file mode 100644
index 3835f37f3e..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/visitors.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Visitors
-template <class Base> struct Visitor;
-template <class Base, class F, class R> FunctorVisitor;
-
-/** Template base implementation for visitables. */
-template <class Base, class Derived>
-struct VisitableBase : public Base {
- virtual void accept(Visitor<Derived>& v) {
- v.visit(static_cast<Derived>&(*this));
- }
- virtual void accept(Visitor<Derived>& v) const {
- v.visit(static_cast<const Derived>&(*this));
- }
-};
-
diff --git a/qpid/cpp/src/qpid/assert.cpp b/qpid/cpp/src/qpid/assert.cpp
deleted file mode 100644
index dba81f3873..0000000000
--- a/qpid/cpp/src/qpid/assert.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef QPID_ASSERT_CPP
-#define QPID_ASSERT_CPP
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <sstream>
-#include <iostream>
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-
-void assert_fail(char const * expr, char const * function, char const * file, long line) {
- std::ostringstream msg;
- msg << "Internal error: " << expr << " in function " << function
- << "(" << file << ":" << line << ")";
-#ifdef NDEBUG
- throw framing::InternalErrorException(msg.str());
-#else
- std::cerr << msg << std::endl;
- abort();
-#endif
-}
-
-} // namespace qpid
-
-#endif /*!QPID_ASSERT_CPP*/
diff --git a/qpid/cpp/src/qpid/assert.h b/qpid/cpp/src/qpid/assert.h
deleted file mode 100644
index 49e7c5355d..0000000000
--- a/qpid/cpp/src/qpid/assert.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef QPID_ASSERT_H
-#define QPID_ASSERT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/current_function.hpp>
-
-/**
- * Abort if !expr in debug mode, throw an exception if NDEBUG is set.
- */
-#define QPID_ASSERT(expr) ((expr) ? static_cast<void>(0) : ::qpid::assert_fail(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
-
-namespace qpid {
-
-void assert_fail(char const * expr, char const * function, char const * file, long line);
-
-} // namespace qpid
-
-#endif /*!QPID_ASSERT_H*/
diff --git a/qpid/cpp/src/qpid/broker/Bridge.cpp b/qpid/cpp/src/qpid/broker/Bridge.cpp
deleted file mode 100644
index 566b9cc197..0000000000
--- a/qpid/cpp/src/qpid/broker/Bridge.cpp
+++ /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.
- *
- */
-#include "Bridge.h"
-#include "ConnectionState.h"
-
-#include "qpid/management/ManagementAgent.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/Uuid.h"
-
-using qpid::framing::FieldTable;
-using qpid::framing::Uuid;
-
-namespace qpid {
-namespace broker {
-
-Bridge::Bridge(framing::ChannelId id, ConnectionState& c, CancellationListener l, const management::ArgsLinkBridge& _args) :
- args(_args), channel(id, &(c.getOutput())), peer(channel),
- mgmtObject(new management::Bridge(this, &c, id, args.i_src, args.i_dest, args.i_key, args.i_src_is_queue, args.i_src_is_local)),
- connection(c), listener(l)
-{
- management::ManagementAgent::getAgent()->addObject(mgmtObject);
-}
-
-Bridge::~Bridge()
-{
- mgmtObject->resourceDestroy();
-}
-
-void Bridge::create()
-{
- framing::AMQP_ServerProxy::Session session(channel);
- session.open(0);
-
- //peer.getSession().open(0);
-
- if (args.i_src_is_local) {
- //TODO: handle 'push' here... simplest way is to create frames and pass them to Connection::received()
- } else {
- if (args.i_src_is_queue) {
- peer.getMessage().subscribe(0, args.i_src, args.i_dest, false, 0, 0, false, FieldTable());
- peer.getMessage().flow(args.i_dest, 0, 0xFFFFFFFF);
- peer.getMessage().flow(args.i_dest, 1, 0xFFFFFFFF);
- } else {
- string queue = "bridge_queue_";
- queue += Uuid(true).str();
- peer.getQueue().declare(0, queue, "", false, false, true, true, FieldTable());
- peer.getQueue().bind(0, queue, args.i_dest, args.i_key, FieldTable());
- peer.getMessage().subscribe(0, queue, args.i_dest, false, 0, 0, false, FieldTable());
- peer.getMessage().flow(args.i_dest, 0, 0xFFFFFFFF);
- peer.getMessage().flow(args.i_dest, 1, 0xFFFFFFFF);
- }
- }
-
-}
-
-void Bridge::cancel()
-{
- peer.getMessage().cancel(args.i_dest);
- peer.getSession().close();
-}
-
-management::ManagementObject::shared_ptr Bridge::GetManagementObject (void) const
-{
- return dynamic_pointer_cast<management::ManagementObject>(mgmtObject);
-}
-
-management::Manageable::status_t Bridge::ManagementMethod(uint32_t methodId, management::Args& /*args*/)
-{
- if (methodId == management::Bridge::METHOD_CLOSE) {
- //notify that we are closed
- listener(this);
- //request time on the connections io thread
- connection.getOutput().activateOutput();
- return management::Manageable::STATUS_OK;
- } else {
- return management::Manageable::STATUS_UNKNOWN_METHOD;
- }
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/broker/Bridge.h b/qpid/cpp/src/qpid/broker/Bridge.h
deleted file mode 100644
index 1198285c93..0000000000
--- a/qpid/cpp/src/qpid/broker/Bridge.h
+++ /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.
- *
- */
-#ifndef _Bridge_
-#define _Bridge_
-
-#include "qpid/framing/AMQP_ServerProxy.h"
-#include "qpid/framing/ChannelHandler.h"
-#include "qpid/management/Manageable.h"
-#include "qpid/management/ArgsLinkBridge.h"
-#include "qpid/management/Bridge.h"
-
-#include <boost/function.hpp>
-
-namespace qpid {
-namespace broker {
-
-class ConnectionState;
-
-class Bridge : public management::Manageable
-{
-public:
- typedef boost::function<void(Bridge*)> CancellationListener;
-
- Bridge(framing::ChannelId id, ConnectionState& c, CancellationListener l,
- const management::ArgsLinkBridge& args);
- ~Bridge();
-
- void create();
- void cancel();
-
- management::ManagementObject::shared_ptr GetManagementObject() const;
- management::Manageable::status_t ManagementMethod(uint32_t methodId, management::Args& args);
-
-private:
- management::ArgsLinkBridge args;
- framing::ChannelHandler channel;
- framing::AMQP_ServerProxy peer;
- management::Bridge::shared_ptr mgmtObject;
- ConnectionState& connection;
- CancellationListener listener;
-};
-
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/Broker.cpp b/qpid/cpp/src/qpid/broker/Broker.cpp
deleted file mode 100644
index 9bfa868d9c..0000000000
--- a/qpid/cpp/src/qpid/broker/Broker.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "config.h"
-#include "Broker.h"
-#include "Connection.h"
-#include "DirectExchange.h"
-#include "FanOutExchange.h"
-#include "HeadersExchange.h"
-#include "MessageStoreModule.h"
-#include "NullMessageStore.h"
-#include "RecoveryManagerImpl.h"
-#include "TopicExchange.h"
-#include "qpid/management/ManagementExchange.h"
-#include "qpid/management/ArgsBrokerEcho.h"
-
-#include "qpid/log/Statement.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/ProtocolInitiation.h"
-#include "qpid/sys/Acceptor.h"
-#include "qpid/sys/ConnectionInputHandler.h"
-#include "qpid/sys/ConnectionInputHandlerFactory.h"
-#include "qpid/sys/TimeoutHandler.h"
-#include "qpid/sys/SystemInfo.h"
-#include "qpid/Url.h"
-
-#include <boost/bind.hpp>
-
-#include <iostream>
-#include <memory>
-
-using qpid::sys::Acceptor;
-using qpid::framing::FrameHandler;
-using qpid::framing::ChannelId;
-using qpid::management::ManagementAgent;
-using qpid::management::ManagementObject;
-using qpid::management::Manageable;
-using qpid::management::Args;
-using qpid::management::ArgsBrokerEcho;
-
-namespace qpid {
-namespace broker {
-
-Broker::Options::Options(const std::string& name) :
- qpid::Options(name),
- noDataDir(0),
- dataDir("/var/lib/qpidd"),
- port(DEFAULT_PORT),
- workerThreads(5),
- maxConnections(500),
- connectionBacklog(10),
- stagingThreshold(5000000),
- enableMgmt(1),
- mgmtPubInterval(10),
- ack(0)
-{
- int c = sys::SystemInfo::concurrency();
- workerThreads=std::max(2,c);
- addOptions()
- ("data-dir", optValue(dataDir,"DIR"),
- "Directory to contain persistent data generated by the broker")
- ("no-data-dir", optValue(noDataDir),
- "Don't use a data directory. No persistent configuration will be loaded or stored")
- ("port,p", optValue(port,"PORT"),
- "Tells the broker to listen on PORT")
- ("worker-threads", optValue(workerThreads, "N"),
- "Sets the broker thread pool size")
- ("max-connections", optValue(maxConnections, "N"),
- "Sets the maximum allowed connections")
- ("connection-backlog", optValue(connectionBacklog, "N"),
- "Sets the connection backlog limit for the server socket")
- ("staging-threshold", optValue(stagingThreshold, "N"),
- "Stages messages over N bytes to disk")
- ("mgmt-enable,m", optValue(enableMgmt,"yes|no"),
- "Enable Management")
- ("mgmt-pub-interval", optValue(mgmtPubInterval, "SECONDS"),
- "Management Publish Interval")
- ("ack", optValue(ack, "N"),
- "Send session.ack/solicit-ack at least every N frames. 0 disables voluntary ack/solitict-ack");
-}
-
-const std::string empty;
-const std::string amq_direct("amq.direct");
-const std::string amq_topic("amq.topic");
-const std::string amq_fanout("amq.fanout");
-const std::string amq_match("amq.match");
-const std::string qpid_management("qpid.management");
-
-Broker::Broker(const Broker::Options& conf) :
- config(conf),
- store(0),
- dataDir(conf.noDataDir ? std::string () : conf.dataDir),
- factory(*this),
- sessionManager(conf.ack),
- previewSessionManager(conf.ack)
-{
- // Early-Initialize plugins
- const Plugin::Plugins& plugins=Plugin::getPlugins();
- for (Plugin::Plugins::const_iterator i = plugins.begin();
- i != plugins.end();
- i++)
- (*i)->earlyInitialize(*this);
-
- // If no plugin store module registered itself, set up the null store.
- if (store == 0)
- setStore (new NullMessageStore (false));
-
- queues.setStore (store);
- dtxManager.setStore (store);
-
- if(conf.enableMgmt){
- ManagementAgent::enableManagement ();
- managementAgent = ManagementAgent::getAgent ();
- managementAgent->setInterval (conf.mgmtPubInterval);
-
- mgmtObject = management::Broker::shared_ptr (new management::Broker (this, 0, 0, conf.port));
- mgmtObject->set_workerThreads (conf.workerThreads);
- mgmtObject->set_maxConns (conf.maxConnections);
- mgmtObject->set_connBacklog (conf.connectionBacklog);
- mgmtObject->set_stagingThreshold (conf.stagingThreshold);
- mgmtObject->set_mgmtPubInterval (conf.mgmtPubInterval);
- mgmtObject->set_version (PACKAGE_VERSION);
-
- managementAgent->addObject (mgmtObject, 1, 0);
-
- // Since there is currently no support for virtual hosts, a placeholder object
- // representing the implied single virtual host is added here to keep the
- // management schema correct.
- Vhost* vhost = new Vhost (this);
- vhostObject = Vhost::shared_ptr (vhost);
-
- queues.setParent (vhost);
- exchanges.setParent (vhost);
- }
-
- exchanges.declare(empty, DirectExchange::typeName); // Default exchange.
-
- if (store != 0) {
- RecoveryManagerImpl recoverer(queues, exchanges, dtxManager,
- conf.stagingThreshold);
- store->recover(recoverer);
- }
-
- //ensure standard exchanges exist (done after recovery from store)
- declareStandardExchange(amq_direct, DirectExchange::typeName);
- declareStandardExchange(amq_topic, TopicExchange::typeName);
- declareStandardExchange(amq_fanout, FanOutExchange::typeName);
- declareStandardExchange(amq_match, HeadersExchange::typeName);
-
- if(conf.enableMgmt) {
- QPID_LOG(info, "Management enabled");
- exchanges.declare(qpid_management, ManagementExchange::typeName);
- Exchange::shared_ptr mExchange = exchanges.get (qpid_management);
- Exchange::shared_ptr dExchange = exchanges.get (amq_direct);
- managementAgent->setExchange (mExchange, dExchange);
- dynamic_pointer_cast<ManagementExchange>(mExchange)->setManagmentAgent (managementAgent);
- }
- else
- QPID_LOG(info, "Management not enabled");
-
- // Initialize plugins
- for (Plugin::Plugins::const_iterator i = plugins.begin();
- i != plugins.end();
- i++)
- (*i)->initialize(*this);
-}
-
-void Broker::declareStandardExchange(const std::string& name, const std::string& type)
-{
- bool storeEnabled = store != NULL;
- std::pair<Exchange::shared_ptr, bool> status = exchanges.declare(name, type, storeEnabled);
- if (status.second && storeEnabled) {
- store->create(*status.first);
- }
-}
-
-
-shared_ptr<Broker> Broker::create(int16_t port)
-{
- Options config;
- config.port=port;
- return create(config);
-}
-
-shared_ptr<Broker> Broker::create(const Options& opts)
-{
- return shared_ptr<Broker>(new Broker(opts));
-}
-
-void Broker::setStore (MessageStore* _store)
-{
- assert (store == 0 && _store != 0);
- if (store == 0 && _store != 0)
- store = new MessageStoreModule (_store);
-}
-
-void Broker::run() {
- getAcceptor().run(&factory);
-}
-
-void Broker::shutdown() {
- // NB: this function must be async-signal safe, it must not
- // call any function that is not async-signal safe.
- // Any unsafe shutdown actions should be done in the destructor.
- if (acceptor)
- acceptor->shutdown();
-}
-
-Broker::~Broker() {
- shutdown();
- ManagementAgent::shutdown ();
- delete store;
-}
-
-uint16_t Broker::getPort() const { return getAcceptor().getPort(); }
-
-Acceptor& Broker::getAcceptor() const {
- if (!acceptor) {
- const_cast<Acceptor::shared_ptr&>(acceptor) =
- Acceptor::create(config.port,
- config.connectionBacklog,
- config.workerThreads);
- QPID_LOG(info, "Listening on port " << getPort());
- }
- return *acceptor;
-}
-
-ManagementObject::shared_ptr Broker::GetManagementObject(void) const
-{
- return dynamic_pointer_cast<ManagementObject> (mgmtObject);
-}
-
-Manageable* Broker::GetVhostObject(void) const
-{
- return vhostObject.get();
-}
-
-Manageable::status_t Broker::ManagementMethod (uint32_t methodId,
- Args& args)
-{
- Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
-
- QPID_LOG (debug, "Broker::ManagementMethod [id=" << methodId << "]");
-
- switch (methodId)
- {
- case management::Broker::METHOD_ECHO :
- status = Manageable::STATUS_OK;
- break;
- case management::Broker::METHOD_CONNECT : {
- management::ArgsBrokerConnect& hp=
- dynamic_cast<management::ArgsBrokerConnect&>(args);
- connect(hp.i_host, hp.i_port);
- status = Manageable::STATUS_OK;
- break;
- }
- case management::Broker::METHOD_JOINCLUSTER :
- case management::Broker::METHOD_LEAVECLUSTER :
- status = Manageable::STATUS_NOT_IMPLEMENTED;
- break;
- }
-
- return status;
-}
-
-sys::ConnectionInputHandler* Broker::connect(
- const std::string& host, uint16_t port,
- sys::ConnectionInputHandlerFactory* f)
-{
- return getAcceptor().connect(host, port, f ? f : &factory);
-}
-
-sys::ConnectionInputHandler* Broker::connect(
- const Url& url, sys::ConnectionInputHandlerFactory* f)
-{
- url.throwIfEmpty();
- TcpAddress addr=boost::get<TcpAddress>(url[0]);
- return connect(addr.host, addr.port, f);
-}
-
-}} // namespace qpid::broker
-
diff --git a/qpid/cpp/src/qpid/broker/Broker.h b/qpid/cpp/src/qpid/broker/Broker.h
deleted file mode 100644
index 153eabc6b3..0000000000
--- a/qpid/cpp/src/qpid/broker/Broker.h
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef _Broker_
-#define _Broker_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "ConnectionFactory.h"
-#include "ConnectionToken.h"
-#include "DirectExchange.h"
-#include "DtxManager.h"
-#include "ExchangeRegistry.h"
-#include "MessageStore.h"
-#include "QueueRegistry.h"
-#include "SessionManager.h"
-#include "PreviewSessionManager.h"
-#include "Vhost.h"
-#include "qpid/management/Manageable.h"
-#include "qpid/management/ManagementAgent.h"
-#include "qpid/management/Broker.h"
-#include "qpid/management/ArgsBrokerConnect.h"
-#include "qpid/Options.h"
-#include "qpid/Plugin.h"
-#include "qpid/DataDir.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/OutputHandler.h"
-#include "qpid/framing/ProtocolInitiation.h"
-#include "qpid/sys/Acceptor.h"
-#include "qpid/sys/Runnable.h"
-
-#include <vector>
-
-namespace qpid {
-
-class Url;
-
-namespace broker {
-
-static const uint16_t DEFAULT_PORT=5672;
-
-/**
- * A broker instance.
- */
-class Broker : public sys::Runnable, public Plugin::Target,
- public management::Manageable
-{
- public:
-
- struct Options : public qpid::Options {
- Options(const std::string& name="Broker Options");
-
- bool noDataDir;
- std::string dataDir;
- uint16_t port;
- int workerThreads;
- int maxConnections;
- int connectionBacklog;
- uint64_t stagingThreshold;
- bool enableMgmt;
- uint16_t mgmtPubInterval;
- uint32_t ack;
- };
-
- virtual ~Broker();
-
- Broker(const Options& configuration);
- static shared_ptr<Broker> create(const Options& configuration);
- static shared_ptr<Broker> create(int16_t port = DEFAULT_PORT);
-
- /**
- * Return listening port. If called before bind this is
- * the configured port. If called after it is the actual
- * port, which will be different if the configured port is
- * 0.
- */
- virtual uint16_t getPort() const;
-
- /**
- * Run the broker. Implements Runnable::run() so the broker
- * can be run in a separate thread.
- */
- virtual void run();
-
- /** Shut down the broker */
- virtual void shutdown();
-
- void setStore (MessageStore*);
- MessageStore& getStore() { return *store; }
- QueueRegistry& getQueues() { return queues; }
- ExchangeRegistry& getExchanges() { return exchanges; }
- uint64_t getStagingThreshold() { return config.stagingThreshold; }
- DtxManager& getDtxManager() { return dtxManager; }
- DataDir& getDataDir() { return dataDir; }
-
- SessionManager& getSessionManager() { return sessionManager; }
- PreviewSessionManager& getPreviewSessionManager() { return previewSessionManager; }
-
- management::ManagementObject::shared_ptr GetManagementObject (void) const;
- management::Manageable* GetVhostObject (void) const;
- management::Manageable::status_t
- ManagementMethod (uint32_t methodId, management::Args& args);
-
- /** Create a connection to another broker. */
- sys::ConnectionInputHandler*
- connect(const std::string& host, uint16_t port,
- sys::ConnectionInputHandlerFactory* =0);
- /** Create a connection to another broker. */
- sys::ConnectionInputHandler*
- connect(const Url& url, sys::ConnectionInputHandlerFactory* =0);
-
- private:
- sys::Acceptor& getAcceptor() const;
-
- Options config;
- sys::Acceptor::shared_ptr acceptor;
- MessageStore* store;
- DataDir dataDir;
-
- QueueRegistry queues;
- ExchangeRegistry exchanges;
- ConnectionFactory factory;
- DtxManager dtxManager;
- SessionManager sessionManager;
- PreviewSessionManager previewSessionManager;
- management::ManagementAgent::shared_ptr managementAgent;
- management::Broker::shared_ptr mgmtObject;
- Vhost::shared_ptr vhostObject;
-
- void declareStandardExchange(const std::string& name, const std::string& type);
-};
-
-}}
-
-
-
-#endif /*!_Broker_*/
diff --git a/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp b/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp
deleted file mode 100644
index 526b58cb14..0000000000
--- a/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include "BrokerAdapter.h"
-#include "Connection.h"
-#include "DeliveryToken.h"
-#include "MessageDelivery.h"
-#include "qpid/framing/AMQMethodBody.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace broker {
-
-using namespace qpid;
-using namespace qpid::framing;
-
-typedef std::vector<Queue::shared_ptr> QueueVector;
-
-// TODO aconway 2007-08-31: now that functionality is distributed
-// between different handlers, BrokerAdapter should be dropped.
-// Instead the individual class Handler interfaces can be implemented
-// by the handlers responsible for those classes.
-//
-
-BrokerAdapter::BrokerAdapter(SemanticState& s) :
- HandlerImpl(s),
- basicHandler(s),
- exchangeHandler(s),
- bindingHandler(s),
- messageHandler(s),
- queueHandler(s),
- txHandler(s),
- dtxHandler(s)
-{}
-
-
-void BrokerAdapter::ExchangeHandlerImpl::declare(uint16_t /*ticket*/, const string& exchange, const string& type,
- const string& alternateExchange,
- bool passive, bool durable, bool /*autoDelete*/, const FieldTable& args){
- Exchange::shared_ptr alternate;
- if (!alternateExchange.empty()) {
- alternate = getBroker().getExchanges().get(alternateExchange);
- }
- if(passive){
- Exchange::shared_ptr actual(getBroker().getExchanges().get(exchange));
- checkType(actual, type);
- checkAlternate(actual, alternate);
- }else{
- try{
- std::pair<Exchange::shared_ptr, bool> response = getBroker().getExchanges().declare(exchange, type, durable, args);
- if (response.second) {
- if (durable) {
- getBroker().getStore().create(*response.first);
- }
- if (alternate) {
- response.first->setAlternate(alternate);
- alternate->incAlternateUsers();
- }
- } else {
- checkType(response.first, type);
- checkAlternate(response.first, alternate);
- }
- }catch(UnknownExchangeTypeException& e){
- throw CommandInvalidException(QPID_MSG("Exchange type not implemented: " << type));
- }
- }
-}
-
-void BrokerAdapter::ExchangeHandlerImpl::checkType(Exchange::shared_ptr exchange, const std::string& type)
-{
- if (!type.empty() && exchange->getType() != type) {
- throw NotAllowedException(QPID_MSG("Exchange declared to be of type " << exchange->getType() << ", requested " << type));
- }
-}
-
-void BrokerAdapter::ExchangeHandlerImpl::checkAlternate(Exchange::shared_ptr exchange, Exchange::shared_ptr alternate)
-{
- if (alternate && alternate != exchange->getAlternate())
- throw NotAllowedException(
- QPID_MSG("Exchange declared with alternate-exchange "
- << exchange->getAlternate()->getName() << ", requested "
- << alternate->getName()));
-}
-
-void BrokerAdapter::ExchangeHandlerImpl::delete_(uint16_t /*ticket*/, const string& name, bool /*ifUnused*/){
- //TODO: implement unused
- Exchange::shared_ptr exchange(getBroker().getExchanges().get(name));
- if (exchange->inUseAsAlternate()) throw NotAllowedException(QPID_MSG("Exchange in use as alternate-exchange."));
- if (exchange->isDurable()) getBroker().getStore().destroy(*exchange);
- if (exchange->getAlternate()) exchange->getAlternate()->decAlternateUsers();
- getBroker().getExchanges().destroy(name);
-}
-
-ExchangeQueryResult BrokerAdapter::ExchangeHandlerImpl::query(u_int16_t /*ticket*/, const string& name)
-{
- try {
- Exchange::shared_ptr exchange(getBroker().getExchanges().get(name));
- return ExchangeQueryResult(exchange->getType(), exchange->isDurable(), false, exchange->getArgs());
- } catch (const ChannelException& e) {
- return ExchangeQueryResult("", false, true, FieldTable());
- }
-}
-
-BindingQueryResult BrokerAdapter::BindingHandlerImpl::query(u_int16_t /*ticket*/,
- const std::string& exchangeName,
- const std::string& queueName,
- const std::string& key,
- const framing::FieldTable& args)
-{
- Exchange::shared_ptr exchange;
- try {
- exchange = getBroker().getExchanges().get(exchangeName);
- } catch (const ChannelException&) {}
-
- Queue::shared_ptr queue;
- if (!queueName.empty()) {
- queue = getBroker().getQueues().find(queueName);
- }
-
- if (!exchange) {
- return BindingQueryResult(true, false, false, false, false);
- } else if (!queueName.empty() && !queue) {
- return BindingQueryResult(false, true, false, false, false);
- } else if (exchange->isBound(queue, key.empty() ? 0 : &key, args.count() > 0 ? &args : &args)) {
- return BindingQueryResult(false, false, false, false, false);
- } else {
- //need to test each specified option individually
- bool queueMatched = queueName.empty() || exchange->isBound(queue, 0, 0);
- bool keyMatched = key.empty() || exchange->isBound(Queue::shared_ptr(), &key, 0);
- bool argsMatched = args.count() == 0 || exchange->isBound(Queue::shared_ptr(), 0, &args);
-
- return BindingQueryResult(false, false, !queueMatched, !keyMatched, !argsMatched);
- }
-}
-
-QueueQueryResult BrokerAdapter::QueueHandlerImpl::query(const string& name)
-{
- Queue::shared_ptr queue = state.getQueue(name);
- Exchange::shared_ptr alternateExchange = queue->getAlternateExchange();
-
- return QueueQueryResult(queue->getName(),
- alternateExchange ? alternateExchange->getName() : "",
- queue->isDurable(),
- queue->hasExclusiveOwner(),
- queue->isAutoDelete(),
- queue->getSettings(),
- queue->getMessageCount(),
- queue->getConsumerCount());
-}
-
-void BrokerAdapter::QueueHandlerImpl::declare(uint16_t /*ticket*/, const string& name, const string& alternateExchange,
- bool passive, bool durable, bool exclusive,
- bool autoDelete, const qpid::framing::FieldTable& arguments){
-
- Exchange::shared_ptr alternate;
- if (!alternateExchange.empty()) {
- alternate = getBroker().getExchanges().get(alternateExchange);
- }
- Queue::shared_ptr queue;
- if (passive && !name.empty()) {
- queue = state.getQueue(name);
- //TODO: check alternate-exchange is as expected
- } else {
- std::pair<Queue::shared_ptr, bool> queue_created =
- getBroker().getQueues().declare(
- name, durable,
- autoDelete,
- exclusive ? &getConnection() : 0);
- queue = queue_created.first;
- assert(queue);
- if (queue_created.second) { // This is a new queue
- if (alternate) {
- queue->setAlternateExchange(alternate);
- alternate->incAlternateUsers();
- }
-
- //apply settings & create persistent record if required
- queue_created.first->create(arguments);
-
- //add default binding:
- getBroker().getExchanges().getDefault()->bind(queue, name, 0);
- queue->bound(getBroker().getExchanges().getDefault()->getName(), name, arguments);
-
- //handle automatic cleanup:
- if (exclusive) {
- getConnection().exclusiveQueues.push_back(queue);
- }
- } else {
- if (exclusive && queue->setExclusiveOwner(&getConnection())) {
- getConnection().exclusiveQueues.push_back(queue);
- }
- }
- }
- if (exclusive && !queue->isExclusiveOwner(&getConnection()))
- throw ResourceLockedException(
- QPID_MSG("Cannot grant exclusive access to queue "
- << queue->getName()));
-}
-
-void BrokerAdapter::QueueHandlerImpl::bind(uint16_t /*ticket*/, const string& queueName,
- const string& exchangeName, const string& routingKey,
- const FieldTable& arguments){
-
- Queue::shared_ptr queue = state.getQueue(queueName);
- Exchange::shared_ptr exchange = getBroker().getExchanges().get(exchangeName);
- if(exchange){
- string exchangeRoutingKey = routingKey.empty() && queueName.empty() ? queue->getName() : routingKey;
- if (exchange->bind(queue, exchangeRoutingKey, &arguments)) {
- queue->bound(exchangeName, routingKey, arguments);
- if (exchange->isDurable() && queue->isDurable()) {
- getBroker().getStore().bind(*exchange, *queue, routingKey, arguments);
- }
- }
- }else{
- throw NotFoundException(
- "Bind failed. No such exchange: " + exchangeName);
- }
-}
-
-void
-BrokerAdapter::QueueHandlerImpl::unbind(uint16_t /*ticket*/,
- const string& queueName,
- const string& exchangeName,
- const string& routingKey,
- const qpid::framing::FieldTable& arguments )
-{
- Queue::shared_ptr queue = state.getQueue(queueName);
- if (!queue.get()) throw NotFoundException("Unbind failed. No such exchange: " + exchangeName);
-
- Exchange::shared_ptr exchange = getBroker().getExchanges().get(exchangeName);
- if (!exchange.get()) throw NotFoundException("Unbind failed. No such exchange: " + exchangeName);
-
- if (exchange->unbind(queue, routingKey, &arguments) && exchange->isDurable() && queue->isDurable()) {
- getBroker().getStore().unbind(*exchange, *queue, routingKey, arguments);
- }
-
-}
-
-void BrokerAdapter::QueueHandlerImpl::purge(uint16_t /*ticket*/, const string& queue){
- state.getQueue(queue)->purge();
-}
-
-void BrokerAdapter::QueueHandlerImpl::delete_(uint16_t /*ticket*/, const string& queue, bool ifUnused, bool ifEmpty){
- ChannelException error(0, "");
- Queue::shared_ptr q = state.getQueue(queue);
- if(ifEmpty && q->getMessageCount() > 0){
- throw PreconditionFailedException("Queue not empty.");
- }else if(ifUnused && q->getConsumerCount() > 0){
- throw PreconditionFailedException("Queue in use.");
- }else{
- //remove the queue from the list of exclusive queues if necessary
- if(q->isExclusiveOwner(&getConnection())){
- QueueVector::iterator i = find(getConnection().exclusiveQueues.begin(), getConnection().exclusiveQueues.end(), q);
- if(i < getConnection().exclusiveQueues.end()) getConnection().exclusiveQueues.erase(i);
- }
- q->destroy();
- getBroker().getQueues().destroy(queue);
- q->unbind(getBroker().getExchanges(), q);
- }
-}
-
-
-
-
-void BrokerAdapter::BasicHandlerImpl::qos(uint32_t prefetchSize, uint16_t prefetchCount, bool /*global*/){
- //TODO: handle global
- state.setPrefetchSize(prefetchSize);
- state.setPrefetchCount(prefetchCount);
-}
-
-void BrokerAdapter::BasicHandlerImpl::consume(uint16_t /*ticket*/,
- const string& queueName, const string& consumerTag,
- bool noLocal, bool noAck, bool exclusive,
- bool nowait, const FieldTable& fields)
-{
-
- Queue::shared_ptr queue = state.getQueue(queueName);
- if(!consumerTag.empty() && state.exists(consumerTag)){
- throw NotAllowedException(QPID_MSG("Consumer tags must be unique"));
- }
- string newTag = consumerTag;
- //need to generate name here, so we have it for the adapter (it is
- //also version specific behaviour now)
- if (newTag.empty()) newTag = tagGenerator.generate();
- DeliveryToken::shared_ptr token(MessageDelivery::getBasicConsumeToken(newTag));
- state.consume(token, newTag, queue, noLocal, !noAck, true, exclusive, &fields);
-
- if(!nowait)
- getProxy().getBasic().consumeOk(newTag);
-}
-
-void BrokerAdapter::BasicHandlerImpl::cancel(const string& consumerTag){
- state.cancel(consumerTag);
-}
-
-void BrokerAdapter::BasicHandlerImpl::get(uint16_t /*ticket*/, const string& queueName, bool noAck){
- Queue::shared_ptr queue = state.getQueue(queueName);
- DeliveryToken::shared_ptr token(MessageDelivery::getBasicGetToken(queue));
- if(!state.get(token, queue, !noAck)){
- string clusterId;//not used, part of an imatix hack
-
- getProxy().getBasic().getEmpty(clusterId);
- }
-}
-
-void BrokerAdapter::BasicHandlerImpl::ack(uint64_t deliveryTag, bool multiple){
- if (multiple) {
- state.ackCumulative(deliveryTag);
- } else {
- state.ackRange(deliveryTag, deliveryTag);
- }
-}
-
-void BrokerAdapter::BasicHandlerImpl::reject(uint64_t /*deliveryTag*/, bool /*requeue*/){}
-
-void BrokerAdapter::BasicHandlerImpl::recover(bool requeue)
-{
- state.recover(requeue);
-}
-
-void BrokerAdapter::TxHandlerImpl::select()
-{
- state.startTx();
-}
-
-void BrokerAdapter::TxHandlerImpl::commit()
-{
- state.commit(&getBroker().getStore());
-}
-
-void BrokerAdapter::TxHandlerImpl::rollback()
-{
- state.rollback();
- state.recover(true);
-}
-
-}} // namespace qpid::broker
-
diff --git a/qpid/cpp/src/qpid/broker/BrokerAdapter.h b/qpid/cpp/src/qpid/broker/BrokerAdapter.h
deleted file mode 100644
index ef2c51bb8d..0000000000
--- a/qpid/cpp/src/qpid/broker/BrokerAdapter.h
+++ /dev/null
@@ -1,199 +0,0 @@
-#ifndef _broker_BrokerAdapter_h
-#define _broker_BrokerAdapter_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include "DtxHandlerImpl.h"
-#include "MessageHandlerImpl.h"
-
-#include "qpid/Exception.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace broker {
-
-class Channel;
-class Connection;
-class Broker;
-class ConnectionHandler;
-class BasicHandler;
-class ExchangeHandler;
-class QueueHandler;
-class TxHandler;
-class MessageHandler;
-class AccessHandler;
-class FileHandler;
-class StreamHandler;
-class DtxHandler;
-class TunnelHandler;
-class MessageHandlerImpl;
-class Exchange;
-
-/**
- * Per-channel protocol adapter.
- *
- * A container for a collection of AMQP-class adapters that translate
- * AMQP method bodies into calls on the core Broker objects. Each
- * adapter class also provides a client proxy to send methods to the
- * peer.
- *
- */
-class BrokerAdapter : public HandlerImpl, public framing::AMQP_ServerOperations
-{
- public:
- BrokerAdapter(SemanticState& session);
-
- BasicHandler* getBasicHandler() { return &basicHandler; }
- ExchangeHandler* getExchangeHandler() { return &exchangeHandler; }
- BindingHandler* getBindingHandler() { return &bindingHandler; }
- QueueHandler* getQueueHandler() { return &queueHandler; }
- TxHandler* getTxHandler() { return &txHandler; }
- MessageHandler* getMessageHandler() { return &messageHandler; }
- DtxCoordinationHandler* getDtxCoordinationHandler() { return &dtxHandler; }
- DtxDemarcationHandler* getDtxDemarcationHandler() { return &dtxHandler; }
-
- framing::ProtocolVersion getVersion() const { return session.getConnection().getVersion();}
-
-
- AccessHandler* getAccessHandler() {
- throw framing::NotImplementedException("Access class not implemented"); }
- FileHandler* getFileHandler() {
- throw framing::NotImplementedException("File class not implemented"); }
- StreamHandler* getStreamHandler() {
- throw framing::NotImplementedException("Stream class not implemented"); }
- TunnelHandler* getTunnelHandler() {
- throw framing::NotImplementedException("Tunnel class not implemented"); }
-
- // Handlers no longer implemented in BrokerAdapter:
-#define BADHANDLER() assert(0); throw framing::NotImplementedException("")
- ExecutionHandler* getExecutionHandler() { BADHANDLER(); }
- ConnectionHandler* getConnectionHandler() { BADHANDLER(); }
- SessionHandler* getSessionHandler() { BADHANDLER(); }
-#undef BADHANDLER
-
- private:
- class ExchangeHandlerImpl :
- public ExchangeHandler,
- public HandlerImpl
- {
- public:
- ExchangeHandlerImpl(SemanticState& session) : HandlerImpl(session) {}
-
- void declare(uint16_t ticket,
- const std::string& exchange, const std::string& type,
- const std::string& alternateExchange,
- bool passive, bool durable, bool autoDelete,
- const qpid::framing::FieldTable& arguments);
- void delete_(uint16_t ticket,
- const std::string& exchange, bool ifUnused);
- framing::ExchangeQueryResult query(u_int16_t ticket,
- const std::string& name);
- private:
- void checkType(shared_ptr<Exchange> exchange, const std::string& type);
-
- void checkAlternate(shared_ptr<Exchange> exchange,
- shared_ptr<Exchange> alternate);
- };
-
- class BindingHandlerImpl :
- public BindingHandler,
- public HandlerImpl
- {
- public:
- BindingHandlerImpl(SemanticState& session) : HandlerImpl(session) {}
-
- framing::BindingQueryResult query(u_int16_t ticket,
- const std::string& exchange,
- const std::string& queue,
- const std::string& routingKey,
- const framing::FieldTable& arguments);
- };
-
- class QueueHandlerImpl :
- public QueueHandler,
- public HandlerImpl
- {
- public:
- QueueHandlerImpl(SemanticState& session) : HandlerImpl(session) {}
-
- void declare(uint16_t ticket, const std::string& queue,
- const std::string& alternateExchange,
- bool passive, bool durable, bool exclusive,
- bool autoDelete,
- const qpid::framing::FieldTable& arguments);
- void bind(uint16_t ticket, const std::string& queue,
- const std::string& exchange, const std::string& routingKey,
- const qpid::framing::FieldTable& arguments);
- void unbind(uint16_t ticket,
- const std::string& queue,
- const std::string& exchange,
- const std::string& routingKey,
- const qpid::framing::FieldTable& arguments );
- framing::QueueQueryResult query(const std::string& queue);
- void purge(uint16_t ticket, const std::string& queue);
- void delete_(uint16_t ticket, const std::string& queue,
- bool ifUnused, bool ifEmpty);
- };
-
- class BasicHandlerImpl :
- public BasicHandler,
- public HandlerImpl
- {
- NameGenerator tagGenerator;
- public:
- BasicHandlerImpl(SemanticState& session) : HandlerImpl(session), tagGenerator("sgen") {}
-
- void qos(uint32_t prefetchSize,
- uint16_t prefetchCount, bool global);
- void consume(uint16_t ticket, const std::string& queue,
- const std::string& consumerTag,
- bool noLocal, bool noAck, bool exclusive, bool nowait,
- const qpid::framing::FieldTable& fields);
- void cancel(const std::string& consumerTag);
- void get(uint16_t ticket, const std::string& queue, bool noAck);
- void ack(uint64_t deliveryTag, bool multiple);
- void reject(uint64_t deliveryTag, bool requeue);
- void recover(bool requeue);
- };
-
- class TxHandlerImpl :
- public TxHandler,
- public HandlerImpl
- {
- public:
- TxHandlerImpl(SemanticState& session) : HandlerImpl(session) {}
-
- void select();
- void commit();
- void rollback();
- };
-
- BasicHandlerImpl basicHandler;
- ExchangeHandlerImpl exchangeHandler;
- BindingHandlerImpl bindingHandler;
- MessageHandlerImpl messageHandler;
- QueueHandlerImpl queueHandler;
- TxHandlerImpl txHandler;
- DtxHandlerImpl dtxHandler;
-};
-}} // namespace qpid::broker
-
-
-
-#endif /*!_broker_BrokerAdapter_h*/
diff --git a/qpid/cpp/src/qpid/broker/BrokerSingleton.cpp b/qpid/cpp/src/qpid/broker/BrokerSingleton.cpp
deleted file mode 100644
index 77200dd760..0000000000
--- a/qpid/cpp/src/qpid/broker/BrokerSingleton.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "BrokerSingleton.h"
-
-namespace qpid {
-namespace broker {
-
-BrokerSingleton::BrokerSingleton() {
- if (broker.get() == 0)
- broker = Broker::create();
- shared_ptr<Broker>::operator=(broker);
-}
-
-BrokerSingleton::~BrokerSingleton() {
- broker->shutdown();
-}
-
-shared_ptr<Broker> BrokerSingleton::broker;
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/BrokerSingleton.h b/qpid/cpp/src/qpid/broker/BrokerSingleton.h
deleted file mode 100644
index 14b932df36..0000000000
--- a/qpid/cpp/src/qpid/broker/BrokerSingleton.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _broker_BrokerSingleton_h
-#define _broker_BrokerSingleton_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Broker.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * BrokerSingleton is a smart pointer to a process-wide singleton broker
- * started on an os-chosen port. The broker starts the first time
- * an instance of BrokerSingleton is created and runs untill the process exits.
- *
- * Useful for unit tests that want to share a broker between multiple
- * tests to reduce overhead of starting/stopping a broker for every test.
- *
- * Tests that need a new broker can create it directly.
- *
- * THREAD UNSAFE.
- */
-class BrokerSingleton : public shared_ptr<Broker>
-{
- public:
- BrokerSingleton();
- ~BrokerSingleton();
- private:
- static shared_ptr<Broker> broker;
-};
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!_broker_BrokerSingleton_h*/
diff --git a/qpid/cpp/src/qpid/broker/Connection.cpp b/qpid/cpp/src/qpid/broker/Connection.cpp
deleted file mode 100644
index 822890ae76..0000000000
--- a/qpid/cpp/src/qpid/broker/Connection.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "Connection.h"
-#include "SessionState.h"
-#include "BrokerAdapter.h"
-#include "Bridge.h"
-#include "SemanticHandler.h"
-
-#include "qpid/log/Statement.h"
-#include "qpid/ptr_map.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/management/ManagementAgent.h"
-
-#include <boost/bind.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-
-#include <algorithm>
-#include <iostream>
-#include <assert.h>
-
-using namespace boost;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using namespace qpid::sys;
-using namespace qpid::ptr_map;
-using qpid::management::ManagementAgent;
-using qpid::management::ManagementObject;
-using qpid::management::Manageable;
-using qpid::management::Args;
-
-namespace qpid {
-namespace broker {
-
-class Connection::MgmtClient : public Connection::MgmtWrapper
-{
- management::Client::shared_ptr mgmtClient;
-
-public:
- MgmtClient(Connection* conn, Manageable* parent, ManagementAgent::shared_ptr agent, const std::string& mgmtId);
- ~MgmtClient();
- void received(framing::AMQFrame& frame);
- management::ManagementObject::shared_ptr getManagementObject() const;
- void closing();
-};
-
-class Connection::MgmtLink : public Connection::MgmtWrapper
-{
- typedef boost::ptr_vector<Bridge> Bridges;
-
- management::Link::shared_ptr mgmtLink;
- Bridges created;//holds list of bridges pending creation
- Bridges cancelled;//holds list of bridges pending cancellation
- Bridges active;//holds active bridges
- uint channelCounter;
- sys::Mutex lock;
-
- void cancel(Bridge*);
-
-public:
- MgmtLink(Connection* conn, Manageable* parent, ManagementAgent::shared_ptr agent, const std::string& mgmtId);
- ~MgmtLink();
- void received(framing::AMQFrame& frame);
- management::ManagementObject::shared_ptr getManagementObject() const;
- void closing();
- void processPending();
- void process(Connection& connection, const management::Args& args);
-};
-
-
-Connection::Connection(ConnectionOutputHandler* out_, Broker& broker_, const std::string& mgmtId_) :
- ConnectionState(out_, broker_),
- adapter(*this),
- mgmtClosing(0),
- mgmtId(mgmtId_)
-{}
-
-void Connection::initMgmt(bool asLink)
-{
- Manageable* parent = broker.GetVhostObject ();
-
- if (parent != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
-
- if (agent.get () != 0)
- {
- if (asLink) {
- mgmtWrapper = std::auto_ptr<MgmtWrapper>(new MgmtLink(this, parent, agent, mgmtId));
- } else {
- mgmtWrapper = std::auto_ptr<MgmtWrapper>(new MgmtClient(this, parent, agent, mgmtId));
- }
- }
- }
-}
-
-Connection::~Connection () {}
-
-void Connection::received(framing::AMQFrame& frame){
- if (mgmtClosing)
- close (403, "Closed by Management Request", 0, 0);
-
- if (frame.getChannel() == 0) {
- adapter.handle(frame);
- } else {
- getChannel(frame.getChannel()).in(frame);
- }
-
- if (mgmtWrapper.get()) mgmtWrapper->received(frame);
-}
-
-void Connection::close(
- ReplyCode code, const string& text, ClassId classId, MethodId methodId)
-{
- adapter.close(code, text, classId, methodId);
- channels.clear();
- getOutput().close();
-}
-
-void Connection::initiated(const framing::ProtocolInitiation& header) {
- version = ProtocolVersion(header.getMajor(), header.getMinor());
- adapter.init(header);
- initMgmt();
-}
-
-void Connection::idleOut(){}
-
-void Connection::idleIn(){}
-
-void Connection::closed(){ // Physically closed, suspend open sessions.
- try {
- for (ChannelMap::iterator i = channels.begin(); i != channels.end(); ++i)
- get_pointer(i)->localSuspend();
- while (!exclusiveQueues.empty()) {
- Queue::shared_ptr q(exclusiveQueues.front());
- q->releaseExclusiveOwnership();
- if (q->canAutoDelete()) {
- Queue::tryAutoDelete(broker, q);
- }
- exclusiveQueues.erase(exclusiveQueues.begin());
- }
- } catch(std::exception& e) {
- QPID_LOG(error, " Unhandled exception while closing session: " <<
- e.what());
- assert(0);
- }
-}
-
-bool Connection::doOutput()
-{
- try{
- //process any pending mgmt commands:
- if (mgmtWrapper.get()) mgmtWrapper->processPending();
-
- //then do other output as needed:
- return outputTasks.doOutput();
- }catch(ConnectionException& e){
- close(e.code, e.what(), 0, 0);
- }catch(std::exception& e){
- close(541/*internal error*/, e.what(), 0, 0);
- }
- return false;
-}
-
-void Connection::closeChannel(uint16_t id) {
- ChannelMap::iterator i = channels.find(id);
- if (i != channels.end()) channels.erase(i);
-}
-
-SessionHandler& Connection::getChannel(ChannelId id) {
- ChannelMap::iterator i=channels.find(id);
- if (i == channels.end()) {
- i = channels.insert(id, new SessionHandler(*this, id)).first;
- }
- return *get_pointer(i);
-}
-
-ManagementObject::shared_ptr Connection::GetManagementObject (void) const
-{
- return mgmtWrapper.get() ? mgmtWrapper->getManagementObject() : ManagementObject::shared_ptr();
-}
-
-Manageable::status_t Connection::ManagementMethod (uint32_t methodId,
- Args& args)
-{
- Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
-
- QPID_LOG (debug, "Connection::ManagementMethod [id=" << methodId << "]");
-
- switch (methodId)
- {
- case management::Client::METHOD_CLOSE :
- mgmtClosing = 1;
- if (mgmtWrapper.get()) mgmtWrapper->closing();
- status = Manageable::STATUS_OK;
- break;
- case management::Link::METHOD_BRIDGE :
- //queue this up and request chance to do output (i.e. get connections thread of control):
- mgmtWrapper->process(*this, args);
- out->activateOutput();
- status = Manageable::STATUS_OK;
- break;
- }
-
- return status;
-}
-
-Connection::MgmtLink::MgmtLink(Connection* conn, Manageable* parent, ManagementAgent::shared_ptr agent, const std::string& mgmtId)
- : channelCounter(1)
-{
- mgmtLink = management::Link::shared_ptr
- (new management::Link(conn, parent, mgmtId));
- agent->addObject (mgmtLink);
-}
-
-Connection::MgmtLink::~MgmtLink()
-{
- if (mgmtLink.get () != 0)
- mgmtLink->resourceDestroy ();
-}
-
-void Connection::MgmtLink::received(framing::AMQFrame& frame)
-{
- if (mgmtLink.get () != 0)
- {
- mgmtLink->inc_framesFromPeer ();
- mgmtLink->inc_bytesFromPeer (frame.size ());
- }
-}
-
-management::ManagementObject::shared_ptr Connection::MgmtLink::getManagementObject() const
-{
- return dynamic_pointer_cast<ManagementObject>(mgmtLink);
-}
-
-void Connection::MgmtLink::closing()
-{
- if (mgmtLink) mgmtLink->set_closing (1);
-}
-
-void Connection::MgmtLink::processPending()
-{
- //process any pending creates
- if (!created.empty()) {
- for (Bridges::iterator i = created.begin(); i != created.end(); ++i) {
- i->create();
- }
- active.transfer(active.end(), created.begin(), created.end(), created);
- }
- if (!cancelled.empty()) {
- //process any pending cancellations
- for (Bridges::iterator i = cancelled.begin(); i != cancelled.end(); ++i) {
- i->cancel();
- }
- cancelled.clear();
- }
-}
-
-void Connection::MgmtLink::process(Connection& connection, const management::Args& args)
-{
- created.push_back(new Bridge(channelCounter++, connection,
- boost::bind(&MgmtLink::cancel, this, _1),
- dynamic_cast<const management::ArgsLinkBridge&>(args)));
-}
-
-void Connection::MgmtLink::cancel(Bridge* b)
-{
- //need to take this out the active map and add it to the cancelled map
- for (Bridges::iterator i = active.begin(); i != active.end(); i++) {
- if (&(*i) == b) {
- cancelled.transfer(cancelled.end(), i, active);
- break;
- }
- }
-}
-
-Connection::MgmtClient::MgmtClient(Connection* conn, Manageable* parent, ManagementAgent::shared_ptr agent, const std::string& mgmtId)
-{
- mgmtClient = management::Client::shared_ptr
- (new management::Client (conn, parent, mgmtId));
- agent->addObject (mgmtClient);
-}
-
-Connection::MgmtClient::~MgmtClient()
-{
- if (mgmtClient.get () != 0)
- mgmtClient->resourceDestroy ();
-}
-
-void Connection::MgmtClient::received(framing::AMQFrame& frame)
-{
- if (mgmtClient.get () != 0)
- {
- mgmtClient->inc_framesFromClient ();
- mgmtClient->inc_bytesFromClient (frame.size ());
- }
-}
-
-management::ManagementObject::shared_ptr Connection::MgmtClient::getManagementObject() const
-{
- return dynamic_pointer_cast<ManagementObject>(mgmtClient);
-}
-
-void Connection::MgmtClient::closing()
-{
- if (mgmtClient) mgmtClient->set_closing (1);
-}
-
-}}
-
diff --git a/qpid/cpp/src/qpid/broker/Connection.h b/qpid/cpp/src/qpid/broker/Connection.h
deleted file mode 100644
index 8719a9dfcd..0000000000
--- a/qpid/cpp/src/qpid/broker/Connection.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _Connection_
-#define _Connection_
-
-#include <memory>
-#include <sstream>
-#include <vector>
-
-#include <boost/ptr_container/ptr_map.hpp>
-
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/sys/AggregateOutput.h"
-#include "qpid/sys/ConnectionOutputHandler.h"
-#include "qpid/sys/ConnectionInputHandler.h"
-#include "qpid/sys/TimeoutHandler.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "Broker.h"
-#include "qpid/sys/Socket.h"
-#include "qpid/Exception.h"
-#include "ConnectionHandler.h"
-#include "ConnectionState.h"
-#include "SessionHandler.h"
-#include "qpid/management/Manageable.h"
-#include "qpid/management/Client.h"
-#include "qpid/management/Link.h"
-
-#include <boost/ptr_container/ptr_map.hpp>
-
-namespace qpid {
-namespace broker {
-
-class Connection : public sys::ConnectionInputHandler,
- public ConnectionState
-{
- public:
- Connection(sys::ConnectionOutputHandler* out, Broker& broker, const std::string& mgmtId);
- ~Connection ();
-
- /** Get the SessionHandler for channel. Create if it does not already exist */
- SessionHandler& getChannel(framing::ChannelId channel);
-
- /** Close the connection */
- void close(framing::ReplyCode code, const string& text, framing::ClassId classId, framing::MethodId methodId);
-
- // ConnectionInputHandler methods
- void received(framing::AMQFrame& frame);
- void initiated(const framing::ProtocolInitiation& header);
- void idleOut();
- void idleIn();
- void closed();
- bool doOutput();
- framing::ProtocolInitiation getInitiation() { return framing::ProtocolInitiation(version); }
-
- void closeChannel(framing::ChannelId channel);
-
- // Manageable entry points
- management::ManagementObject::shared_ptr GetManagementObject (void) const;
- management::Manageable::status_t
- ManagementMethod (uint32_t methodId, management::Args& args);
-
- void initMgmt(bool asLink = false);
-
- private:
- typedef boost::ptr_map<framing::ChannelId, SessionHandler> ChannelMap;
- typedef std::vector<Queue::shared_ptr>::iterator queue_iterator;
-
- /**
- * Connection may appear, for the purposes of management, as a
- * normal client initiated connection or as an agent initiated
- * inter-broker link. This wrapper abstracts the common interface
- * for both.
- */
- class MgmtWrapper
- {
- public:
- virtual ~MgmtWrapper(){}
- virtual void received(framing::AMQFrame& frame) = 0;
- virtual management::ManagementObject::shared_ptr getManagementObject() const = 0;
- virtual void closing() = 0;
- virtual void processPending(){}
- virtual void process(Connection&, const management::Args&){}
- };
- class MgmtClient;
- class MgmtLink;
-
- ChannelMap channels;
- framing::AMQP_ClientProxy::Connection* client;
- ConnectionHandler adapter;
- std::auto_ptr<MgmtWrapper> mgmtWrapper;
- bool mgmtClosing;
- const std::string mgmtId;
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/ConnectionFactory.cpp b/qpid/cpp/src/qpid/broker/ConnectionFactory.cpp
deleted file mode 100644
index a0cd4e35d7..0000000000
--- a/qpid/cpp/src/qpid/broker/ConnectionFactory.cpp
+++ /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.
- *
- */
-#include "ConnectionFactory.h"
-#include "Connection.h"
-#include "MultiVersionConnectionInputHandler.h"
-
-namespace qpid {
-namespace broker {
-
-
-ConnectionFactory::ConnectionFactory(Broker& b) : broker(b)
-{}
-
-
-ConnectionFactory::~ConnectionFactory()
-{
-
-}
-
-qpid::sys::ConnectionInputHandler*
-ConnectionFactory::create(qpid::sys::ConnectionOutputHandler* out,
- const std::string& id)
-{
- return new MultiVersionConnectionInputHandler(out, broker, id);
-}
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/ConnectionFactory.h b/qpid/cpp/src/qpid/broker/ConnectionFactory.h
deleted file mode 100644
index 53fb160279..0000000000
--- a/qpid/cpp/src/qpid/broker/ConnectionFactory.h
+++ /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.
- *
- */
-#ifndef _ConnectionFactory_
-#define _ConnectionFactory_
-
-#include "qpid/sys/ConnectionInputHandlerFactory.h"
-
-namespace qpid {
-namespace broker {
-class Broker;
-
-class ConnectionFactory : public qpid::sys::ConnectionInputHandlerFactory
-{
- public:
- ConnectionFactory(Broker& b);
-
- virtual qpid::sys::ConnectionInputHandler*
- create(qpid::sys::ConnectionOutputHandler* out, const std::string& id);
-
- virtual ~ConnectionFactory();
-
- private:
- Broker& broker;
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp b/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
deleted file mode 100644
index e296d52214..0000000000
--- a/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "ConnectionHandler.h"
-#include "Connection.h"
-#include "qpid/framing/ConnectionStartBody.h"
-#include "qpid/framing/ClientInvoker.h"
-#include "qpid/framing/ServerInvoker.h"
-
-using namespace qpid;
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-
-namespace
-{
-const std::string PLAIN = "PLAIN";
-const std::string en_US = "en_US";
-}
-
-void ConnectionHandler::init(const framing::ProtocolInitiation& header) {
- FieldTable properties;
- string mechanisms(PLAIN);
- string locales(en_US);
- handler->serverMode = true;
- handler->client.start(header.getMajor(), header.getMinor(), properties, mechanisms, locales);
-}
-
-void ConnectionHandler::close(ReplyCode code, const string& text, ClassId classId, MethodId methodId)
-{
- handler->client.close(code, text, classId, methodId);
-}
-
-void ConnectionHandler::handle(framing::AMQFrame& frame)
-{
- AMQMethodBody* method=frame.getBody()->getMethod();
- try{
- if (handler->serverMode) {
- if (!invoke(static_cast<AMQP_ServerOperations::ConnectionHandler&>(*handler.get()), *method))
- throw ChannelErrorException(QPID_MSG("Class can't be accessed over channel 0"));
- } else {
- if (!invoke(static_cast<AMQP_ClientOperations::ConnectionHandler&>(*handler.get()), *method))
- throw ChannelErrorException(QPID_MSG("Class can't be accessed over channel 0"));
- }
- }catch(ConnectionException& e){
- handler->client.close(e.code, e.what(), method->amqpClassId(), method->amqpMethodId());
- }catch(std::exception& e){
- handler->client.close(541/*internal error*/, e.what(), method->amqpClassId(), method->amqpMethodId());
- }
-}
-
-ConnectionHandler::ConnectionHandler(Connection& connection) : handler(new Handler(connection)) {}
-
-ConnectionHandler::Handler:: Handler(Connection& c) : client(c.getOutput()), server(c.getOutput()),
- connection(c), serverMode(false) {}
-
-void ConnectionHandler::Handler::startOk(const framing::FieldTable& /*clientProperties*/,
- const string& mechanism,
- const string& response, const string& /*locale*/)
-{
- //TODO: handle SASL mechanisms more cleverly
- if (mechanism == PLAIN) {
- if (response.size() > 0 && response[0] == (char) 0) {
- string temp = response.substr(1);
- string::size_type i = temp.find((char)0);
- string uid = temp.substr(0, i);
- string pwd = temp.substr(i + 1);
- //TODO: authentication
- connection.setUserId(uid);
- }
- }
- client.tune(framing::CHANNEL_MAX, connection.getFrameMax(), connection.getHeartbeat());
-}
-
-void ConnectionHandler::Handler::secureOk(const string& /*response*/){}
-
-void ConnectionHandler::Handler::tuneOk(uint16_t /*channelmax*/,
- uint32_t framemax, uint16_t heartbeat)
-{
- connection.setFrameMax(framemax);
- connection.setHeartbeat(heartbeat);
-}
-
-void ConnectionHandler::Handler::open(const string& /*virtualHost*/,
- const string& /*capabilities*/, bool /*insist*/)
-{
- string knownhosts;
- client.openOk(knownhosts);
-}
-
-
-void ConnectionHandler::Handler::close(uint16_t /*replyCode*/, const string& /*replyText*/,
- uint16_t /*classId*/, uint16_t /*methodId*/)
-{
- client.closeOk();
- connection.getOutput().close();
-}
-
-void ConnectionHandler::Handler::closeOk(){
- connection.getOutput().close();
-}
-
-
-void ConnectionHandler::Handler::start(uint8_t /*versionMajor*/,
- uint8_t /*versionMinor*/,
- const FieldTable& /*serverProperties*/,
- const string& /*mechanisms*/,
- const string& /*locales*/)
-{
- string uid = "qpidd";
- string pwd = "qpidd";
- string response = ((char)0) + uid + ((char)0) + pwd;
- server.startOk(FieldTable(), PLAIN, response, en_US);
- connection.initMgmt(true);
-}
-
-void ConnectionHandler::Handler::secure(const string& /*challenge*/)
-{
- server.secureOk("");
-}
-
-void ConnectionHandler::Handler::tune(uint16_t channelMax,
- uint32_t frameMax,
- uint16_t heartbeat)
-{
- connection.setFrameMax(frameMax);
- connection.setHeartbeat(heartbeat);
- server.tuneOk(channelMax, frameMax, heartbeat);
- server.open("/", "", true);
-}
-
-void ConnectionHandler::Handler::openOk(const string& /*knownHosts*/)
-{
-}
-
-void ConnectionHandler::Handler::redirect(const string& /*host*/, const string& /*knownHosts*/)
-{
-
-}
diff --git a/qpid/cpp/src/qpid/broker/ConnectionHandler.h b/qpid/cpp/src/qpid/broker/ConnectionHandler.h
deleted file mode 100644
index 2a581d5675..0000000000
--- a/qpid/cpp/src/qpid/broker/ConnectionHandler.h
+++ /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.
- *
- */
-#ifndef _ConnectionAdapter_
-#define _ConnectionAdapter_
-
-#include <memory>
-#include "qpid/framing/amqp_types.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/AMQP_ClientOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ServerProxy.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/ProtocolInitiation.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/Exception.h"
-
-namespace qpid {
-namespace broker {
-
-class Connection;
-
-// TODO aconway 2007-09-18: Rename to ConnectionHandler
-class ConnectionHandler : public framing::FrameHandler
-{
- struct Handler : public framing::AMQP_ServerOperations::ConnectionHandler,
- public framing::AMQP_ClientOperations::ConnectionHandler
- {
- framing::AMQP_ClientProxy::Connection client;
- framing::AMQP_ServerProxy::Connection server;
- Connection& connection;
- bool serverMode;
-
- Handler(Connection& connection);
- void startOk(const qpid::framing::FieldTable& clientProperties,
- const std::string& mechanism, const std::string& response,
- const std::string& locale);
- void secureOk(const std::string& response);
- void tuneOk(uint16_t channelMax, uint32_t frameMax, uint16_t heartbeat);
- void open(const std::string& virtualHost,
- const std::string& capabilities, bool insist);
- void close(uint16_t replyCode, const std::string& replyText,
- uint16_t classId, uint16_t methodId);
- void closeOk();
-
-
- void start(uint8_t versionMajor,
- uint8_t versionMinor,
- const qpid::framing::FieldTable& serverProperties,
- const std::string& mechanisms,
- const std::string& locales);
-
- void secure(const std::string& challenge);
-
- void tune(uint16_t channelMax,
- uint32_t frameMax,
- uint16_t heartbeat);
-
- void openOk(const std::string& knownHosts);
-
- void redirect(const std::string& host, const std::string& knownHosts);
- };
- std::auto_ptr<Handler> handler;
- public:
- ConnectionHandler(Connection& connection);
- void init(const framing::ProtocolInitiation& header);
- void close(framing::ReplyCode code, const std::string& text, framing::ClassId classId, framing::MethodId methodId);
- void handle(framing::AMQFrame& frame);
-};
-
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/ConnectionState.h b/qpid/cpp/src/qpid/broker/ConnectionState.h
deleted file mode 100644
index 691d47d866..0000000000
--- a/qpid/cpp/src/qpid/broker/ConnectionState.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _ConnectionState_
-#define _ConnectionState_
-
-#include <vector>
-
-#include "qpid/sys/AggregateOutput.h"
-#include "qpid/sys/ConnectionOutputHandler.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/management/Manageable.h"
-#include "Broker.h"
-
-namespace qpid {
-namespace broker {
-
-class ConnectionState : public ConnectionToken, public management::Manageable
-{
- public:
- ConnectionState(qpid::sys::ConnectionOutputHandler* o, Broker& b) :
- broker(b),
- outputTasks(*o),
- out(o),
- framemax(65535),
- heartbeat(0),
- stagingThreshold(broker.getStagingThreshold())
- {}
-
-
-
- virtual ~ConnectionState () {}
-
- uint32_t getFrameMax() const { return framemax; }
- uint16_t getHeartbeat() const { return heartbeat; }
- uint64_t getStagingThreshold() const { return stagingThreshold; }
-
- void setFrameMax(uint32_t fm) { framemax = fm; }
- void setHeartbeat(uint16_t hb) { heartbeat = hb; }
- void setStagingThreshold(uint64_t st) { stagingThreshold = st; }
-
- void setUserId(const string& uid) { userId = uid; }
- const string& getUserId() const { return userId; }
-
- Broker& getBroker() { return broker; }
-
- Broker& broker;
- std::vector<Queue::shared_ptr> exclusiveQueues;
-
- //contained output tasks
- sys::AggregateOutput outputTasks;
-
- sys::ConnectionOutputHandler& getOutput() const { return *out; }
- framing::ProtocolVersion getVersion() const { return version; }
-
- protected:
- framing::ProtocolVersion version;
- sys::ConnectionOutputHandler* out;
- uint32_t framemax;
- uint16_t heartbeat;
- uint64_t stagingThreshold;
- string userId;
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/ConnectionToken.h b/qpid/cpp/src/qpid/broker/ConnectionToken.h
deleted file mode 100644
index 7e7f813d0e..0000000000
--- a/qpid/cpp/src/qpid/broker/ConnectionToken.h
+++ /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.
- *
- */
-#ifndef _ConnectionToken_
-#define _ConnectionToken_
-
-namespace qpid {
- namespace broker {
- /**
- * An empty interface allowing opaque implementations of some
- * form of token to identify a connection.
- */
- class ConnectionToken{
- public:
- virtual ~ConnectionToken(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/Consumer.h b/qpid/cpp/src/qpid/broker/Consumer.h
deleted file mode 100644
index ed4bb176f6..0000000000
--- a/qpid/cpp/src/qpid/broker/Consumer.h
+++ /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.
- *
- */
-#ifndef _Consumer_
-#define _Consumer_
-
-namespace qpid {
- namespace broker {
- class Queue;
-}}
-
-#include "Message.h"
-
-namespace qpid {
- namespace broker {
-
- struct QueuedMessage
- {
- intrusive_ptr<Message> payload;
- framing::SequenceNumber position;
- Queue* queue;
-
- QueuedMessage(Queue* q, intrusive_ptr<Message> msg, framing::SequenceNumber sn) :
- payload(msg), position(sn), queue(q) {}
- QueuedMessage(Queue* q) : queue(q) {}
- };
-
-
- class Consumer {
- const bool acquires;
- public:
- typedef shared_ptr<Consumer> ptr;
-
- framing::SequenceNumber position;
-
- Consumer(bool preAcquires = true) : acquires(preAcquires) {}
- bool preAcquires() const { return acquires; }
- virtual bool deliver(QueuedMessage& msg) = 0;
- virtual void notify() = 0;
- virtual bool filter(intrusive_ptr<Message>) { return true; }
- virtual bool accept(intrusive_ptr<Message>) { return true; }
- virtual ~Consumer(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/Daemon.cpp b/qpid/cpp/src/qpid/broker/Daemon.cpp
deleted file mode 100644
index 3fcc487324..0000000000
--- a/qpid/cpp/src/qpid/broker/Daemon.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include "Daemon.h"
-#include "qpid/log/Statement.h"
-#include "qpid/Exception.h"
-
-#include <boost/iostreams/stream.hpp>
-#include <boost/iostreams/device/file_descriptor.hpp>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-namespace qpid {
-namespace broker {
-
-using namespace std;
-typedef boost::iostreams::stream<boost::iostreams::file_descriptor> fdstream;
-
-namespace {
-/** Throw an exception containing msg and strerror if throwIf is true.
- * Name is supposed to be reminiscent of perror().
- */
-void throwIf(bool condition, const string& msg, int errNo=errno) {
- if (condition)
- throw Exception(msg + (errNo? ": "+strError(errNo) : string(".")));
-}
-
-
-struct LockFile : public fdstream {
-
- LockFile(const std::string& path_, bool create)
- : path(path_), fd(-1), created(create)
- {
- errno = 0;
- int flags=create ? O_WRONLY|O_CREAT|O_NOFOLLOW : O_RDWR;
- fd = ::open(path.c_str(), flags, 0644);
- throwIf(fd < 0,"Cannot open "+path);
- throwIf(::lockf(fd, F_TLOCK, 0) < 0, "Cannot lock "+path);
- open(boost::iostreams::file_descriptor(fd));
- }
-
- ~LockFile() {
- if (fd >= 0) {
- ::lockf(fd, F_ULOCK, 0);
- close();
- }
- }
-
- std::string path;
- int fd;
- bool created;
-};
-
-} // namespace
-
-Daemon::Daemon() {
- pid = -1;
- pipeFds[0] = pipeFds[1] = -1;
-}
-
-string Daemon::dir() {
- return (getuid() == 0 ? "/var/run" : "/tmp");
-}
-
-string Daemon::pidFile(uint16_t port) {
- ostringstream path;
- path << dir() << "/qpidd." << port << ".pid";
- return path.str();
-}
-
-void Daemon::fork()
-{
- throwIf(pipe(pipeFds) < 0, "Can't create pipe");
- throwIf((pid = ::fork()) < 0, "Daemon fork failed");
- if (pid == 0) { // Child
- try {
- QPID_LOG(debug, "Forked daemon child process");
-
- // File descriptors
- throwIf(::close(pipeFds[0])<0, "Cannot close read pipe");
- throwIf(::close(0)<0, "Cannot close stdin");
- throwIf(::close(1)<0, "Cannot close stdout");
- throwIf(::close(2)<0, "Cannot close stderr");
- int fd=::open("/dev/null",O_RDWR); // stdin
- throwIf(fd != 0, "Cannot re-open stdin");
- throwIf(::dup(fd)<0, "Cannot re-open stdout");
- throwIf(::dup(fd)<0, "Cannot re-open stderror");
-
- // Misc
- throwIf(setsid()<0, "Cannot set session ID");
- throwIf(chdir(dir().c_str()) < 0, "Cannot change directory to "+dir());
- umask(027);
-
- // Child behavior
- child();
- }
- catch (const exception& e) {
- QPID_LOG(critical, "Daemon startup failed: " << e.what());
- fdstream pipe(pipeFds[1]);
- assert(pipe.is_open());
- pipe << "0 " << e.what() << endl;
- }
- }
- else { // Parent
- close(pipeFds[1]); // Write side.
- parent();
- }
-}
-
-Daemon::~Daemon() {
- if (!lockFile.empty())
- unlink(lockFile.c_str());
-}
-
-uint16_t Daemon::wait(int timeout) { // parent waits for child.
- errno = 0;
- struct timeval tv;
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
-
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(pipeFds[0], &fds);
- int n=select(FD_SETSIZE, &fds, 0, 0, &tv);
- throwIf(n==0, "Timed out waiting for daemon");
- throwIf(n<0, "Error waiting for daemon");
- fdstream pipe(pipeFds[0]);
- pipe.exceptions(ios::failbit|ios::badbit|ios::eofbit);
- uint16_t port = 0;
- try {
- pipe >> port;
- if (port == 0) {
- string errmsg;
- pipe >> skipws;
- getline(pipe, errmsg);
- throw Exception("Daemon startup failed"+
- (errmsg.empty() ? string(".") : ": " + errmsg));
- }
- }
- catch (const fdstream::failure& e) {
- throw Exception(string("Failed to read daemon port: ")+e.what());
- }
- return port;
-}
-
-void Daemon::ready(uint16_t port) { // child
- lockFile = pidFile(port);
- LockFile lf(lockFile, true);
- lf << getpid() << endl;
- if (lf.fail())
- throw Exception("Cannot write lock file "+lockFile);
- fdstream pipe(pipeFds[1]);
- QPID_LOG(debug, "Daemon ready on port: " << port);
- pipe << port << endl;
- throwIf(!pipe.good(), "Error writing to parent");
-}
-
-pid_t Daemon::getPid(uint16_t port) {
- string name = pidFile(port);
- LockFile lockFile(name, false);
- pid_t pid;
- lockFile >> pid;
- if (lockFile.fail())
- throw Exception("Cannot read lock file "+name);
- if (kill(pid, 0) < 0 && errno != EPERM) {
- unlink(name.c_str());
- throw Exception("Removing stale lock file "+name);
- }
- return pid;
-}
-
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/Daemon.h b/qpid/cpp/src/qpid/broker/Daemon.h
deleted file mode 100644
index 821334c11e..0000000000
--- a/qpid/cpp/src/qpid/broker/Daemon.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef _broker_Daemon_h
-#define _broker_Daemon_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <string>
-#include <boost/scoped_ptr.hpp>
-#include <boost/function.hpp>
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
-namespace broker {
-
-/**
- * Tools for forking and managing a daemon process.
- * NB: Only one Daemon instance is allowed in a process.
- */
-class Daemon : private boost::noncopyable
-{
- public:
- /** Check daemon is running on port, throw exception if not */
- static pid_t getPid(uint16_t port);
-
- Daemon();
-
- virtual ~Daemon();
-
- /**
- * Fork a daemon process.
- * Call parent() in the parent process, child() in the child.
- */
- void fork();
-
- protected:
-
- /** Called in parent process */
- virtual void parent() = 0;
-
- /** Called in child process */
- virtual void child() = 0;
-
- /** Call from parent(): wait for child to indicate it is ready.
- * @timeout in seconds to wait for response.
- * @return port passed by child to ready().
- */
- uint16_t wait(int timeout);
-
- /** Call from child(): Notify the parent we are ready and write the
- * PID file.
- *@param port returned by parent call to wait().
- */
- void ready(uint16_t port);
-
- private:
- static std::string dir();
- static std::string pidFile(uint16_t port);
-
- pid_t pid;
- int pipeFds[2];
- std::string lockFile;
-};
-
-}} // namespace qpid::broker
-
-#endif /*!_broker_Daemon_h*/
diff --git a/qpid/cpp/src/qpid/broker/Deliverable.h b/qpid/cpp/src/qpid/broker/Deliverable.h
deleted file mode 100644
index e46d2024bf..0000000000
--- a/qpid/cpp/src/qpid/broker/Deliverable.h
+++ /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.
- *
- */
-#ifndef _Deliverable_
-#define _Deliverable_
-
-#include "Queue.h"
-
-namespace qpid {
- namespace broker {
- class Deliverable{
- public:
- bool delivered;
- Deliverable() : delivered(false) {}
- virtual void deliverTo(Queue::shared_ptr& queue) = 0;
- virtual uint64_t contentSize() { return 0; }
- virtual ~Deliverable(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DeliverableMessage.cpp b/qpid/cpp/src/qpid/broker/DeliverableMessage.cpp
deleted file mode 100644
index e79a3aa773..0000000000
--- a/qpid/cpp/src/qpid/broker/DeliverableMessage.cpp
+++ /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.
- *
- */
-#include "DeliverableMessage.h"
-
-using namespace qpid::broker;
-
-DeliverableMessage::DeliverableMessage(intrusive_ptr<Message>& _msg) : msg(_msg)
-{
-}
-
-void DeliverableMessage::deliverTo(Queue::shared_ptr& queue)
-{
- queue->deliver(msg);
- delivered = true;
-}
-
-Message& DeliverableMessage::getMessage()
-{
- return *msg;
-}
-
-uint64_t DeliverableMessage::contentSize ()
-{
- return msg->contentSize ();
-}
diff --git a/qpid/cpp/src/qpid/broker/DeliverableMessage.h b/qpid/cpp/src/qpid/broker/DeliverableMessage.h
deleted file mode 100644
index 440d1184eb..0000000000
--- a/qpid/cpp/src/qpid/broker/DeliverableMessage.h
+++ /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.
- *
- */
-#ifndef _DeliverableMessage_
-#define _DeliverableMessage_
-
-#include "Deliverable.h"
-#include "Queue.h"
-#include "Message.h"
-
-namespace qpid {
- namespace broker {
- class DeliverableMessage : public Deliverable{
- intrusive_ptr<Message> msg;
- public:
- DeliverableMessage(intrusive_ptr<Message>& msg);
- virtual void deliverTo(Queue::shared_ptr& queue);
- Message& getMessage();
- uint64_t contentSize();
- virtual ~DeliverableMessage(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DeliveryAdapter.h b/qpid/cpp/src/qpid/broker/DeliveryAdapter.h
deleted file mode 100644
index 4c2b2f615f..0000000000
--- a/qpid/cpp/src/qpid/broker/DeliveryAdapter.h
+++ /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.
- *
- */
-#ifndef _DeliveryAdapter_
-#define _DeliveryAdapter_
-
-#include "DeliveryId.h"
-#include "DeliveryToken.h"
-#include "Message.h"
-#include "qpid/framing/amqp_types.h"
-
-namespace qpid {
-namespace broker {
-
- /**
- * The intention behind this interface is to separate the generic
- * handling of some form of message delivery to clients that is
- * contained in the version independent Channel class from the
- * details required for a particular situation or
- * version. i.e. where the existing adapters allow (through
- * supporting the generated interface for a version of the
- * protocol) inputs of a channel to be adapted to the version
- * independent part, this does the same for the outputs.
- */
- class DeliveryAdapter
- {
- public:
- virtual DeliveryId deliver(QueuedMessage& msg, DeliveryToken::shared_ptr token) = 0;
- virtual ~DeliveryAdapter(){}
- };
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DeliveryId.h b/qpid/cpp/src/qpid/broker/DeliveryId.h
deleted file mode 100644
index 05b19f032e..0000000000
--- a/qpid/cpp/src/qpid/broker/DeliveryId.h
+++ /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.
- *
- */
-#ifndef _DeliveryId_
-#define _DeliveryId_
-
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/framing/SequenceNumberSet.h"
-
-namespace qpid {
-namespace broker {
-
- typedef framing::SequenceNumber DeliveryId;
- typedef framing::SequenceNumberSet DeliveryIds;
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DeliveryRecord.cpp b/qpid/cpp/src/qpid/broker/DeliveryRecord.cpp
deleted file mode 100644
index 154394e5de..0000000000
--- a/qpid/cpp/src/qpid/broker/DeliveryRecord.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "DeliveryRecord.h"
-#include "DeliverableMessage.h"
-#include "SemanticState.h"
-#include "Exchange.h"
-#include "qpid/log/Statement.h"
-
-using namespace qpid::broker;
-using std::string;
-
-DeliveryRecord::DeliveryRecord(const QueuedMessage& _msg,
- Queue::shared_ptr _queue,
- const std::string _tag,
- DeliveryToken::shared_ptr _token,
- const DeliveryId _id,
- bool _acquired, bool _confirmed) : msg(_msg),
- queue(_queue),
- tag(_tag),
- token(_token),
- id(_id),
- acquired(_acquired),
- confirmed(_confirmed),
- pull(false),
- cancelled(false)
-{
-}
-
-DeliveryRecord::DeliveryRecord(const QueuedMessage& _msg,
- Queue::shared_ptr _queue,
- const DeliveryId _id) : msg(_msg),
- queue(_queue),
- id(_id),
- acquired(true),
- confirmed(false),
- pull(true),
- cancelled(false)
-{}
-
-
-void DeliveryRecord::dequeue(TransactionContext* ctxt) const{
- if (acquired && !confirmed) {
- queue->dequeue(ctxt, msg.payload);
- }
-}
-
-bool DeliveryRecord::matches(DeliveryId tag) const{
- return id == tag;
-}
-
-bool DeliveryRecord::matchOrAfter(DeliveryId tag) const{
- return matches(tag) || after(tag);
-}
-
-bool DeliveryRecord::after(DeliveryId tag) const{
- return id > tag;
-}
-
-bool DeliveryRecord::coveredBy(const framing::AccumulatedAck* const range) const{
- return range->covers(id);
-}
-
-void DeliveryRecord::redeliver(SemanticState* const session) {
- if (!confirmed) {
- if(pull || cancelled){
- //if message was originally sent as response to get, we must requeue it
-
- //or if subscription was cancelled, requeue it (waiting for
- //final confirmation for AMQP WG on this case)
-
- requeue();
- }else{
- msg.payload->redeliver();//mark as redelivered
- id = session->redeliver(msg, token);
- }
- }
-}
-
-void DeliveryRecord::requeue() const
-{
- if (acquired && !confirmed) {
- msg.payload->redeliver();
- queue->requeue(msg);
- }
-}
-
-void DeliveryRecord::release()
-{
- if (acquired && !confirmed) {
- queue->requeue(msg);
- acquired = false;
- }
-}
-
-void DeliveryRecord::reject()
-{
- Exchange::shared_ptr alternate = queue->getAlternateExchange();
- if (alternate) {
- DeliverableMessage delivery(msg.payload);
- alternate->route(delivery, msg.payload->getRoutingKey(), msg.payload->getApplicationHeaders());
- QPID_LOG(info, "Routed rejected message from " << queue->getName() << " to "
- << alternate->getName());
- } else {
- //just drop it
- QPID_LOG(info, "Dropping rejected message from " << queue->getName());
- }
-}
-
-void DeliveryRecord::updateByteCredit(uint32_t& credit) const
-{
- credit += msg.payload->getRequiredCredit();
-}
-
-
-void DeliveryRecord::addTo(Prefetch& prefetch) const{
- if(!pull){
- //ignore 'pulled' messages (i.e. those that were sent in
- //response to get) when calculating prefetch
- prefetch.size += msg.payload->contentSize();
- prefetch.count++;
- }
-}
-
-void DeliveryRecord::subtractFrom(Prefetch& prefetch) const{
- if(!pull){
- //ignore 'pulled' messages (i.e. those that were sent in
- //response to get) when calculating prefetch
- prefetch.size -= msg.payload->contentSize();
- prefetch.count--;
- }
-}
-
-void DeliveryRecord::acquire(DeliveryIds& results) {
- if (queue->acquire(msg)) {
- acquired = true;
- results.push_back(id);
- } else {
- QPID_LOG(info, "Message already acquired " << id.getValue());
- }
-}
-
-void DeliveryRecord::cancel(const std::string& cancelledTag)
-{
- if (tag == cancelledTag)
- cancelled = true;
-}
-
-namespace qpid {
-namespace broker {
-
-std::ostream& operator<<(std::ostream& out, const DeliveryRecord& r)
-{
- out << "{" << "id=" << r.id.getValue();
- out << ", tag=" << r.tag << "}";
- out << ", queue=" << r.queue->getName() << "}";
- return out;
-}
-
-bool operator<(const DeliveryRecord& a, const DeliveryRecord& b)
-{
- return a.id < b.id;
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/broker/DeliveryRecord.h b/qpid/cpp/src/qpid/broker/DeliveryRecord.h
deleted file mode 100644
index eeb363bcfc..0000000000
--- a/qpid/cpp/src/qpid/broker/DeliveryRecord.h
+++ /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.
- *
- */
-#ifndef _DeliveryRecord_
-#define _DeliveryRecord_
-
-#include <algorithm>
-#include <list>
-#include <vector>
-#include <ostream>
-#include "qpid/framing/AccumulatedAck.h"
-#include "Queue.h"
-#include "Consumer.h"
-#include "DeliveryId.h"
-#include "DeliveryToken.h"
-#include "Message.h"
-#include "Prefetch.h"
-
-namespace qpid {
-namespace broker {
-class SemanticState;
-
-/**
- * Record of a delivery for which an ack is outstanding.
- */
-class DeliveryRecord{
- QueuedMessage msg;
- mutable Queue::shared_ptr queue;
- const std::string tag;
- DeliveryToken::shared_ptr token;
- DeliveryId id;
- bool acquired;
- const bool confirmed;
- const bool pull;
- bool cancelled;
-
- public:
- DeliveryRecord(const QueuedMessage& msg, Queue::shared_ptr queue, const std::string tag, DeliveryToken::shared_ptr token,
- const DeliveryId id, bool acquired, bool confirmed = false);
- DeliveryRecord(const QueuedMessage& msg, Queue::shared_ptr queue, const DeliveryId id);
-
- void dequeue(TransactionContext* ctxt = 0) const;
- bool matches(DeliveryId tag) const;
- bool matchOrAfter(DeliveryId tag) const;
- bool after(DeliveryId tag) const;
- bool coveredBy(const framing::AccumulatedAck* const range) const;
- void requeue() const;
- void release();
- void reject();
- void cancel(const std::string& tag);
- void redeliver(SemanticState* const);
- void updateByteCredit(uint32_t& credit) const;
- void addTo(Prefetch&) const;
- void subtractFrom(Prefetch&) const;
- const std::string& getTag() const { return tag; }
- bool isPull() const { return pull; }
- bool isAcquired() const { return acquired; }
- void acquire(DeliveryIds& results);
- friend bool operator<(const DeliveryRecord&, const DeliveryRecord&);
- friend std::ostream& operator<<(std::ostream&, const DeliveryRecord&);
-};
-
-typedef std::list<DeliveryRecord> DeliveryRecords;
-typedef std::list<DeliveryRecord>::iterator ack_iterator;
-
-struct AckRange
-{
- ack_iterator start;
- ack_iterator end;
- AckRange(ack_iterator _start, ack_iterator _end) : start(_start), end(_end) {}
-};
-
-struct AcquireFunctor
-{
- DeliveryIds& results;
-
- AcquireFunctor(DeliveryIds& _results) : results(_results) {}
-
- void operator()(DeliveryRecord& record)
- {
- record.acquire(results);
- }
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DeliveryToken.h b/qpid/cpp/src/qpid/broker/DeliveryToken.h
deleted file mode 100644
index 8bdf5e6359..0000000000
--- a/qpid/cpp/src/qpid/broker/DeliveryToken.h
+++ /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.
- *
- */
-#ifndef _DeliveryToken_
-#define _DeliveryToken_
-
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace broker {
-
- /**
- * A DeliveryToken allows the delivery of a message to be
- * associated with whatever mechanism caused it to be
- * delivered. (i.e. its a form of Memento).
- */
- class DeliveryToken
- {
- public:
- typedef boost::shared_ptr<DeliveryToken> shared_ptr;
-
- virtual ~DeliveryToken(){}
- };
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DirectExchange.cpp b/qpid/cpp/src/qpid/broker/DirectExchange.cpp
deleted file mode 100644
index 43b707a5c8..0000000000
--- a/qpid/cpp/src/qpid/broker/DirectExchange.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/log/Statement.h"
-#include "DirectExchange.h"
-#include <iostream>
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-using qpid::management::Manageable;
-
-DirectExchange::DirectExchange(const string& _name, Manageable* _parent) : Exchange(_name, _parent)
-{
- if (mgmtExchange.get() != 0)
- mgmtExchange->set_type (typeName);
-}
-
-DirectExchange::DirectExchange(const std::string& _name, bool _durable,
- const FieldTable& _args, Manageable* _parent) :
- Exchange(_name, _durable, _args, _parent)
-{
- if (mgmtExchange.get() != 0)
- mgmtExchange->set_type (typeName);
-}
-
-bool DirectExchange::bind(Queue::shared_ptr queue, const string& routingKey, const FieldTable*){
- RWlock::ScopedWlock l(lock);
- std::vector<Binding::shared_ptr>& queues(bindings[routingKey]);
- std::vector<Binding::shared_ptr>::iterator i;
-
- for (i = queues.begin(); i != queues.end(); i++)
- if ((*i)->queue == queue)
- break;
-
- if (i == queues.end()) {
- Binding::shared_ptr binding (new Binding (routingKey, queue, this));
- bindings[routingKey].push_back(binding);
- if (mgmtExchange.get() != 0) {
- mgmtExchange->inc_bindings ();
- }
- return true;
- } else{
- return false;
- }
-}
-
-bool DirectExchange::unbind(Queue::shared_ptr queue, const string& routingKey, const FieldTable* /*args*/){
- RWlock::ScopedWlock l(lock);
- std::vector<Binding::shared_ptr>& queues(bindings[routingKey]);
- std::vector<Binding::shared_ptr>::iterator i;
-
- for (i = queues.begin(); i != queues.end(); i++)
- if ((*i)->queue == queue)
- break;
-
- if (i < queues.end()) {
- queues.erase(i);
- if (queues.empty()) {
- bindings.erase(routingKey);
- }
- if (mgmtExchange.get() != 0) {
- mgmtExchange->dec_bindings ();
- }
- return true;
- } else {
- return false;
- }
-}
-
-void DirectExchange::route(Deliverable& msg, const string& routingKey, const FieldTable* /*args*/){
- RWlock::ScopedRlock l(lock);
- std::vector<Binding::shared_ptr>& queues(bindings[routingKey]);
- std::vector<Binding::shared_ptr>::iterator i;
- int count(0);
-
- for(i = queues.begin(); i != queues.end(); i++, count++) {
- msg.deliverTo((*i)->queue);
- if ((*i)->mgmtBinding.get() != 0)
- (*i)->mgmtBinding->inc_msgMatched ();
- }
-
- if(!count){
- QPID_LOG(warning, "DirectExchange " << getName() << " could not route message with key " << routingKey);
- if (mgmtExchange.get() != 0) {
- mgmtExchange->inc_msgDrops ();
- mgmtExchange->inc_byteDrops (msg.contentSize ());
- }
- }
- else {
- if (mgmtExchange.get() != 0) {
- mgmtExchange->inc_msgRoutes (count);
- mgmtExchange->inc_byteRoutes (count * msg.contentSize ());
- }
- }
-
- if (mgmtExchange.get() != 0) {
- mgmtExchange->inc_msgReceives ();
- mgmtExchange->inc_byteReceives (msg.contentSize ());
- }
-}
-
-
-bool DirectExchange::isBound(Queue::shared_ptr queue, const string* const routingKey, const FieldTable* const)
-{
- std::vector<Binding::shared_ptr>::iterator j;
-
- if (routingKey) {
- Bindings::iterator i = bindings.find(*routingKey);
-
- if (i == bindings.end())
- return false;
- if (!queue)
- return true;
- for (j = i->second.begin(); j != i->second.end(); j++)
- if ((*j)->queue == queue)
- return true;
- } else if (!queue) {
- //if no queue or routing key is specified, just report whether any bindings exist
- return bindings.size() > 0;
- } else {
- for (Bindings::iterator i = bindings.begin(); i != bindings.end(); i++)
- for (j = i->second.begin(); j != i->second.end(); j++)
- if ((*j)->queue == queue)
- return true;
- return false;
- }
-
- return false;
-}
-
-DirectExchange::~DirectExchange() {}
-
-const std::string DirectExchange::typeName("direct");
diff --git a/qpid/cpp/src/qpid/broker/DirectExchange.h b/qpid/cpp/src/qpid/broker/DirectExchange.h
deleted file mode 100644
index 118f2ed4d3..0000000000
--- a/qpid/cpp/src/qpid/broker/DirectExchange.h
+++ /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.
- *
- */
-#ifndef _DirectExchange_
-#define _DirectExchange_
-
-#include <map>
-#include <vector>
-#include "Exchange.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/sys/Monitor.h"
-#include "Queue.h"
-
-namespace qpid {
-namespace broker {
- class DirectExchange : public virtual Exchange{
- typedef std::vector<Binding::shared_ptr> Queues;
- typedef std::map<string, Queues> Bindings;
- Bindings bindings;
- qpid::sys::RWlock lock;
-
- public:
- static const std::string typeName;
-
- DirectExchange(const std::string& name, management::Manageable* parent = 0);
- DirectExchange(const string& _name, bool _durable,
- const qpid::framing::FieldTable& _args, management::Manageable* parent = 0);
-
- virtual std::string getType() const { return typeName; }
-
- virtual bool bind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual bool unbind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual void route(Deliverable& msg, const std::string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args);
-
- virtual ~DirectExchange();
- };
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DtxAck.cpp b/qpid/cpp/src/qpid/broker/DtxAck.cpp
deleted file mode 100644
index 25186b4102..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxAck.cpp
+++ /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.
- *
- */
-#include "DtxAck.h"
-#include "qpid/log/Statement.h"
-
-using std::bind1st;
-using std::bind2nd;
-using std::mem_fun_ref;
-using namespace qpid::broker;
-
-DtxAck::DtxAck(const framing::AccumulatedAck& acked, std::list<DeliveryRecord>& unacked)
-{
- remove_copy_if(unacked.begin(), unacked.end(), inserter(pending, pending.end()),
- not1(bind2nd(mem_fun_ref(&DeliveryRecord::coveredBy), &acked)));
- unacked.remove_if(bind2nd(mem_fun_ref(&DeliveryRecord::coveredBy), &acked));
-}
-
-bool DtxAck::prepare(TransactionContext* ctxt) throw()
-{
- try{
- //record dequeue in the store
- for (ack_iterator i = pending.begin(); i != pending.end(); i++) {
- i->dequeue(ctxt);
- }
- return true;
- }catch(...){
- QPID_LOG(error, "Failed to prepare");
- return false;
- }
-}
-
-void DtxAck::commit() throw()
-{
- pending.clear();
-}
-
-void DtxAck::rollback() throw()
-{
- for_each(pending.begin(), pending.end(), mem_fun_ref(&DeliveryRecord::requeue));
- pending.clear();
-}
diff --git a/qpid/cpp/src/qpid/broker/DtxAck.h b/qpid/cpp/src/qpid/broker/DtxAck.h
deleted file mode 100644
index c61b279c42..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxAck.h
+++ /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.
- *
- */
-#ifndef _DtxAck_
-#define _DtxAck_
-
-#include <algorithm>
-#include <functional>
-#include <list>
-#include "qpid/framing/AccumulatedAck.h"
-#include "DeliveryRecord.h"
-#include "TxOp.h"
-
-namespace qpid {
- namespace broker {
- class DtxAck : public TxOp{
- std::list<DeliveryRecord> pending;
-
- public:
- DtxAck(const framing::AccumulatedAck& acked, std::list<DeliveryRecord>& unacked);
- virtual bool prepare(TransactionContext* ctxt) throw();
- virtual void commit() throw();
- virtual void rollback() throw();
- virtual ~DtxAck(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DtxBuffer.cpp b/qpid/cpp/src/qpid/broker/DtxBuffer.cpp
deleted file mode 100644
index 29a07ea6d9..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxBuffer.cpp
+++ /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.
- *
- */
-#include "DtxBuffer.h"
-
-using namespace qpid::broker;
-using qpid::sys::Mutex;
-
-DtxBuffer::DtxBuffer(const std::string& _xid)
- : xid(_xid), ended(false), suspended(false), failed(false), expired(false) {}
-
-DtxBuffer::~DtxBuffer() {}
-
-void DtxBuffer::markEnded()
-{
- Mutex::ScopedLock locker(lock);
- ended = true;
-}
-
-bool DtxBuffer::isEnded()
-{
- Mutex::ScopedLock locker(lock);
- return ended;
-}
-
-void DtxBuffer::setSuspended(bool isSuspended)
-{
- suspended = isSuspended;
-}
-
-bool DtxBuffer::isSuspended()
-{
- return suspended;
-}
-
-void DtxBuffer::fail()
-{
- Mutex::ScopedLock locker(lock);
- rollback();
- failed = true;
- ended = true;
-}
-
-bool DtxBuffer::isRollbackOnly()
-{
- Mutex::ScopedLock locker(lock);
- return failed;
-}
-
-const std::string& DtxBuffer::getXid()
-{
- return xid;
-}
-
-void DtxBuffer::timedout()
-{
- Mutex::ScopedLock locker(lock);
- expired = true;
- fail();
-}
-
-bool DtxBuffer::isExpired()
-{
- Mutex::ScopedLock locker(lock);
- return expired;
-}
diff --git a/qpid/cpp/src/qpid/broker/DtxBuffer.h b/qpid/cpp/src/qpid/broker/DtxBuffer.h
deleted file mode 100644
index b302632037..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxBuffer.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _DtxBuffer_
-#define _DtxBuffer_
-
-#include "TxBuffer.h"
-#include "qpid/sys/Mutex.h"
-
-namespace qpid {
- namespace broker {
- class DtxBuffer : public TxBuffer{
- sys::Mutex lock;
- const std::string xid;
- bool ended;
- bool suspended;
- bool failed;
- bool expired;
-
- public:
- typedef boost::shared_ptr<DtxBuffer> shared_ptr;
-
- DtxBuffer(const std::string& xid = "");
- ~DtxBuffer();
- void markEnded();
- bool isEnded();
- void setSuspended(bool suspended);
- bool isSuspended();
- void fail();
- bool isRollbackOnly();
- void timedout();
- bool isExpired();
- const std::string& getXid();
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DtxHandlerImpl.cpp b/qpid/cpp/src/qpid/broker/DtxHandlerImpl.cpp
deleted file mode 100644
index 533872e849..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxHandlerImpl.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include "DtxHandlerImpl.h"
-
-#include <boost/format.hpp>
-#include "Broker.h"
-#include "qpid/framing/constants.h"
-#include "qpid/framing/Array.h"
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-using std::string;
-
-DtxHandlerImpl::DtxHandlerImpl(SemanticState& s) : HandlerImpl(s) {}
-
-// DtxDemarcationHandler:
-
-
-void DtxHandlerImpl::select()
-{
- state.selectDtx();
-}
-
-DtxDemarcationEndResult DtxHandlerImpl::end(u_int16_t /*ticket*/,
- const string& xid,
- bool fail,
- bool suspend)
-{
- try {
- if (fail) {
- state.endDtx(xid, true);
- if (suspend) {
- throw CommandInvalidException(QPID_MSG("End and suspend cannot both be set."));
- } else {
- return DtxDemarcationEndResult(XA_RBROLLBACK);
- }
- } else {
- if (suspend) {
- state.suspendDtx(xid);
- } else {
- state.endDtx(xid, false);
- }
- return DtxDemarcationEndResult(XA_OK);
- }
- } catch (const DtxTimeoutException& e) {
- return DtxDemarcationEndResult(XA_RBTIMEOUT);
- }
-}
-
-DtxDemarcationStartResult DtxHandlerImpl::start(u_int16_t /*ticket*/,
- const string& xid,
- bool join,
- bool resume)
-{
- if (join && resume) {
- throw CommandInvalidException(QPID_MSG("Join and resume cannot both be set."));
- }
- try {
- if (resume) {
- state.resumeDtx(xid);
- } else {
- state.startDtx(xid, getBroker().getDtxManager(), join);
- }
- return DtxDemarcationStartResult(XA_OK);
- } catch (const DtxTimeoutException& e) {
- return DtxDemarcationStartResult(XA_RBTIMEOUT);
- }
-}
-
-// DtxCoordinationHandler:
-
-DtxCoordinationPrepareResult DtxHandlerImpl::prepare(u_int16_t /*ticket*/,
- const string& xid)
-{
- try {
- bool ok = getBroker().getDtxManager().prepare(xid);
- return DtxCoordinationPrepareResult(ok ? XA_OK : XA_RBROLLBACK);
- } catch (const DtxTimeoutException& e) {
- return DtxCoordinationPrepareResult(XA_RBTIMEOUT);
- }
-}
-
-DtxCoordinationCommitResult DtxHandlerImpl::commit(u_int16_t /*ticket*/,
- const string& xid,
- bool onePhase)
-{
- try {
- bool ok = getBroker().getDtxManager().commit(xid, onePhase);
- return DtxCoordinationCommitResult(ok ? XA_OK : XA_RBROLLBACK);
- } catch (const DtxTimeoutException& e) {
- return DtxCoordinationCommitResult(XA_RBTIMEOUT);
- }
-}
-
-
-DtxCoordinationRollbackResult DtxHandlerImpl::rollback(u_int16_t /*ticket*/,
- const string& xid )
-{
- try {
- getBroker().getDtxManager().rollback(xid);
- return DtxCoordinationRollbackResult(XA_OK);
- } catch (const DtxTimeoutException& e) {
- return DtxCoordinationRollbackResult(XA_RBTIMEOUT);
- }
-}
-
-DtxCoordinationRecoverResult DtxHandlerImpl::recover(u_int16_t /*ticket*/,
- bool /*startscan*/,
- bool /*endscan*/ )
-{
- //TODO: what do startscan and endscan actually mean?
-
- // response should hold on key value pair with key = 'xids' and
- // value = sequence of xids
-
- // until sequences are supported (0-10 encoding), an alternate
- // scheme is used for testing:
- //
- // key = 'xids' and value = a longstr containing shortstrs for each xid
- //
- // note that this restricts the length of the xids more than is
- // strictly 'legal', but that is ok for testing
- std::set<std::string> xids;
- getBroker().getStore().collectPreparedXids(xids);
-
- //TODO: remove the need to copy from one container type to another
- std::vector<std::string> data;
- for (std::set<std::string>::iterator i = xids.begin(); i != xids.end(); i++) {
- data.push_back(*i);
- }
- Array indoubt(data);
- return DtxCoordinationRecoverResult(indoubt);
-}
-
-void DtxHandlerImpl::forget(u_int16_t /*ticket*/,
- const string& xid)
-{
- //Currently no heuristic completion is supported, so this should never be used.
- throw CommandInvalidException(QPID_MSG("Forget is invalid. Branch with xid " << xid << " not heuristically completed!"));
-}
-
-DtxCoordinationGetTimeoutResult DtxHandlerImpl::getTimeout(const string& xid)
-{
- uint32_t timeout = getBroker().getDtxManager().getTimeout(xid);
- return DtxCoordinationGetTimeoutResult(timeout);
-}
-
-
-void DtxHandlerImpl::setTimeout(u_int16_t /*ticket*/,
- const string& xid,
- u_int32_t timeout)
-{
- getBroker().getDtxManager().setTimeout(xid, timeout);
-}
-
-
diff --git a/qpid/cpp/src/qpid/broker/DtxHandlerImpl.h b/qpid/cpp/src/qpid/broker/DtxHandlerImpl.h
deleted file mode 100644
index 5bc9d5142a..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxHandlerImpl.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef _broker_DtxHandlerImpl_h
-#define _broker_DtxHandlerImpl_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "HandlerImpl.h"
-
-namespace qpid {
-namespace broker {
-
-class DtxHandlerImpl
- : public HandlerImpl,
- public framing::AMQP_ServerOperations::DtxCoordinationHandler,
- public framing::AMQP_ServerOperations::DtxDemarcationHandler
-{
-public:
- DtxHandlerImpl(SemanticState&);
-
- // DtxCoordinationHandler:
-
- framing::DtxCoordinationCommitResult commit(u_int16_t ticket, const std::string& xid, bool onePhase);
-
- void forget(u_int16_t ticket, const std::string& xid);
-
- framing::DtxCoordinationGetTimeoutResult getTimeout(const std::string& xid);
-
- framing::DtxCoordinationPrepareResult prepare(u_int16_t ticket, const std::string& xid);
-
- framing::DtxCoordinationRecoverResult recover(u_int16_t ticket, bool startscan, bool endscan);
-
- framing::DtxCoordinationRollbackResult rollback(u_int16_t ticket, const std::string& xid);
-
- void setTimeout(u_int16_t ticket, const std::string& xid, u_int32_t timeout);
-
- // DtxDemarcationHandler:
-
- framing::DtxDemarcationEndResult end(u_int16_t ticket, const std::string& xid, bool fail, bool suspend);
-
- void select();
-
- framing::DtxDemarcationStartResult start(u_int16_t ticket, const std::string& xid, bool join, bool resume);
-};
-
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!_broker_DtxHandlerImpl_h*/
diff --git a/qpid/cpp/src/qpid/broker/DtxManager.cpp b/qpid/cpp/src/qpid/broker/DtxManager.cpp
deleted file mode 100644
index 6070b17b24..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxManager.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "DtxManager.h"
-#include "DtxTimeout.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/log/Statement.h"
-#include "qpid/ptr_map.h"
-
-#include <boost/format.hpp>
-#include <iostream>
-
-using qpid::sys::Mutex;
-using namespace qpid::ptr_map;
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-DtxManager::DtxManager() : store(0) {}
-
-DtxManager::~DtxManager() {}
-
-void DtxManager::start(const std::string& xid, DtxBuffer::shared_ptr ops)
-{
- createWork(xid)->add(ops);
-}
-
-void DtxManager::join(const std::string& xid, DtxBuffer::shared_ptr ops)
-{
- getWork(xid)->add(ops);
-}
-
-void DtxManager::recover(const std::string& xid, std::auto_ptr<TPCTransactionContext> txn, DtxBuffer::shared_ptr ops)
-{
- createWork(xid)->recover(txn, ops);
-}
-
-bool DtxManager::prepare(const std::string& xid)
-{
- try {
- return getWork(xid)->prepare();
- } catch (DtxTimeoutException& e) {
- remove(xid);
- throw e;
- }
-}
-
-bool DtxManager::commit(const std::string& xid, bool onePhase)
-{
- try {
- bool result = getWork(xid)->commit(onePhase);
- remove(xid);
- return result;
- } catch (DtxTimeoutException& e) {
- remove(xid);
- throw e;
- }
-}
-
-void DtxManager::rollback(const std::string& xid)
-{
- try {
- getWork(xid)->rollback();
- remove(xid);
- } catch (DtxTimeoutException& e) {
- remove(xid);
- throw e;
- }
-}
-
-DtxWorkRecord* DtxManager::getWork(const std::string& xid)
-{
- Mutex::ScopedLock locker(lock);
- WorkMap::iterator i = work.find(xid);
- if (i == work.end()) {
- throw InvalidArgumentException(QPID_MSG("Unrecognised xid " << xid));
- }
- return get_pointer(i);
-}
-
-void DtxManager::remove(const std::string& xid)
-{
- Mutex::ScopedLock locker(lock);
- WorkMap::iterator i = work.find(xid);
- if (i == work.end()) {
- throw InvalidArgumentException(QPID_MSG("Unrecognised xid " << xid));
- } else {
- work.erase(i);
- }
-}
-
-DtxWorkRecord* DtxManager::createWork(std::string xid)
-{
- Mutex::ScopedLock locker(lock);
- WorkMap::iterator i = work.find(xid);
- if (i != work.end()) {
- throw CommandInvalidException(QPID_MSG("Xid " << xid << " is already known (use 'join' to add work to an existing xid)"));
- } else {
- return get_pointer(work.insert(xid, new DtxWorkRecord(xid, store)).first);
- }
-}
-
-void DtxManager::setTimeout(const std::string& xid, uint32_t secs)
-{
- DtxWorkRecord* record = getWork(xid);
- intrusive_ptr<DtxTimeout> timeout = record->getTimeout();
- if (timeout.get()) {
- if (timeout->timeout == secs) return;//no need to do anything further if timeout hasn't changed
- timeout->cancelled = true;
- }
- timeout = intrusive_ptr<DtxTimeout>(new DtxTimeout(secs, *this, xid));
- record->setTimeout(timeout);
- timer.add(boost::static_pointer_cast<TimerTask>(timeout));
-
-}
-
-uint32_t DtxManager::getTimeout(const std::string& xid)
-{
- intrusive_ptr<DtxTimeout> timeout = getWork(xid)->getTimeout();
- return !timeout ? 0 : timeout->timeout;
-}
-
-void DtxManager::timedout(const std::string& xid)
-{
- Mutex::ScopedLock locker(lock);
- WorkMap::iterator i = work.find(xid);
- if (i == work.end()) {
- QPID_LOG(warning, "Transaction timeout failed: no record for xid");
- } else {
- get_pointer(i)->timedout();
- //TODO: do we want to have a timed task to cleanup, or can we rely on an explicit completion?
- //timer.add(intrusive_ptr<TimerTask>(new DtxCleanup(60*30/*30 mins*/, *this, xid)));
- }
-}
-
-DtxManager::DtxCleanup::DtxCleanup(uint32_t _timeout, DtxManager& _mgr, const std::string& _xid)
- : TimerTask(qpid::sys::Duration(_timeout * qpid::sys::TIME_SEC)), mgr(_mgr), xid(_xid) {}
-
-void DtxManager::DtxCleanup::fire()
-{
- try {
- mgr.remove(xid);
- } catch (ConnectionException& e) {
- //assume it was explicitly cleaned up after a call to prepare, commit or rollback
- }
-}
-
-void DtxManager::setStore (TransactionalStore* _store)
-{
- assert (store == 0 && _store != 0);
- store = _store;
-}
diff --git a/qpid/cpp/src/qpid/broker/DtxManager.h b/qpid/cpp/src/qpid/broker/DtxManager.h
deleted file mode 100644
index fa5c62c233..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxManager.h
+++ /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.
- *
- */
-#ifndef _DtxManager_
-#define _DtxManager_
-
-#include <boost/ptr_container/ptr_map.hpp>
-#include "DtxBuffer.h"
-#include "DtxWorkRecord.h"
-#include "Timer.h"
-#include "TransactionalStore.h"
-#include "qpid/framing/amqp_types.h"
-#include "qpid/sys/Mutex.h"
-
-namespace qpid {
-namespace broker {
-
-class DtxManager{
- typedef boost::ptr_map<std::string, DtxWorkRecord> WorkMap;
-
- struct DtxCleanup : public TimerTask
- {
- DtxManager& mgr;
- const std::string& xid;
-
- DtxCleanup(uint32_t timeout, DtxManager& mgr, const std::string& xid);
- void fire();
- };
-
- WorkMap work;
- TransactionalStore* store;
- qpid::sys::Mutex lock;
- Timer timer;
-
- void remove(const std::string& xid);
- DtxWorkRecord* getWork(const std::string& xid);
- DtxWorkRecord* createWork(std::string xid);
-
-public:
- DtxManager();
- ~DtxManager();
- void start(const std::string& xid, DtxBuffer::shared_ptr work);
- void join(const std::string& xid, DtxBuffer::shared_ptr work);
- void recover(const std::string& xid, std::auto_ptr<TPCTransactionContext> txn, DtxBuffer::shared_ptr work);
- bool prepare(const std::string& xid);
- bool commit(const std::string& xid, bool onePhase);
- void rollback(const std::string& xid);
- void setTimeout(const std::string& xid, uint32_t secs);
- uint32_t getTimeout(const std::string& xid);
- void timedout(const std::string& xid);
- void setStore(TransactionalStore* store);
-};
-
-}
-}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DtxTimeout.cpp b/qpid/cpp/src/qpid/broker/DtxTimeout.cpp
deleted file mode 100644
index 8e0a7741c4..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxTimeout.cpp
+++ /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.
- *
- */
-#include "DtxTimeout.h"
-#include "DtxManager.h"
-#include "qpid/sys/Time.h"
-
-using namespace qpid::broker;
-
-DtxTimeout::DtxTimeout(uint32_t _timeout, DtxManager& _mgr, const std::string& _xid)
- : TimerTask(qpid::sys::Duration(_timeout * qpid::sys::TIME_SEC)), timeout(_timeout), mgr(_mgr), xid(_xid)
-{
-}
-
-void DtxTimeout::fire()
-{
- mgr.timedout(xid);
-}
diff --git a/qpid/cpp/src/qpid/broker/DtxTimeout.h b/qpid/cpp/src/qpid/broker/DtxTimeout.h
deleted file mode 100644
index 6e949eab0d..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxTimeout.h
+++ /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.
- *
- */
-#ifndef _DtxTimeout_
-#define _DtxTimeout_
-
-#include "qpid/Exception.h"
-#include "Timer.h"
-
-namespace qpid {
-namespace broker {
-
-class DtxManager;
-
-struct DtxTimeoutException : public Exception {};
-
-struct DtxTimeout : public TimerTask
-{
- const uint32_t timeout;
- DtxManager& mgr;
- const std::string xid;
-
- DtxTimeout(uint32_t timeout, DtxManager& mgr, const std::string& xid);
- void fire();
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/DtxWorkRecord.cpp b/qpid/cpp/src/qpid/broker/DtxWorkRecord.cpp
deleted file mode 100644
index fe9e42ca32..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxWorkRecord.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "DtxWorkRecord.h"
-#include "qpid/framing/reply_exceptions.h"
-#include <boost/format.hpp>
-#include <boost/mem_fn.hpp>
-using boost::mem_fn;
-using qpid::sys::Mutex;
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-DtxWorkRecord::DtxWorkRecord(const std::string& _xid, TransactionalStore* const _store) :
- xid(_xid), store(_store), completed(false), rolledback(false), prepared(false), expired(false) {}
-
-DtxWorkRecord::~DtxWorkRecord()
-{
- if (timeout.get()) {
- timeout->cancelled = true;
- }
-}
-
-bool DtxWorkRecord::prepare()
-{
- Mutex::ScopedLock locker(lock);
- if (check()) {
- txn = store->begin(xid);
- if (prepare(txn.get())) {
- store->prepare(*txn);
- prepared = true;
- } else {
- abort();
- //TODO: this should probably be flagged as internal error
- }
- } else {
- //some part of the work has been marked rollback only
- abort();
- }
- return prepared;
-}
-
-bool DtxWorkRecord::prepare(TransactionContext* _txn)
-{
- bool succeeded(true);
- for (Work::iterator i = work.begin(); succeeded && i != work.end(); i++) {
- succeeded = (*i)->prepare(_txn);
- }
- return succeeded;
-}
-
-bool DtxWorkRecord::commit(bool onePhase)
-{
- Mutex::ScopedLock locker(lock);
- if (check()) {
- if (prepared) {
- //already prepared i.e. 2pc
- if (onePhase) {
- throw CommandInvalidException(QPID_MSG("Branch with xid " << xid << " has been prepared, one-phase option not valid!"));
- }
-
- store->commit(*txn);
- txn.reset();
-
- for_each(work.begin(), work.end(), mem_fn(&TxBuffer::commit));
- return true;
- } else {
- //1pc commit optimisation, don't need a 2pc transaction context:
- if (!onePhase) {
- throw CommandInvalidException(QPID_MSG("Branch with xid " << xid << " has not been prepared, one-phase option required!"));
- }
- std::auto_ptr<TransactionContext> localtxn = store->begin();
- if (prepare(localtxn.get())) {
- store->commit(*localtxn);
- for_each(work.begin(), work.end(), mem_fn(&TxBuffer::commit));
- return true;
- } else {
- store->abort(*localtxn);
- abort();
- //TODO: this should probably be flagged as internal error
- return false;
- }
- }
- } else {
- //some part of the work has been marked rollback only
- abort();
- return false;
- }
-}
-
-void DtxWorkRecord::rollback()
-{
- Mutex::ScopedLock locker(lock);
- check();
- abort();
-}
-
-void DtxWorkRecord::add(DtxBuffer::shared_ptr ops)
-{
- Mutex::ScopedLock locker(lock);
- if (expired) {
- throw DtxTimeoutException();
- }
- if (completed) {
- throw CommandInvalidException(QPID_MSG("Branch with xid " << xid << " has been completed!"));
- }
- work.push_back(ops);
-}
-
-bool DtxWorkRecord::check()
-{
- if (expired) {
- throw DtxTimeoutException();
- }
- if (!completed) {
- //iterate through all DtxBuffers and ensure they are all ended
- for (Work::iterator i = work.begin(); i != work.end(); i++) {
- if (!(*i)->isEnded()) {
- throw CommandInvalidException(QPID_MSG("Branch with xid " << xid << " not completed!"));
- } else if ((*i)->isRollbackOnly()) {
- rolledback = true;
- }
- }
- completed = true;
- }
- return !rolledback;
-}
-
-void DtxWorkRecord::abort()
-{
- if (txn.get()) {
- store->abort(*txn);
- txn.reset();
- }
- for_each(work.begin(), work.end(), mem_fn(&TxBuffer::rollback));
-}
-
-void DtxWorkRecord::recover(std::auto_ptr<TPCTransactionContext> _txn, DtxBuffer::shared_ptr ops)
-{
- add(ops);
- txn = _txn;
- ops->markEnded();
- completed = true;
- prepared = true;
-}
-
-void DtxWorkRecord::timedout()
-{
- Mutex::ScopedLock locker(lock);
- expired = true;
- rolledback = true;
- if (!completed) {
- for (Work::iterator i = work.begin(); i != work.end(); i++) {
- if (!(*i)->isEnded()) {
- (*i)->timedout();
- }
- }
- }
- abort();
-}
diff --git a/qpid/cpp/src/qpid/broker/DtxWorkRecord.h b/qpid/cpp/src/qpid/broker/DtxWorkRecord.h
deleted file mode 100644
index cd0e13e991..0000000000
--- a/qpid/cpp/src/qpid/broker/DtxWorkRecord.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _DtxWorkRecord_
-#define _DtxWorkRecord_
-
-#include <algorithm>
-#include <functional>
-#include <vector>
-#include "DtxBuffer.h"
-#include "DtxTimeout.h"
-#include "TransactionalStore.h"
-#include "qpid/framing/amqp_types.h"
-#include "qpid/sys/Mutex.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * Represents the work done under a particular distributed transaction
- * across potentially multiple channels. Identified by a xid. Allows
- * that work to be prepared, committed and rolled-back.
- */
-class DtxWorkRecord
-{
- typedef std::vector<DtxBuffer::shared_ptr> Work;
-
- const std::string xid;
- TransactionalStore* const store;
- bool completed;
- bool rolledback;
- bool prepared;
- bool expired;
- intrusive_ptr<DtxTimeout> timeout;
- Work work;
- std::auto_ptr<TPCTransactionContext> txn;
- qpid::sys::Mutex lock;
-
- bool check();
- void abort();
- bool prepare(TransactionContext* txn);
-public:
- DtxWorkRecord(const std::string& xid, TransactionalStore* const store);
- ~DtxWorkRecord();
- bool prepare();
- bool commit(bool onePhase);
- void rollback();
- void add(DtxBuffer::shared_ptr ops);
- void recover(std::auto_ptr<TPCTransactionContext> txn, DtxBuffer::shared_ptr ops);
- void timedout();
- void setTimeout(intrusive_ptr<DtxTimeout> t) { timeout = t; }
- intrusive_ptr<DtxTimeout> getTimeout() { return timeout; }
-};
-
-}
-}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/Exchange.cpp b/qpid/cpp/src/qpid/broker/Exchange.cpp
deleted file mode 100644
index 83466085bc..0000000000
--- a/qpid/cpp/src/qpid/broker/Exchange.cpp
+++ /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.
- *
- */
-
-#include "Exchange.h"
-#include "ExchangeRegistry.h"
-#include "qpid/management/ManagementAgent.h"
-
-using namespace qpid::broker;
-using qpid::framing::Buffer;
-using qpid::framing::FieldTable;
-using qpid::management::ManagementAgent;
-using qpid::management::ManagementObject;
-using qpid::management::Manageable;
-using qpid::management::Args;
-
-Exchange::Exchange (const string& _name, Manageable* parent) :
- name(_name), durable(false), persistenceId(0)
-{
- if (parent != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
- if (agent.get () != 0)
- {
- mgmtExchange = management::Exchange::shared_ptr
- (new management::Exchange (this, parent, _name));
- agent->addObject (mgmtExchange);
- }
- }
-}
-
-Exchange::Exchange(const string& _name, bool _durable, const qpid::framing::FieldTable& _args,
- Manageable* parent)
- : name(_name), durable(_durable), args(_args), alternateUsers(0), persistenceId(0)
-{
- if (parent != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
- if (agent.get () != 0)
- {
- mgmtExchange = management::Exchange::shared_ptr
- (new management::Exchange (this, parent, _name));
- agent->addObject (mgmtExchange);
- }
- }
-}
-
-Exchange::~Exchange ()
-{
- if (mgmtExchange.get () != 0)
- mgmtExchange->resourceDestroy ();
-}
-
-Exchange::shared_ptr Exchange::decode(ExchangeRegistry& exchanges, Buffer& buffer)
-{
- string name;
- string type;
- FieldTable args;
-
- buffer.getShortString(name);
- bool durable(buffer.getOctet());
- buffer.getShortString(type);
- buffer.get(args);
-
- return exchanges.declare(name, type, durable, args).first;
-}
-
-void Exchange::encode(Buffer& buffer) const
-{
- buffer.putShortString(name);
- buffer.putOctet(durable);
- buffer.putShortString(getType());
- buffer.put(args);
-}
-
-uint32_t Exchange::encodedSize() const
-{
- return name.size() + 1/*short string size*/
- + 1 /*durable*/
- + getType().size() + 1/*short string size*/
- + args.size();
-}
-
-ManagementObject::shared_ptr Exchange::GetManagementObject (void) const
-{
- return dynamic_pointer_cast<ManagementObject> (mgmtExchange);
-}
-
-Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, Exchange* parent)
- : queue(_queue), key(_key)
-{
- if (parent != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
- if (agent.get() != 0)
- {
- ManagementObject::shared_ptr mo = queue->GetManagementObject();
- if (mo.get() != 0)
- {
- uint64_t queueId = mo->getObjectId();
- mgmtBinding = management::Binding::shared_ptr
- (new management::Binding (this, (Manageable*) parent, queueId, key));
- agent->addObject (mgmtBinding);
- }
- }
- }
-}
-
-Exchange::Binding::~Binding ()
-{
- if (mgmtBinding.get () != 0)
- mgmtBinding->resourceDestroy ();
-}
-
-ManagementObject::shared_ptr Exchange::Binding::GetManagementObject () const
-{
- return dynamic_pointer_cast<ManagementObject> (mgmtBinding);
-}
-
-Manageable::status_t Exchange::Binding::ManagementMethod (uint32_t, Args&)
-{
- return Manageable::STATUS_UNKNOWN_METHOD;
-}
diff --git a/qpid/cpp/src/qpid/broker/Exchange.h b/qpid/cpp/src/qpid/broker/Exchange.h
deleted file mode 100644
index e9f5b3965a..0000000000
--- a/qpid/cpp/src/qpid/broker/Exchange.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef _broker_Exchange_h
-#define _broker_Exchange_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/shared_ptr.hpp>
-#include "Deliverable.h"
-#include "Queue.h"
-#include "MessageStore.h"
-#include "PersistableExchange.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/management/Manageable.h"
-#include "qpid/management/Exchange.h"
-#include "qpid/management/Binding.h"
-
-namespace qpid {
- namespace broker {
- using std::string;
- class ExchangeRegistry;
-
- class Exchange : public PersistableExchange, public management::Manageable {
- private:
- const string name;
- const bool durable;
- qpid::framing::FieldTable args;
- boost::shared_ptr<Exchange> alternate;
- uint32_t alternateUsers;
- mutable uint64_t persistenceId;
-
- protected:
- struct Binding : public management::Manageable {
- typedef boost::shared_ptr<Binding> shared_ptr;
- typedef std::vector<Binding::shared_ptr> vector;
-
- Queue::shared_ptr queue;
- const std::string key;
- const qpid::framing::FieldTable args;
- management::Binding::shared_ptr mgmtBinding;
-
- Binding(const std::string& key, const Queue::shared_ptr queue, Exchange* parent = 0);
- ~Binding ();
- management::ManagementObject::shared_ptr GetManagementObject () const;
- management::Manageable::status_t ManagementMethod (uint32_t methodId, management::Args& args);
- };
-
- management::Exchange::shared_ptr mgmtExchange;
-
- public:
- typedef boost::shared_ptr<Exchange> shared_ptr;
-
- explicit Exchange(const string& name, management::Manageable* parent = 0);
- Exchange(const string& _name, bool _durable, const qpid::framing::FieldTable& _args,
- management::Manageable* parent = 0);
- virtual ~Exchange();
-
- const string& getName() const { return name; }
- bool isDurable() { return durable; }
- qpid::framing::FieldTable& getArgs() { return args; }
-
- Exchange::shared_ptr getAlternate() { return alternate; }
- void setAlternate(Exchange::shared_ptr _alternate) { alternate = _alternate; }
- void incAlternateUsers() { alternateUsers++; }
- void decAlternateUsers() { alternateUsers--; }
- bool inUseAsAlternate() { return alternateUsers > 0; }
-
- virtual string getType() const = 0;
- virtual bool bind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args) = 0;
- virtual bool unbind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args) = 0;
- virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args) = 0;
- virtual void route(Deliverable& msg, const string& routingKey, const qpid::framing::FieldTable* args) = 0;
-
- //PersistableExchange:
- void setPersistenceId(uint64_t id) const { persistenceId = id; }
- uint64_t getPersistenceId() const { return persistenceId; }
- uint32_t encodedSize() const;
- void encode(framing::Buffer& buffer) const;
-
- static Exchange::shared_ptr decode(ExchangeRegistry& exchanges, framing::Buffer& buffer);
-
- // Manageable entry points
- management::ManagementObject::shared_ptr GetManagementObject (void) const;
- management::Manageable::status_t
- ManagementMethod (uint32_t, management::Args&) { return management::Manageable::STATUS_UNKNOWN_METHOD; }
- };
- }
-}
-
-
-#endif /*!_broker_Exchange.cpp_h*/
diff --git a/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp b/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp
deleted file mode 100644
index 58d9d5efb8..0000000000
--- a/qpid/cpp/src/qpid/broker/ExchangeRegistry.cpp
+++ /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.
- *
- */
-#include "ExchangeRegistry.h"
-#include "DirectExchange.h"
-#include "FanOutExchange.h"
-#include "HeadersExchange.h"
-#include "TopicExchange.h"
-#include "qpid/management/ManagementExchange.h"
-#include "qpid/framing/reply_exceptions.h"
-
-using namespace qpid::broker;
-using namespace qpid::sys;
-using std::pair;
-using qpid::framing::FieldTable;
-
-pair<Exchange::shared_ptr, bool> ExchangeRegistry::declare(const string& name, const string& type)
- throw(UnknownExchangeTypeException){
-
- return declare(name, type, false, FieldTable());
-}
-
-pair<Exchange::shared_ptr, bool> ExchangeRegistry::declare(const string& name, const string& type,
- bool durable, const FieldTable& args)
- throw(UnknownExchangeTypeException){
- RWlock::ScopedWlock locker(lock);
- ExchangeMap::iterator i = exchanges.find(name);
- if (i == exchanges.end()) {
- Exchange::shared_ptr exchange;
-
- if(type == TopicExchange::typeName){
- exchange = Exchange::shared_ptr(new TopicExchange(name, durable, args, parent));
- }else if(type == DirectExchange::typeName){
- exchange = Exchange::shared_ptr(new DirectExchange(name, durable, args, parent));
- }else if(type == FanOutExchange::typeName){
- exchange = Exchange::shared_ptr(new FanOutExchange(name, durable, args, parent));
- }else if (type == HeadersExchange::typeName) {
- exchange = Exchange::shared_ptr(new HeadersExchange(name, durable, args, parent));
- }else if (type == ManagementExchange::typeName) {
- exchange = Exchange::shared_ptr(new ManagementExchange(name, durable, args, parent));
- }else{
- throw UnknownExchangeTypeException();
- }
- exchanges[name] = exchange;
- return std::pair<Exchange::shared_ptr, bool>(exchange, true);
- } else {
- return std::pair<Exchange::shared_ptr, bool>(i->second, false);
- }
-}
-
-void ExchangeRegistry::destroy(const string& name){
- RWlock::ScopedWlock locker(lock);
- ExchangeMap::iterator i = exchanges.find(name);
- if (i != exchanges.end()) {
- exchanges.erase(i);
- }
-}
-
-Exchange::shared_ptr ExchangeRegistry::get(const string& name){
- RWlock::ScopedRlock locker(lock);
- ExchangeMap::iterator i = exchanges.find(name);
- if (i == exchanges.end())
- throw framing::NotFoundException(QPID_MSG("Exchange not found: " << name));
- return i->second;
-}
-
-namespace
-{
-const std::string empty;
-}
-
-Exchange::shared_ptr ExchangeRegistry::getDefault()
-{
- return get(empty);
-}
diff --git a/qpid/cpp/src/qpid/broker/ExchangeRegistry.h b/qpid/cpp/src/qpid/broker/ExchangeRegistry.h
deleted file mode 100644
index f39bd661fa..0000000000
--- a/qpid/cpp/src/qpid/broker/ExchangeRegistry.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef _broker_ExchangeRegistry_h
-#define _broker_ExchangeRegistry_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <map>
-#include "Exchange.h"
-#include "MessageStore.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid/management/Manageable.h"
-
-namespace qpid {
-namespace broker {
- struct UnknownExchangeTypeException{};
-
- class ExchangeRegistry{
- typedef std::map<std::string, Exchange::shared_ptr> ExchangeMap;
- ExchangeMap exchanges;
- qpid::sys::RWlock lock;
- management::Manageable* parent;
- public:
- ExchangeRegistry () : parent(0) {}
- std::pair<Exchange::shared_ptr, bool> declare(const std::string& name, const std::string& type)
- throw(UnknownExchangeTypeException);
- std::pair<Exchange::shared_ptr, bool> declare(const std::string& name, const std::string& type,
- bool durable, const qpid::framing::FieldTable& args = framing::FieldTable())
- throw(UnknownExchangeTypeException);
- void destroy(const std::string& name);
- Exchange::shared_ptr get(const std::string& name);
- Exchange::shared_ptr getDefault();
-
- /**
- * Register the manageable parent for declared queues
- */
- void setParent (management::Manageable* _parent) { parent = _parent; }
- };
-}
-}
-
-
-#endif /*!_broker_ExchangeRegistry_h*/
diff --git a/qpid/cpp/src/qpid/broker/FanOutExchange.cpp b/qpid/cpp/src/qpid/broker/FanOutExchange.cpp
deleted file mode 100644
index 714d4ea444..0000000000
--- a/qpid/cpp/src/qpid/broker/FanOutExchange.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "FanOutExchange.h"
-#include <algorithm>
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-FanOutExchange::FanOutExchange(const std::string& _name, Manageable* _parent) :
- Exchange(_name, _parent)
-{
- if (mgmtExchange.get() != 0)
- mgmtExchange->set_type (typeName);
-}
-
-FanOutExchange::FanOutExchange(const std::string& _name, bool _durable,
- const FieldTable& _args, Manageable* _parent) :
- Exchange(_name, _durable, _args, _parent)
-{
- if (mgmtExchange.get() != 0)
- mgmtExchange->set_type (typeName);
-}
-
-bool FanOutExchange::bind(Queue::shared_ptr queue, const string& /*routingKey*/, const FieldTable* /*args*/){
- RWlock::ScopedWlock locker(lock);
- std::vector<Binding::shared_ptr>::iterator i;
-
- // Add if not already present.
- for (i = bindings.begin (); i != bindings.end(); i++)
- if ((*i)->queue == queue)
- break;
-
- if (i == bindings.end()) {
- Binding::shared_ptr binding (new Binding ("", queue, this));
- bindings.push_back(binding);
- if (mgmtExchange.get() != 0) {
- mgmtExchange->inc_bindings ();
- }
- return true;
- } else {
- return false;
- }
-}
-
-bool FanOutExchange::unbind(Queue::shared_ptr queue, const string& /*routingKey*/, const FieldTable* /*args*/){
- RWlock::ScopedWlock locker(lock);
- std::vector<Binding::shared_ptr>::iterator i;
-
- for (i = bindings.begin (); i != bindings.end(); i++)
- if ((*i)->queue == queue)
- break;
-
- if (i != bindings.end()) {
- bindings.erase(i);
- if (mgmtExchange.get() != 0) {
- mgmtExchange->dec_bindings ();
- }
- return true;
- } else {
- return false;
- }
-}
-
-void FanOutExchange::route(Deliverable& msg, const string& /*routingKey*/, const FieldTable* /*args*/){
- RWlock::ScopedRlock locker(lock);
- uint32_t count(0);
-
- for(std::vector<Binding::shared_ptr>::iterator i = bindings.begin(); i != bindings.end(); ++i, count++){
- msg.deliverTo((*i)->queue);
- if ((*i)->mgmtBinding.get() != 0)
- (*i)->mgmtBinding->inc_msgMatched ();
- }
-
- if (mgmtExchange.get() != 0)
- {
- mgmtExchange->inc_msgReceives ();
- mgmtExchange->inc_byteReceives (msg.contentSize ());
- if (count == 0)
- {
- mgmtExchange->inc_msgDrops ();
- mgmtExchange->inc_byteDrops (msg.contentSize ());
- }
- else
- {
- mgmtExchange->inc_msgRoutes (count);
- mgmtExchange->inc_byteRoutes (count * msg.contentSize ());
- }
- }
-}
-
-bool FanOutExchange::isBound(Queue::shared_ptr queue, const string* const, const FieldTable* const)
-{
- std::vector<Binding::shared_ptr>::iterator i;
-
- for (i = bindings.begin (); i != bindings.end(); i++)
- if ((*i)->queue == queue)
- break;
-
- return i != bindings.end();
-}
-
-
-FanOutExchange::~FanOutExchange() {}
-
-const std::string FanOutExchange::typeName("fanout");
diff --git a/qpid/cpp/src/qpid/broker/FanOutExchange.h b/qpid/cpp/src/qpid/broker/FanOutExchange.h
deleted file mode 100644
index 4bc92f6b28..0000000000
--- a/qpid/cpp/src/qpid/broker/FanOutExchange.h
+++ /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.
- *
- */
-#ifndef _FanOutExchange_
-#define _FanOutExchange_
-
-#include <map>
-#include <vector>
-#include "Exchange.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/sys/Monitor.h"
-#include "Queue.h"
-
-namespace qpid {
-namespace broker {
-
-class FanOutExchange : public virtual Exchange {
- std::vector<Binding::shared_ptr> bindings;
- qpid::sys::RWlock lock;
-
- public:
- static const std::string typeName;
-
- FanOutExchange(const std::string& name, management::Manageable* parent = 0);
- FanOutExchange(const string& _name, bool _durable,
- const qpid::framing::FieldTable& _args,
- management::Manageable* parent = 0);
-
- virtual std::string getType() const { return typeName; }
-
- virtual bool bind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual bool unbind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual void route(Deliverable& msg, const std::string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args);
-
- virtual ~FanOutExchange();
-};
-
-}
-}
-
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/HandlerImpl.h b/qpid/cpp/src/qpid/broker/HandlerImpl.h
deleted file mode 100644
index 4c51e2a826..0000000000
--- a/qpid/cpp/src/qpid/broker/HandlerImpl.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef _broker_HandlerImpl_h
-#define _broker_HandlerImpl_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "SemanticState.h"
-#include "SessionContext.h"
-#include "ConnectionState.h"
-
-namespace qpid {
-namespace broker {
-
-class Broker;
-
-/**
- * Base template for protocol handler implementations.
- * Provides convenience methods for getting common session objects.
- */
-class HandlerImpl {
- protected:
- SemanticState& state;
- SessionContext& session;
-
- HandlerImpl(SemanticState& s) : state(s), session(s.getSession()) {}
-
- framing::AMQP_ClientProxy& getProxy() { return session.getProxy(); }
- ConnectionState& getConnection() { return session.getConnection(); }
- Broker& getBroker() { return session.getConnection().getBroker(); }
-};
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!_broker_HandlerImpl_h*/
-
-
diff --git a/qpid/cpp/src/qpid/broker/HeadersExchange.cpp b/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
deleted file mode 100644
index c0f6cf19d2..0000000000
--- a/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
+++ /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.
- *
- */
-#include "HeadersExchange.h"
-#include "qpid/framing/FieldValue.h"
-#include "qpid/framing/reply_exceptions.h"
-#include <algorithm>
-
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-// TODO aconway 2006-09-20: More efficient matching algorithm.
-// The current search algorithm really sucks.
-// Fieldtables are heavy, maybe use shared_ptr to do handle-body.
-
-using namespace qpid::broker;
-
-namespace {
- const StringValue all("all");
- const StringValue any("any");
- const std::string x_match("x-match");
-}
-
-HeadersExchange::HeadersExchange(const string& _name, Manageable* _parent) :
- Exchange(_name, _parent)
-{
- if (mgmtExchange.get() != 0)
- mgmtExchange->set_type (typeName);
-}
-
-HeadersExchange::HeadersExchange(const std::string& _name, bool _durable,
- const FieldTable& _args, Manageable* _parent) :
- Exchange(_name, _durable, _args, _parent)
-{
- if (mgmtExchange.get() != 0)
- mgmtExchange->set_type (typeName);
-}
-
-bool HeadersExchange::bind(Queue::shared_ptr queue, const string& /*routingKey*/, const FieldTable* args){
- RWlock::ScopedWlock locker(lock);
- FieldTable::ValuePtr what = args->get(x_match);
- if (!what || (*what != all && *what != any))
- throw InternalErrorException(QPID_MSG("Invalid x-match value binding to headers exchange."));
- Bindings::iterator i;
-
- for (i = bindings.begin(); i != bindings.end(); i++)
- if (i->first == *args && i->second->queue == queue)
- break;
-
- if (i == bindings.end()) {
- Binding::shared_ptr binding (new Binding ("", queue, this));
- HeaderMap headerMap(*args, binding);
-
- bindings.push_back(headerMap);
- if (mgmtExchange.get() != 0) {
- mgmtExchange->inc_bindings ();
- }
- return true;
- } else {
- return false;
- }
-}
-
-bool HeadersExchange::unbind(Queue::shared_ptr queue, const string& /*routingKey*/, const FieldTable* args){
- RWlock::ScopedWlock locker(lock);
- Bindings::iterator i;
- for (i = bindings.begin(); i != bindings.end(); i++)
- if (i->first == *args && i->second->queue == queue)
- break;
-
- if (i != bindings.end()) {
- bindings.erase(i);
- if (mgmtExchange.get() != 0) {
- mgmtExchange->dec_bindings ();
- }
- return true;
- } else {
- return false;
- }
-}
-
-
-void HeadersExchange::route(Deliverable& msg, const string& /*routingKey*/, const FieldTable* args){
- RWlock::ScopedRlock locker(lock);
- uint32_t count(0);
-
- for (Bindings::iterator i = bindings.begin(); i != bindings.end(); ++i, count++) {
- if (match(i->first, *args)) msg.deliverTo(i->second->queue);
- if (i->second->mgmtBinding.get() != 0)
- i->second->mgmtBinding->inc_msgMatched ();
- }
-
- if (mgmtExchange.get() != 0)
- {
- mgmtExchange->inc_msgReceives ();
- mgmtExchange->inc_byteReceives (msg.contentSize ());
- if (count == 0)
- {
- mgmtExchange->inc_msgDrops ();
- mgmtExchange->inc_byteDrops (msg.contentSize ());
- }
- else
- {
- mgmtExchange->inc_msgRoutes (count);
- mgmtExchange->inc_byteRoutes (count * msg.contentSize ());
- }
- }
-}
-
-
-bool HeadersExchange::isBound(Queue::shared_ptr queue, const string* const, const FieldTable* const args)
-{
- for (Bindings::iterator i = bindings.begin(); i != bindings.end(); ++i) {
- if ( (!args || equal(i->first, *args)) && (!queue || i->second->queue == queue)) {
- return true;
- }
- }
- return false;
-}
-
-HeadersExchange::~HeadersExchange() {}
-
-const std::string HeadersExchange::typeName("headers");
-
-namespace
-{
-
- bool match_values(const FieldValue& bind, const FieldValue& msg) {
- return bind.empty() || bind == msg;
- }
-
-}
-
-
-bool HeadersExchange::match(const FieldTable& bind, const FieldTable& msg) {
- typedef FieldTable::ValueMap Map;
- FieldTable::ValuePtr what = bind.get(x_match);
- if (!what) {
- return false;
- } else if (*what == all) {
- for (Map::const_iterator i = bind.begin();
- i != bind.end();
- ++i)
- {
- if (i->first != x_match)
- {
- Map::const_iterator j = msg.find(i->first);
- if (j == msg.end()) return false;
- if (!match_values(*(i->second), *(j->second))) return false;
- }
- }
- return true;
- } else if (*what == any) {
- for (Map::const_iterator i = bind.begin();
- i != bind.end();
- ++i)
- {
- if (i->first != x_match)
- {
- Map::const_iterator j = msg.find(i->first);
- if (j != msg.end()) {
- if (match_values(*(i->second), *(j->second))) return true;
- }
- }
- }
- return false;
- } else {
- return false;
- }
-}
-
-bool HeadersExchange::equal(const FieldTable& a, const FieldTable& b) {
- typedef FieldTable::ValueMap Map;
- for (Map::const_iterator i = a.begin();
- i != a.end();
- ++i)
- {
- Map::const_iterator j = b.find(i->first);
- if (j == b.end()) return false;
- if (!match_values(*(i->second), *(j->second))) return false;
- }
- return true;
-}
-
-
-
diff --git a/qpid/cpp/src/qpid/broker/HeadersExchange.h b/qpid/cpp/src/qpid/broker/HeadersExchange.h
deleted file mode 100644
index 4f654179c5..0000000000
--- a/qpid/cpp/src/qpid/broker/HeadersExchange.h
+++ /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.
- *
- */
-#ifndef _HeadersExchange_
-#define _HeadersExchange_
-
-#include <vector>
-#include "Exchange.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/sys/Monitor.h"
-#include "Queue.h"
-
-namespace qpid {
-namespace broker {
-
-
-class HeadersExchange : public virtual Exchange {
- typedef std::pair<qpid::framing::FieldTable, Binding::shared_ptr> HeaderMap;
- typedef std::vector<HeaderMap> Bindings;
-
- Bindings bindings;
- qpid::sys::RWlock lock;
-
- public:
- static const std::string typeName;
-
- HeadersExchange(const string& name, management::Manageable* parent = 0);
- HeadersExchange(const string& _name, bool _durable,
- const qpid::framing::FieldTable& _args,
- management::Manageable* parent = 0);
-
- virtual std::string getType() const { return typeName; }
-
- virtual bool bind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual bool unbind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual void route(Deliverable& msg, const string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args);
-
- virtual ~HeadersExchange();
-
- static bool match(const qpid::framing::FieldTable& bindArgs, const qpid::framing::FieldTable& msgArgs);
- static bool equal(const qpid::framing::FieldTable& bindArgs, const qpid::framing::FieldTable& msgArgs);
-};
-
-
-
-}
-}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp b/qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp
deleted file mode 100644
index f2c2965ecd..0000000000
--- a/qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp
+++ /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.
- *
- */
-
-#include "IncomingExecutionContext.h"
-#include "qpid/Exception.h"
-
-namespace qpid {
-namespace broker {
-
-using qpid::framing::AccumulatedAck;
-using qpid::framing::SequenceNumber;
-using qpid::framing::SequenceNumberSet;
-
-void IncomingExecutionContext::noop()
-{
- complete(next());
-}
-
-void IncomingExecutionContext::flush()
-{
- for (Messages::iterator i = incomplete.begin(); i != incomplete.end(); ) {
- if ((*i)->isEnqueueComplete()) {
- complete((*i)->getCommandId());
- i = incomplete.erase(i);
- } else {
- i++;
- }
- }
- window.lwm = completed.mark;
-}
-
-void IncomingExecutionContext::sync()
-{
- while (completed.mark < window.hwm) {
- wait();
- }
-}
-
-void IncomingExecutionContext::sync(const SequenceNumber& point)
-{
- while (!isComplete(point)) {
- wait();
- }
-}
-
-/**
- * Every call to next() should be followed be either a call to
- * complete() - in the case of commands, which are always synchronous
- * - or track() - in the case of messages which may be asynchronously
- * stored.
- */
-SequenceNumber IncomingExecutionContext::next()
-{
- return ++window.hwm;
-}
-
-void IncomingExecutionContext::complete(const SequenceNumber& command)
-{
- completed.update(command, command);
-}
-
-void IncomingExecutionContext::track(intrusive_ptr<Message> msg)
-{
- if (msg->isEnqueueComplete()) {
- complete(msg->getCommandId());
- } else {
- incomplete.push_back(msg);
- }
-}
-
-bool IncomingExecutionContext::isComplete(const SequenceNumber& command)
-{
- if (command > window.hwm) {
- throw Exception(QPID_MSG("Bad sync request: point exceeds last command received ["
- << command.getValue() << " > " << window.hwm.getValue() << "]"));
- }
-
- return completed.covers(command);
-}
-
-
-const SequenceNumber& IncomingExecutionContext::getMark()
-{
- return completed.mark;
-}
-
-SequenceNumberSet IncomingExecutionContext::getRange()
-{
- SequenceNumberSet range;
- completed.collectRanges(range);
- return range;
-}
-
-void IncomingExecutionContext::wait()
-{
- check();
- // for IO flush on the store
- for (Messages::iterator i = incomplete.begin(); i != incomplete.end(); i++) {
- (*i)->flush();
- }
- incomplete.front()->waitForEnqueueComplete();
- flush();
-}
-
-/**
- * This is a check of internal state consistency.
- */
-void IncomingExecutionContext::check()
-{
- if (incomplete.empty()) {
- if (window.hwm != completed.mark) {
- //can only happen if there is a call to next() without a
- //corresponding call to completed() or track() - or if
- //there is a logical error in flush() or
- //AccumulatedAck::update()
- throw Exception(QPID_MSG("Completion tracking error: window.hwm="
- << window.hwm.getValue() << ", completed.mark="
- << completed.mark.getValue()));
- }
- }
-}
-
-}}
-
diff --git a/qpid/cpp/src/qpid/broker/IncomingExecutionContext.h b/qpid/cpp/src/qpid/broker/IncomingExecutionContext.h
deleted file mode 100644
index 3056c2b4bc..0000000000
--- a/qpid/cpp/src/qpid/broker/IncomingExecutionContext.h
+++ /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.
- *
- */
-#ifndef _IncomingExecutionContext_
-#define _IncomingExecutionContext_
-
-#include "qpid/framing/AccumulatedAck.h"
-#include "qpid/framing/SequenceNumber.h"
-#include "Message.h"
-
-namespace qpid {
-namespace broker {
-
-class IncomingExecutionContext
-{
- typedef std::list<intrusive_ptr<Message> > Messages;
- framing::Window window;
- framing::AccumulatedAck completed;
- Messages incomplete;
-
- bool isComplete(const framing::SequenceNumber& command);
- void check();
- void wait();
-public:
- void noop();
- void flush();
- void sync();
- void sync(const framing::SequenceNumber& point);
- framing::SequenceNumber next();
- void complete(const framing::SequenceNumber& command);
- void track(intrusive_ptr<Message>);
-
- const framing::SequenceNumber& getMark();
- framing::SequenceNumberSet getRange();
-
-};
-
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/Message.cpp b/qpid/cpp/src/qpid/broker/Message.cpp
deleted file mode 100644
index 1730c01099..0000000000
--- a/qpid/cpp/src/qpid/broker/Message.cpp
+++ /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.
- *
- */
-
-#include "Message.h"
-#include "ExchangeRegistry.h"
-#include "qpid/framing/frame_functors.h"
-#include "qpid/framing/BasicPublishBody.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/MessageTransferBody.h"
-#include "qpid/framing/SendContent.h"
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/framing/TypeFilter.h"
-#include "qpid/log/Statement.h"
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-using std::string;
-
-TransferAdapter Message::TRANSFER;
-
-Message::Message(const SequenceNumber& id) : frames(id), persistenceId(0), redelivered(false), loaded(false), staged(false), publisher(0), adapter(0) {}
-
-Message::~Message()
-{
- if (staged) {
- if (store) {
- store->destroy(*this);
- } else {
- QPID_LOG(error, "Message content was staged but no store is set so it can't be destroyed");
- }
- }
-}
-
-std::string Message::getRoutingKey() const
-{
- return getAdapter().getRoutingKey(frames);
-}
-
-std::string Message::getExchangeName() const
-{
- return getAdapter().getExchange(frames);
-}
-
-const boost::shared_ptr<Exchange> Message::getExchange(ExchangeRegistry& registry) const
-{
- if (!exchange) {
- exchange = registry.get(getExchangeName());
- }
- return exchange;
-}
-
-bool Message::isImmediate() const
-{
- return getAdapter().isImmediate(frames);
-}
-
-const FieldTable* Message::getApplicationHeaders() const
-{
- return getAdapter().getApplicationHeaders(frames);
-}
-
-bool Message::isPersistent()
-{
- return getAdapter().isPersistent(frames);
-}
-
-uint32_t Message::getRequiredCredit() const
-{
- //add up payload for all header and content frames in the frameset
- SumBodySize sum;
- frames.map_if(sum, TypeFilter2<HEADER_BODY, CONTENT_BODY>());
- return sum.getSize();
-}
-
-void Message::encode(framing::Buffer& buffer) const
-{
- //encode method and header frames
- EncodeFrame f1(buffer);
- frames.map_if(f1, TypeFilter2<METHOD_BODY, HEADER_BODY>());
-
- //then encode the payload of each content frame
- EncodeBody f2(buffer);
- frames.map_if(f2, TypeFilter<CONTENT_BODY>());
-}
-
-void Message::encodeContent(framing::Buffer& buffer) const
-{
- //encode the payload of each content frame
- EncodeBody f2(buffer);
- frames.map_if(f2, TypeFilter<CONTENT_BODY>());
-}
-
-uint32_t Message::encodedSize() const
-{
- return encodedHeaderSize() + encodedContentSize();
-}
-
-uint32_t Message::encodedContentSize() const
-{
- return frames.getContentSize();
-}
-
-uint32_t Message::encodedHeaderSize() const
-{
- //add up the size for all method and header frames in the frameset
- SumFrameSize sum;
- frames.map_if(sum, TypeFilter2<METHOD_BODY, HEADER_BODY>());
- return sum.getSize();
-}
-
-void Message::decodeHeader(framing::Buffer& buffer)
-{
- AMQFrame method;
- method.decode(buffer);
- frames.append(method);
-
- AMQFrame header;
- header.decode(buffer);
- frames.append(header);
-}
-
-void Message::decodeContent(framing::Buffer& buffer)
-{
- if (buffer.available()) {
- //get the data as a string and set that as the content
- //body on a frame then add that frame to the frameset
- AMQFrame frame;
- frame.setBody(AMQContentBody());
- frame.castBody<AMQContentBody>()->decode(buffer, buffer.available());
- frames.append(frame);
- } else {
- //adjust header flags
- MarkLastSegment f;
- frames.map_if(f, TypeFilter<HEADER_BODY>());
- }
- //mark content loaded
- loaded = true;
-}
-
-void Message::releaseContent(MessageStore* _store)
-{
- if (!store) {
- store = _store;
- }
- if (store) {
- if (!getPersistenceId()) {
- intrusive_ptr<PersistableMessage> pmsg(this);
- store->stage(pmsg);
- staged = true;
- }
- //remove any content frames from the frameset
- frames.remove(TypeFilter<CONTENT_BODY>());
- setContentReleased();
- }
-}
-
-void Message::sendContent(Queue& queue, framing::FrameHandler& out, uint16_t maxFrameSize) const
-{
- if (isContentReleased()) {
- //load content from store in chunks of maxContentSize
- uint16_t maxContentSize = maxFrameSize - AMQFrame::frameOverhead();
- uint64_t expectedSize(frames.getHeaders()->getContentLength());
- intrusive_ptr<const PersistableMessage> pmsg(this);
- for (uint64_t offset = 0; offset < expectedSize; offset += maxContentSize)
- {
- uint64_t remaining = expectedSize - offset;
- AMQFrame frame(in_place<AMQContentBody>());
- string& data = frame.castBody<AMQContentBody>()->getData();
-
- store->loadContent(queue, pmsg, data, offset,
- remaining > maxContentSize ? maxContentSize : remaining);
- frame.setBof(false);
- frame.setEof(true);
- if (offset > 0) {
- frame.setBos(false);
- }
- if (remaining > maxContentSize) {
- frame.setEos(false);
- }
- out.handle(frame);
- }
-
- } else {
- Count c;
- frames.map_if(c, TypeFilter<CONTENT_BODY>());
-
- SendContent f(out, maxFrameSize, c.getCount());
- frames.map_if(f, TypeFilter<CONTENT_BODY>());
- }
-}
-
-void Message::sendHeader(framing::FrameHandler& out, uint16_t /*maxFrameSize*/) const
-{
- Relay f(out);
- frames.map_if(f, TypeFilter<HEADER_BODY>());
-}
-
-// TODO aconway 2007-11-09: Obsolete, remove. Was used to cover over
-// 0-8/0-9 message differences.
-MessageAdapter& Message::getAdapter() const
-{
- if (!adapter) {
- if(frames.isA<MessageTransferBody>()) {
- adapter = &TRANSFER;
- } else {
- const AMQMethodBody* method = frames.getMethod();
- if (!method) throw Exception("Can't adapt message with no method");
- else throw Exception(QPID_MSG("Can't adapt message based on " << *method));
- }
- }
- return *adapter;
-}
-
-uint64_t Message::contentSize() const
-{
- return frames.getContentSize();
-}
-
-bool Message::isContentLoaded() const
-{
- return loaded;
-}
diff --git a/qpid/cpp/src/qpid/broker/Message.h b/qpid/cpp/src/qpid/broker/Message.h
deleted file mode 100644
index 8a30c5770b..0000000000
--- a/qpid/cpp/src/qpid/broker/Message.h
+++ /dev/null
@@ -1,143 +0,0 @@
-#ifndef _broker_Message_h
-#define _broker_Message_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <string>
-#include <boost/shared_ptr.hpp>
-#include <boost/variant.hpp>
-#include "PersistableMessage.h"
-#include "MessageAdapter.h"
-#include "qpid/framing/amqp_types.h"
-
-namespace qpid {
-
-namespace framing {
-class FieldTable;
-class SequenceNumber;
-}
-
-namespace broker {
-class ConnectionToken;
-class Exchange;
-class ExchangeRegistry;
-class MessageStore;
-class Queue;
-
-class Message : public PersistableMessage {
-public:
- typedef boost::intrusive_ptr<Message> shared_ptr;
-
- Message(const framing::SequenceNumber& id = framing::SequenceNumber());
- ~Message();
-
- uint64_t getPersistenceId() const { return persistenceId; }
- void setPersistenceId(uint64_t _persistenceId) const { persistenceId = _persistenceId; }
-
- bool getRedelivered() const { return redelivered; }
- void redeliver() { redelivered = true; }
-
- const ConnectionToken* getPublisher() const { return publisher; }
- void setPublisher(ConnectionToken* p) { publisher = p; }
-
- const framing::SequenceNumber& getCommandId() { return frames.getId(); }
-
- uint64_t contentSize() const;
-
- std::string getRoutingKey() const;
- const boost::shared_ptr<Exchange> getExchange(ExchangeRegistry&) const;
- std::string getExchangeName() const;
- bool isImmediate() const;
- const framing::FieldTable* getApplicationHeaders() const;
- bool isPersistent();
-
- framing::FrameSet& getFrames() { return frames; }
- const framing::FrameSet& getFrames() const { return frames; }
-
- template <class T> T* getProperties() {
- return frames.getHeaders()->get<T>(true);
- }
-
- template <class T> const T* getProperties() const {
- return frames.getHeaders()->get<T>();
- }
-
- template <class T> const T* getMethod() const {
- return frames.as<T>();
- }
-
- template <class T> bool isA() const {
- return frames.isA<T>();
- }
-
- uint32_t getRequiredCredit() const;
-
- void encode(framing::Buffer& buffer) const;
- void encodeContent(framing::Buffer& buffer) const;
-
- /**
- * @returns the size of the buffer needed to encode this
- * message in its entirety
- */
- uint32_t encodedSize() const;
- /**
- * @returns the size of the buffer needed to encode the
- * 'header' of this message (not just the header frame,
- * but other meta data e.g.routing key and exchange)
- */
- uint32_t encodedHeaderSize() const;
- uint32_t encodedContentSize() const;
-
- void decodeHeader(framing::Buffer& buffer);
- void decodeContent(framing::Buffer& buffer);
-
- /**
- * Releases the in-memory content data held by this
- * message. Must pass in a store from which the data can
- * be reloaded.
- */
- void releaseContent(MessageStore* store);
-
- void sendContent(Queue& queue, framing::FrameHandler& out, uint16_t maxFrameSize) const;
- void sendHeader(framing::FrameHandler& out, uint16_t maxFrameSize) const;
-
- bool isContentLoaded() const;
-
- private:
- framing::FrameSet frames;
- mutable boost::shared_ptr<Exchange> exchange;
- mutable uint64_t persistenceId;
- bool redelivered;
- bool loaded;
- bool staged;
- ConnectionToken* publisher;
- mutable MessageAdapter* adapter;
-
- static TransferAdapter TRANSFER;
-
- MessageAdapter& getAdapter() const;
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/MessageAdapter.cpp b/qpid/cpp/src/qpid/broker/MessageAdapter.cpp
deleted file mode 100644
index 2c29aa5444..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageAdapter.cpp
+++ /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.
- *
- */
-
-#include "MessageAdapter.h"
-
-namespace {
- const std::string empty;
-}
-
-namespace qpid {
-namespace broker{
-
- std::string TransferAdapter::getRoutingKey(const framing::FrameSet& f)
- {
- const framing::DeliveryProperties* p = f.getHeaders()->get<framing::DeliveryProperties>();
- return p ? p->getRoutingKey() : empty;
- }
-
- std::string TransferAdapter::getExchange(const framing::FrameSet& f)
- {
- return f.as<framing::MessageTransferBody>()->getDestination();
- }
-
- bool TransferAdapter::isImmediate(const framing::FrameSet&)
- {
- //TODO: we seem to have lost the immediate flag
- return false;
- }
-
- const framing::FieldTable* TransferAdapter::getApplicationHeaders(const framing::FrameSet& f)
- {
- const framing::MessageProperties* p = f.getHeaders()->get<framing::MessageProperties>();
- return p ? &(p->getApplicationHeaders()) : 0;
- }
-
- bool TransferAdapter::isPersistent(const framing::FrameSet& f)
- {
- const framing::DeliveryProperties* p = f.getHeaders()->get<framing::DeliveryProperties>();
- return p && p->getDeliveryMode() == 2;
- }
-
-}}
diff --git a/qpid/cpp/src/qpid/broker/MessageAdapter.h b/qpid/cpp/src/qpid/broker/MessageAdapter.h
deleted file mode 100644
index 3220f304cc..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageAdapter.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef _broker_MessageAdapter_h
-#define _broker_MessageAdapter_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <string>
-#include "qpid/framing/BasicPublishBody.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/FrameSet.h"
-#include "qpid/framing/DeliveryProperties.h"
-#include "qpid/framing/MessageProperties.h"
-#include "qpid/framing/MessageTransferBody.h"
-
-namespace qpid {
-namespace broker {
-
-// TODO aconway 2007-11-09: No longer needed, we only have one type of message.
-struct MessageAdapter
-{
- virtual ~MessageAdapter() {}
-
- virtual std::string getRoutingKey(const framing::FrameSet& f) = 0;
- virtual std::string getExchange(const framing::FrameSet& f) = 0;
- virtual bool isImmediate(const framing::FrameSet& f) = 0;
- virtual const framing::FieldTable* getApplicationHeaders(const framing::FrameSet& f) = 0;
- virtual bool isPersistent(const framing::FrameSet& f) = 0;
-};
-
-struct TransferAdapter : MessageAdapter
-{
- std::string getRoutingKey(const framing::FrameSet& f);
- std::string getExchange(const framing::FrameSet& f);
- bool isImmediate(const framing::FrameSet&);
- const framing::FieldTable* getApplicationHeaders(const framing::FrameSet& f);
- bool isPersistent(const framing::FrameSet& f);
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/MessageBuilder.cpp b/qpid/cpp/src/qpid/broker/MessageBuilder.cpp
deleted file mode 100644
index 376a321d2d..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageBuilder.cpp
+++ /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.
- *
- */
-#include "MessageBuilder.h"
-
-#include "Message.h"
-#include "MessageStore.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/reply_exceptions.h"
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-MessageBuilder::MessageBuilder(MessageStore* const _store, uint64_t _stagingThreshold) :
- state(DORMANT), store(_store), stagingThreshold(_stagingThreshold), staging(false) {}
-
-void MessageBuilder::handle(AMQFrame& frame)
-{
- switch(state) {
- case METHOD:
- checkType(METHOD_BODY, frame.getBody()->type());
- state = HEADER;
- break;
- case HEADER:
- checkType(HEADER_BODY, frame.getBody()->type());
- state = CONTENT;
- break;
- case CONTENT:
- checkType(CONTENT_BODY, frame.getBody()->type());
- break;
- default:
- throw CommandInvalidException(QPID_MSG("Invalid frame sequence for message (state=" << state << ")"));
- }
- if (staging) {
- intrusive_ptr<const PersistableMessage> cpmsg = boost::static_pointer_cast<const PersistableMessage>(message);
- store->appendContent(cpmsg, frame.castBody<AMQContentBody>()->getData());
- } else {
- message->getFrames().append(frame);
- //have we reached the staging limit? if so stage message and release content
- if (state == CONTENT && stagingThreshold && message->getFrames().getContentSize() >= stagingThreshold) {
- message->releaseContent(store);
- staging = true;
- }
- }
-}
-
-void MessageBuilder::end()
-{
- message = 0;
- state = DORMANT;
- staging = false;
-}
-
-void MessageBuilder::start(const SequenceNumber& id)
-{
- message = intrusive_ptr<Message>(new Message(id));
- state = METHOD;
- staging = false;
-}
-
-namespace {
-
-const std::string HEADER_BODY_S = "HEADER";
-const std::string METHOD_BODY_S = "METHOD";
-const std::string CONTENT_BODY_S = "CONTENT";
-const std::string HEARTBEAT_BODY_S = "HEARTBEAT";
-const std::string UNKNOWN = "unknown";
-
-std::string type_str(uint8_t type)
-{
- switch(type) {
- case METHOD_BODY: return METHOD_BODY_S;
- case HEADER_BODY: return HEADER_BODY_S;
- case CONTENT_BODY: return CONTENT_BODY_S;
- case HEARTBEAT_BODY: return HEARTBEAT_BODY_S;
- }
- return UNKNOWN;
-}
-
-}
-
-void MessageBuilder::checkType(uint8_t expected, uint8_t actual)
-{
- if (expected != actual) {
- throw CommandInvalidException(QPID_MSG("Invalid frame sequence for message (expected "
- << type_str(expected) << " got " << type_str(actual) << ")"));
- }
-}
diff --git a/qpid/cpp/src/qpid/broker/MessageBuilder.h b/qpid/cpp/src/qpid/broker/MessageBuilder.h
deleted file mode 100644
index 5bf6b1939a..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageBuilder.h
+++ /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.
- *
- */
-#ifndef _MessageBuilder_
-#define _MessageBuilder_
-
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/RefCounted.h"
-
-namespace qpid {
- namespace broker {
- class Message;
- class MessageStore;
-
- class MessageBuilder : public framing::FrameHandler{
- public:
- MessageBuilder(MessageStore* const store, uint64_t stagingThreshold);
- void handle(framing::AMQFrame& frame);
- intrusive_ptr<Message> getMessage() { return message; }
- void start(const framing::SequenceNumber& id);
- void end();
- private:
- enum State {DORMANT, METHOD, HEADER, CONTENT};
- State state;
- intrusive_ptr<Message> message;
- MessageStore* const store;
- const uint64_t stagingThreshold;
- bool staging;
-
- void checkType(uint8_t expected, uint8_t actual);
- };
- }
-}
-
-
-#endif
-
diff --git a/qpid/cpp/src/qpid/broker/MessageDelivery.cpp b/qpid/cpp/src/qpid/broker/MessageDelivery.cpp
deleted file mode 100644
index 886008c213..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageDelivery.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "MessageDelivery.h"
-
-#include "DeliveryToken.h"
-#include "Message.h"
-#include "Queue.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/BasicDeliverBody.h"
-#include "qpid/framing/BasicGetOkBody.h"
-#include "qpid/framing/MessageTransferBody.h"
-
-
-using namespace boost;
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-namespace qpid{
-namespace broker{
-
-struct BaseToken : DeliveryToken
-{
- virtual ~BaseToken() {}
- virtual AMQFrame sendMethod(intrusive_ptr<Message> msg, DeliveryId id) = 0;
-};
-
-struct BasicGetToken : BaseToken
-{
- typedef boost::shared_ptr<BasicGetToken> shared_ptr;
-
- Queue::shared_ptr queue;
-
- BasicGetToken(Queue::shared_ptr q) : queue(q) {}
-
- AMQFrame sendMethod(intrusive_ptr<Message> msg, DeliveryId id)
- {
- return AMQFrame(in_place<BasicGetOkBody>(
- ProtocolVersion(), id.getValue(),
- msg->getRedelivered(), msg->getExchangeName(),
- msg->getRoutingKey(), queue->getMessageCount()));
- }
-};
-
-struct BasicConsumeToken : BaseToken
-{
- typedef boost::shared_ptr<BasicConsumeToken> shared_ptr;
-
- const string consumer;
-
- BasicConsumeToken(const string c) : consumer(c) {}
-
- AMQFrame sendMethod(intrusive_ptr<Message> msg, DeliveryId id)
- {
- return AMQFrame(in_place<BasicDeliverBody>(
- ProtocolVersion(), consumer, id.getValue(),
- msg->getRedelivered(), msg->getExchangeName(),
- msg->getRoutingKey()));
- }
-
-};
-
-struct MessageDeliveryToken : BaseToken
-{
- const std::string destination;
- const u_int8_t confirmMode;
- const u_int8_t acquireMode;
-
- MessageDeliveryToken(const std::string& d, u_int8_t c, u_int8_t a) :
- destination(d), confirmMode(c), acquireMode(a) {}
-
- AMQFrame sendMethod(intrusive_ptr<Message> msg, DeliveryId /*id*/)
- {
- //may need to set the redelivered flag:
- if (msg->getRedelivered()){
- msg->getProperties<DeliveryProperties>()->setRedelivered(true);
- }
- return AMQFrame(in_place<MessageTransferBody>(
- ProtocolVersion(), 0, destination,
- confirmMode, acquireMode));
- }
-};
-
-}
-}
-
-DeliveryToken::shared_ptr MessageDelivery::getBasicGetToken(Queue::shared_ptr queue)
-{
- return DeliveryToken::shared_ptr(new BasicGetToken(queue));
-}
-
-DeliveryToken::shared_ptr MessageDelivery::getBasicConsumeToken(const string& consumer)
-{
- return DeliveryToken::shared_ptr(new BasicConsumeToken(consumer));
-}
-
-DeliveryToken::shared_ptr MessageDelivery::getMessageDeliveryToken(const std::string& destination,
- u_int8_t confirmMode, u_int8_t acquireMode)
-{
- return DeliveryToken::shared_ptr(new MessageDeliveryToken(destination, confirmMode, acquireMode));
-}
-
-void MessageDelivery::deliver(QueuedMessage& msg,
- framing::FrameHandler& handler,
- DeliveryId id,
- DeliveryToken::shared_ptr token,
- uint16_t framesize)
-{
- //currently a message published from one class and delivered to
- //another may well have the wrong headers; however we will only
- //have one content class for 0-10 proper
-
- boost::shared_ptr<BaseToken> t = dynamic_pointer_cast<BaseToken>(token);
- AMQFrame method = t->sendMethod(msg.payload, id);
- method.setEof(false);
- handler.handle(method);
- msg.payload->sendHeader(handler, framesize);
- msg.payload->sendContent(*(msg.queue), handler, framesize);
-}
diff --git a/qpid/cpp/src/qpid/broker/MessageDelivery.h b/qpid/cpp/src/qpid/broker/MessageDelivery.h
deleted file mode 100644
index ac7818feed..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageDelivery.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _broker_MessageDelivery_h
-#define _broker_MessageDelivery_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <boost/shared_ptr.hpp>
-#include "DeliveryId.h"
-#include "Consumer.h"
-#include "qpid/framing/FrameHandler.h"
-
-namespace qpid {
-namespace broker {
-
-class DeliveryToken;
-class Message;
-class Queue;
-
-/**
- * Encapsulates the different options for message delivery currently supported.
- */
-class MessageDelivery {
-public:
- static boost::shared_ptr<DeliveryToken> getBasicGetToken(boost::shared_ptr<Queue> queue);
- static boost::shared_ptr<DeliveryToken> getBasicConsumeToken(const std::string& consumer);
- static boost::shared_ptr<DeliveryToken> getMessageDeliveryToken(const std::string& destination,
- u_int8_t confirmMode,
- u_int8_t acquireMode);
-
- static void deliver(QueuedMessage& msg, framing::FrameHandler& out,
- DeliveryId deliveryTag, boost::shared_ptr<DeliveryToken> token, uint16_t framesize);
-};
-
-}
-}
-
-
-#endif /*!_broker_MessageDelivery_h*/
diff --git a/qpid/cpp/src/qpid/broker/MessageHandlerImpl.cpp b/qpid/cpp/src/qpid/broker/MessageHandlerImpl.cpp
deleted file mode 100644
index 69cccf0ff0..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageHandlerImpl.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include "qpid/log/Statement.h"
-#include "MessageHandlerImpl.h"
-#include "qpid/framing/FramingContent.h"
-#include "Connection.h"
-#include "Broker.h"
-#include "MessageDelivery.h"
-#include "qpid/framing/MessageAppendBody.h"
-#include "qpid/framing/MessageTransferBody.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "BrokerAdapter.h"
-
-#include <boost/format.hpp>
-#include <boost/cast.hpp>
-#include <boost/bind.hpp>
-
-namespace qpid {
-namespace broker {
-
-using namespace framing;
-
-MessageHandlerImpl::MessageHandlerImpl(SemanticState& s) :
- HandlerImpl(s),
- releaseOp(boost::bind(&SemanticState::release, &state, _1, _2)),
- rejectOp(boost::bind(&SemanticState::reject, &state, _1, _2))
- {}
-
-//
-// Message class method handlers
-//
-
-void
-MessageHandlerImpl::cancel(const string& destination )
-{
- state.cancel(destination);
-}
-
-void
-MessageHandlerImpl::open(const string& /*reference*/)
-{
- throw NotImplementedException("References no longer supported");
-}
-
-void
-MessageHandlerImpl::append(const std::string& /*reference*/, const std::string& /*bytes*/)
-{
- throw NotImplementedException("References no longer supported");
-}
-
-void
-MessageHandlerImpl::close(const string& /*reference*/)
-{
- throw NotImplementedException("References no longer supported");
-}
-
-void
-MessageHandlerImpl::checkpoint(const string& /*reference*/,
- const string& /*identifier*/ )
-{
- throw NotImplementedException("References no longer supported");
-}
-
-void
-MessageHandlerImpl::resume(const string& /*reference*/,
- const string& /*identifier*/ )
-{
- throw NotImplementedException("References no longer supported");
-}
-
-void
-MessageHandlerImpl::offset(uint64_t /*value*/ )
-{
- throw NotImplementedException("References no longer supported");
-}
-
-void
-MessageHandlerImpl::get(uint16_t /*ticket*/,
- const string& /*queueName*/,
- const string& /*destination*/,
- bool /*noAck*/ )
-{
- throw NotImplementedException("get no longer supported");
-}
-
-void
-MessageHandlerImpl::empty()
-{
- throw NotImplementedException("empty no longer supported");
-}
-
-void
-MessageHandlerImpl::ok()
-{
- throw NotImplementedException("Message.Ok no longer supported");
-}
-
-void
-MessageHandlerImpl::qos(uint32_t prefetchSize,
- uint16_t prefetchCount,
- bool /*global*/ )
-{
- //TODO: handle global
- state.setPrefetchSize(prefetchSize);
- state.setPrefetchCount(prefetchCount);
-}
-
-void
-MessageHandlerImpl::subscribe(uint16_t /*ticket*/,
- const string& queueName,
- const string& destination,
- bool noLocal,
- u_int8_t confirmMode,
- u_int8_t acquireMode,
- bool exclusive,
- const framing::FieldTable& filter )
-{
- Queue::shared_ptr queue = state.getQueue(queueName);
- if(!destination.empty() && state.exists(destination))
- throw NotAllowedException(QPID_MSG("Consumer tags must be unique"));
-
- string tag = destination;
- state.consume(MessageDelivery::getMessageDeliveryToken(destination, confirmMode, acquireMode),
- tag, queue, noLocal, confirmMode == 1, acquireMode == 0, exclusive, &filter);
-}
-
-void
-MessageHandlerImpl::recover(bool requeue)
-{
- state.recover(requeue);
-}
-
-void
-MessageHandlerImpl::reject(const SequenceNumberSet& transfers, uint16_t /*code*/, const string& /*text*/ )
-{
- transfers.processRanges(rejectOp);
-}
-
-void MessageHandlerImpl::flow(const std::string& destination, u_int8_t unit, u_int32_t value)
-{
- if (unit == 0) {
- //message
- state.addMessageCredit(destination, value);
- } else if (unit == 1) {
- //bytes
- state.addByteCredit(destination, value);
- } else {
- //unknown
- throw SyntaxErrorException(QPID_MSG("Invalid value for unit " << unit));
- }
-
-}
-
-void MessageHandlerImpl::flowMode(const std::string& destination, u_int8_t mode)
-{
- if (mode == 0) {
- //credit
- state.setCreditMode(destination);
- } else if (mode == 1) {
- //window
- state.setWindowMode(destination);
- } else{
- throw SyntaxErrorException(QPID_MSG("Invalid value for mode " << mode));
- }
-}
-
-void MessageHandlerImpl::flush(const std::string& destination)
-{
- state.flush(destination);
-}
-
-void MessageHandlerImpl::stop(const std::string& destination)
-{
- state.stop(destination);
-}
-
-void MessageHandlerImpl::acquire(const SequenceNumberSet& transfers, u_int8_t /*mode*/)
-{
- //TODO: implement mode
-
- SequenceNumberSet results;
- RangedOperation op = boost::bind(&SemanticState::acquire, &state, _1, _2, boost::ref(results));
- transfers.processRanges(op);
- results = results.condense();
- getProxy().getMessage().acquired(results);
-}
-
-void MessageHandlerImpl::release(const SequenceNumberSet& transfers)
-{
- transfers.processRanges(releaseOp);
-}
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/MessageHandlerImpl.h b/qpid/cpp/src/qpid/broker/MessageHandlerImpl.h
deleted file mode 100644
index dd70f35dbb..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageHandlerImpl.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef _broker_MessageHandlerImpl_h
-#define _broker_MessageHandlerImpl_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <memory>
-
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "HandlerImpl.h"
-
-#include <boost/function.hpp>
-
-namespace qpid {
-namespace broker {
-
-class Connection;
-class Broker;
-class MessageMessage;
-
-class MessageHandlerImpl :
- public framing::AMQP_ServerOperations::MessageHandler,
- public HandlerImpl
-{
- typedef boost::function<void(DeliveryId, DeliveryId)> RangedOperation;
- RangedOperation releaseOp;
- RangedOperation rejectOp;
-
- public:
- MessageHandlerImpl(SemanticState&);
-
- void append(const std::string& reference, const std::string& bytes);
-
- void cancel(const std::string& destination );
-
- void checkpoint(const std::string& reference,
- const std::string& identifier );
-
- void close(const std::string& reference );
-
- void empty();
-
- void get(uint16_t ticket,
- const std::string& queue,
- const std::string& destination,
- bool noAck );
-
- void offset(uint64_t value);
-
- void ok();
-
- void open(const std::string& reference );
-
- void qos(uint32_t prefetchSize,
- uint16_t prefetchCount,
- bool global );
-
- void recover(bool requeue );
-
- void reject(const framing::SequenceNumberSet& transfers,
- uint16_t code,
- const std::string& text );
-
- void resume(const std::string& reference,
- const std::string& identifier );
-
- void flow(const std::string& destination, u_int8_t unit, u_int32_t value);
-
- void flowMode(const std::string& destination, u_int8_t mode);
-
- void flush(const std::string& destination);
-
- void stop(const std::string& destination);
-
- void acquire(const framing::SequenceNumberSet& transfers, u_int8_t mode);
-
- void release(const framing::SequenceNumberSet& transfers);
-
- void subscribe(u_int16_t ticket,
- const std::string& queue,
- const std::string& destination,
- bool noLocal,
- u_int8_t confirmMode,
- u_int8_t acquireMode,
- bool exclusive,
- const framing::FieldTable& filter);
-
-};
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!_broker_MessageHandlerImpl_h*/
diff --git a/qpid/cpp/src/qpid/broker/MessageStore.h b/qpid/cpp/src/qpid/broker/MessageStore.h
deleted file mode 100644
index eaf9f1688f..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageStore.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _MessageStore_
-#define _MessageStore_
-
-#include <boost/shared_ptr.hpp>
-#include <qpid/Options.h>
-#include "PersistableExchange.h"
-#include "PersistableMessage.h"
-#include "PersistableQueue.h"
-#include "RecoveryManager.h"
-#include "TransactionalStore.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * An abstraction of the persistent storage for messages. (In
- * all methods, any pointers/references to queues or messages
- * are valid only for the duration of the call).
- */
-class MessageStore : public TransactionalStore, public Recoverable {
-public:
-
- /**
- * init the store, call before any other call. If not called, store
- * is free to pick any defaults
- *
- * @param dir the directory to create logs/db's
- * @param async true, enable async, false, enable sync
- * @param force true, delete data on mode change, false, error on mode change
- */
- virtual bool init(const Options* options) = 0;
-
- /**
- * Record the existence of a durable queue
- */
- virtual void create(PersistableQueue& queue) = 0;
- /**
- * Destroy a durable queue
- */
- virtual void destroy(PersistableQueue& queue) = 0;
-
- /**
- * Record the existence of a durable exchange
- */
- virtual void create(const PersistableExchange& exchange) = 0;
- /**
- * Destroy a durable exchange
- */
- virtual void destroy(const PersistableExchange& exchange) = 0;
-
- /**
- * Record a binding
- */
- virtual void bind(const PersistableExchange& exchange, const PersistableQueue& queue,
- const std::string& key, const framing::FieldTable& args) = 0;
-
- /**
- * Forget a binding
- */
- virtual void unbind(const PersistableExchange& exchange, const PersistableQueue& queue,
- const std::string& key, const framing::FieldTable& args) = 0;
-
- /**
- * Stores a messages before it has been enqueued
- * (enqueueing automatically stores the message so this is
- * only required if storage is required prior to that
- * point). If the message has not yet been stored it will
- * store the headers as well as any content passed in. A
- * persistence id will be set on the message which can be
- * used to load the content or to append to it.
- *
- * TODO ::If it is know
- * which queue the message is to be staged/ release to in cases
- * of flowing tmp messages to disk for memory conservation set
- * the queue ptr. This allows the store to optimize the read/writes
- * for that queue and avoid searching based on id. Set queue = 0 for
- * large message staging when the queue is not known.
- */
- virtual void stage(intrusive_ptr<PersistableMessage>& msg) = 0;
-
- /**
- * Destroys a previously staged message. This only needs
- * to be called if the message is never enqueued. (Once
- * enqueued, deletion will be automatic when the message
- * is dequeued from all queues it was enqueued onto).
- */
- virtual void destroy(PersistableMessage& msg) = 0;
-
- /**
- * Appends content to a previously staged message
- */
- virtual void appendContent(intrusive_ptr<const PersistableMessage>& msg,
- const std::string& data) = 0;
-
- /**
- * Loads (a section) of content data for the specified
- * message (previously stored through a call to stage or
- * enqueue) into data. The offset refers to the content
- * only (i.e. an offset of 0 implies that the start of the
- * content should be loaded, not the headers or related
- * meta-data).
- */
- virtual void loadContent(const qpid::broker::PersistableQueue& queue,
- intrusive_ptr<const PersistableMessage>& msg,
- std::string& data, uint64_t offset, uint32_t length) = 0;
-
- /**
- * Enqueues a message, storing the message if it has not
- * been previously stored and recording that the given
- * message is on the given queue.
- *
- * Note: that this is async so the return of the function does
- * not mean the opperation is complete.
- *
- * @param msg the message to enqueue
- * @param queue the name of the queue onto which it is to be enqueued
- * @param xid (a pointer to) an identifier of the
- * distributed transaction in which the operation takes
- * place or null for 'local' transactions
- */
- virtual void enqueue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
- const PersistableQueue& queue) = 0;
-
- /**
- * Dequeues a message, recording that the given message is
- * no longer on the given queue and deleting the message
- * if it is no longer on any other queue.
- *
- * Note: that this is async so the return of the function does
- * not mean the opperation is complete.
- *
- * @param msg the message to dequeue
- * @param queue the name of the queue from which it is to be dequeued
- * @param xid (a pointer to) an identifier of the
- * distributed transaction in which the operation takes
- * place or null for 'local' transactions
- */
- virtual void dequeue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
- const PersistableQueue& queue) = 0;
-
- /**
- * Flushes all async messages to disk for the specified queue
- *
- * Note: that this is async so the return of the function does
- * not mean the opperation is complete.
- *
- * @param queue the name of the queue from which it is to be dequeued
- */
- virtual void flush(const qpid::broker::PersistableQueue& queue)=0;
-
- /**
- * Returns the number of outstanding AIO's for a given queue
- *
- * If 0, than all the enqueue / dequeues have been stored
- * to disk
- *
- * @param queue the name of the queue to check for outstanding AIO
- */
- virtual u_int32_t outstandingQueueAIO(const PersistableQueue& queue) = 0;
-
-
- virtual ~MessageStore(){}
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp b/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
deleted file mode 100644
index 094983e3fb..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
+++ /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.
- *
- */
-
-#include "MessageStoreModule.h"
-#include <iostream>
-
-// This transfer protects against the unloading of the store lib prior to the handling of the exception
-#define TRANSFER_EXCEPTION(fn) try { fn; } catch (std::exception& e) { throw Exception(e.what()); }
-
-using namespace qpid::broker;
-
-MessageStoreModule::MessageStoreModule(MessageStore* _store) : store(_store) {}
-
-MessageStoreModule::~MessageStoreModule()
-{
- delete store;
-}
-
-bool MessageStoreModule::init(const Options*) { return true; }
-
-void MessageStoreModule::create(PersistableQueue& queue)
-{
- TRANSFER_EXCEPTION(store->create(queue));
-}
-
-void MessageStoreModule::destroy(PersistableQueue& queue)
-{
- TRANSFER_EXCEPTION(store->destroy(queue));
-}
-
-void MessageStoreModule::create(const PersistableExchange& exchange)
-{
- TRANSFER_EXCEPTION(store->create(exchange));
-}
-
-void MessageStoreModule::destroy(const PersistableExchange& exchange)
-{
- TRANSFER_EXCEPTION(store->destroy(exchange));
-}
-
-void MessageStoreModule::bind(const PersistableExchange& e, const PersistableQueue& q,
- const std::string& k, const framing::FieldTable& a)
-{
- TRANSFER_EXCEPTION(store->bind(e, q, k, a));
-}
-
-void MessageStoreModule::unbind(const PersistableExchange& e, const PersistableQueue& q,
- const std::string& k, const framing::FieldTable& a)
-{
- TRANSFER_EXCEPTION(store->unbind(e, q, k, a));
-}
-
-void MessageStoreModule::recover(RecoveryManager& registry)
-{
- TRANSFER_EXCEPTION(store->recover(registry));
-}
-
-void MessageStoreModule::stage( intrusive_ptr<PersistableMessage>& msg)
-{
- TRANSFER_EXCEPTION(store->stage(msg));
-}
-
-void MessageStoreModule::destroy(PersistableMessage& msg)
-{
- TRANSFER_EXCEPTION(store->destroy(msg));
-}
-
-void MessageStoreModule::appendContent(intrusive_ptr<const PersistableMessage>& msg, const std::string& data)
-{
- TRANSFER_EXCEPTION(store->appendContent(msg, data));
-}
-
-void MessageStoreModule::loadContent(const qpid::broker::PersistableQueue& queue,
- intrusive_ptr<const PersistableMessage>& msg, string& data, uint64_t offset, uint32_t length)
-{
- TRANSFER_EXCEPTION(store->loadContent(queue, msg, data, offset, length));
-}
-
-void MessageStoreModule::enqueue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg, const PersistableQueue& queue)
-{
- TRANSFER_EXCEPTION(store->enqueue(ctxt, msg, queue));
-}
-
-void MessageStoreModule::dequeue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg, const PersistableQueue& queue)
-{
- TRANSFER_EXCEPTION(store->dequeue(ctxt, msg, queue));
-}
-
-void MessageStoreModule::flush(const qpid::broker::PersistableQueue& queue)
-{
- TRANSFER_EXCEPTION(store->flush(queue));
-}
-
-u_int32_t MessageStoreModule::outstandingQueueAIO(const PersistableQueue& queue)
-{
- TRANSFER_EXCEPTION(return store->outstandingQueueAIO(queue));
-}
-
-std::auto_ptr<TransactionContext> MessageStoreModule::begin()
-{
- TRANSFER_EXCEPTION(return store->begin());
-}
-
-std::auto_ptr<TPCTransactionContext> MessageStoreModule::begin(const std::string& xid)
-{
- TRANSFER_EXCEPTION(return store->begin(xid));
-}
-
-void MessageStoreModule::prepare(TPCTransactionContext& txn)
-{
- TRANSFER_EXCEPTION(store->prepare(txn));
-}
-
-void MessageStoreModule::commit(TransactionContext& ctxt)
-{
- TRANSFER_EXCEPTION(store->commit(ctxt));
-}
-
-void MessageStoreModule::abort(TransactionContext& ctxt)
-{
- TRANSFER_EXCEPTION(store->abort(ctxt));
-}
-
-void MessageStoreModule::collectPreparedXids(std::set<std::string>& xids)
-{
- TRANSFER_EXCEPTION(store->collectPreparedXids(xids));
-}
diff --git a/qpid/cpp/src/qpid/broker/MessageStoreModule.h b/qpid/cpp/src/qpid/broker/MessageStoreModule.h
deleted file mode 100644
index 160d681fab..0000000000
--- a/qpid/cpp/src/qpid/broker/MessageStoreModule.h
+++ /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.
- *
- */
-#ifndef _MessageStoreModule_
-#define _MessageStoreModule_
-
-#include "MessageStore.h"
-#include "Queue.h"
-#include "RecoveryManager.h"
-#include "qpid/sys/Module.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * A null implementation of the MessageStore interface
- */
-class MessageStoreModule : public MessageStore
-{
- MessageStore* store;
-public:
- MessageStoreModule(MessageStore* store);
-
- bool init(const Options* options);
- std::auto_ptr<TransactionContext> begin();
- std::auto_ptr<TPCTransactionContext> begin(const std::string& xid);
- void prepare(TPCTransactionContext& txn);
- void commit(TransactionContext& txn);
- void abort(TransactionContext& txn);
- void collectPreparedXids(std::set<std::string>& xids);
-
- void create(PersistableQueue& queue);
- void destroy(PersistableQueue& queue);
- void create(const PersistableExchange& exchange);
- void destroy(const PersistableExchange& exchange);
- void bind(const PersistableExchange& exchange, const PersistableQueue& queue,
- const std::string& key, const framing::FieldTable& args);
- void unbind(const PersistableExchange& exchange, const PersistableQueue& queue,
- const std::string& key, const framing::FieldTable& args);
- void recover(RecoveryManager& queues);
- void stage(intrusive_ptr<PersistableMessage>& msg);
- void destroy(PersistableMessage& msg);
- void appendContent(intrusive_ptr<const PersistableMessage>& msg, const std::string& data);
- void loadContent(const qpid::broker::PersistableQueue& queue,
- intrusive_ptr<const PersistableMessage>& msg, std::string& data,
- uint64_t offset, uint32_t length);
-
- void enqueue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
- const PersistableQueue& queue);
- void dequeue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
- const PersistableQueue& queue);
- u_int32_t outstandingQueueAIO(const PersistableQueue& queue);
- void flush(const qpid::broker::PersistableQueue& queue);
-
- ~MessageStoreModule();
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/MultiVersionConnectionInputHandler.cpp b/qpid/cpp/src/qpid/broker/MultiVersionConnectionInputHandler.cpp
deleted file mode 100644
index 676f9e4b3d..0000000000
--- a/qpid/cpp/src/qpid/broker/MultiVersionConnectionInputHandler.cpp
+++ /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.
- *
- */
-#include "MultiVersionConnectionInputHandler.h"
-#include "Connection.h"
-#include "PreviewConnection.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace broker {
-
-MultiVersionConnectionInputHandler::MultiVersionConnectionInputHandler(
- qpid::sys::ConnectionOutputHandler* _out,
- Broker& _broker,
- const std::string& _id) : linkVersion(99,0), out(_out), broker(_broker), id(_id) {}
-
-
-void MultiVersionConnectionInputHandler::initiated(const qpid::framing::ProtocolInitiation& i)
-{
- if (i.getMajor() == 99 && i.getMinor() == 0) {
- handler = std::auto_ptr<ConnectionInputHandler>(new PreviewConnection(out, broker, id));
- } else if (i.getMajor() == 0 && i.getMinor() == 10) {
- handler = std::auto_ptr<ConnectionInputHandler>(new Connection(out, broker, id));
- } else {
- throw qpid::framing::InternalErrorException("Unsupported version: " + i.getVersion().toString());
- }
- handler->initiated(i);
-}
-
-void MultiVersionConnectionInputHandler::received(qpid::framing::AMQFrame& f)
-{
- check();
- handler->received(f);
-}
-
-void MultiVersionConnectionInputHandler::idleOut()
-{
- check();
- handler->idleOut();
-}
-
-void MultiVersionConnectionInputHandler::idleIn()
-{
- check();
- handler->idleIn();
-}
-
-bool MultiVersionConnectionInputHandler::doOutput()
-{
- return check(false) && handler->doOutput();
-}
-
-qpid::framing::ProtocolInitiation MultiVersionConnectionInputHandler::getInitiation()
-{
- return qpid::framing::ProtocolInitiation(linkVersion);
-}
-
-void MultiVersionConnectionInputHandler::closed()
-{
- check();
- handler->closed();
-}
-
-bool MultiVersionConnectionInputHandler::check(bool fail)
-{
- if (!handler.get()) {
- if (fail) throw qpid::framing::InternalErrorException("Handler not initialised!");
- else return false;
- } else {
- return true;
- }
-}
-
-}
-}
diff --git a/qpid/cpp/src/qpid/broker/MultiVersionConnectionInputHandler.h b/qpid/cpp/src/qpid/broker/MultiVersionConnectionInputHandler.h
deleted file mode 100644
index 4301eba57c..0000000000
--- a/qpid/cpp/src/qpid/broker/MultiVersionConnectionInputHandler.h
+++ /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.
- *
- */
-#ifndef _MultiVersionConnectionInputHandler_
-#define _MultiVersionConnectionInputHandler_
-
-#include <memory>
-#include <string>
-#include "qpid/sys/ConnectionInputHandler.h"
-#include "qpid/sys/ConnectionOutputHandler.h"
-#include "qpid/broker/Broker.h"
-
-namespace qpid {
-namespace broker {
-
-class MultiVersionConnectionInputHandler : public qpid::sys::ConnectionInputHandler
-{
- qpid::framing::ProtocolVersion linkVersion;//version used for inter-broker links
- std::auto_ptr<qpid::sys::ConnectionInputHandler> handler;
- qpid::sys::ConnectionOutputHandler* out;
- Broker& broker;
- const std::string id;
-
- bool check(bool fail = true);
-
-public:
- MultiVersionConnectionInputHandler(qpid::sys::ConnectionOutputHandler* out, Broker& broker, const std::string& id);
- virtual ~MultiVersionConnectionInputHandler() {}
-
- void initiated(const qpid::framing::ProtocolInitiation&);
- void received(qpid::framing::AMQFrame&);
- void idleOut();
- void idleIn();
- bool doOutput();
- qpid::framing::ProtocolInitiation getInitiation();
- void closed();
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/NameGenerator.cpp b/qpid/cpp/src/qpid/broker/NameGenerator.cpp
deleted file mode 100644
index 8484f921e9..0000000000
--- a/qpid/cpp/src/qpid/broker/NameGenerator.cpp
+++ /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.
- *
- */
-#include "NameGenerator.h"
-#include <sstream>
-
-using namespace qpid::broker;
-
-NameGenerator::NameGenerator(const std::string& _base) : base(_base), counter(1) {}
-
-std::string NameGenerator::generate(){
- std::stringstream ss;
- ss << base << counter++;
- return ss.str();
-}
diff --git a/qpid/cpp/src/qpid/broker/NameGenerator.h b/qpid/cpp/src/qpid/broker/NameGenerator.h
deleted file mode 100644
index 6ea25c9797..0000000000
--- a/qpid/cpp/src/qpid/broker/NameGenerator.h
+++ /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.
- *
- */
-#ifndef _NameGenerator_
-#define _NameGenerator_
-
-#include <string>
-
-namespace qpid {
- namespace broker {
- class NameGenerator{
- const std::string base;
- unsigned int counter;
- public:
- NameGenerator(const std::string& base);
- std::string generate();
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/NullMessageStore.cpp b/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
deleted file mode 100644
index 5dbd3379fa..0000000000
--- a/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
+++ /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.
- *
- */
-
-#include "NullMessageStore.h"
-#include "RecoveryManager.h"
-#include "qpid/log/Statement.h"
-
-#include <iostream>
-
-namespace qpid{
-namespace broker{
-
-const std::string nullxid = "";
-
-class DummyCtxt : public TPCTransactionContext
-{
- const std::string xid;
-public:
- DummyCtxt(const std::string& _xid) : xid(_xid) {}
- static std::string getXid(TransactionContext& ctxt)
- {
- DummyCtxt* c(dynamic_cast<DummyCtxt*>(&ctxt));
- return c ? c->xid : nullxid;
- }
-};
-
-}
-}
-
-using namespace qpid::broker;
-
-NullMessageStore::NullMessageStore(bool _warn) : warn(_warn){}
-
-bool NullMessageStore::init(const Options* /*options*/) {return true;}
-
-void NullMessageStore::create(PersistableQueue& queue)
-{
- QPID_LOG(info, "Queue '" << queue.getName()
- << "' will not be durable. Persistence not enabled.");
-}
-
-void NullMessageStore::destroy(PersistableQueue&)
-{
-}
-
-void NullMessageStore::create(const PersistableExchange& exchange)
-{
- QPID_LOG(info, "Exchange'" << exchange.getName()
- << "' will not be durable. Persistence not enabled.");
-}
-
-void NullMessageStore::destroy(const PersistableExchange& )
-{}
-
-void NullMessageStore::bind(const PersistableExchange&, const PersistableQueue&, const std::string&, const framing::FieldTable&){}
-
-void NullMessageStore::unbind(const PersistableExchange&, const PersistableQueue&, const std::string&, const framing::FieldTable&){}
-
-void NullMessageStore::recover(RecoveryManager&)
-{
- QPID_LOG(info, "Persistence not enabled, no recovery attempted.");
-}
-
-void NullMessageStore::stage(intrusive_ptr<PersistableMessage>&)
-{
- QPID_LOG(info, "Can't stage message. Persistence not enabled.");
-}
-
-void NullMessageStore::destroy(PersistableMessage&)
-{
-}
-
-void NullMessageStore::appendContent(intrusive_ptr<const PersistableMessage>&, const string&)
-{
- QPID_LOG(info, "Can't append content. Persistence not enabled.");
-}
-
-void NullMessageStore::loadContent(const qpid::broker::PersistableQueue&, intrusive_ptr<const PersistableMessage>&, string&, uint64_t, uint32_t)
-{
- QPID_LOG(info, "Can't load content. Persistence not enabled.");
-}
-
-void NullMessageStore::enqueue(TransactionContext*, intrusive_ptr<PersistableMessage>& msg, const PersistableQueue& queue)
-{
- msg->enqueueComplete();
- QPID_LOG(info, "Message is not durably recorded on '" << queue.getName() << "'. Persistence not enabled.");
-}
-
-void NullMessageStore::dequeue(TransactionContext*, intrusive_ptr<PersistableMessage>& msg, const PersistableQueue&)
-{
- msg->dequeueComplete();
-}
-
-void NullMessageStore::flush(const qpid::broker::PersistableQueue&)
-{
-}
-
-u_int32_t NullMessageStore::outstandingQueueAIO(const PersistableQueue& )
-{
- return 0;
-}
-
-std::auto_ptr<TransactionContext> NullMessageStore::begin()
-{
- return std::auto_ptr<TransactionContext>();
-}
-
-std::auto_ptr<TPCTransactionContext> NullMessageStore::begin(const std::string& xid)
-{
- return std::auto_ptr<TPCTransactionContext>(new DummyCtxt(xid));
-}
-
-void NullMessageStore::prepare(TPCTransactionContext& ctxt)
-{
- prepared.insert(DummyCtxt::getXid(ctxt));
-}
-
-void NullMessageStore::commit(TransactionContext& ctxt)
-{
- prepared.erase(DummyCtxt::getXid(ctxt));
-}
-
-void NullMessageStore::abort(TransactionContext& ctxt)
-{
- prepared.erase(DummyCtxt::getXid(ctxt));
-}
-
-void NullMessageStore::collectPreparedXids(std::set<string>& out)
-{
- out.insert(prepared.begin(), prepared.end());
-}
diff --git a/qpid/cpp/src/qpid/broker/NullMessageStore.h b/qpid/cpp/src/qpid/broker/NullMessageStore.h
deleted file mode 100644
index 9c5631b75d..0000000000
--- a/qpid/cpp/src/qpid/broker/NullMessageStore.h
+++ /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.
- *
- */
-#ifndef _NullMessageStore_
-#define _NullMessageStore_
-
-#include <set>
-#include "MessageStore.h"
-#include "Queue.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * A null implementation of the MessageStore interface
- */
-class NullMessageStore : public MessageStore
-{
- std::set<std::string> prepared;
- const bool warn;
-public:
- NullMessageStore(bool warn = false);
-
- virtual bool init(const Options* options);
- virtual std::auto_ptr<TransactionContext> begin();
- virtual std::auto_ptr<TPCTransactionContext> begin(const std::string& xid);
- virtual void prepare(TPCTransactionContext& txn);
- virtual void commit(TransactionContext& txn);
- virtual void abort(TransactionContext& txn);
- virtual void collectPreparedXids(std::set<std::string>& xids);
-
- virtual void create(PersistableQueue& queue);
- virtual void destroy(PersistableQueue& queue);
- virtual void create(const PersistableExchange& exchange);
- virtual void destroy(const PersistableExchange& exchange);
-
- virtual void bind(const PersistableExchange& exchange, const PersistableQueue& queue,
- const std::string& key, const framing::FieldTable& args);
- virtual void unbind(const PersistableExchange& exchange, const PersistableQueue& queue,
- const std::string& key, const framing::FieldTable& args);
- virtual void recover(RecoveryManager& queues);
- virtual void stage(intrusive_ptr<PersistableMessage>& msg);
- virtual void destroy(PersistableMessage& msg);
- virtual void appendContent(intrusive_ptr<const PersistableMessage>& msg,
- const std::string& data);
- virtual void loadContent(const qpid::broker::PersistableQueue& queue,
- intrusive_ptr<const PersistableMessage>& msg, std::string& data,
- uint64_t offset, uint32_t length);
- virtual void enqueue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
- const PersistableQueue& queue);
- virtual void dequeue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
- const PersistableQueue& queue);
- virtual u_int32_t outstandingQueueAIO(const PersistableQueue& queue);
- virtual void flush(const qpid::broker::PersistableQueue& queue);
- ~NullMessageStore(){}
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/Persistable.h b/qpid/cpp/src/qpid/broker/Persistable.h
deleted file mode 100644
index 36499c7a1a..0000000000
--- a/qpid/cpp/src/qpid/broker/Persistable.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _broker_Persistable_h
-#define _broker_Persistable_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/amqp_types.h"
-#include "qpid/framing/Buffer.h"
-#include "qpid/RefCounted.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * Base class for all persistable objects
- */
-class Persistable : public RefCounted
-{
-public:
- /**
- * Allows the store to attach its own identifier to this object
- */
- virtual void setPersistenceId(uint64_t id) const = 0;
- /**
- * Returns any identifier the store may have attached to this
- * object
- */
- virtual uint64_t getPersistenceId() const = 0;
- /**
- * Encodes the persistable state of this object into the supplied
- * buffer
- */
- virtual void encode(framing::Buffer& buffer) const = 0;
- /**
- * @returns the size of the buffer needed to encode this object
- */
- virtual uint32_t encodedSize() const = 0;
-
- virtual ~Persistable() {};
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/PersistableExchange.h b/qpid/cpp/src/qpid/broker/PersistableExchange.h
deleted file mode 100644
index 683b740ddc..0000000000
--- a/qpid/cpp/src/qpid/broker/PersistableExchange.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef _broker_PersistableExchange_h
-#define _broker_PersistableExchange_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <string>
-#include "Persistable.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * The interface exchanges must expose to the MessageStore in order to be
- * persistable.
- */
-class PersistableExchange : public Persistable
-{
-public:
- virtual const std::string& getName() const = 0;
- virtual ~PersistableExchange() {};
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/PersistableMessage.cpp b/qpid/cpp/src/qpid/broker/PersistableMessage.cpp
deleted file mode 100644
index 3bf390faf3..0000000000
--- a/qpid/cpp/src/qpid/broker/PersistableMessage.cpp
+++ /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.
- *
- */
-
-
-#include "PersistableMessage.h"
-#include "MessageStore.h"
-#include <iostream>
-
-using namespace qpid::broker;
-
-void PersistableMessage::flush()
-{
- syncList copy;
- {
- sys::ScopedLock<sys::Mutex> l(storeLock);
- if (store) {
- copy = synclist;
- } else {
- return;//early exit as nothing to do
- }
- }
- for (syncList::iterator i = copy.begin(); i != copy.end(); ++i) {
- PersistableQueue::shared_ptr q(i->lock());
- if (q) {
- store->flush(*q);
- }
- }
-}
-
-
diff --git a/qpid/cpp/src/qpid/broker/PersistableMessage.h b/qpid/cpp/src/qpid/broker/PersistableMessage.h
deleted file mode 100644
index d5977665fe..0000000000
--- a/qpid/cpp/src/qpid/broker/PersistableMessage.h
+++ /dev/null
@@ -1,188 +0,0 @@
-#ifndef _broker_PersistableMessage_h
-#define _broker_PersistableMessage_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <string>
-#include <list>
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-#include "Persistable.h"
-#include "qpid/framing/amqp_types.h"
-#include "qpid/sys/Monitor.h"
-#include "PersistableQueue.h"
-
-namespace qpid {
-namespace broker {
-
-class MessageStore;
-
-/**
- * The interface messages must expose to the MessageStore in order to
- * be persistable.
- */
-class PersistableMessage : public Persistable
-{
- sys::Monitor asyncEnqueueLock;
- sys::Monitor asyncDequeueLock;
- sys::Mutex storeLock;
-
- /**
- * Tracks the number of outstanding asynchronous enqueue
- * operations. When the message is enqueued asynchronously the
- * count is incremented; when that enqueue completes it is
- * decremented. Thus when it is 0, there are no outstanding
- * enqueues.
- */
- int asyncEnqueueCounter;
-
- /**
- * Tracks the number of outstanding asynchronous dequeue
- * operations. When the message is dequeued asynchronously the
- * count is incremented; when that dequeue completes it is
- * decremented. Thus when it is 0, there are no outstanding
- * dequeues.
- */
- int asyncDequeueCounter;
-protected:
- typedef std::list< boost::weak_ptr<PersistableQueue> > syncList;
- syncList synclist;
- MessageStore* store;
- bool contentReleased;
-
- inline void setContentReleased() {contentReleased = true; }
-
-public:
- typedef boost::shared_ptr<PersistableMessage> shared_ptr;
-
- /**
- * @returns the size of the headers when encoded
- */
- virtual uint32_t encodedHeaderSize() const = 0;
-
- virtual ~PersistableMessage() {};
-
- PersistableMessage():
- asyncEnqueueCounter(0),
- asyncDequeueCounter(0),
- store(0),
- contentReleased(false)
- {}
-
- void flush();
-
- inline bool isContentReleased()const {return contentReleased; }
-
- inline void waitForEnqueueComplete() {
- sys::ScopedLock<sys::Monitor> l(asyncEnqueueLock);
- while (asyncEnqueueCounter > 0) {
- asyncEnqueueLock.wait();
- }
- }
-
- inline bool isEnqueueComplete() {
- sys::ScopedLock<sys::Monitor> l(asyncEnqueueLock);
- return asyncEnqueueCounter == 0;
- }
-
- inline void enqueueComplete() {
- bool notify = false;
- {
- sys::ScopedLock<sys::Monitor> l(asyncEnqueueLock);
- if (asyncEnqueueCounter > 0) {
- if (--asyncEnqueueCounter == 0) {
- asyncEnqueueLock.notify();
- notify = true;
- }
- }
- }
- if (notify) {
- sys::ScopedLock<sys::Mutex> l(storeLock);
- if (store) {
- for (syncList::iterator i = synclist.begin(); i != synclist.end(); ++i) {
- PersistableQueue::shared_ptr q(i->lock());
- if (q) q->notifyDurableIOComplete();
- }
- //synclist.clear();
- }
- }
- }
-
- inline void enqueueAsync(PersistableQueue::shared_ptr queue, MessageStore* _store) {
- if (_store){
- sys::ScopedLock<sys::Mutex> l(storeLock);
- store = _store;
- boost::weak_ptr<PersistableQueue> q(queue);
- synclist.push_back(q);
- }
- enqueueAsync();
- }
-
- inline void enqueueAsync() {
- sys::ScopedLock<sys::Monitor> l(asyncEnqueueLock);
- asyncEnqueueCounter++;
- }
-
- inline bool isDequeueComplete() {
- sys::ScopedLock<sys::Monitor> l(asyncDequeueLock);
- return asyncDequeueCounter == 0;
- }
-
- inline void dequeueComplete() {
-
- sys::ScopedLock<sys::Monitor> l(asyncDequeueLock);
- if (asyncDequeueCounter > 0) {
- if (--asyncDequeueCounter == 0) {
- asyncDequeueLock.notify();
- }
- }
- }
-
- inline void waitForDequeueComplete() {
- sys::ScopedLock<sys::Monitor> l(asyncDequeueLock);
- while (asyncDequeueCounter > 0) {
- asyncDequeueLock.wait();
- }
- }
-
- inline void dequeueAsync(PersistableQueue::shared_ptr queue, MessageStore* _store) {
- if (_store){
- sys::ScopedLock<sys::Mutex> l(storeLock);
- store = _store;
- boost::weak_ptr<PersistableQueue> q(queue);
- synclist.push_back(q);
- }
- dequeueAsync();
- }
-
- inline void dequeueAsync() {
- sys::ScopedLock<sys::Monitor> l(asyncDequeueLock);
- asyncDequeueCounter++;
- }
-
-
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/PersistableQueue.h b/qpid/cpp/src/qpid/broker/PersistableQueue.h
deleted file mode 100644
index 2d30513884..0000000000
--- a/qpid/cpp/src/qpid/broker/PersistableQueue.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef _broker_PersistableQueue_h
-#define _broker_PersistableQueue_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <string>
-#include "Persistable.h"
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace broker {
-
-
-/**
-* Empty class to be used by any module that wanted to set an external per queue store into
-* persistableQueue
-*/
-
-class ExternalQueueStore
-{
-public:
- virtual ~ExternalQueueStore() {};
-
-};
-
-
-/**
- * The interface queues must expose to the MessageStore in order to be
- * persistable.
- */
-class PersistableQueue : public Persistable
-{
-public:
- typedef boost::shared_ptr<PersistableQueue> shared_ptr;
-
- virtual const std::string& getName() const = 0;
- virtual ~PersistableQueue() {
- if (externalQueueStore)
- delete externalQueueStore;
- };
-
- inline void setExternalQueueStore(ExternalQueueStore* inst){
- if (externalQueueStore!=inst && externalQueueStore)
- delete externalQueueStore;
- externalQueueStore = inst;
- };
-
- inline ExternalQueueStore* getExternalQueueStore() const {return externalQueueStore;};
-
- PersistableQueue():externalQueueStore(NULL){
- };
-
-
- /**
- * call back to signal async AIO writes have
- * completed (enqueue/dequeue etc)
- *
- * Note: DO NOT do work on this callback, if you block
- * this callback you will block the store.
- */
- virtual void notifyDurableIOComplete() = 0;
-protected:
-
- ExternalQueueStore* externalQueueStore;
-
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/Prefetch.h b/qpid/cpp/src/qpid/broker/Prefetch.h
deleted file mode 100644
index 8eb27a3e21..0000000000
--- a/qpid/cpp/src/qpid/broker/Prefetch.h
+++ /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.
- *
- */
-#ifndef _Prefetch_
-#define _Prefetch_
-
-#include "qpid/framing/amqp_types.h"
-
-namespace qpid {
- namespace broker {
- /**
- * Count and total size of asynchronously delivered
- * (i.e. pushed) messages that have acks outstanding.
- */
- struct Prefetch{
- uint32_t size;
- uint16_t count;
-
- void reset() { size = 0; count = 0; }
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/PreviewConnection.cpp b/qpid/cpp/src/qpid/broker/PreviewConnection.cpp
deleted file mode 100644
index 05879a0329..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewConnection.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "PreviewConnection.h"
-#include "SessionState.h"
-#include "BrokerAdapter.h"
-#include "Bridge.h"
-#include "SemanticHandler.h"
-
-#include "qpid/log/Statement.h"
-#include "qpid/ptr_map.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/management/ManagementAgent.h"
-
-#include <boost/bind.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-
-#include <algorithm>
-#include <iostream>
-#include <assert.h>
-
-using namespace boost;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using namespace qpid::sys;
-using namespace qpid::ptr_map;
-using qpid::management::ManagementAgent;
-using qpid::management::ManagementObject;
-using qpid::management::Manageable;
-using qpid::management::Args;
-
-namespace qpid {
-namespace broker {
-
-class PreviewConnection::MgmtClient : public PreviewConnection::MgmtWrapper
-{
- management::Client::shared_ptr mgmtClient;
-
-public:
- MgmtClient(PreviewConnection* conn, Manageable* parent, ManagementAgent::shared_ptr agent, const std::string& mgmtId);
- ~MgmtClient();
- void received(framing::AMQFrame& frame);
- management::ManagementObject::shared_ptr getManagementObject() const;
- void closing();
-};
-
-class PreviewConnection::MgmtLink : public PreviewConnection::MgmtWrapper
-{
- typedef boost::ptr_vector<Bridge> Bridges;
-
- management::Link::shared_ptr mgmtLink;
- Bridges created;//holds list of bridges pending creation
- Bridges cancelled;//holds list of bridges pending cancellation
- Bridges active;//holds active bridges
- uint channelCounter;
- sys::Mutex lock;
-
- void cancel(Bridge*);
-
-public:
- MgmtLink(PreviewConnection* conn, Manageable* parent, ManagementAgent::shared_ptr agent, const std::string& mgmtId);
- ~MgmtLink();
- void received(framing::AMQFrame& frame);
- management::ManagementObject::shared_ptr getManagementObject() const;
- void closing();
- void processPending();
- void process(PreviewConnection& connection, const management::Args& args);
-};
-
-
-PreviewConnection::PreviewConnection(ConnectionOutputHandler* out_, Broker& broker_, const std::string& mgmtId_) :
- ConnectionState(out_, broker_),
- adapter(*this),
- mgmtClosing(0),
- mgmtId(mgmtId_)
-{}
-
-void PreviewConnection::initMgmt(bool asLink)
-{
- Manageable* parent = broker.GetVhostObject ();
-
- if (parent != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
-
- if (agent.get () != 0)
- {
- if (asLink) {
- mgmtWrapper = std::auto_ptr<MgmtWrapper>(new MgmtLink(this, parent, agent, mgmtId));
- } else {
- mgmtWrapper = std::auto_ptr<MgmtWrapper>(new MgmtClient(this, parent, agent, mgmtId));
- }
- }
- }
-}
-
-PreviewConnection::~PreviewConnection () {}
-
-void PreviewConnection::received(framing::AMQFrame& frame){
- if (mgmtClosing)
- close (403, "Closed by Management Request", 0, 0);
-
- if (frame.getChannel() == 0) {
- adapter.handle(frame);
- } else {
- getChannel(frame.getChannel()).in(frame);
- }
-
- if (mgmtWrapper.get()) mgmtWrapper->received(frame);
-}
-
-void PreviewConnection::close(
- ReplyCode code, const string& text, ClassId classId, MethodId methodId)
-{
- adapter.close(code, text, classId, methodId);
- channels.clear();
- getOutput().close();
-}
-
-void PreviewConnection::initiated(const framing::ProtocolInitiation& header) {
- version = ProtocolVersion(header.getMajor(), header.getMinor());
- adapter.init(header);
- initMgmt();
-}
-
-void PreviewConnection::idleOut(){}
-
-void PreviewConnection::idleIn(){}
-
-void PreviewConnection::closed(){ // Physically closed, suspend open sessions.
- try {
- for (ChannelMap::iterator i = channels.begin(); i != channels.end(); ++i)
- get_pointer(i)->localSuspend();
- while (!exclusiveQueues.empty()) {
- Queue::shared_ptr q(exclusiveQueues.front());
- q->releaseExclusiveOwnership();
- if (q->canAutoDelete()) {
- Queue::tryAutoDelete(broker, q);
- }
- exclusiveQueues.erase(exclusiveQueues.begin());
- }
- } catch(std::exception& e) {
- QPID_LOG(error, " Unhandled exception while closing session: " <<
- e.what());
- assert(0);
- }
-}
-
-bool PreviewConnection::doOutput()
-{
- try{
- //process any pending mgmt commands:
- if (mgmtWrapper.get()) mgmtWrapper->processPending();
-
- //then do other output as needed:
- return outputTasks.doOutput();
- }catch(ConnectionException& e){
- close(e.code, e.what(), 0, 0);
- }catch(std::exception& e){
- close(541/*internal error*/, e.what(), 0, 0);
- }
- return false;
-}
-
-void PreviewConnection::closeChannel(uint16_t id) {
- ChannelMap::iterator i = channels.find(id);
- if (i != channels.end()) channels.erase(i);
-}
-
-PreviewSessionHandler& PreviewConnection::getChannel(ChannelId id) {
- ChannelMap::iterator i=channels.find(id);
- if (i == channels.end()) {
- i = channels.insert(id, new PreviewSessionHandler(*this, id)).first;
- }
- return *get_pointer(i);
-}
-
-ManagementObject::shared_ptr PreviewConnection::GetManagementObject (void) const
-{
- return mgmtWrapper.get() ? mgmtWrapper->getManagementObject() : ManagementObject::shared_ptr();
-}
-
-Manageable::status_t PreviewConnection::ManagementMethod (uint32_t methodId,
- Args& args)
-{
- Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
-
- QPID_LOG (debug, "PreviewConnection::ManagementMethod [id=" << methodId << "]");
-
- switch (methodId)
- {
- case management::Client::METHOD_CLOSE :
- mgmtClosing = 1;
- if (mgmtWrapper.get()) mgmtWrapper->closing();
- status = Manageable::STATUS_OK;
- break;
- case management::Link::METHOD_BRIDGE :
- //queue this up and request chance to do output (i.e. get connections thread of control):
- mgmtWrapper->process(*this, args);
- out->activateOutput();
- status = Manageable::STATUS_OK;
- break;
- }
-
- return status;
-}
-
-PreviewConnection::MgmtLink::MgmtLink(PreviewConnection* conn, Manageable* parent, ManagementAgent::shared_ptr agent, const std::string& mgmtId)
- : channelCounter(1)
-{
- mgmtLink = management::Link::shared_ptr
- (new management::Link(conn, parent, mgmtId));
- agent->addObject (mgmtLink);
-}
-
-PreviewConnection::MgmtLink::~MgmtLink()
-{
- if (mgmtLink.get () != 0)
- mgmtLink->resourceDestroy ();
-}
-
-void PreviewConnection::MgmtLink::received(framing::AMQFrame& frame)
-{
- if (mgmtLink.get () != 0)
- {
- mgmtLink->inc_framesFromPeer ();
- mgmtLink->inc_bytesFromPeer (frame.size ());
- }
-}
-
-management::ManagementObject::shared_ptr PreviewConnection::MgmtLink::getManagementObject() const
-{
- return dynamic_pointer_cast<ManagementObject>(mgmtLink);
-}
-
-void PreviewConnection::MgmtLink::closing()
-{
- if (mgmtLink) mgmtLink->set_closing (1);
-}
-
-void PreviewConnection::MgmtLink::processPending()
-{
- //process any pending creates
- if (!created.empty()) {
- for (Bridges::iterator i = created.begin(); i != created.end(); ++i) {
- i->create();
- }
- active.transfer(active.end(), created.begin(), created.end(), created);
- }
- if (!cancelled.empty()) {
- //process any pending cancellations
- for (Bridges::iterator i = cancelled.begin(); i != cancelled.end(); ++i) {
- i->cancel();
- }
- cancelled.clear();
- }
-}
-
-void PreviewConnection::MgmtLink::process(PreviewConnection& connection, const management::Args& args)
-{
- created.push_back(new Bridge(channelCounter++, connection,
- boost::bind(&MgmtLink::cancel, this, _1),
- dynamic_cast<const management::ArgsLinkBridge&>(args)));
-}
-
-void PreviewConnection::MgmtLink::cancel(Bridge* b)
-{
- //need to take this out the active map and add it to the cancelled map
- for (Bridges::iterator i = active.begin(); i != active.end(); i++) {
- if (&(*i) == b) {
- cancelled.transfer(cancelled.end(), i, active);
- break;
- }
- }
-}
-
-PreviewConnection::MgmtClient::MgmtClient(PreviewConnection* conn, Manageable* parent, ManagementAgent::shared_ptr agent, const std::string& mgmtId)
-{
- mgmtClient = management::Client::shared_ptr
- (new management::Client (conn, parent, mgmtId));
- agent->addObject (mgmtClient);
-}
-
-PreviewConnection::MgmtClient::~MgmtClient()
-{
- if (mgmtClient.get () != 0)
- mgmtClient->resourceDestroy ();
-}
-
-void PreviewConnection::MgmtClient::received(framing::AMQFrame& frame)
-{
- if (mgmtClient.get () != 0)
- {
- mgmtClient->inc_framesFromClient ();
- mgmtClient->inc_bytesFromClient (frame.size ());
- }
-}
-
-management::ManagementObject::shared_ptr PreviewConnection::MgmtClient::getManagementObject() const
-{
- return dynamic_pointer_cast<ManagementObject>(mgmtClient);
-}
-
-void PreviewConnection::MgmtClient::closing()
-{
- if (mgmtClient) mgmtClient->set_closing (1);
-}
-
-}}
-
diff --git a/qpid/cpp/src/qpid/broker/PreviewConnection.h b/qpid/cpp/src/qpid/broker/PreviewConnection.h
deleted file mode 100644
index d6a945c26c..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewConnection.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _PreviewConnection_
-#define _PreviewConnection_
-
-#include <memory>
-#include <sstream>
-#include <vector>
-
-#include <boost/ptr_container/ptr_map.hpp>
-
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/sys/AggregateOutput.h"
-#include "qpid/sys/ConnectionOutputHandler.h"
-#include "qpid/sys/ConnectionInputHandler.h"
-#include "qpid/sys/TimeoutHandler.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "Broker.h"
-#include "qpid/sys/Socket.h"
-#include "qpid/Exception.h"
-#include "PreviewConnectionHandler.h"
-#include "ConnectionState.h"
-#include "PreviewSessionHandler.h"
-#include "qpid/management/Manageable.h"
-#include "qpid/management/Client.h"
-#include "qpid/management/Link.h"
-
-#include <boost/ptr_container/ptr_map.hpp>
-
-namespace qpid {
-namespace broker {
-
-class PreviewConnection : public sys::ConnectionInputHandler,
- public ConnectionState
-{
- public:
- PreviewConnection(sys::ConnectionOutputHandler* out, Broker& broker, const std::string& mgmtId);
- ~PreviewConnection ();
-
- /** Get the PreviewSessionHandler for channel. Create if it does not already exist */
- PreviewSessionHandler& getChannel(framing::ChannelId channel);
-
- /** Close the connection */
- void close(framing::ReplyCode code, const string& text, framing::ClassId classId, framing::MethodId methodId);
-
- // ConnectionInputHandler methods
- void received(framing::AMQFrame& frame);
- void initiated(const framing::ProtocolInitiation& header);
- void idleOut();
- void idleIn();
- void closed();
- bool doOutput();
- framing::ProtocolInitiation getInitiation() { return framing::ProtocolInitiation(version); }
-
- void closeChannel(framing::ChannelId channel);
-
- // Manageable entry points
- management::ManagementObject::shared_ptr GetManagementObject (void) const;
- management::Manageable::status_t
- ManagementMethod (uint32_t methodId, management::Args& args);
-
- void initMgmt(bool asLink = false);
-
- private:
- typedef boost::ptr_map<framing::ChannelId, PreviewSessionHandler> ChannelMap;
- typedef std::vector<Queue::shared_ptr>::iterator queue_iterator;
-
- /**
- * Connection may appear, for the purposes of management, as a
- * normal client initiated connection or as an agent initiated
- * inter-broker link. This wrapper abstracts the common interface
- * for both.
- */
- class MgmtWrapper
- {
- public:
- virtual ~MgmtWrapper(){}
- virtual void received(framing::AMQFrame& frame) = 0;
- virtual management::ManagementObject::shared_ptr getManagementObject() const = 0;
- virtual void closing() = 0;
- virtual void processPending(){}
- virtual void process(PreviewConnection&, const management::Args&){}
- };
- class MgmtClient;
- class MgmtLink;
-
- ChannelMap channels;
- framing::AMQP_ClientProxy::Connection* client;
- uint64_t stagingThreshold;
- PreviewConnectionHandler adapter;
- std::auto_ptr<MgmtWrapper> mgmtWrapper;
- bool mgmtClosing;
- const std::string mgmtId;
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/PreviewConnectionHandler.cpp b/qpid/cpp/src/qpid/broker/PreviewConnectionHandler.cpp
deleted file mode 100644
index c0f0d9f5e0..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewConnectionHandler.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "PreviewConnectionHandler.h"
-#include "PreviewConnection.h"
-#include "qpid/framing/ConnectionStartBody.h"
-#include "qpid/framing/ClientInvoker.h"
-#include "qpid/framing/ServerInvoker.h"
-
-using namespace qpid;
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-
-namespace
-{
-const std::string PLAIN = "PLAIN";
-const std::string en_US = "en_US";
-}
-
-void PreviewConnectionHandler::init(const framing::ProtocolInitiation& header) {
- FieldTable properties;
- string mechanisms(PLAIN);
- string locales(en_US);
- handler->serverMode = true;
- handler->client.start(header.getMajor(), header.getMinor(), properties, mechanisms, locales);
-}
-
-void PreviewConnectionHandler::close(ReplyCode code, const string& text, ClassId classId, MethodId methodId)
-{
- handler->client.close(code, text, classId, methodId);
-}
-
-void PreviewConnectionHandler::handle(framing::AMQFrame& frame)
-{
- AMQMethodBody* method=frame.getBody()->getMethod();
- try{
- if (handler->serverMode) {
- if (!invoke(static_cast<AMQP_ServerOperations::ConnectionHandler&>(*handler.get()), *method))
- throw ChannelErrorException(QPID_MSG("Class can't be accessed over channel 0"));
- } else {
- if (!invoke(static_cast<AMQP_ClientOperations::ConnectionHandler&>(*handler.get()), *method))
- throw ChannelErrorException(QPID_MSG("Class can't be accessed over channel 0"));
- }
- }catch(ConnectionException& e){
- handler->client.close(e.code, e.what(), method->amqpClassId(), method->amqpMethodId());
- }catch(std::exception& e){
- handler->client.close(541/*internal error*/, e.what(), method->amqpClassId(), method->amqpMethodId());
- }
-}
-
-PreviewConnectionHandler::PreviewConnectionHandler(PreviewConnection& connection) : handler(new Handler(connection)) {}
-
-PreviewConnectionHandler::Handler:: Handler(PreviewConnection& c) : client(c.getOutput()), server(c.getOutput()),
- connection(c), serverMode(false) {}
-
-void PreviewConnectionHandler::Handler::startOk(const framing::FieldTable& /*clientProperties*/,
- const string& mechanism,
- const string& response, const string& /*locale*/)
-{
- //TODO: handle SASL mechanisms more cleverly
- if (mechanism == PLAIN) {
- if (response.size() > 0 && response[0] == (char) 0) {
- string temp = response.substr(1);
- string::size_type i = temp.find((char)0);
- string uid = temp.substr(0, i);
- string pwd = temp.substr(i + 1);
- //TODO: authentication
- connection.setUserId(uid);
- }
- }
- client.tune(framing::CHANNEL_MAX, connection.getFrameMax(), connection.getHeartbeat());
-}
-
-void PreviewConnectionHandler::Handler::secureOk(const string& /*response*/){}
-
-void PreviewConnectionHandler::Handler::tuneOk(uint16_t /*channelmax*/,
- uint32_t framemax, uint16_t heartbeat)
-{
- connection.setFrameMax(framemax);
- connection.setHeartbeat(heartbeat);
-}
-
-void PreviewConnectionHandler::Handler::open(const string& /*virtualHost*/,
- const string& /*capabilities*/, bool /*insist*/)
-{
- string knownhosts;
- client.openOk(knownhosts);
-}
-
-
-void PreviewConnectionHandler::Handler::close(uint16_t /*replyCode*/, const string& /*replyText*/,
- uint16_t /*classId*/, uint16_t /*methodId*/)
-{
- client.closeOk();
- connection.getOutput().close();
-}
-
-void PreviewConnectionHandler::Handler::closeOk(){
- connection.getOutput().close();
-}
-
-
-void PreviewConnectionHandler::Handler::start(uint8_t /*versionMajor*/,
- uint8_t /*versionMinor*/,
- const FieldTable& /*serverProperties*/,
- const string& /*mechanisms*/,
- const string& /*locales*/)
-{
- string uid = "qpidd";
- string pwd = "qpidd";
- string response = ((char)0) + uid + ((char)0) + pwd;
- server.startOk(FieldTable(), PLAIN, response, en_US);
- connection.initMgmt(true);
-}
-
-void PreviewConnectionHandler::Handler::secure(const string& /*challenge*/)
-{
- server.secureOk("");
-}
-
-void PreviewConnectionHandler::Handler::tune(uint16_t channelMax,
- uint32_t frameMax,
- uint16_t heartbeat)
-{
- connection.setFrameMax(frameMax);
- connection.setHeartbeat(heartbeat);
- server.tuneOk(channelMax, frameMax, heartbeat);
- server.open("/", "", true);
-}
-
-void PreviewConnectionHandler::Handler::openOk(const string& /*knownHosts*/)
-{
-}
-
-void PreviewConnectionHandler::Handler::redirect(const string& /*host*/, const string& /*knownHosts*/)
-{
-
-}
diff --git a/qpid/cpp/src/qpid/broker/PreviewConnectionHandler.h b/qpid/cpp/src/qpid/broker/PreviewConnectionHandler.h
deleted file mode 100644
index 93901dd492..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewConnectionHandler.h
+++ /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.
- *
- */
-#ifndef _PreviewConnectionAdapter_
-#define _PreviewConnectionAdapter_
-
-#include <memory>
-#include "qpid/framing/amqp_types.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/AMQP_ClientOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ServerProxy.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/ProtocolInitiation.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/Exception.h"
-
-namespace qpid {
-namespace broker {
-
-class PreviewConnection;
-
-// TODO aconway 2007-09-18: Rename to ConnectionHandler
-class PreviewConnectionHandler : public framing::FrameHandler
-{
- struct Handler : public framing::AMQP_ServerOperations::ConnectionHandler,
- public framing::AMQP_ClientOperations::ConnectionHandler
- {
- framing::AMQP_ClientProxy::Connection client;
- framing::AMQP_ServerProxy::Connection server;
- PreviewConnection& connection;
- bool serverMode;
-
- Handler(PreviewConnection& connection);
- void startOk(const qpid::framing::FieldTable& clientProperties,
- const std::string& mechanism, const std::string& response,
- const std::string& locale);
- void secureOk(const std::string& response);
- void tuneOk(uint16_t channelMax, uint32_t frameMax, uint16_t heartbeat);
- void open(const std::string& virtualHost,
- const std::string& capabilities, bool insist);
- void close(uint16_t replyCode, const std::string& replyText,
- uint16_t classId, uint16_t methodId);
- void closeOk();
-
-
- void start(uint8_t versionMajor,
- uint8_t versionMinor,
- const qpid::framing::FieldTable& serverProperties,
- const std::string& mechanisms,
- const std::string& locales);
-
- void secure(const std::string& challenge);
-
- void tune(uint16_t channelMax,
- uint32_t frameMax,
- uint16_t heartbeat);
-
- void openOk(const std::string& knownHosts);
-
- void redirect(const std::string& host, const std::string& knownHosts);
- };
- std::auto_ptr<Handler> handler;
- public:
- PreviewConnectionHandler(PreviewConnection& connection);
- void init(const framing::ProtocolInitiation& header);
- void close(framing::ReplyCode code, const std::string& text, framing::ClassId classId, framing::MethodId methodId);
- void handle(framing::AMQFrame& frame);
-};
-
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/PreviewSessionHandler.cpp b/qpid/cpp/src/qpid/broker/PreviewSessionHandler.cpp
deleted file mode 100644
index 36092bb7f6..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewSessionHandler.cpp
+++ /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.
- *
- */
-
-#include "PreviewSessionHandler.h"
-#include "PreviewSessionState.h"
-#include "PreviewConnection.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/framing/constants.h"
-#include "qpid/framing/ClientInvoker.h"
-#include "qpid/framing/ServerInvoker.h"
-#include "qpid/log/Statement.h"
-
-#include <boost/bind.hpp>
-
-namespace qpid {
-namespace broker {
-using namespace framing;
-using namespace std;
-using namespace qpid::sys;
-
-PreviewSessionHandler::PreviewSessionHandler(PreviewConnection& c, ChannelId ch)
- : InOutHandler(0, &out),
- connection(c), channel(ch, &c.getOutput()),
- proxy(out), // Via my own handleOut() for L2 data.
- peerSession(channel), // Direct to channel for L2 commands.
- ignoring(false) {}
-
-PreviewSessionHandler::~PreviewSessionHandler() {}
-
-namespace {
-ClassId classId(AMQMethodBody* m) { return m ? m->amqpMethodId() : 0; }
-MethodId methodId(AMQMethodBody* m) { return m ? m->amqpClassId() : 0; }
-} // namespace
-
-void PreviewSessionHandler::handleIn(AMQFrame& f) {
- // Note on channel states: a channel is open if session != 0. A
- // channel that is closed (session == 0) can be in the "ignoring"
- // state. This is a temporary state after we have sent a channel
- // exception, where extra frames might arrive that should be
- // ignored.
- //
- AMQMethodBody* m = f.getBody()->getMethod();
- try {
- if (m && invoke(static_cast<AMQP_ServerOperations::SessionHandler&>(*this), *m)) {
- return;
- } else if (session.get()) {
- boost::optional<SequenceNumber> ack=session->received(f);
- session->in.handle(f);
- if (ack)
- peerSession.ack(*ack, SequenceNumberSet());
- } else if (m && invoke(static_cast<AMQP_ClientOperations::SessionHandler&>(*this), *m)) {
- return;
- } else if (!ignoring) {
- throw ChannelErrorException(
- QPID_MSG("Channel " << channel.get() << " is not open"));
- }
- } catch(const ChannelException& e) {
- ignoring=true; // Ignore trailing frames sent by client.
- session->detach();
- session.reset();
- peerSession.closed(e.code, e.what());
- }catch(const ConnectionException& e){
- connection.close(e.code, e.what(), classId(m), methodId(m));
- }catch(const std::exception& e){
- connection.close(
- framing::INTERNAL_ERROR, e.what(), classId(m), methodId(m));
- }
-}
-
-void PreviewSessionHandler::handleOut(AMQFrame& f) {
- channel.handle(f); // Send it.
- if (session->sent(f))
- peerSession.solicitAck();
-}
-
-void PreviewSessionHandler::assertAttached(const char* method) const {
- if (!session.get())
- throw ChannelErrorException(
- QPID_MSG(method << " failed: No session for channel "
- << getChannel()));
-}
-
-void PreviewSessionHandler::assertClosed(const char* method) const {
- if (session.get())
- throw ChannelBusyException(
- QPID_MSG(method << " failed: channel " << channel.get()
- << " is already open."));
-}
-
-void PreviewSessionHandler::open(uint32_t detachedLifetime) {
- assertClosed("open");
- std::auto_ptr<PreviewSessionState> state(
- connection.broker.getPreviewSessionManager().open(*this, detachedLifetime));
- session.reset(state.release());
- peerSession.attached(session->getId(), session->getTimeout());
-}
-
-void PreviewSessionHandler::resume(const Uuid& id) {
- assertClosed("resume");
- session = connection.broker.getPreviewSessionManager().resume(id);
- session->attach(*this);
- SequenceNumber seq = session->resuming();
- peerSession.attached(session->getId(), session->getTimeout());
- proxy.getSession().ack(seq, SequenceNumberSet());
-}
-
-void PreviewSessionHandler::flow(bool /*active*/) {
- assertAttached("flow");
- // TODO aconway 2007-09-19: Removed in 0-10, remove
- assert(0); throw NotImplementedException("session.flow");
-}
-
-void PreviewSessionHandler::flowOk(bool /*active*/) {
- assertAttached("flowOk");
- // TODO aconway 2007-09-19: Removed in 0-10, remove
- assert(0); throw NotImplementedException("session.flowOk");
-}
-
-void PreviewSessionHandler::close() {
- assertAttached("close");
- QPID_LOG(info, "Received session.close");
- ignoring=false;
- session->detach();
- session.reset();
- peerSession.closed(REPLY_SUCCESS, "ok");
- assert(&connection.getChannel(channel.get()) == this);
- connection.closeChannel(channel.get());
-}
-
-void PreviewSessionHandler::closed(uint16_t replyCode, const string& replyText) {
- QPID_LOG(warning, "Received session.closed: "<<replyCode<<" "<<replyText);
- ignoring=false;
- session->detach();
- session.reset();
-}
-
-void PreviewSessionHandler::localSuspend() {
- if (session.get() && session->isAttached()) {
- session->detach();
- connection.broker.getPreviewSessionManager().suspend(session);
- session.reset();
- }
-}
-
-void PreviewSessionHandler::suspend() {
- assertAttached("suspend");
- localSuspend();
- peerSession.detached();
- assert(&connection.getChannel(channel.get()) == this);
- connection.closeChannel(channel.get());
-}
-
-void PreviewSessionHandler::ack(uint32_t cumulativeSeenMark,
- const SequenceNumberSet& /*seenFrameSet*/)
-{
- assertAttached("ack");
- if (session->getState() == PreviewSessionState::RESUMING) {
- session->receivedAck(cumulativeSeenMark);
- framing::SessionState::Replay replay=session->replay();
- std::for_each(replay.begin(), replay.end(),
- boost::bind(&PreviewSessionHandler::handleOut, this, _1));
- }
- else
- session->receivedAck(cumulativeSeenMark);
-}
-
-void PreviewSessionHandler::highWaterMark(uint32_t /*lastSentMark*/) {
- // TODO aconway 2007-10-02: may be removed from spec.
- assert(0); throw NotImplementedException("session.high-water-mark");
-}
-
-void PreviewSessionHandler::solicitAck() {
- assertAttached("solicit-ack");
- peerSession.ack(session->sendingAck(), SequenceNumberSet());
-}
-
-void PreviewSessionHandler::attached(const Uuid& /*sessionId*/, uint32_t detachedLifetime)
-{
- std::auto_ptr<PreviewSessionState> state(
- connection.broker.getPreviewSessionManager().open(*this, detachedLifetime));
- session.reset(state.release());
-}
-
-void PreviewSessionHandler::detached()
-{
- connection.broker.getPreviewSessionManager().suspend(session);
- session.reset();
-}
-
-ConnectionState& PreviewSessionHandler::getConnection() { return connection; }
-const ConnectionState& PreviewSessionHandler::getConnection() const { return connection; }
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/PreviewSessionHandler.h b/qpid/cpp/src/qpid/broker/PreviewSessionHandler.h
deleted file mode 100644
index 4c517367d7..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewSessionHandler.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef QPID_BROKER_PREVIEWSESSIONHANDLER_H
-#define QPID_BROKER_PREVIEWSESSIONHANDLER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/AMQP_ClientOperations.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/framing/amqp_types.h"
-#include "qpid/framing/ChannelHandler.h"
-#include "SessionContext.h"
-
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
-namespace broker {
-
-class PreviewConnection;
-class PreviewSessionState;
-
-/**
- * A SessionHandler is associated with each active channel. It
- * receives incoming frames, handles session commands and manages the
- * association between the channel and a session.
- */
-class PreviewSessionHandler : public framing::AMQP_ServerOperations::SessionHandler,
- public framing::AMQP_ClientOperations::SessionHandler,
- public framing::FrameHandler::InOutHandler,
- private boost::noncopyable
-{
- public:
- PreviewSessionHandler(PreviewConnection&, framing::ChannelId);
- ~PreviewSessionHandler();
-
- /** Returns 0 if not attached to a session */
- PreviewSessionState* getSession() { return session.get(); }
- const PreviewSessionState* getSession() const { return session.get(); }
-
- framing::ChannelId getChannel() const { return channel.get(); }
-
- ConnectionState& getConnection();
- const ConnectionState& getConnection() const;
-
- framing::AMQP_ClientProxy& getProxy() { return proxy; }
- const framing::AMQP_ClientProxy& getProxy() const { return proxy; }
-
- // Called by closing connection.
- void localSuspend();
- void detach() { localSuspend(); }
-
- protected:
- void handleIn(framing::AMQFrame&);
- void handleOut(framing::AMQFrame&);
-
- private:
- /// Session methods
- void open(uint32_t detachedLifetime);
- void flow(bool active);
- void flowOk(bool active);
- void close();
- void closed(uint16_t replyCode, const std::string& replyText);
- void resume(const framing::Uuid& sessionId);
- void suspend();
- void ack(uint32_t cumulativeSeenMark,
- const framing::SequenceNumberSet& seenFrameSet);
- void highWaterMark(uint32_t lastSentMark);
- void solicitAck();
-
- //extra methods required for assuming client role
- void attached(const framing::Uuid& sessionId, uint32_t detachedLifetime);
- void detached();
-
-
- void assertAttached(const char* method) const;
- void assertActive(const char* method) const;
- void assertClosed(const char* method) const;
-
-
- PreviewConnection& connection;
- framing::ChannelHandler channel;
- framing::AMQP_ClientProxy proxy;
- framing::AMQP_ClientProxy::Session peerSession;
- bool ignoring;
- std::auto_ptr<PreviewSessionState> session;
-};
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!QPID_BROKER_SESSIONHANDLER_H*/
diff --git a/qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp b/qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp
deleted file mode 100644
index ec73082817..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "PreviewSessionManager.h"
-#include "PreviewSessionState.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/log/Statement.h"
-#include "qpid/log/Helpers.h"
-#include "qpid/memory.h"
-
-#include <boost/bind.hpp>
-#include <boost/range.hpp>
-
-#include <algorithm>
-#include <functional>
-#include <ostream>
-
-namespace qpid {
-namespace broker {
-
-using namespace sys;
-using namespace framing;
-
-PreviewSessionManager::PreviewSessionManager(uint32_t a) : ack(a) {}
-
-PreviewSessionManager::~PreviewSessionManager() {}
-
-// FIXME aconway 2008-02-01: pass handler*, allow open unattached.
-std::auto_ptr<PreviewSessionState> PreviewSessionManager::open(
- PreviewSessionHandler& h, uint32_t timeout_)
-{
- Mutex::ScopedLock l(lock);
- std::auto_ptr<PreviewSessionState> session(
- new PreviewSessionState(this, &h, timeout_, ack));
- active.insert(session->getId());
- for_each(observers.begin(), observers.end(),
- boost::bind(&Observer::opened, _1,boost::ref(*session)));
- return session;
-}
-
-void PreviewSessionManager::suspend(std::auto_ptr<PreviewSessionState> session) {
- Mutex::ScopedLock l(lock);
- active.erase(session->getId());
- session->suspend();
- session->expiry = AbsTime(now(),session->getTimeout()*TIME_SEC);
- if (session->mgmtObject.get() != 0)
- session->mgmtObject->set_expireTime ((uint64_t) Duration (session->expiry));
- suspended.push_back(session.release()); // In expiry order
- eraseExpired();
-}
-
-std::auto_ptr<PreviewSessionState> PreviewSessionManager::resume(const Uuid& id)
-{
- Mutex::ScopedLock l(lock);
- eraseExpired();
- if (active.find(id) != active.end())
- throw SessionBusyException(
- QPID_MSG("Session already active: " << id));
- Suspended::iterator i = std::find_if(
- suspended.begin(), suspended.end(),
- boost::bind(std::equal_to<Uuid>(), id, boost::bind(&PreviewSessionState::getId, _1))
- );
- if (i == suspended.end())
- throw InvalidArgumentException(
- QPID_MSG("No suspended session with id=" << id));
- active.insert(id);
- std::auto_ptr<PreviewSessionState> state(suspended.release(i).release());
- return state;
-}
-
-void PreviewSessionManager::erase(const framing::Uuid& id)
-{
- Mutex::ScopedLock l(lock);
- active.erase(id);
-}
-
-void PreviewSessionManager::eraseExpired() {
- // Called with lock held.
- if (!suspended.empty()) {
- Suspended::iterator keep = std::lower_bound(
- suspended.begin(), suspended.end(), now(),
- boost::bind(std::less<AbsTime>(), boost::bind(&PreviewSessionState::expiry, _1), _2));
- if (suspended.begin() != keep) {
- QPID_LOG(debug, "Expiring sessions: " << log::formatList(suspended.begin(), keep));
- suspended.erase(suspended.begin(), keep);
- }
- }
-}
-
-void PreviewSessionManager::add(const intrusive_ptr<Observer>& o) {
- observers.push_back(o);
-}
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/PreviewSessionManager.h b/qpid/cpp/src/qpid/broker/PreviewSessionManager.h
deleted file mode 100644
index 65ca49ec89..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewSessionManager.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef QPID_BROKER_PREVIEWSESSIONMANAGER_H
-#define QPID_BROKER_PREVIEWSESSIONMANAGER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <qpid/framing/Uuid.h>
-#include <qpid/sys/Time.h>
-#include <qpid/sys/Mutex.h>
-#include <qpid/RefCounted.h>
-
-#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-
-#include <set>
-#include <vector>
-#include <memory>
-
-namespace qpid {
-namespace broker {
-
-class PreviewSessionState;
-class PreviewSessionHandler;
-
-/**
- * Create and manage PreviewSessionState objects.
- */
-class PreviewSessionManager : private boost::noncopyable {
- public:
- /**
- * Observer notified of PreviewSessionManager events.
- */
- struct Observer : public RefCounted {
- virtual void opened(PreviewSessionState&) {}
- };
-
- PreviewSessionManager(uint32_t ack);
-
- ~PreviewSessionManager();
-
- /** Open a new active session, caller takes ownership */
- std::auto_ptr<PreviewSessionState> open(PreviewSessionHandler& c, uint32_t timeout_);
-
- /** Suspend a session, start it's timeout counter.
- * The factory takes ownership.
- */
- void suspend(std::auto_ptr<PreviewSessionState> session);
-
- /** Resume a suspended session.
- *@throw Exception if timed out or non-existant.
- */
- std::auto_ptr<PreviewSessionState> resume(const framing::Uuid&);
-
- /** Add an Observer. */
- void add(const intrusive_ptr<Observer>&);
-
- private:
- typedef boost::ptr_vector<PreviewSessionState> Suspended;
- typedef std::set<framing::Uuid> Active;
- typedef std::vector<intrusive_ptr<Observer> > Observers;
-
- void erase(const framing::Uuid&);
- void eraseExpired();
-
- sys::Mutex lock;
- Suspended suspended;
- Active active;
- uint32_t ack;
- Observers observers;
-
- friend class PreviewSessionState; // removes deleted sessions from active set.
-};
-
-
-
-}} // namespace qpid::broker
-
-
-
-
-
-#endif /*!QPID_BROKER_PREVIEWSESSIONMANAGER_H*/
diff --git a/qpid/cpp/src/qpid/broker/PreviewSessionState.cpp b/qpid/cpp/src/qpid/broker/PreviewSessionState.cpp
deleted file mode 100644
index 7188ffbf40..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewSessionState.cpp
+++ /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.
- *
- */
-#include "PreviewSessionState.h"
-#include "PreviewSessionManager.h"
-#include "PreviewSessionHandler.h"
-#include "ConnectionState.h"
-#include "Broker.h"
-#include "SemanticHandler.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace broker {
-
-using namespace framing;
-using sys::Mutex;
-using qpid::management::ManagementAgent;
-using qpid::management::ManagementObject;
-using qpid::management::Manageable;
-using qpid::management::Args;
-
-PreviewSessionState::PreviewSessionState(
- PreviewSessionManager* f, PreviewSessionHandler* h, uint32_t timeout_, uint32_t ack)
- : framing::SessionState(ack, timeout_ > 0),
- factory(f), handler(h), id(true), timeout(timeout_),
- broker(h->getConnection().broker),
- version(h->getConnection().getVersion()),
- semanticHandler(new SemanticHandler(*this))
-{
- in.next = semanticHandler.get();
- out.next = &handler->out;
-
- getConnection().outputTasks.addOutputTask(&semanticHandler->getSemanticState());
-
- Manageable* parent = broker.GetVhostObject ();
-
- if (parent != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
-
- if (agent.get () != 0)
- {
- mgmtObject = management::Session::shared_ptr
- (new management::Session (this, parent, id.str ()));
- mgmtObject->set_attached (1);
- mgmtObject->set_clientRef (h->getConnection().GetManagementObject()->getObjectId());
- mgmtObject->set_channelId (h->getChannel());
- mgmtObject->set_detachedLifespan (getTimeout());
- agent->addObject (mgmtObject);
- }
- }
-}
-
-PreviewSessionState::~PreviewSessionState() {
- // Remove ID from active session list.
- if (factory)
- factory->erase(getId());
- if (mgmtObject.get () != 0)
- mgmtObject->resourceDestroy ();
-}
-
-PreviewSessionHandler* PreviewSessionState::getHandler() {
- return handler;
-}
-
-AMQP_ClientProxy& PreviewSessionState::getProxy() {
- assert(isAttached());
- return getHandler()->getProxy();
-}
-
-ConnectionState& PreviewSessionState::getConnection() {
- assert(isAttached());
- return getHandler()->getConnection();
-}
-
-void PreviewSessionState::detach() {
- getConnection().outputTasks.removeOutputTask(&semanticHandler->getSemanticState());
- Mutex::ScopedLock l(lock);
- handler = 0; out.next = 0;
- if (mgmtObject.get() != 0)
- {
- mgmtObject->set_attached (0);
- }
-}
-
-void PreviewSessionState::attach(PreviewSessionHandler& h) {
- {
- Mutex::ScopedLock l(lock);
- handler = &h;
- out.next = &handler->out;
- if (mgmtObject.get() != 0)
- {
- mgmtObject->set_attached (1);
- mgmtObject->set_clientRef (h.getConnection().GetManagementObject()->getObjectId());
- mgmtObject->set_channelId (h.getChannel());
- }
- }
- h.getConnection().outputTasks.addOutputTask(&semanticHandler->getSemanticState());
-}
-
-void PreviewSessionState::activateOutput()
-{
- Mutex::ScopedLock l(lock);
- if (isAttached()) {
- getConnection().outputTasks.activateOutput();
- }
-}
- //This class could be used as the callback for queue notifications
- //if not attached, it can simply ignore the callback, else pass it
- //on to the connection
-
-ManagementObject::shared_ptr PreviewSessionState::GetManagementObject (void) const
-{
- return dynamic_pointer_cast<ManagementObject> (mgmtObject);
-}
-
-Manageable::status_t PreviewSessionState::ManagementMethod (uint32_t methodId,
- Args& /*args*/)
-{
- Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
-
- switch (methodId)
- {
- case management::Session::METHOD_DETACH :
- if (handler != 0)
- {
- handler->detach();
- }
- status = Manageable::STATUS_OK;
- break;
-
- case management::Session::METHOD_CLOSE :
- /*
- if (handler != 0)
- {
- handler->getConnection().closeChannel(handler->getChannel());
- }
- status = Manageable::STATUS_OK;
- break;
- */
-
- case management::Session::METHOD_SOLICITACK :
- case management::Session::METHOD_RESETLIFESPAN :
- status = Manageable::STATUS_NOT_IMPLEMENTED;
- break;
- }
-
- return status;
-}
-
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/PreviewSessionState.h b/qpid/cpp/src/qpid/broker/PreviewSessionState.h
deleted file mode 100644
index 6e8523317c..0000000000
--- a/qpid/cpp/src/qpid/broker/PreviewSessionState.h
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef QPID_BROKER_PREVIEWSESSION_H
-#define QPID_BROKER_PREVIEWSESSION_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/Uuid.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/SessionState.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/Time.h"
-#include "qpid/management/Manageable.h"
-#include "qpid/management/Session.h"
-#include "SessionContext.h"
-
-#include <boost/noncopyable.hpp>
-#include <boost/scoped_ptr.hpp>
-
-#include <set>
-#include <vector>
-#include <ostream>
-
-namespace qpid {
-
-namespace framing {
-class AMQP_ClientProxy;
-}
-
-namespace broker {
-
-class SemanticHandler;
-class PreviewSessionHandler;
-class PreviewSessionManager;
-class Broker;
-class ConnectionState;
-
-/**
- * Broker-side session state includes sessions handler chains, which may
- * themselves have state.
- */
-class PreviewSessionState : public framing::SessionState,
- public SessionContext,
- public framing::FrameHandler::Chains,
- public management::Manageable
-{
- public:
- ~PreviewSessionState();
- bool isAttached() { return handler; }
-
- void detach();
- void attach(PreviewSessionHandler& handler);
-
-
- PreviewSessionHandler* getHandler();
-
- /** @pre isAttached() */
- framing::AMQP_ClientProxy& getProxy();
-
- /** @pre isAttached() */
- ConnectionState& getConnection();
-
- uint32_t getTimeout() const { return timeout; }
- Broker& getBroker() { return broker; }
- framing::ProtocolVersion getVersion() const { return version; }
-
- /** OutputControl **/
- void activateOutput();
-
- // Manageable entry points
- management::ManagementObject::shared_ptr GetManagementObject (void) const;
- management::Manageable::status_t
- ManagementMethod (uint32_t methodId, management::Args& args);
-
- // Normally SessionManager creates sessions.
- PreviewSessionState(PreviewSessionManager*,
- PreviewSessionHandler* out,
- uint32_t timeout,
- uint32_t ackInterval);
-
-
- private:
- PreviewSessionManager* factory;
- PreviewSessionHandler* handler;
- framing::Uuid id;
- uint32_t timeout;
- sys::AbsTime expiry; // Used by SessionManager.
- Broker& broker;
- framing::ProtocolVersion version;
- sys::Mutex lock;
- boost::scoped_ptr<SemanticHandler> semanticHandler;
- management::Session::shared_ptr mgmtObject;
-
- friend class PreviewSessionManager;
-};
-
-
-inline std::ostream& operator<<(std::ostream& out, const PreviewSessionState& session) {
- return out << session.getId();
-}
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!QPID_BROKER_SESSION_H*/
diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp
deleted file mode 100644
index abe4f3f9a5..0000000000
--- a/qpid/cpp/src/qpid/broker/Queue.cpp
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/log/Statement.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "Broker.h"
-#include "Queue.h"
-#include "Exchange.h"
-#include "DeliverableMessage.h"
-#include "MessageStore.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid/sys/Time.h"
-#include <iostream>
-#include <boost/bind.hpp>
-#include "QueueRegistry.h"
-#include <algorithm>
-#include <functional>
-
-using namespace qpid::broker;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using qpid::management::ManagementAgent;
-using qpid::management::ManagementObject;
-using qpid::management::Manageable;
-using qpid::management::Args;
-using std::for_each;
-using std::mem_fun;
-
-Queue::Queue(const string& _name, bool _autodelete,
- MessageStore* const _store,
- const ConnectionToken* const _owner,
- Manageable* parent) :
-
- name(_name),
- autodelete(_autodelete),
- store(_store),
- owner(_owner),
- consumerCount(0),
- exclusive(false),
- persistenceId(0)
-{
- if (parent != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
-
- if (agent.get () != 0)
- {
- mgmtObject = management::Queue::shared_ptr
- (new management::Queue (this, parent, _name, _store != 0, _autodelete, 0));
-
- // Add the object to the management agent only if this queue is not durable.
- // If it's durable, we will add it later when the queue is assigned a persistenceId.
- if (store == 0)
- agent->addObject (mgmtObject);
- }
- }
-}
-
-Queue::~Queue()
-{
- if (mgmtObject.get () != 0)
- mgmtObject->resourceDestroy ();
-}
-
-void Queue::notifyDurableIOComplete()
-{
- Mutex::ScopedLock locker(messageLock);
- notify();
-}
-
-
-void Queue::deliver(intrusive_ptr<Message>& msg){
- if (msg->isImmediate() && getConsumerCount() == 0) {
- if (alternateExchange) {
- DeliverableMessage deliverable(msg);
- alternateExchange->route(deliverable, msg->getRoutingKey(), msg->getApplicationHeaders());
- }
- } else {
-
-
- // if no store then mark as enqueued
- if (!enqueue(0, msg)){
- push(msg);
- msg->enqueueComplete();
- if (mgmtObject.get() != 0) {
- Mutex::ScopedLock alock(mgmtObject->accessorLock);
- mgmtObject->inc_msgTotalEnqueues ();
- mgmtObject->inc_byteTotalEnqueues (msg->contentSize ());
- mgmtObject->inc_msgDepth ();
- mgmtObject->inc_byteDepth (msg->contentSize ());
- }
- }else {
- if (mgmtObject.get() != 0) {
- Mutex::ScopedLock alock(mgmtObject->accessorLock);
- mgmtObject->inc_msgTotalEnqueues ();
- mgmtObject->inc_byteTotalEnqueues (msg->contentSize ());
- mgmtObject->inc_msgDepth ();
- mgmtObject->inc_byteDepth (msg->contentSize ());
- mgmtObject->inc_msgPersistEnqueues ();
- mgmtObject->inc_bytePersistEnqueues (msg->contentSize ());
- }
- push(msg);
- }
- QPID_LOG(debug, "Message " << msg << " enqueued on " << name << "[" << this << "]");
- }
-}
-
-
-void Queue::recover(intrusive_ptr<Message>& msg){
- push(msg);
- msg->enqueueComplete(); // mark the message as enqueued
- if (mgmtObject.get() != 0) {
- Mutex::ScopedLock alock(mgmtObject->accessorLock);
- mgmtObject->inc_msgTotalEnqueues ();
- mgmtObject->inc_byteTotalEnqueues (msg->contentSize ());
- mgmtObject->inc_msgPersistEnqueues ();
- mgmtObject->inc_bytePersistEnqueues (msg->contentSize ());
- mgmtObject->inc_msgDepth ();
- mgmtObject->inc_byteDepth (msg->contentSize ());
- }
-
- if (store && !msg->isContentLoaded()) {
- //content has not been loaded, need to ensure that lazy loading mode is set:
- //TODO: find a nicer way to do this
- msg->releaseContent(store);
- }
-}
-
-void Queue::process(intrusive_ptr<Message>& msg){
- push(msg);
- if (mgmtObject.get() != 0) {
- Mutex::ScopedLock alock(mgmtObject->accessorLock);
- mgmtObject->inc_msgTotalEnqueues ();
- mgmtObject->inc_byteTotalEnqueues (msg->contentSize ());
- mgmtObject->inc_msgTxnEnqueues ();
- mgmtObject->inc_byteTxnEnqueues (msg->contentSize ());
- mgmtObject->inc_msgDepth ();
- mgmtObject->inc_byteDepth (msg->contentSize ());
- if (msg->isPersistent ()) {
- mgmtObject->inc_msgPersistEnqueues ();
- mgmtObject->inc_bytePersistEnqueues (msg->contentSize ());
- }
- }
-}
-
-void Queue::requeue(const QueuedMessage& msg){
- Mutex::ScopedLock locker(messageLock);
- msg.payload->enqueueComplete(); // mark the message as enqueued
- messages.push_front(msg);
- notify();
-}
-
-bool Queue::acquire(const QueuedMessage& msg) {
- Mutex::ScopedLock locker(messageLock);
- QPID_LOG(debug, "attempting to acquire " << msg.position);
- for (Messages::iterator i = messages.begin(); i != messages.end(); i++) {
- if (i->position == msg.position) {
- messages.erase(i);
- QPID_LOG(debug, "Match found, acquire succeeded: " << i->position << " == " << msg.position);
- return true;
- } else {
- QPID_LOG(debug, "No match: " << i->position << " != " << msg.position);
- }
- }
- QPID_LOG(debug, "Acquire failed for " << msg.position);
- return false;
-}
-
-/**
- * Return true if the message can be excluded. This is currently the
- * case if the queue is exclusive and has an exclusive consumer that
- * doesn't want the message or has a single consumer that doesn't want
- * the message (covers the JMS topic case).
- */
-bool Queue::canExcludeUnwanted()
-{
- Mutex::ScopedLock locker(consumerLock);
- return hasExclusiveOwner() && (exclusive || consumerCount == 1);
-}
-
-
-bool Queue::getNextMessage(QueuedMessage& m, Consumer& c)
-{
- if (c.preAcquires()) {
- return consumeNextMessage(m, c);
- } else {
- return browseNextMessage(m, c);
- }
-}
-
-bool Queue::consumeNextMessage(QueuedMessage& m, Consumer& c)
-{
- while (true) {
- Mutex::ScopedLock locker(messageLock);
- if (messages.empty()) {
- QPID_LOG(debug, "No messages to dispatch on queue '" << name << "'");
- addListener(c);
- return false;
- } else {
- QueuedMessage msg = messages.front();
- if (!msg.payload->isEnqueueComplete()) {
- QPID_LOG(debug, "Messages not ready to dispatch on queue '" << name << "'");
- addListener(c);
- return false;
- }
-
- if (c.filter(msg.payload)) {
- if (c.accept(msg.payload)) {
- m = msg;
- pop();
- return true;
- } else {
- //message(s) are available but consumer hasn't got enough credit
- QPID_LOG(debug, "Consumer can't currently accept message from '" << name << "'");
- return false;
- }
- } else {
- //consumer will never want this message
- if (canExcludeUnwanted()) {
- //hack for no-local on JMS topics; get rid of this message
- QPID_LOG(debug, "Excluding message from '" << name << "'");
- pop();
- } else {
- //leave it for another consumer
- QPID_LOG(debug, "Consumer doesn't want message from '" << name << "'");
- return false;
- }
- }
- }
- }
-}
-
-
-bool Queue::browseNextMessage(QueuedMessage& m, Consumer& c)
-{
- QueuedMessage msg(this);
- while (seek(msg, c)) {
- if (c.filter(msg.payload)) {
- if (c.accept(msg.payload)) {
- //consumer wants the message
- c.position = msg.position;
- m = msg;
- return true;
- } else {
- //browser hasn't got enough credit for the message
- QPID_LOG(debug, "Browser can't currently accept message from '" << name << "'");
- return false;
- }
- } else {
- //consumer will never want this message, continue seeking
- c.position = msg.position;
- QPID_LOG(debug, "Browser skipping message from '" << name << "'");
- }
- }
- return false;
-}
-
-void Queue::notify()
-{
- //notify listeners that there may be messages to process
- for_each(listeners.begin(), listeners.end(), mem_fun(&Consumer::notify));
- listeners.clear();
-}
-
-void Queue::removeListener(Consumer& c)
-{
- Mutex::ScopedLock locker(messageLock);
- listeners.erase(&c);
-}
-
-void Queue::addListener(Consumer& c)
-{
- listeners.insert(&c);
-}
-
-bool Queue::dispatch(Consumer& c)
-{
- QueuedMessage msg(this);
- if (getNextMessage(msg, c)) {
- c.deliver(msg);
- return true;
- } else {
- return false;
- }
-}
-
-bool Queue::seek(QueuedMessage& msg, Consumer& c) {
- Mutex::ScopedLock locker(messageLock);
- if (!messages.empty() && messages.back().position > c.position) {
- if (c.position < messages.front().position) {
- msg = messages.front();
- return true;
- } else {
- //TODO: can improve performance of this search, for now just searching linearly from end
- Messages::reverse_iterator pos;
- for (Messages::reverse_iterator i = messages.rbegin(); i != messages.rend() && i->position > c.position; i++) {
- pos = i;
- }
- msg = *pos;
- return true;
- }
- }
- addListener(c);
- return false;
-}
-
-void Queue::consume(Consumer&, bool requestExclusive){
- Mutex::ScopedLock locker(consumerLock);
- if(exclusive) {
- throw AccessRefusedException(
- QPID_MSG("Queue " << getName() << " has an exclusive consumer. No more consumers allowed."));
- } else if(requestExclusive) {
- if(consumerCount) {
- throw AccessRefusedException(
- QPID_MSG("Queue " << getName() << " already has consumers. Exclusive access denied."));
- } else {
- exclusive = true;
- }
- }
- consumerCount++;
-
- if (mgmtObject.get() != 0){
- Mutex::ScopedLock alock(mgmtObject->accessorLock);
- mgmtObject->inc_consumers ();
- }
-}
-
-void Queue::cancel(Consumer& c){
- removeListener(c);
- Mutex::ScopedLock locker(consumerLock);
- consumerCount--;
- if(exclusive) exclusive = false;
- if (mgmtObject.get() != 0){
- Mutex::ScopedLock alock(mgmtObject->accessorLock);
- mgmtObject->dec_consumers ();
- }
-}
-
-QueuedMessage Queue::dequeue(){
- Mutex::ScopedLock locker(messageLock);
- QueuedMessage msg(this);
-
- if(!messages.empty()){
- msg = messages.front();
- pop();
- }
- return msg;
-}
-
-uint32_t Queue::purge(){
- Mutex::ScopedLock locker(messageLock);
- int count = messages.size();
- while(!messages.empty()) pop();
- return count;
-}
-
-/**
- * Assumes messageLock is held
- */
-void Queue::pop(){
- QueuedMessage& msg = messages.front();
-
- if (policy.get()) policy->dequeued(msg.payload->contentSize());
- if (mgmtObject.get() != 0){
- Mutex::ScopedLock alock(mgmtObject->accessorLock);
- mgmtObject->inc_msgTotalDequeues ();
- mgmtObject->inc_byteTotalDequeues (msg.payload->contentSize());
- mgmtObject->dec_msgDepth ();
- mgmtObject->dec_byteDepth (msg.payload->contentSize());
- if (msg.payload->isPersistent ()){
- mgmtObject->inc_msgPersistDequeues ();
- mgmtObject->inc_bytePersistDequeues (msg.payload->contentSize());
- }
- }
- messages.pop_front();
-}
-
-void Queue::push(intrusive_ptr<Message>& msg){
- Mutex::ScopedLock locker(messageLock);
- messages.push_back(QueuedMessage(this, msg, ++sequence));
- if (policy.get()) {
- policy->enqueued(msg->contentSize());
- if (policy->limitExceeded()) {
- if (store) {
- QPID_LOG(debug, "Message " << msg << " on " << name << " released from memory");
- msg->releaseContent(store);
- } else {
- QPID_LOG(warning, "Message " << msg << " on " << name
- << " exceeds the policy for the queue but can't be released from memory as the queue is not durable");
- }
- }
- }
- notify();
-}
-
-/** function only provided for unit tests, or code not in critical message path */
-uint32_t Queue::getMessageCount() const{
- Mutex::ScopedLock locker(messageLock);
-
- uint32_t count =0;
- for ( Messages::const_iterator i = messages.begin(); i != messages.end(); ++i ) {
- if ( i->payload->isEnqueueComplete() ) count ++;
- }
-
- return count;
-}
-
-uint32_t Queue::getConsumerCount() const{
- Mutex::ScopedLock locker(consumerLock);
- return consumerCount;
-}
-
-bool Queue::canAutoDelete() const{
- Mutex::ScopedLock locker(consumerLock);
- return autodelete && !consumerCount;
-}
-
-// return true if store exists,
-bool Queue::enqueue(TransactionContext* ctxt, intrusive_ptr<Message> msg)
-{
- if (msg->isPersistent() && store) {
- msg->enqueueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue
- intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
- store->enqueue(ctxt, pmsg, *this);
- return true;
- }
- //msg->enqueueAsync(); // increments intrusive ptr cnt
- return false;
-}
-
-// return true if store exists,
-bool Queue::dequeue(TransactionContext* ctxt, intrusive_ptr<Message> msg)
-{
- if (msg->isPersistent() && store) {
- msg->dequeueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue
- intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
- store->dequeue(ctxt, pmsg, *this);
- return true;
- }
- //msg->dequeueAsync(); // decrements intrusive ptr cnt
- return false;
-}
-
-
-namespace
-{
- const std::string qpidMaxSize("qpid.max_size");
- const std::string qpidMaxCount("qpid.max_count");
-}
-
-void Queue::create(const FieldTable& _settings)
-{
- settings = _settings;
- //TODO: hold onto settings and persist them as part of encode
- // in fact settings should be passed in on construction
- if (store) {
- store->create(*this);
- }
- configure(_settings);
-}
-
-void Queue::configure(const FieldTable& _settings)
-{
- std::auto_ptr<QueuePolicy> _policy(new QueuePolicy(_settings));
- if (_policy->getMaxCount() || _policy->getMaxSize())
- setPolicy(_policy);
-}
-
-void Queue::destroy()
-{
- if (alternateExchange.get()) {
- Mutex::ScopedLock locker(messageLock);
- while(!messages.empty()){
- DeliverableMessage msg(messages.front().payload);
- alternateExchange->route(msg, msg.getMessage().getRoutingKey(),
- msg.getMessage().getApplicationHeaders());
- pop();
- }
- alternateExchange->decAlternateUsers();
- }
-
- if (store) {
- store->flush(*this);
- store->destroy(*this);
- store = 0;//ensure we make no more calls to the store for this queue
- }
-}
-
-void Queue::bound(const string& exchange, const string& key,
- const FieldTable& args)
-{
- bindings.add(exchange, key, args);
-}
-
-void Queue::unbind(ExchangeRegistry& exchanges, Queue::shared_ptr shared_ref)
-{
- bindings.unbind(exchanges, shared_ref);
-}
-
-void Queue::setPolicy(std::auto_ptr<QueuePolicy> _policy)
-{
- policy = _policy;
-}
-
-const QueuePolicy* const Queue::getPolicy()
-{
- return policy.get();
-}
-
-uint64_t Queue::getPersistenceId() const
-{
- return persistenceId;
-}
-
-void Queue::setPersistenceId(uint64_t _persistenceId) const
-{
- if (mgmtObject != 0 && persistenceId == 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
- agent->addObject (mgmtObject, _persistenceId);
- }
- persistenceId = _persistenceId;
-}
-
-void Queue::encode(framing::Buffer& buffer) const
-{
- buffer.putShortString(name);
- buffer.put(settings);
-}
-
-uint32_t Queue::encodedSize() const
-{
- return name.size() + 1/*short string size octet*/ + settings.size();
-}
-
-Queue::shared_ptr Queue::decode(QueueRegistry& queues, framing::Buffer& buffer)
-{
- string name;
- buffer.getShortString(name);
- std::pair<Queue::shared_ptr, bool> result = queues.declare(name, true);
- buffer.get(result.first->settings);
- result.first->configure(result.first->settings);
- return result.first;
-}
-
-
-void Queue::setAlternateExchange(boost::shared_ptr<Exchange> exchange)
-{
- alternateExchange = exchange;
-}
-
-boost::shared_ptr<Exchange> Queue::getAlternateExchange()
-{
- return alternateExchange;
-}
-
-void Queue::tryAutoDelete(Broker& broker, Queue::shared_ptr queue)
-{
- if (broker.getQueues().destroyIf(queue->getName(),
- boost::bind(boost::mem_fn(&Queue::canAutoDelete), queue))) {
- queue->unbind(broker.getExchanges(), queue);
- queue->destroy();
- }
-
-}
-
-bool Queue::isExclusiveOwner(const ConnectionToken* const o) const
-{
- Mutex::ScopedLock locker(ownershipLock);
- return o == owner;
-}
-
-void Queue::releaseExclusiveOwnership()
-{
- Mutex::ScopedLock locker(ownershipLock);
- owner = 0;
-}
-
-bool Queue::setExclusiveOwner(const ConnectionToken* const o)
-{
- Mutex::ScopedLock locker(ownershipLock);
- if (owner) {
- return false;
- } else {
- owner = o;
- return true;
- }
-}
-
-bool Queue::hasExclusiveOwner() const
-{
- Mutex::ScopedLock locker(ownershipLock);
- return owner != 0;
-}
-
-bool Queue::hasExclusiveConsumer() const
-{
- return exclusive;
-}
-
-ManagementObject::shared_ptr Queue::GetManagementObject (void) const
-{
- return dynamic_pointer_cast<ManagementObject> (mgmtObject);
-}
-
-Manageable::status_t Queue::ManagementMethod (uint32_t methodId,
- Args& /*args*/)
-{
- Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
-
- QPID_LOG (debug, "Queue::ManagementMethod [id=" << methodId << "]");
-
- switch (methodId)
- {
- case management::Queue::METHOD_PURGE :
- purge ();
- status = Manageable::STATUS_OK;
- break;
- }
-
- return status;
-}
diff --git a/qpid/cpp/src/qpid/broker/Queue.h b/qpid/cpp/src/qpid/broker/Queue.h
deleted file mode 100644
index aaae175be8..0000000000
--- a/qpid/cpp/src/qpid/broker/Queue.h
+++ /dev/null
@@ -1,189 +0,0 @@
-#ifndef _broker_Queue_h
-#define _broker_Queue_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <vector>
-#include <memory>
-#include <deque>
-#include <set>
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-#include "qpid/framing/amqp_types.h"
-#include "ConnectionToken.h"
-#include "Consumer.h"
-#include "Message.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/sys/Serializer.h"
-#include "qpid/sys/Monitor.h"
-#include "PersistableQueue.h"
-#include "QueuePolicy.h"
-#include "QueueBindings.h"
-#include "qpid/management/Manageable.h"
-#include "qpid/management/Queue.h"
-
-namespace qpid {
- namespace broker {
- class Broker;
- class MessageStore;
- class QueueRegistry;
- class TransactionContext;
- class Exchange;
-
- using std::string;
-
- /**
- * The brokers representation of an amqp queue. Messages are
- * delivered to a queue from where they can be dispatched to
- * registered consumers or be stored until dequeued or until one
- * or more consumers registers.
- */
- class Queue : public boost::enable_shared_from_this<Queue>, public PersistableQueue, public management::Manageable {
- typedef std::set<Consumer*> Listeners;
- typedef std::deque<QueuedMessage> Messages;
-
- const string name;
- const bool autodelete;
- MessageStore* store;
- const ConnectionToken* owner;
- uint32_t consumerCount;
- bool exclusive;
- Listeners listeners;
- Messages messages;
- mutable qpid::sys::Mutex consumerLock;
- mutable qpid::sys::Mutex messageLock;
- mutable qpid::sys::Mutex ownershipLock;
- mutable uint64_t persistenceId;
- framing::FieldTable settings;
- std::auto_ptr<QueuePolicy> policy;
- QueueBindings bindings;
- boost::shared_ptr<Exchange> alternateExchange;
- framing::SequenceNumber sequence;
- management::Queue::shared_ptr mgmtObject;
-
- void pop();
- void push(intrusive_ptr<Message>& msg);
- void setPolicy(std::auto_ptr<QueuePolicy> policy);
- bool seek(QueuedMessage& msg, Consumer& position);
- bool getNextMessage(QueuedMessage& msg, Consumer& c);
- bool consumeNextMessage(QueuedMessage& msg, Consumer& c);
- bool browseNextMessage(QueuedMessage& msg, Consumer& c);
- bool canExcludeUnwanted();
-
- void notify();
- void removeListener(Consumer&);
- void addListener(Consumer&);
-
- public:
- virtual void notifyDurableIOComplete();
- typedef boost::shared_ptr<Queue> shared_ptr;
-
- typedef std::vector<shared_ptr> vector;
-
- Queue(const string& name, bool autodelete = false,
- MessageStore* const store = 0,
- const ConnectionToken* const owner = 0,
- Manageable* parent = 0);
- ~Queue();
-
- bool dispatch(Consumer&);
-
- void create(const qpid::framing::FieldTable& settings);
- void configure(const qpid::framing::FieldTable& settings);
- void destroy();
- void bound(const string& exchange, const string& key, const qpid::framing::FieldTable& args);
- void unbind(ExchangeRegistry& exchanges, Queue::shared_ptr shared_ref);
-
- bool acquire(const QueuedMessage& msg);
-
- /**
- * Delivers a message to the queue. Will record it as
- * enqueued if persistent then process it.
- */
- void deliver(intrusive_ptr<Message>& msg);
- /**
- * Dispatches the messages immediately to a consumer if
- * one is available or stores it for later if not.
- */
- void process(intrusive_ptr<Message>& msg);
- /**
- * Returns a message to the in-memory queue (due to lack
- * of acknowledegement from a receiver). If a consumer is
- * available it will be dispatched immediately, else it
- * will be returned to the front of the queue.
- */
- void requeue(const QueuedMessage& msg);
- /**
- * Used during recovery to add stored messages back to the queue
- */
- void recover(intrusive_ptr<Message>& msg);
-
- void consume(Consumer& c, bool exclusive = false);
- void cancel(Consumer& c);
-
- uint32_t purge();
- uint32_t getMessageCount() const;
- uint32_t getConsumerCount() const;
- inline const string& getName() const { return name; }
- bool isExclusiveOwner(const ConnectionToken* const o) const;
- void releaseExclusiveOwnership();
- bool setExclusiveOwner(const ConnectionToken* const o);
- bool hasExclusiveConsumer() const;
- bool hasExclusiveOwner() const;
- inline bool isDurable() const { return store != 0; }
- inline const framing::FieldTable& getSettings() const { return settings; }
- inline bool isAutoDelete() const { return autodelete; }
- bool canAutoDelete() const;
-
- bool enqueue(TransactionContext* ctxt, intrusive_ptr<Message> msg);
- /**
- * dequeue from store (only done once messages is acknowledged)
- */
- bool dequeue(TransactionContext* ctxt, intrusive_ptr<Message> msg);
- /**
- * dequeues from memory only
- */
- QueuedMessage dequeue();
-
- const QueuePolicy* const getPolicy();
-
- void setAlternateExchange(boost::shared_ptr<Exchange> exchange);
- boost::shared_ptr<Exchange> getAlternateExchange();
-
- //PersistableQueue support:
- uint64_t getPersistenceId() const;
- void setPersistenceId(uint64_t persistenceId) const;
- void encode(framing::Buffer& buffer) const;
- uint32_t encodedSize() const;
-
- static Queue::shared_ptr decode(QueueRegistry& queues, framing::Buffer& buffer);
- static void tryAutoDelete(Broker& broker, Queue::shared_ptr);
-
- // Manageable entry points
- management::ManagementObject::shared_ptr GetManagementObject (void) const;
- management::Manageable::status_t
- ManagementMethod (uint32_t methodId, management::Args& args);
- };
- }
-}
-
-
-#endif /*!_broker_Queue_h*/
diff --git a/qpid/cpp/src/qpid/broker/QueueBindings.cpp b/qpid/cpp/src/qpid/broker/QueueBindings.cpp
deleted file mode 100644
index e2fcd493db..0000000000
--- a/qpid/cpp/src/qpid/broker/QueueBindings.cpp
+++ /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.
- *
- */
-#include "QueueBindings.h"
-#include "ExchangeRegistry.h"
-
-using qpid::framing::FieldTable;
-using std::string;
-using namespace qpid::broker;
-
-void QueueBindings::add(const string& exchange, const string& key, const FieldTable& args)
-{
- bindings.push_back(new Binding(exchange, key, args));
-}
-
-void QueueBindings::unbind(ExchangeRegistry& exchanges, Queue::shared_ptr queue)
-{
- for (Bindings::iterator i = bindings.begin(); i != bindings.end(); i++) {
- try {
- exchanges.get(i->exchange)->unbind(queue, i->key, &(i->args));
- } catch (ChannelException&) {
- }
- }
-}
-
-QueueBindings::Binding::Binding(const string& _exchange, const string& _key, const FieldTable& _args)
- : exchange(_exchange), key(_key), args(_args)
-{}
diff --git a/qpid/cpp/src/qpid/broker/QueueBindings.h b/qpid/cpp/src/qpid/broker/QueueBindings.h
deleted file mode 100644
index b9b0f7c15c..0000000000
--- a/qpid/cpp/src/qpid/broker/QueueBindings.h
+++ /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.
- *
- */
-#ifndef _QueueBindings_
-#define _QueueBindings_
-
-#include "qpid/framing/FieldTable.h"
-#include <boost/ptr_container/ptr_list.hpp>
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace broker {
-
-class ExchangeRegistry;
-class Queue;
-class QueueBindings
-{
- struct Binding{
- const std::string exchange;
- const std::string key;
- const qpid::framing::FieldTable args;
- Binding(const std::string& exchange, const std::string& key, const qpid::framing::FieldTable& args);
- };
-
- typedef boost::ptr_list<Binding> Bindings;
- Bindings bindings;
-
-public:
- void add(const std::string& exchange, const std::string& key, const qpid::framing::FieldTable& args);
- void unbind(ExchangeRegistry& exchanges, boost::shared_ptr<Queue> queue);
-};
-
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/QueuePolicy.cpp b/qpid/cpp/src/qpid/broker/QueuePolicy.cpp
deleted file mode 100644
index 9b9717def0..0000000000
--- a/qpid/cpp/src/qpid/broker/QueuePolicy.cpp
+++ /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.
- *
- */
-#include "QueuePolicy.h"
-#include "qpid/framing/FieldValue.h"
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-QueuePolicy::QueuePolicy(uint32_t _maxCount, uint64_t _maxSize) :
- maxCount(_maxCount), maxSize(_maxSize), count(0), size(0) {}
-
-QueuePolicy::QueuePolicy(const FieldTable& settings) :
- maxCount(getInt(settings, maxCountKey, 0)),
- maxSize(getInt(settings, maxSizeKey, 0)), count(0), size(0) {}
-
-void QueuePolicy::enqueued(uint64_t _size)
-{
- if (maxCount) count++;
- if (maxSize) size += _size;
-}
-
-void QueuePolicy::dequeued(uint64_t _size)
-{
- if (maxCount) count--;
- if (maxSize) size -= _size;
-}
-
-bool QueuePolicy::limitExceeded()
-{
- return (maxSize && size > maxSize) || (maxCount && count > maxCount);
-}
-
-void QueuePolicy::update(FieldTable& settings)
-{
- if (maxCount) settings.setInt(maxCountKey, maxCount);
- if (maxSize) settings.setInt(maxSizeKey, maxSize);
-}
-
-
-int QueuePolicy::getInt(const FieldTable& settings, const std::string& key, int defaultValue)
-{
- //Note: currently field table only contain signed 32 bit ints, which
- // restricts the values that can be set on the queue policy.
- try {
- return settings.getInt(key);
- } catch (FieldValueException& ignore) {
- return defaultValue;
- }
-}
-
-const std::string QueuePolicy::maxCountKey("qpid.max_count");
-const std::string QueuePolicy::maxSizeKey("qpid.max_size");
diff --git a/qpid/cpp/src/qpid/broker/QueuePolicy.h b/qpid/cpp/src/qpid/broker/QueuePolicy.h
deleted file mode 100644
index 0cc7070e09..0000000000
--- a/qpid/cpp/src/qpid/broker/QueuePolicy.h
+++ /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.
- *
- */
-#ifndef _QueuePolicy_
-#define _QueuePolicy_
-
-#include "qpid/framing/FieldTable.h"
-
-namespace qpid {
- namespace broker {
- class QueuePolicy
- {
- static const std::string maxCountKey;
- static const std::string maxSizeKey;
-
- const uint32_t maxCount;
- const uint64_t maxSize;
- uint32_t count;
- uint64_t size;
-
- static int getInt(const qpid::framing::FieldTable& settings, const std::string& key, int defaultValue);
-
- public:
- QueuePolicy(uint32_t maxCount, uint64_t maxSize);
- QueuePolicy(const qpid::framing::FieldTable& settings);
- void enqueued(uint64_t size);
- void dequeued(uint64_t size);
- void update(qpid::framing::FieldTable& settings);
- bool limitExceeded();
- uint32_t getMaxCount() const { return maxCount; }
- uint64_t getMaxSize() const { return maxSize; }
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/QueueRegistry.cpp b/qpid/cpp/src/qpid/broker/QueueRegistry.cpp
deleted file mode 100644
index 14d5f362e3..0000000000
--- a/qpid/cpp/src/qpid/broker/QueueRegistry.cpp
+++ /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.
- *
- */
-#include "QueueRegistry.h"
-#include "qpid/log/Statement.h"
-#include <sstream>
-#include <assert.h>
-
-using namespace qpid::broker;
-using namespace qpid::sys;
-
-QueueRegistry::QueueRegistry() :
- counter(1), store(0), parent(0) {}
-
-QueueRegistry::~QueueRegistry(){}
-
-std::pair<Queue::shared_ptr, bool>
-QueueRegistry::declare(const string& declareName, bool durable,
- bool autoDelete, const ConnectionToken* owner)
-{
- RWlock::ScopedWlock locker(lock);
- string name = declareName.empty() ? generateName() : declareName;
- assert(!name.empty());
- QueueMap::iterator i = queues.find(name);
-
- if (i == queues.end()) {
- Queue::shared_ptr queue(new Queue(name, autoDelete, durable ? store : 0, owner, parent));
- queues[name] = queue;
-
- return std::pair<Queue::shared_ptr, bool>(queue, true);
- } else {
- return std::pair<Queue::shared_ptr, bool>(i->second, false);
- }
-}
-
-void QueueRegistry::destroyLH (const string& name){
- queues.erase(name);
-}
-
-void QueueRegistry::destroy (const string& name){
- RWlock::ScopedWlock locker(lock);
- destroyLH (name);
-}
-
-Queue::shared_ptr QueueRegistry::find(const string& name){
- RWlock::ScopedRlock locker(lock);
- QueueMap::iterator i = queues.find(name);
-
- if (i == queues.end()) {
- return Queue::shared_ptr();
- } else {
- return i->second;
- }
-}
-
-string QueueRegistry::generateName(){
- string name;
- do {
- std::stringstream ss;
- ss << "tmp_" << counter++;
- name = ss.str();
- // Thread safety: Private function, only called with lock held
- // so this is OK.
- } while(queues.find(name) != queues.end());
- return name;
-}
-
-void QueueRegistry::setStore (MessageStore* _store)
-{
- assert (store == 0 && _store != 0);
- store = _store;
-}
-
-MessageStore* QueueRegistry::getStore() const {
- return store;
-}
diff --git a/qpid/cpp/src/qpid/broker/QueueRegistry.h b/qpid/cpp/src/qpid/broker/QueueRegistry.h
deleted file mode 100644
index ccccef31b5..0000000000
--- a/qpid/cpp/src/qpid/broker/QueueRegistry.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _QueueRegistry_
-#define _QueueRegistry_
-
-#include <map>
-#include "qpid/sys/Mutex.h"
-#include "Queue.h"
-#include "qpid/management/Manageable.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * A registry of queues indexed by queue name.
- *
- * Queues are reference counted using shared_ptr to ensure that they
- * are deleted when and only when they are no longer in use.
- *
- */
-class QueueRegistry{
- public:
- QueueRegistry();
- ~QueueRegistry();
-
- /**
- * Declare a queue.
- *
- * @return The queue and a boolean flag which is true if the queue
- * was created by this declare call false if it already existed.
- */
- std::pair<Queue::shared_ptr, bool> declare(const string& name, bool durable = false, bool autodelete = false,
- const ConnectionToken* const owner = 0);
-
- /**
- * Destroy the named queue.
- *
- * Note: if the queue is in use it is not actually destroyed until
- * all shared_ptrs to it are destroyed. During that time it is
- * possible that a new queue with the same name may be
- * created. This should not create any problems as the new and
- * old queues exist independently. The registry has
- * forgotten the old queue so there can be no confusion for
- * subsequent calls to find or declare with the same name.
- *
- */
- void destroyLH (const string& name);
- void destroy (const string& name);
- template <class Test> bool destroyIf(const string& name, Test test)
- {
- qpid::sys::RWlock::ScopedWlock locker(lock);
- if (test()) {
- destroyLH (name);
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Find the named queue. Return 0 if not found.
- */
- Queue::shared_ptr find(const string& name);
-
- /**
- * Generate unique queue name.
- */
- string generateName();
-
- /**
- * Set the store to use. May only be called once.
- */
- void setStore (MessageStore*);
-
- /**
- * Return the message store used.
- */
- MessageStore* getStore() const;
-
- /**
- * Register the manageable parent for declared queues
- */
- void setParent (management::Manageable* _parent) { parent = _parent; }
-
-private:
- typedef std::map<string, Queue::shared_ptr> QueueMap;
- QueueMap queues;
- qpid::sys::RWlock lock;
- int counter;
- MessageStore* store;
- management::Manageable* parent;
-};
-
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/RecoverableExchange.h b/qpid/cpp/src/qpid/broker/RecoverableExchange.h
deleted file mode 100644
index 76d0d2ecdf..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoverableExchange.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef _broker_RecoverableExchange_h
-#define _broker_RecoverableExchange_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/shared_ptr.hpp>
-#include "qpid/framing/FieldTable.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * The interface through which bindings are recovered.
- */
-class RecoverableExchange
-{
-public:
- typedef boost::shared_ptr<RecoverableExchange> shared_ptr;
-
- virtual void setPersistenceId(uint64_t id) = 0;
- /**
- * Recover binding. Nb: queue must have been recovered earlier.
- */
- virtual void bind(std::string& queue, std::string& routingKey, qpid::framing::FieldTable& args) = 0;
- virtual ~RecoverableExchange() {};
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/RecoverableMessage.h b/qpid/cpp/src/qpid/broker/RecoverableMessage.h
deleted file mode 100644
index f755fdf727..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoverableMessage.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef _broker_RecoverableMessage_h
-#define _broker_RecoverableMessage_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/shared_ptr.hpp>
-#include "qpid/framing/amqp_types.h"
-#include "qpid/framing/Buffer.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * The interface through which messages are reloaded on recovery.
- */
-class RecoverableMessage
-{
-public:
- typedef boost::shared_ptr<RecoverableMessage> shared_ptr;
- virtual void setPersistenceId(uint64_t id) = 0;
- /**
- * Used by store to determine whether to load content on recovery
- * or let message load its own content as and when it requires it.
- *
- * @returns true if the content of the message should be loaded
- */
- virtual bool loadContent(uint64_t available) = 0;
- /**
- * Loads the content held in the supplied buffer (may do checking
- * of length as necessary)
- */
- virtual void decodeContent(framing::Buffer& buffer) = 0;
- virtual ~RecoverableMessage() {};
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/RecoverableQueue.h b/qpid/cpp/src/qpid/broker/RecoverableQueue.h
deleted file mode 100644
index b32bae7f07..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoverableQueue.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _broker_RecoverableQueue_h
-#define _broker_RecoverableQueue_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "RecoverableMessage.h"
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace broker {
-
-class ExternalQueueStore;
-
-/**
- * The interface through which messages are added back to queues on
- * recovery.
- */
-class RecoverableQueue
-{
-public:
- typedef boost::shared_ptr<RecoverableQueue> shared_ptr;
-
- virtual void setPersistenceId(uint64_t id) = 0;
- virtual uint64_t getPersistenceId() const = 0;
- /**
- * Used during recovery to add stored messages back to the queue
- */
- virtual void recover(RecoverableMessage::shared_ptr msg) = 0;
- virtual ~RecoverableQueue() {};
-
- virtual const std::string& getName() const = 0;
- virtual void setExternalQueueStore(ExternalQueueStore* inst) = 0;
- virtual ExternalQueueStore* getExternalQueueStore() const = 0;
-
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/RecoverableTransaction.h b/qpid/cpp/src/qpid/broker/RecoverableTransaction.h
deleted file mode 100644
index 7fe34b6756..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoverableTransaction.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef _broker_RecoverableTransaction_h
-#define _broker_RecoverableTransaction_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/shared_ptr.hpp>
-
-#include "RecoverableMessage.h"
-#include "RecoverableQueue.h"
-
-namespace qpid {
-namespace broker {
-
-/**
- * The interface through which prepared 2pc transactions are
- * recovered.
- */
-class RecoverableTransaction
-{
-public:
- typedef boost::shared_ptr<RecoverableTransaction> shared_ptr;
- virtual void enqueue(RecoverableQueue::shared_ptr queue, RecoverableMessage::shared_ptr message) = 0;
- virtual void dequeue(RecoverableQueue::shared_ptr queue, RecoverableMessage::shared_ptr message) = 0;
- virtual ~RecoverableTransaction() {};
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp b/qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp
deleted file mode 100644
index 9b5e23884e..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp
+++ /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.
- *
- */
-#include "RecoveredDequeue.h"
-
-using namespace qpid::broker;
-
-RecoveredDequeue::RecoveredDequeue(Queue::shared_ptr _queue, intrusive_ptr<Message> _msg) : queue(_queue), msg(_msg) {}
-
-bool RecoveredDequeue::prepare(TransactionContext*) throw(){
- //should never be called; transaction has already prepared if an enqueue is recovered
- return false;
-}
-
-void RecoveredDequeue::commit() throw(){
-}
-
-void RecoveredDequeue::rollback() throw(){
- msg->enqueueComplete();
- queue->process(msg);
-}
-
diff --git a/qpid/cpp/src/qpid/broker/RecoveredDequeue.h b/qpid/cpp/src/qpid/broker/RecoveredDequeue.h
deleted file mode 100644
index 82668adb67..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoveredDequeue.h
+++ /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.
- *
- */
-#ifndef _RecoveredDequeue_
-#define _RecoveredDequeue_
-
-#include <algorithm>
-#include <functional>
-#include <list>
-#include "Deliverable.h"
-#include "Message.h"
-#include "MessageStore.h"
-#include "Queue.h"
-#include "TxOp.h"
-
-namespace qpid {
- namespace broker {
- class RecoveredDequeue : public TxOp{
- Queue::shared_ptr queue;
- intrusive_ptr<Message> msg;
-
- public:
- RecoveredDequeue(Queue::shared_ptr queue, intrusive_ptr<Message> msg);
- virtual bool prepare(TransactionContext* ctxt) throw();
- virtual void commit() throw();
- virtual void rollback() throw();
- virtual ~RecoveredDequeue(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp b/qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp
deleted file mode 100644
index 5eeab7a435..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp
+++ /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.
- *
- */
-#include "RecoveredEnqueue.h"
-
-using namespace qpid::broker;
-
-RecoveredEnqueue::RecoveredEnqueue(Queue::shared_ptr _queue, intrusive_ptr<Message> _msg) : queue(_queue), msg(_msg) {}
-
-bool RecoveredEnqueue::prepare(TransactionContext*) throw(){
- //should never be called; transaction has already prepared if an enqueue is recovered
- return false;
-}
-
-void RecoveredEnqueue::commit() throw(){
- msg->enqueueComplete();
- queue->process(msg);
-}
-
-void RecoveredEnqueue::rollback() throw(){
-}
-
diff --git a/qpid/cpp/src/qpid/broker/RecoveredEnqueue.h b/qpid/cpp/src/qpid/broker/RecoveredEnqueue.h
deleted file mode 100644
index 25b55e3e0c..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoveredEnqueue.h
+++ /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.
- *
- */
-#ifndef _RecoveredEnqueue_
-#define _RecoveredEnqueue_
-
-#include <algorithm>
-#include <functional>
-#include <list>
-#include "Deliverable.h"
-#include "Message.h"
-#include "MessageStore.h"
-#include "Queue.h"
-#include "TxOp.h"
-
-namespace qpid {
- namespace broker {
- class RecoveredEnqueue : public TxOp{
- Queue::shared_ptr queue;
- intrusive_ptr<Message> msg;
-
- public:
- RecoveredEnqueue(Queue::shared_ptr queue, intrusive_ptr<Message> msg);
- virtual bool prepare(TransactionContext* ctxt) throw();
- virtual void commit() throw();
- virtual void rollback() throw();
- virtual ~RecoveredEnqueue(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/RecoveryManager.h b/qpid/cpp/src/qpid/broker/RecoveryManager.h
deleted file mode 100644
index bf1813a093..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoveryManager.h
+++ /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.
- *
- */
-#ifndef _RecoveryManager_
-#define _RecoveryManager_
-
-#include "RecoverableExchange.h"
-#include "RecoverableQueue.h"
-#include "RecoverableMessage.h"
-#include "RecoverableTransaction.h"
-#include "TransactionalStore.h"
-#include "qpid/framing/Buffer.h"
-
-namespace qpid {
-namespace broker {
-
-class RecoveryManager{
- public:
- virtual ~RecoveryManager(){}
- virtual RecoverableExchange::shared_ptr recoverExchange(framing::Buffer& buffer) = 0;
- virtual RecoverableQueue::shared_ptr recoverQueue(framing::Buffer& buffer) = 0;
- virtual RecoverableMessage::shared_ptr recoverMessage(framing::Buffer& buffer) = 0;
- virtual RecoverableTransaction::shared_ptr recoverTransaction(const std::string& xid,
- std::auto_ptr<TPCTransactionContext> txn) = 0;
- virtual void recoveryComplete() = 0;
-};
-
-class Recoverable {
- public:
- virtual ~Recoverable() {}
-
- /**
- * Request recovery of queue and message state.
- */
- virtual void recover(RecoveryManager& recoverer) = 0;
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp b/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp
deleted file mode 100644
index 65583f1964..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "RecoveryManagerImpl.h"
-
-#include "Message.h"
-#include "Queue.h"
-#include "RecoveredEnqueue.h"
-#include "RecoveredDequeue.h"
-
-using namespace qpid;
-using namespace qpid::broker;
-using boost::dynamic_pointer_cast;
-
-
-static const uint8_t BASIC = 1;
-static const uint8_t MESSAGE = 2;
-
-RecoveryManagerImpl::RecoveryManagerImpl(QueueRegistry& _queues, ExchangeRegistry& _exchanges,
- DtxManager& _dtxMgr, uint64_t _stagingThreshold)
- : queues(_queues), exchanges(_exchanges), dtxMgr(_dtxMgr), stagingThreshold(_stagingThreshold) {}
-
-RecoveryManagerImpl::~RecoveryManagerImpl() {}
-
-class RecoverableMessageImpl : public RecoverableMessage
-{
- intrusive_ptr<Message> msg;
- const uint64_t stagingThreshold;
-public:
- RecoverableMessageImpl(Message::shared_ptr& _msg, uint64_t _stagingThreshold)
- : msg(_msg), stagingThreshold(_stagingThreshold) {}
- ~RecoverableMessageImpl() {};
- void setPersistenceId(uint64_t id);
- bool loadContent(uint64_t available);
- void decodeContent(framing::Buffer& buffer);
- void recover(Queue::shared_ptr queue);
- void enqueue(DtxBuffer::shared_ptr buffer, Queue::shared_ptr queue);
- void dequeue(DtxBuffer::shared_ptr buffer, Queue::shared_ptr queue);
-};
-
-class RecoverableQueueImpl : public RecoverableQueue
-{
- Queue::shared_ptr queue;
-public:
- RecoverableQueueImpl(Queue::shared_ptr& _queue) : queue(_queue) {}
- ~RecoverableQueueImpl() {};
- void setPersistenceId(uint64_t id);
- uint64_t getPersistenceId() const;
- const std::string& getName() const;
- void setExternalQueueStore(ExternalQueueStore* inst);
- ExternalQueueStore* getExternalQueueStore() const;
- void recover(RecoverableMessage::shared_ptr msg);
- void enqueue(DtxBuffer::shared_ptr buffer, RecoverableMessage::shared_ptr msg);
- void dequeue(DtxBuffer::shared_ptr buffer, RecoverableMessage::shared_ptr msg);
-};
-
-class RecoverableExchangeImpl : public RecoverableExchange
-{
- Exchange::shared_ptr exchange;
- QueueRegistry& queues;
-public:
- RecoverableExchangeImpl(Exchange::shared_ptr _exchange, QueueRegistry& _queues) : exchange(_exchange), queues(_queues) {}
- void setPersistenceId(uint64_t id);
- void bind(std::string& queue, std::string& routingKey, qpid::framing::FieldTable& args);
-};
-
-class RecoverableTransactionImpl : public RecoverableTransaction
-{
- DtxBuffer::shared_ptr buffer;
-public:
- RecoverableTransactionImpl(DtxBuffer::shared_ptr _buffer) : buffer(_buffer) {}
- void enqueue(RecoverableQueue::shared_ptr queue, RecoverableMessage::shared_ptr message);
- void dequeue(RecoverableQueue::shared_ptr queue, RecoverableMessage::shared_ptr message);
-};
-
-RecoverableExchange::shared_ptr RecoveryManagerImpl::recoverExchange(framing::Buffer& buffer)
-{
- return RecoverableExchange::shared_ptr(new RecoverableExchangeImpl(Exchange::decode(exchanges, buffer), queues));
-}
-
-RecoverableQueue::shared_ptr RecoveryManagerImpl::recoverQueue(framing::Buffer& buffer)
-{
- Queue::shared_ptr queue = Queue::decode(queues, buffer);
- try {
- Exchange::shared_ptr exchange = exchanges.getDefault();
- if (exchange) {
- exchange->bind(queue, queue->getName(), 0);
- }
- } catch (ChannelException& e) {
- //assume no default exchange has been declared
- }
- return RecoverableQueue::shared_ptr(new RecoverableQueueImpl(queue));
-}
-
-RecoverableMessage::shared_ptr RecoveryManagerImpl::recoverMessage(framing::Buffer& buffer)
-{
- Message::shared_ptr message(new Message());
- message->decodeHeader(buffer);
- return RecoverableMessage::shared_ptr(new RecoverableMessageImpl(message, stagingThreshold));
-}
-
-RecoverableTransaction::shared_ptr RecoveryManagerImpl::recoverTransaction(const std::string& xid,
- std::auto_ptr<TPCTransactionContext> txn)
-{
- DtxBuffer::shared_ptr buffer(new DtxBuffer());
- dtxMgr.recover(xid, txn, buffer);
- return RecoverableTransaction::shared_ptr(new RecoverableTransactionImpl(buffer));
-}
-
-void RecoveryManagerImpl::recoveryComplete()
-{
- //TODO (finalise binding setup etc)
-}
-
-bool RecoverableMessageImpl::loadContent(uint64_t available)
-{
- return !stagingThreshold || available < stagingThreshold;
-}
-
-void RecoverableMessageImpl::decodeContent(framing::Buffer& buffer)
-{
- msg->decodeContent(buffer);
-}
-
-void RecoverableMessageImpl::recover(Queue::shared_ptr queue)
-{
- queue->recover(msg);
-}
-
-void RecoverableMessageImpl::setPersistenceId(uint64_t id)
-{
- msg->setPersistenceId(id);
-}
-
-void RecoverableQueueImpl::recover(RecoverableMessage::shared_ptr msg)
-{
- dynamic_pointer_cast<RecoverableMessageImpl>(msg)->recover(queue);
-}
-
-void RecoverableQueueImpl::setPersistenceId(uint64_t id)
-{
- queue->setPersistenceId(id);
-}
-
-uint64_t RecoverableQueueImpl::getPersistenceId() const
-{
- return queue->getPersistenceId();
-}
-
-const std::string& RecoverableQueueImpl::getName() const
-{
- return queue->getName();
-}
-
-void RecoverableQueueImpl::setExternalQueueStore(ExternalQueueStore* inst)
-{
- queue->setExternalQueueStore(inst);
-}
-
-ExternalQueueStore* RecoverableQueueImpl::getExternalQueueStore() const
-{
- return queue->getExternalQueueStore();
-}
-
-void RecoverableExchangeImpl::setPersistenceId(uint64_t id)
-{
- exchange->setPersistenceId(id);
-}
-
-void RecoverableExchangeImpl::bind(string& queueName, string& key, framing::FieldTable& args)
-{
- Queue::shared_ptr queue = queues.find(queueName);
- exchange->bind(queue, key, &args);
-}
-
-void RecoverableMessageImpl::dequeue(DtxBuffer::shared_ptr buffer, Queue::shared_ptr queue)
-{
- buffer->enlist(TxOp::shared_ptr(new RecoveredDequeue(queue, msg)));
-}
-
-void RecoverableMessageImpl::enqueue(DtxBuffer::shared_ptr buffer, Queue::shared_ptr queue)
-{
- msg->enqueueComplete(); // recoved nmessage to enqueued in store already
- buffer->enlist(TxOp::shared_ptr(new RecoveredEnqueue(queue, msg)));
-}
-
-void RecoverableQueueImpl::dequeue(DtxBuffer::shared_ptr buffer, RecoverableMessage::shared_ptr message)
-{
- dynamic_pointer_cast<RecoverableMessageImpl>(message)->dequeue(buffer, queue);
-}
-
-void RecoverableQueueImpl::enqueue(DtxBuffer::shared_ptr buffer, RecoverableMessage::shared_ptr message)
-{
- dynamic_pointer_cast<RecoverableMessageImpl>(message)->enqueue(buffer, queue);
-}
-
-void RecoverableTransactionImpl::dequeue(RecoverableQueue::shared_ptr queue, RecoverableMessage::shared_ptr message)
-{
- dynamic_pointer_cast<RecoverableQueueImpl>(queue)->dequeue(buffer, message);
-}
-
-void RecoverableTransactionImpl::enqueue(RecoverableQueue::shared_ptr queue, RecoverableMessage::shared_ptr message)
-{
- dynamic_pointer_cast<RecoverableQueueImpl>(queue)->enqueue(buffer, message);
-}
diff --git a/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.h b/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.h
deleted file mode 100644
index 58ec63926c..0000000000
--- a/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.h
+++ /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.
- *
- */
-#ifndef _RecoveryManagerImpl_
-#define _RecoveryManagerImpl_
-
-#include <list>
-#include "DtxManager.h"
-#include "ExchangeRegistry.h"
-#include "QueueRegistry.h"
-#include "RecoveryManager.h"
-
-namespace qpid {
-namespace broker {
-
- class RecoveryManagerImpl : public RecoveryManager{
- QueueRegistry& queues;
- ExchangeRegistry& exchanges;
- DtxManager& dtxMgr;
- const uint64_t stagingThreshold;
- public:
- RecoveryManagerImpl(QueueRegistry& queues, ExchangeRegistry& exchanges, DtxManager& dtxMgr, uint64_t stagingThreshold);
- ~RecoveryManagerImpl();
-
- RecoverableExchange::shared_ptr recoverExchange(framing::Buffer& buffer);
- RecoverableQueue::shared_ptr recoverQueue(framing::Buffer& buffer);
- RecoverableMessage::shared_ptr recoverMessage(framing::Buffer& buffer);
- RecoverableTransaction::shared_ptr recoverTransaction(const std::string& xid,
- std::auto_ptr<TPCTransactionContext> txn);
- void recoveryComplete();
- };
-
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/SemanticHandler.cpp b/qpid/cpp/src/qpid/broker/SemanticHandler.cpp
deleted file mode 100644
index fdde7ec18c..0000000000
--- a/qpid/cpp/src/qpid/broker/SemanticHandler.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "SemanticHandler.h"
-#include "SemanticState.h"
-#include "SessionContext.h"
-#include "BrokerAdapter.h"
-#include "MessageDelivery.h"
-#include "qpid/framing/ExecutionCompleteBody.h"
-#include "qpid/framing/ExecutionResultBody.h"
-#include "qpid/framing/ServerInvoker.h"
-#include "qpid/log/Statement.h"
-
-#include <boost/format.hpp>
-#include <boost/bind.hpp>
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-SemanticHandler::SemanticHandler(SessionContext& s) :
- state(*this,s), session(s),
- msgBuilder(&s.getConnection().getBroker().getStore(), s.getConnection().getBroker().getStagingThreshold()),
- ackOp(boost::bind(&SemanticState::ackRange, &state, _1, _2))
- {}
-
-void SemanticHandler::handle(framing::AMQFrame& frame)
-{
- //TODO: assembly for method and headers
-
- //have potentially three separate tracks at this point:
- //
- // (1) execution controls
- // (2) commands
- // (3) data i.e. content-bearing commands
- //
- //framesets on each can be interleaved. framesets on the latter
- //two share a command-id sequence. controls on the first track are
- //used to communicate details about that command-id sequence.
- //
- //need to decide what to do if a frame on the command track
- //arrives while a frameset on the data track is still
- //open. execute it (i.e. out-of order execution with respect to
- //the command id sequence) or queue it up?
-
- TrackId track = getTrack(frame);//will be replaced by field in 0-10 frame header
-
- switch(track) {
- case EXECUTION_CONTROL_TRACK:
- handleL3(frame.getMethod());
- break;
- case MODEL_COMMAND_TRACK:
- handleCommand(frame.getMethod());
- break;
- case MODEL_CONTENT_TRACK:
- handleContent(frame);
- break;
- }
-}
-
-void SemanticHandler::complete(uint32_t cumulative, const SequenceNumberSet& range)
-{
- //record:
- SequenceNumber mark(cumulative);
- if (outgoing.lwm < mark) {
- outgoing.lwm = mark;
- //ack messages:
- state.ackCumulative(mark.getValue());
- }
- range.processRanges(ackOp);
-}
-
-void SemanticHandler::sendCompletion()
-{
- SequenceNumber mark = incoming.getMark();
- SequenceNumberSet range = incoming.getRange();
- session.getProxy().getExecution().complete(mark.getValue(), range);
-}
-
-void SemanticHandler::flush()
-{
- incoming.flush();
- sendCompletion();
-}
-void SemanticHandler::sync()
-{
- incoming.sync();
- sendCompletion();
-}
-
-void SemanticHandler::noop()
-{
- incoming.noop();
-}
-
-void SemanticHandler::result(uint32_t /*command*/, const std::string& /*data*/)
-{
- //never actually sent by client at present
-}
-
-void SemanticHandler::handleCommand(framing::AMQMethodBody* method)
-{
- SequenceNumber id = incoming.next();
- BrokerAdapter adapter(state);
- Invoker::Result invoker = invoke(adapter, *method);
- incoming.complete(id);
-
- if (!invoker.wasHandled()) {
- throw NotImplementedException("Not implemented");
- } else if (invoker.hasResult()) {
- session.getProxy().getExecution().result(id.getValue(), invoker.getResult());
- }
- if (method->isSync()) {
- incoming.sync(id);
- sendCompletion();
- }
- //TODO: if window gets too large send unsolicited completion
-}
-
-void SemanticHandler::handleL3(framing::AMQMethodBody* method)
-{
- if (!invoke(*this, *method))
- throw NotImplementedException("Not implemented");
-}
-
-void SemanticHandler::handleContent(AMQFrame& frame)
-{
- intrusive_ptr<Message> msg(msgBuilder.getMessage());
- if (!msg) {//start of frameset will be indicated by frame flags
- msgBuilder.start(incoming.next());
- msg = msgBuilder.getMessage();
- }
- msgBuilder.handle(frame);
- if (frame.getEof() && frame.getEos()) {//end of frameset will be indicated by frame flags
- msg->setPublisher(&session.getConnection());
- state.handle(msg);
- msgBuilder.end();
- incoming.track(msg);
- if (msg->getFrames().getMethod()->isSync()) {
- incoming.sync(msg->getCommandId());
- sendCompletion();
- }
- }
-}
-
-DeliveryId SemanticHandler::deliver(QueuedMessage& msg, DeliveryToken::shared_ptr token)
-{
- uint32_t maxFrameSize = session.getConnection().getFrameMax();
- MessageDelivery::deliver(msg, session.getProxy().getHandler(), ++outgoing.hwm, token, maxFrameSize);
- return outgoing.hwm;
-}
-
-SemanticHandler::TrackId SemanticHandler::getTrack(const AMQFrame& frame)
-{
- //will be replaced by field in 0-10 frame header
- uint8_t type = frame.getBody()->type();
- uint16_t classId;
- switch(type) {
- case METHOD_BODY:
- if (frame.castBody<AMQMethodBody>()->isContentBearing()) {
- return MODEL_CONTENT_TRACK;
- }
-
- classId = frame.castBody<AMQMethodBody>()->amqpClassId();
- switch (classId) {
- case ExecutionCompleteBody::CLASS_ID:
- return EXECUTION_CONTROL_TRACK;
- }
-
- return MODEL_COMMAND_TRACK;
- case HEADER_BODY:
- case CONTENT_BODY:
- return MODEL_CONTENT_TRACK;
- }
- throw Exception("Could not determine track");
-}
-
diff --git a/qpid/cpp/src/qpid/broker/SemanticHandler.h b/qpid/cpp/src/qpid/broker/SemanticHandler.h
deleted file mode 100644
index 893a0cbded..0000000000
--- a/qpid/cpp/src/qpid/broker/SemanticHandler.h
+++ /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.
- *
- */
-#ifndef _SemanticHandler_
-#define _SemanticHandler_
-
-#include <memory>
-#include "BrokerAdapter.h"
-#include "DeliveryAdapter.h"
-#include "MessageBuilder.h"
-#include "IncomingExecutionContext.h"
-#include "HandlerImpl.h"
-
-#include "qpid/framing/amqp_types.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/SequenceNumber.h"
-
-#include <boost/function.hpp>
-
-namespace qpid {
-
-namespace framing {
-class AMQMethodBody;
-class AMQHeaderBody;
-class AMQContentBody;
-class AMQHeaderBody;
-}
-
-namespace broker {
-
-class SessionContext;
-
-class SemanticHandler : public DeliveryAdapter,
- public framing::FrameHandler,
- public framing::AMQP_ServerOperations::ExecutionHandler
-
-{
- typedef boost::function<void(DeliveryId, DeliveryId)> RangedOperation;
-
- SemanticState state;
- SessionContext& session;
- // TODO aconway 2007-09-20: Why are these on the handler rather than the
- // state?
- IncomingExecutionContext incoming;
- framing::Window outgoing;
- MessageBuilder msgBuilder;
- RangedOperation ackOp;
-
- enum TrackId {EXECUTION_CONTROL_TRACK, MODEL_COMMAND_TRACK, MODEL_CONTENT_TRACK};
- TrackId getTrack(const framing::AMQFrame& frame);
-
- void handleL3(framing::AMQMethodBody* method);
- void handleCommand(framing::AMQMethodBody* method);
- void handleContent(framing::AMQFrame& frame);
-
- void sendCompletion();
-
- //delivery adapter methods:
- DeliveryId deliver(QueuedMessage& msg, DeliveryToken::shared_ptr token);
-
- framing::AMQP_ClientProxy& getProxy() { return session.getProxy(); }
- //Connection& getConnection() { return session.getConnection(); }
- Broker& getBroker() { return session.getConnection().getBroker(); }
-
-public:
- SemanticHandler(SessionContext& session);
-
- //frame handler:
- void handle(framing::AMQFrame& frame);
-
- //execution class method handlers:
- void complete(uint32_t cumulativeExecutionMark, const framing::SequenceNumberSet& range);
- void flush();
- void noop();
- void result(uint32_t command, const std::string& data);
- void sync();
-
-
- SemanticState& getSemanticState() { return state; }
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/SemanticState.cpp b/qpid/cpp/src/qpid/broker/SemanticState.cpp
deleted file mode 100644
index 9b44f31e14..0000000000
--- a/qpid/cpp/src/qpid/broker/SemanticState.cpp
+++ /dev/null
@@ -1,642 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "SessionContext.h"
-#include "BrokerAdapter.h"
-#include "Queue.h"
-#include "Connection.h"
-#include "DeliverableMessage.h"
-#include "DtxAck.h"
-#include "DtxTimeout.h"
-#include "Message.h"
-#include "SemanticHandler.h"
-#include "SessionHandler.h"
-#include "TxAck.h"
-#include "TxPublish.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/log/Statement.h"
-#include "qpid/ptr_map.h"
-
-#include <boost/bind.hpp>
-#include <boost/format.hpp>
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-#include <functional>
-
-#include <assert.h>
-
-
-namespace qpid {
-namespace broker {
-
-using std::mem_fun_ref;
-using std::bind2nd;
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-using namespace qpid::ptr_map;
-
-SemanticState::SemanticState(DeliveryAdapter& da, SessionContext& ss)
- : session(ss),
- deliveryAdapter(da),
- prefetchSize(0),
- prefetchCount(0),
- tagGenerator("sgen"),
- dtxSelected(false),
- accumulatedAck(0),
- flowActive(true),
- outputTasks(ss)
-{
- outstanding.reset();
-}
-
-SemanticState::~SemanticState() {
- //cancel all consumers
- for (ConsumerImplMap::iterator i = consumers.begin(); i != consumers.end(); i++) {
- cancel(*get_pointer(i));
- }
-
- if (dtxBuffer.get()) {
- dtxBuffer->fail();
- }
- recover(true);
-}
-
-bool SemanticState::exists(const string& consumerTag){
- return consumers.find(consumerTag) != consumers.end();
-}
-
-void SemanticState::consume(DeliveryToken::shared_ptr token, string& tagInOut,
- Queue::shared_ptr queue, bool nolocal, bool acks, bool acquire,
- bool exclusive, const FieldTable*)
-{
- if(tagInOut.empty())
- tagInOut = tagGenerator.generate();
- std::auto_ptr<ConsumerImpl> c(new ConsumerImpl(this, token, tagInOut, queue, acks, nolocal, acquire));
- queue->consume(*c, exclusive);//may throw exception
- outputTasks.addOutputTask(c.get());
- consumers.insert(tagInOut, c.release());
-}
-
-void SemanticState::cancel(const string& tag){
- ConsumerImplMap::iterator i = consumers.find(tag);
- if (i != consumers.end()) {
- cancel(*get_pointer(i));
- consumers.erase(i);
- //should cancel all unacked messages for this consumer so that
- //they are not redelivered on recovery
- for_each(unacked.begin(), unacked.end(), boost::bind(mem_fun_ref(&DeliveryRecord::cancel), _1, tag));
-
- }
-}
-
-
-void SemanticState::startTx()
-{
- txBuffer = TxBuffer::shared_ptr(new TxBuffer());
-}
-
-void SemanticState::commit(MessageStore* const store)
-{
- if (!txBuffer) throw
- CommandInvalidException(QPID_MSG("Session has not been selected for use with transactions"));
-
- TxOp::shared_ptr txAck(new TxAck(accumulatedAck, unacked));
- txBuffer->enlist(txAck);
- if (txBuffer->commitLocal(store)) {
- accumulatedAck.clear();
- }
-}
-
-void SemanticState::rollback()
-{
- if (!txBuffer)
- throw CommandInvalidException(QPID_MSG("Session has not been selected for use with transactions"));
-
- txBuffer->rollback();
- accumulatedAck.clear();
-}
-
-void SemanticState::selectDtx()
-{
- dtxSelected = true;
-}
-
-void SemanticState::startDtx(const std::string& xid, DtxManager& mgr, bool join)
-{
- if (!dtxSelected) {
- throw CommandInvalidException(QPID_MSG("Session has not been selected for use with dtx"));
- }
- dtxBuffer = DtxBuffer::shared_ptr(new DtxBuffer(xid));
- txBuffer = static_pointer_cast<TxBuffer>(dtxBuffer);
- if (join) {
- mgr.join(xid, dtxBuffer);
- } else {
- mgr.start(xid, dtxBuffer);
- }
-}
-
-void SemanticState::endDtx(const std::string& xid, bool fail)
-{
- if (!dtxBuffer) {
- throw CommandInvalidException(QPID_MSG("xid " << xid << " not associated with this session"));
- }
- if (dtxBuffer->getXid() != xid) {
- throw CommandInvalidException(
- QPID_MSG("xid specified on start was " << dtxBuffer->getXid() << ", but " << xid << " specified on end"));
-
- }
-
- txBuffer.reset();//ops on this session no longer transactional
-
- checkDtxTimeout();
- if (fail) {
- dtxBuffer->fail();
- } else {
- dtxBuffer->markEnded();
- }
- dtxBuffer.reset();
-}
-
-void SemanticState::suspendDtx(const std::string& xid)
-{
- if (dtxBuffer->getXid() != xid) {
- throw CommandInvalidException(
- QPID_MSG("xid specified on start was " << dtxBuffer->getXid() << ", but " << xid << " specified on suspend"));
- }
- txBuffer.reset();//ops on this session no longer transactional
-
- checkDtxTimeout();
- dtxBuffer->setSuspended(true);
- suspendedXids[xid] = dtxBuffer;
- dtxBuffer.reset();
-}
-
-void SemanticState::resumeDtx(const std::string& xid)
-{
- if (!dtxSelected) {
- throw CommandInvalidException(QPID_MSG("Session has not been selected for use with dtx"));
- }
-
- dtxBuffer = suspendedXids[xid];
- if (!dtxBuffer) {
- throw CommandInvalidException(QPID_MSG("xid " << xid << " not attached"));
- } else {
- suspendedXids.erase(xid);
- }
-
- if (dtxBuffer->getXid() != xid) {
- throw CommandInvalidException(
- QPID_MSG("xid specified on start was " << dtxBuffer->getXid() << ", but " << xid << " specified on resume"));
-
- }
- if (!dtxBuffer->isSuspended()) {
- throw CommandInvalidException(QPID_MSG("xid " << xid << " not suspended"));
- }
-
- checkDtxTimeout();
- dtxBuffer->setSuspended(false);
- txBuffer = static_pointer_cast<TxBuffer>(dtxBuffer);
-}
-
-void SemanticState::checkDtxTimeout()
-{
- if (dtxBuffer->isExpired()) {
- dtxBuffer.reset();
- throw DtxTimeoutException();
- }
-}
-
-void SemanticState::record(const DeliveryRecord& delivery)
-{
- unacked.push_back(delivery);
- delivery.addTo(outstanding);
-}
-
-bool SemanticState::checkPrefetch(intrusive_ptr<Message>& msg)
-{
- bool countOk = !prefetchCount || prefetchCount > unacked.size();
- bool sizeOk = !prefetchSize || prefetchSize > msg->contentSize() + outstanding.size || unacked.empty();
- return countOk && sizeOk;
-}
-
-SemanticState::ConsumerImpl::ConsumerImpl(SemanticState* _parent,
- DeliveryToken::shared_ptr _token,
- const string& _name,
- Queue::shared_ptr _queue,
- bool ack,
- bool _nolocal,
- bool _acquire
- ) :
- Consumer(_acquire),
- parent(_parent),
- token(_token),
- name(_name),
- queue(_queue),
- ackExpected(ack),
- nolocal(_nolocal),
- acquire(_acquire),
- blocked(true),
- windowing(true),
- msgCredit(0),
- byteCredit(0) {}
-
-bool SemanticState::ConsumerImpl::deliver(QueuedMessage& msg)
-{
- allocateCredit(msg.payload);
- DeliveryId deliveryTag =
- parent->deliveryAdapter.deliver(msg, token);
- if (windowing || ackExpected) {
- parent->record(DeliveryRecord(msg, queue, name, token, deliveryTag, acquire, !ackExpected));
- }
- if (acquire && !ackExpected) {
- queue->dequeue(0, msg.payload);
- }
- return true;
-}
-
-bool SemanticState::ConsumerImpl::filter(intrusive_ptr<Message> msg)
-{
- return !(nolocal &&
- &parent->getSession().getConnection() == msg->getPublisher());
-}
-
-bool SemanticState::ConsumerImpl::accept(intrusive_ptr<Message> msg)
-{
- //TODO: remove the now redundant checks (channel.flow & basic|message.qos removed):
- blocked = !(filter(msg) && checkCredit(msg) && parent->flowActive && (!ackExpected || parent->checkPrefetch(msg)));
- return !blocked;
-}
-
-void SemanticState::ConsumerImpl::allocateCredit(intrusive_ptr<Message>& msg)
-{
- uint32_t originalMsgCredit = msgCredit;
- uint32_t originalByteCredit = byteCredit;
- if (msgCredit != 0xFFFFFFFF) {
- msgCredit--;
- }
- if (byteCredit != 0xFFFFFFFF) {
- byteCredit -= msg->getRequiredCredit();
- }
- QPID_LOG(debug, "Credit allocated for '" << name << "' on " << parent
- << ", was " << " bytes: " << originalByteCredit << " msgs: " << originalMsgCredit
- << " now bytes: " << byteCredit << " msgs: " << msgCredit);
-
-}
-
-bool SemanticState::ConsumerImpl::checkCredit(intrusive_ptr<Message>& msg)
-{
- if (msgCredit == 0 || (byteCredit != 0xFFFFFFFF && byteCredit < msg->getRequiredCredit())) {
- QPID_LOG(debug, "Not enough credit for '" << name << "' on " << parent
- << ", bytes: " << byteCredit << " msgs: " << msgCredit);
- return false;
- } else {
- QPID_LOG(debug, "Credit available for '" << name << "' on " << parent
- << " bytes: " << byteCredit << " msgs: " << msgCredit);
- return true;
- }
-}
-
-SemanticState::ConsumerImpl::~ConsumerImpl() {}
-
-void SemanticState::cancel(ConsumerImpl& c)
-{
- outputTasks.removeOutputTask(&c);
- Queue::shared_ptr queue = c.getQueue();
- if(queue) {
- queue->cancel(c);
- if (queue->canAutoDelete() && !queue->hasExclusiveOwner()) {
- Queue::tryAutoDelete(session.getBroker(), queue);
- }
- }
-}
-
-void SemanticState::handle(intrusive_ptr<Message> msg) {
- if (txBuffer.get()) {
- TxPublish* deliverable(new TxPublish(msg));
- TxOp::shared_ptr op(deliverable);
- route(msg, *deliverable);
- txBuffer->enlist(op);
- } else {
- DeliverableMessage deliverable(msg);
- route(msg, deliverable);
- }
-}
-
-void SemanticState::route(intrusive_ptr<Message> msg, Deliverable& strategy) {
- std::string exchangeName = msg->getExchangeName();
- msg->getProperties<DeliveryProperties>()->setExchange(exchangeName);
- if (!cacheExchange || cacheExchange->getName() != exchangeName){
- cacheExchange = session.getBroker().getExchanges().get(exchangeName);
- }
-
- cacheExchange->route(strategy, msg->getRoutingKey(), msg->getApplicationHeaders());
-
- if (!strategy.delivered) {
- //TODO:if reject-unroutable, then reject
- //else route to alternate exchange
- if (cacheExchange->getAlternate()) {
- cacheExchange->getAlternate()->route(strategy, msg->getRoutingKey(), msg->getApplicationHeaders());
- }
- }
-
-}
-
-void SemanticState::ackCumulative(DeliveryId id)
-{
- ack(id, id, true);
-}
-
-void SemanticState::ackRange(DeliveryId first, DeliveryId last)
-{
- ack(first, last, false);
-}
-
-void SemanticState::ack(DeliveryId first, DeliveryId last, bool cumulative)
-{
- {
- ack_iterator start = cumulative ? unacked.begin() :
- find_if(unacked.begin(), unacked.end(), bind2nd(mem_fun_ref(&DeliveryRecord::matchOrAfter), first));
- ack_iterator end = start;
-
- if (cumulative || first != last) {
- //need to find end (position it just after the last record in range)
- end = find_if(start, unacked.end(), bind2nd(mem_fun_ref(&DeliveryRecord::after), last));
- } else if (start != unacked.end()) {
- //just acked single element (move end past it)
- ++end;
- }
-
- for_each(start, end, boost::bind(&SemanticState::acknowledged, this, _1));
-
- if (txBuffer.get()) {
- //in transactional mode, don't dequeue or remove, just
- //maintain set of acknowledged messages:
- accumulatedAck.update(cumulative ? accumulatedAck.mark : first, last);
-
- if (dtxBuffer.get()) {
- //if enlisted in a dtx, remove the relevant slice from
- //unacked and record it against that transaction
- TxOp::shared_ptr txAck(new DtxAck(accumulatedAck, unacked));
- accumulatedAck.clear();
- dtxBuffer->enlist(txAck);
- }
- } else {
- for_each(start, end, bind2nd(mem_fun_ref(&DeliveryRecord::dequeue), 0));
- unacked.erase(start, end);
- }
- }//end of lock scope for delivery lock (TODO this is ugly, make it prettier)
-
- //if the prefetch limit had previously been reached, or credit
- //had expired in windowing mode there may be messages that can
- //be now be delivered
- requestDispatch();
-}
-
-void SemanticState::requestDispatch()
-{
- for (ConsumerImplMap::iterator i = consumers.begin(); i != consumers.end(); i++) {
- requestDispatch(*get_pointer(i));
- }
-}
-
-void SemanticState::requestDispatch(ConsumerImpl& c)
-{
- if(c.isBlocked()) {
- c.doOutput();
- }
-}
-
-void SemanticState::acknowledged(const DeliveryRecord& delivery)
-{
- delivery.subtractFrom(outstanding);
- ConsumerImplMap::iterator i = consumers.find(delivery.getTag());
- if (i != consumers.end()) {
- get_pointer(i)->acknowledged(delivery);
- }
-}
-
-void SemanticState::ConsumerImpl::acknowledged(const DeliveryRecord& delivery)
-{
- if (windowing) {
- if (msgCredit != 0xFFFFFFFF) msgCredit++;
- if (byteCredit != 0xFFFFFFFF) delivery.updateByteCredit(byteCredit);
- }
-}
-
-void SemanticState::recover(bool requeue)
-{
- if(requeue){
- outstanding.reset();
- //take copy and clear unacked as requeue may result in redelivery to this session
- //which will in turn result in additions to unacked
- std::list<DeliveryRecord> copy = unacked;
- unacked.clear();
- for_each(copy.rbegin(), copy.rend(), mem_fun_ref(&DeliveryRecord::requeue));
- }else{
- for_each(unacked.begin(), unacked.end(), bind2nd(mem_fun_ref(&DeliveryRecord::redeliver), this));
- //unconfirmed messages re redelivered and therefore have their
- //id adjusted, confirmed messages are not and so the ordering
- //w.r.t id is lost
- unacked.sort();
- }
-}
-
-bool SemanticState::get(DeliveryToken::shared_ptr token, Queue::shared_ptr queue, bool ackExpected)
-{
- QueuedMessage msg = queue->dequeue();
- if(msg.payload){
- DeliveryId myDeliveryTag = deliveryAdapter.deliver(msg, token);
- if(ackExpected){
- unacked.push_back(DeliveryRecord(msg, queue, myDeliveryTag));
- }
- return true;
- }else{
- return false;
- }
-}
-
-DeliveryId SemanticState::redeliver(QueuedMessage& msg, DeliveryToken::shared_ptr token)
-{
- return deliveryAdapter.deliver(msg, token);
-}
-
-void SemanticState::flow(bool active)
-{
- bool requestDelivery(!flowActive && active);
- flowActive = active;
- if (requestDelivery) {
- //there may be messages that can be now be delivered
- requestDispatch();
- }
-}
-
-
-SemanticState::ConsumerImpl& SemanticState::find(const std::string& destination)
-{
- ConsumerImplMap::iterator i = consumers.find(destination);
- if (i == consumers.end()) {
- throw NotFoundException(QPID_MSG("Unknown destination " << destination));
- } else {
- return *get_pointer(i);
- }
-}
-
-void SemanticState::setWindowMode(const std::string& destination)
-{
- find(destination).setWindowMode();
-}
-
-void SemanticState::setCreditMode(const std::string& destination)
-{
- find(destination).setCreditMode();
-}
-
-void SemanticState::addByteCredit(const std::string& destination, uint32_t value)
-{
- ConsumerImpl& c = find(destination);
- c.addByteCredit(value);
- requestDispatch(c);
-}
-
-
-void SemanticState::addMessageCredit(const std::string& destination, uint32_t value)
-{
- ConsumerImpl& c = find(destination);
- c.addMessageCredit(value);
- requestDispatch(c);
-}
-
-void SemanticState::flush(const std::string& destination)
-{
- find(destination).flush();
-}
-
-
-void SemanticState::stop(const std::string& destination)
-{
- find(destination).stop();
-}
-
-void SemanticState::ConsumerImpl::setWindowMode()
-{
- windowing = true;
-}
-
-void SemanticState::ConsumerImpl::setCreditMode()
-{
- windowing = false;
-}
-
-void SemanticState::ConsumerImpl::addByteCredit(uint32_t value)
-{
- if (byteCredit != 0xFFFFFFFF) {
- byteCredit += value;
- }
-}
-
-void SemanticState::ConsumerImpl::addMessageCredit(uint32_t value)
-{
- if (msgCredit != 0xFFFFFFFF) {
- msgCredit += value;
- }
-}
-
-void SemanticState::ConsumerImpl::flush()
-{
- while(queue->dispatch(*this));
- stop();
-}
-
-void SemanticState::ConsumerImpl::stop()
-{
- msgCredit = 0;
- byteCredit = 0;
-}
-
-Queue::shared_ptr SemanticState::getQueue(const string& name) const {
- Queue::shared_ptr queue;
- if (name.empty()) {
- throw NotAllowedException(QPID_MSG("No queue name specified."));
- } else {
- queue = session.getBroker().getQueues().find(name);
- if (!queue)
- throw NotFoundException(QPID_MSG("Queue not found: "<<name));
- }
- return queue;
-}
-
-AckRange SemanticState::findRange(DeliveryId first, DeliveryId last)
-{
- ack_iterator start = find_if(unacked.begin(), unacked.end(), bind2nd(mem_fun_ref(&DeliveryRecord::matchOrAfter), first));
- ack_iterator end = start;
-
- if (start != unacked.end()) {
- if (first == last) {
- //just acked single element (move end past it)
- ++end;
- } else {
- //need to find end (position it just after the last record in range)
- end = find_if(start, unacked.end(), bind2nd(mem_fun_ref(&DeliveryRecord::after), last));
- }
- }
- return AckRange(start, end);
-}
-
-void SemanticState::acquire(DeliveryId first, DeliveryId last, DeliveryIds& acquired)
-{
- AckRange range = findRange(first, last);
- for_each(range.start, range.end, AcquireFunctor(acquired));
-}
-
-void SemanticState::release(DeliveryId first, DeliveryId last)
-{
- AckRange range = findRange(first, last);
- //release results in the message being added to the head so want
- //to release in reverse order to keep the original transfer order
- DeliveryRecords::reverse_iterator start(range.end);
- DeliveryRecords::reverse_iterator end(range.start);
- for_each(start, end, mem_fun_ref(&DeliveryRecord::release));
-}
-
-void SemanticState::reject(DeliveryId first, DeliveryId last)
-{
- AckRange range = findRange(first, last);
- for_each(range.start, range.end, mem_fun_ref(&DeliveryRecord::reject));
- //need to remove the delivery records as well
- unacked.erase(range.start, range.end);
-}
-
-bool SemanticState::ConsumerImpl::doOutput()
-{
- //TODO: think through properly
- return queue->dispatch(*this);
-}
-
-void SemanticState::ConsumerImpl::notify()
-{
- //TODO: think through properly
- parent->outputTasks.activateOutput();
-}
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/SemanticState.h b/qpid/cpp/src/qpid/broker/SemanticState.h
deleted file mode 100644
index cc9c0e1e9b..0000000000
--- a/qpid/cpp/src/qpid/broker/SemanticState.h
+++ /dev/null
@@ -1,192 +0,0 @@
-#ifndef QPID_BROKER_SEMANTICSTATE_H
-#define QPID_BROKER_SEMANTICSTATE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Consumer.h"
-#include "Deliverable.h"
-#include "DeliveryAdapter.h"
-#include "DeliveryRecord.h"
-#include "DeliveryToken.h"
-#include "DtxBuffer.h"
-#include "DtxManager.h"
-#include "NameGenerator.h"
-#include "Prefetch.h"
-#include "TxBuffer.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/AccumulatedAck.h"
-#include "qpid/framing/Uuid.h"
-#include "qpid/sys/AggregateOutput.h"
-#include "qpid/shared_ptr.h"
-
-#include <list>
-#include <map>
-#include <vector>
-
-namespace qpid {
-namespace broker {
-
-class SessionContext;
-
-/**
- * SemanticState holds the L3 and L4 state of an open session, whether
- * attached to a channel or suspended.
- */
-class SemanticState : public framing::FrameHandler::Chains,
- public sys::OutputTask,
- private boost::noncopyable
-{
- class ConsumerImpl : public Consumer, public sys::OutputTask
- {
- SemanticState* const parent;
- const DeliveryToken::shared_ptr token;
- const string name;
- const Queue::shared_ptr queue;
- const bool ackExpected;
- const bool nolocal;
- const bool acquire;
- bool blocked;
- bool windowing;
- uint32_t msgCredit;
- uint32_t byteCredit;
-
- bool checkCredit(intrusive_ptr<Message>& msg);
- void allocateCredit(intrusive_ptr<Message>& msg);
-
- public:
- ConsumerImpl(SemanticState* parent, DeliveryToken::shared_ptr token,
- const string& name, Queue::shared_ptr queue,
- bool ack, bool nolocal, bool acquire);
- ~ConsumerImpl();
- bool deliver(QueuedMessage& msg);
- bool filter(intrusive_ptr<Message> msg);
- bool accept(intrusive_ptr<Message> msg);
- void notify();
-
- void setWindowMode();
- void setCreditMode();
- void addByteCredit(uint32_t value);
- void addMessageCredit(uint32_t value);
- void flush();
- void stop();
- void acknowledged(const DeliveryRecord&);
- Queue::shared_ptr getQueue() { return queue; }
- bool isBlocked() const { return blocked; }
-
- bool doOutput();
- };
-
- typedef boost::ptr_map<std::string,ConsumerImpl> ConsumerImplMap;
- typedef std::map<std::string, DtxBuffer::shared_ptr> DtxBufferMap;
-
- SessionContext& session;
- DeliveryAdapter& deliveryAdapter;
- Queue::shared_ptr defaultQueue;
- ConsumerImplMap consumers;
- uint32_t prefetchSize;
- uint16_t prefetchCount;
- Prefetch outstanding;
- NameGenerator tagGenerator;
- std::list<DeliveryRecord> unacked;
- TxBuffer::shared_ptr txBuffer;
- DtxBuffer::shared_ptr dtxBuffer;
- bool dtxSelected;
- DtxBufferMap suspendedXids;
- framing::AccumulatedAck accumulatedAck;
- bool flowActive;
- boost::shared_ptr<Exchange> cacheExchange;
- sys::AggregateOutput outputTasks;
-
- void route(intrusive_ptr<Message> msg, Deliverable& strategy);
- void record(const DeliveryRecord& delivery);
- bool checkPrefetch(intrusive_ptr<Message>& msg);
- void checkDtxTimeout();
- ConsumerImpl& find(const std::string& destination);
- void ack(DeliveryId deliveryTag, DeliveryId endTag, bool cumulative);
- void acknowledged(const DeliveryRecord&);
- AckRange findRange(DeliveryId first, DeliveryId last);
- void requestDispatch();
- void requestDispatch(ConsumerImpl&);
- void cancel(ConsumerImpl&);
-
- public:
- SemanticState(DeliveryAdapter&, SessionContext&);
- ~SemanticState();
-
- SessionContext& getSession() { return session; }
-
- /**
- * Get named queue, never returns 0.
- * @return: named queue
- * @exception: ChannelException if no queue of that name is found.
- * @exception: ConnectionException if name="" and session has no default.
- */
- Queue::shared_ptr getQueue(const std::string& name) const;
-
- uint32_t setPrefetchSize(uint32_t size){ return prefetchSize = size; }
- uint16_t setPrefetchCount(uint16_t n){ return prefetchCount = n; }
-
- bool exists(const string& consumerTag);
-
- /**
- *@param tagInOut - if empty it is updated with the generated token.
- */
- void consume(DeliveryToken::shared_ptr token, string& tagInOut, Queue::shared_ptr queue,
- bool nolocal, bool acks, bool acquire, bool exclusive, const framing::FieldTable* = 0);
-
- void cancel(const string& tag);
-
- void setWindowMode(const std::string& destination);
- void setCreditMode(const std::string& destination);
- void addByteCredit(const std::string& destination, uint32_t value);
- void addMessageCredit(const std::string& destination, uint32_t value);
- void flush(const std::string& destination);
- void stop(const std::string& destination);
-
- bool get(DeliveryToken::shared_ptr token, Queue::shared_ptr queue, bool ackExpected);
- void startTx();
- void commit(MessageStore* const store);
- void rollback();
- void selectDtx();
- void startDtx(const std::string& xid, DtxManager& mgr, bool join);
- void endDtx(const std::string& xid, bool fail);
- void suspendDtx(const std::string& xid);
- void resumeDtx(const std::string& xid);
- void ackCumulative(DeliveryId deliveryTag);
- void ackRange(DeliveryId deliveryTag, DeliveryId endTag);
- void recover(bool requeue);
- void flow(bool active);
- DeliveryId redeliver(QueuedMessage& msg, DeliveryToken::shared_ptr token);
- void acquire(DeliveryId first, DeliveryId last, DeliveryIds& acquired);
- void release(DeliveryId first, DeliveryId last);
- void reject(DeliveryId first, DeliveryId last);
- void handle(intrusive_ptr<Message> msg);
-
- bool doOutput() { return outputTasks.doOutput(); }
-};
-
-}} // namespace qpid::broker
-
-
-
-
-#endif /*!QPID_BROKER_SEMANTICSTATE_H*/
diff --git a/qpid/cpp/src/qpid/broker/SessionContext.h b/qpid/cpp/src/qpid/broker/SessionContext.h
deleted file mode 100644
index a289310b15..0000000000
--- a/qpid/cpp/src/qpid/broker/SessionContext.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef QPID_BROKER_SESSIONCONTEXT_H
-#define QPID_BROKER_SESSIONCONTEXT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/framing/amqp_types.h"
-#include "qpid/sys/OutputControl.h"
-#include "ConnectionState.h"
-
-
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
-namespace broker {
-
-class SessionContext : public sys::OutputControl
-{
- public:
- virtual ~SessionContext(){}
- virtual ConnectionState& getConnection() = 0;
- virtual framing::AMQP_ClientProxy& getProxy() = 0;
- virtual Broker& getBroker() = 0;
-};
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!QPID_BROKER_SESSIONCONTEXT_H*/
diff --git a/qpid/cpp/src/qpid/broker/SessionHandler.cpp b/qpid/cpp/src/qpid/broker/SessionHandler.cpp
deleted file mode 100644
index 0e3c9928d1..0000000000
--- a/qpid/cpp/src/qpid/broker/SessionHandler.cpp
+++ /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.
- *
- */
-
-#include "SessionHandler.h"
-#include "SessionState.h"
-#include "Connection.h"
-#include "ConnectionState.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/framing/constants.h"
-#include "qpid/framing/ClientInvoker.h"
-#include "qpid/framing/ServerInvoker.h"
-#include "qpid/log/Statement.h"
-
-#include <boost/bind.hpp>
-
-namespace qpid {
-namespace broker {
-using namespace framing;
-using namespace std;
-using namespace qpid::sys;
-
-SessionHandler::SessionHandler(Connection& c, ChannelId ch)
- : InOutHandler(0, &out),
- connection(c), channel(ch, &c.getOutput()),
- proxy(out), // Via my own handleOut() for L2 data.
- peerSession(channel), // Direct to channel for L2 commands.
- ignoring(false) {}
-
-SessionHandler::~SessionHandler() {}
-
-namespace {
-ClassId classId(AMQMethodBody* m) { return m ? m->amqpMethodId() : 0; }
-MethodId methodId(AMQMethodBody* m) { return m ? m->amqpClassId() : 0; }
-} // namespace
-
-void SessionHandler::handleIn(AMQFrame& f) {
- // Note on channel states: a channel is open if session != 0. A
- // channel that is closed (session == 0) can be in the "ignoring"
- // state. This is a temporary state after we have sent a channel
- // exception, where extra frames might arrive that should be
- // ignored.
- //
- AMQMethodBody* m = f.getBody()->getMethod();
- try {
- if (!ignoring) {
- if (m &&
- (invoke(static_cast<AMQP_ServerOperations::SessionHandler&>(*this), *m) ||
- invoke(static_cast<AMQP_ServerOperations::ExecutionHandler&>(*this), *m))) {
- return;
- } else if (session.get()) {
- boost::optional<SequenceNumber> ack=session->received(f);
- session->handle(f);
- if (ack)
- peerSession.ack(*ack, SequenceNumberSet());
- } else if (m && invoke(static_cast<AMQP_ClientOperations::SessionHandler&>(*this), *m)) {
- return;
- } else {
- throw ChannelErrorException(
- QPID_MSG("Channel " << channel.get() << " is not open"));
- }
- }
- } catch(const ChannelException& e) {
- ignoring=true; // Ignore trailing frames sent by client.
- session->detach();
- session.reset();
- peerSession.closed(e.code, e.what());
- }catch(const ConnectionException& e){
- connection.close(e.code, e.what(), classId(m), methodId(m));
- }catch(const std::exception& e){
- connection.close(
- framing::INTERNAL_ERROR, e.what(), classId(m), methodId(m));
- }
-}
-
-void SessionHandler::handleOut(AMQFrame& f) {
- channel.handle(f); // Send it.
- if (session->sent(f))
- peerSession.solicitAck();
-}
-
-void SessionHandler::assertAttached(const char* method) const {
- if (!session.get()) {
- std::cout << "SessionHandler::assertAttached() failed for " << method << std::endl;
- throw ChannelErrorException(
- QPID_MSG(method << " failed: No session for channel "
- << getChannel()));
- }
-}
-
-void SessionHandler::assertClosed(const char* method) const {
- if (session.get())
- throw ChannelBusyException(
- QPID_MSG(method << " failed: channel " << channel.get()
- << " is already open."));
-}
-
-void SessionHandler::open(uint32_t detachedLifetime) {
- assertClosed("open");
- std::auto_ptr<SessionState> state(
- connection.broker.getSessionManager().open(*this, detachedLifetime));
- session.reset(state.release());
- peerSession.attached(session->getId(), session->getTimeout());
-}
-
-void SessionHandler::resume(const Uuid& id) {
- assertClosed("resume");
- session = connection.broker.getSessionManager().resume(id);
- session->attach(*this);
- SequenceNumber seq = session->resuming();
- peerSession.attached(session->getId(), session->getTimeout());
- proxy.getSession().ack(seq, SequenceNumberSet());
-}
-
-void SessionHandler::flow(bool /*active*/) {
- assertAttached("flow");
- // TODO aconway 2007-09-19: Removed in 0-10, remove
- assert(0); throw NotImplementedException("session.flow");
-}
-
-void SessionHandler::flowOk(bool /*active*/) {
- assertAttached("flowOk");
- // TODO aconway 2007-09-19: Removed in 0-10, remove
- assert(0); throw NotImplementedException("session.flowOk");
-}
-
-void SessionHandler::close() {
- assertAttached("close");
- QPID_LOG(info, "Received session.close");
- ignoring=false;
- session->detach();
- session.reset();
- peerSession.closed(REPLY_SUCCESS, "ok");
- assert(&connection.getChannel(channel.get()) == this);
- connection.closeChannel(channel.get());
-}
-
-void SessionHandler::closed(uint16_t replyCode, const string& replyText) {
- QPID_LOG(warning, "Received session.closed: "<<replyCode<<" "<<replyText);
- ignoring=false;
- session->detach();
- session.reset();
-}
-
-void SessionHandler::localSuspend() {
- if (session.get() && session->isAttached()) {
- session->detach();
- connection.broker.getSessionManager().suspend(session);
- session.reset();
- }
-}
-
-void SessionHandler::suspend() {
- assertAttached("suspend");
- localSuspend();
- peerSession.detached();
- assert(&connection.getChannel(channel.get()) == this);
- connection.closeChannel(channel.get());
-}
-
-void SessionHandler::ack(uint32_t cumulativeSeenMark,
- const SequenceNumberSet& /*seenFrameSet*/)
-{
- assertAttached("ack");
- if (session->getState() == SessionState::RESUMING) {
- session->receivedAck(cumulativeSeenMark);
- framing::SessionState::Replay replay=session->replay();
- std::for_each(replay.begin(), replay.end(),
- boost::bind(&SessionHandler::handleOut, this, _1));
- }
- else
- session->receivedAck(cumulativeSeenMark);
-}
-
-void SessionHandler::highWaterMark(uint32_t /*lastSentMark*/) {
- // TODO aconway 2007-10-02: may be removed from spec.
- assert(0); throw NotImplementedException("session.high-water-mark");
-}
-
-void SessionHandler::solicitAck() {
- assertAttached("solicit-ack");
- peerSession.ack(session->sendingAck(), SequenceNumberSet());
-}
-
-void SessionHandler::attached(const Uuid& /*sessionId*/, uint32_t detachedLifetime)
-{
- std::auto_ptr<SessionState> state(
- connection.broker.getSessionManager().open(*this, detachedLifetime));
- session.reset(state.release());
-}
-
-void SessionHandler::detached()
-{
- connection.broker.getSessionManager().suspend(session);
- session.reset();
-}
-
-
-ConnectionState& SessionHandler::getConnection() { return connection; }
-const ConnectionState& SessionHandler::getConnection() const { return connection; }
-
-void SessionHandler::complete(uint32_t cumulative, const SequenceNumberSet& range)
-{
- assertAttached("complete");
- session->complete(cumulative, range);
-}
-
-void SessionHandler::flush()
-{
- assertAttached("flush");
- session->flush();
-}
-void SessionHandler::sync()
-{
- assertAttached("sync");
- session->sync();
-}
-
-void SessionHandler::noop()
-{
- assertAttached("noop");
- session->noop();
-}
-
-void SessionHandler::result(uint32_t /*command*/, const std::string& /*data*/)
-{
- //never actually sent by client at present
-}
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/SessionHandler.h b/qpid/cpp/src/qpid/broker/SessionHandler.h
deleted file mode 100644
index e6bc463a82..0000000000
--- a/qpid/cpp/src/qpid/broker/SessionHandler.h
+++ /dev/null
@@ -1,118 +0,0 @@
-#ifndef QPID_BROKER_SESSIONHANDLER_H
-#define QPID_BROKER_SESSIONHANDLER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/AMQP_ClientOperations.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/framing/amqp_types.h"
-#include "qpid/framing/ChannelHandler.h"
-#include "qpid/framing/SequenceNumber.h"
-
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
-namespace broker {
-
-class Connection;
-class ConnectionState;
-class SessionState;
-
-/**
- * A SessionHandler is associated with each active channel. It
- * receives incoming frames, handles session controls and manages the
- * association between the channel and a session.
- */
-class SessionHandler : public framing::AMQP_ServerOperations::SessionHandler,
- public framing::AMQP_ClientOperations::SessionHandler,
- public framing::AMQP_ServerOperations::ExecutionHandler,
- public framing::FrameHandler::InOutHandler,
- private boost::noncopyable
-{
- public:
- SessionHandler(Connection&, framing::ChannelId);
- ~SessionHandler();
-
- /** Returns 0 if not attached to a session */
- SessionState* getSession() { return session.get(); }
- const SessionState* getSession() const { return session.get(); }
-
- framing::ChannelId getChannel() const { return channel.get(); }
-
- ConnectionState& getConnection();
- const ConnectionState& getConnection() const;
-
- framing::AMQP_ClientProxy& getProxy() { return proxy; }
- const framing::AMQP_ClientProxy& getProxy() const { return proxy; }
-
- // Called by closing connection.
- void localSuspend();
- void detach() { localSuspend(); }
-
- protected:
- void handleIn(framing::AMQFrame&);
- void handleOut(framing::AMQFrame&);
-
- private:
- /// Session methods
- void open(uint32_t detachedLifetime);
- void flow(bool active);
- void flowOk(bool active);
- void close();
- void closed(uint16_t replyCode, const std::string& replyText);
- void resume(const framing::Uuid& sessionId);
- void suspend();
- void ack(uint32_t cumulativeSeenMark,
- const framing::SequenceNumberSet& seenFrameSet);
- void highWaterMark(uint32_t lastSentMark);
- void solicitAck();
-
- //extra methods required for assuming client role
- void attached(const framing::Uuid& sessionId, uint32_t detachedLifetime);
- void detached();
-
- //Execution methods:
- void complete(uint32_t cumulativeExecutionMark, const framing::SequenceNumberSet& range);
- void flush();
- void noop();
- void result(uint32_t command, const std::string& data);
- void sync();
-
- void assertAttached(const char* method) const;
- void assertActive(const char* method) const;
- void assertClosed(const char* method) const;
-
- Connection& connection;
- framing::ChannelHandler channel;
- framing::AMQP_ClientProxy proxy;
- framing::AMQP_ClientProxy::Session peerSession;
- bool ignoring;
- std::auto_ptr<SessionState> session;
-};
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!QPID_BROKER_SESSIONHANDLER_H*/
diff --git a/qpid/cpp/src/qpid/broker/SessionManager.cpp b/qpid/cpp/src/qpid/broker/SessionManager.cpp
deleted file mode 100644
index 571d3365db..0000000000
--- a/qpid/cpp/src/qpid/broker/SessionManager.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "SessionManager.h"
-#include "SessionState.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/log/Statement.h"
-#include "qpid/log/Helpers.h"
-#include "qpid/memory.h"
-
-#include <boost/bind.hpp>
-#include <boost/range.hpp>
-
-#include <algorithm>
-#include <functional>
-#include <ostream>
-
-namespace qpid {
-namespace broker {
-
-using namespace sys;
-using namespace framing;
-
-SessionManager::SessionManager(uint32_t a) : ack(a) {}
-
-SessionManager::~SessionManager() {}
-
-// FIXME aconway 2008-02-01: pass handler*, allow open unattached.
-std::auto_ptr<SessionState> SessionManager::open(
- SessionHandler& h, uint32_t timeout_)
-{
- Mutex::ScopedLock l(lock);
- std::auto_ptr<SessionState> session(
- new SessionState(this, &h, timeout_, ack));
- active.insert(session->getId());
- for_each(observers.begin(), observers.end(),
- boost::bind(&Observer::opened, _1,boost::ref(*session)));
- return session;
-}
-
-void SessionManager::suspend(std::auto_ptr<SessionState> session) {
- Mutex::ScopedLock l(lock);
- active.erase(session->getId());
- session->suspend();
- session->expiry = AbsTime(now(),session->getTimeout()*TIME_SEC);
- if (session->mgmtObject.get() != 0)
- session->mgmtObject->set_expireTime ((uint64_t) Duration (session->expiry));
- suspended.push_back(session.release()); // In expiry order
- eraseExpired();
-}
-
-std::auto_ptr<SessionState> SessionManager::resume(const Uuid& id)
-{
- Mutex::ScopedLock l(lock);
- eraseExpired();
- if (active.find(id) != active.end())
- throw SessionBusyException(
- QPID_MSG("Session already active: " << id));
- Suspended::iterator i = std::find_if(
- suspended.begin(), suspended.end(),
- boost::bind(std::equal_to<Uuid>(), id, boost::bind(&SessionState::getId, _1))
- );
- if (i == suspended.end())
- throw InvalidArgumentException(
- QPID_MSG("No suspended session with id=" << id));
- active.insert(id);
- std::auto_ptr<SessionState> state(suspended.release(i).release());
- return state;
-}
-
-void SessionManager::erase(const framing::Uuid& id)
-{
- Mutex::ScopedLock l(lock);
- active.erase(id);
-}
-
-void SessionManager::eraseExpired() {
- // Called with lock held.
- if (!suspended.empty()) {
- Suspended::iterator keep = std::lower_bound(
- suspended.begin(), suspended.end(), now(),
- boost::bind(std::less<AbsTime>(), boost::bind(&SessionState::expiry, _1), _2));
- if (suspended.begin() != keep) {
- QPID_LOG(debug, "Expiring sessions: " << log::formatList(suspended.begin(), keep));
- suspended.erase(suspended.begin(), keep);
- }
- }
-}
-
-void SessionManager::add(const intrusive_ptr<Observer>& o) {
- observers.push_back(o);
-}
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/SessionManager.h b/qpid/cpp/src/qpid/broker/SessionManager.h
deleted file mode 100644
index 7e8bd18f57..0000000000
--- a/qpid/cpp/src/qpid/broker/SessionManager.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef QPID_BROKER_SESSIONMANAGER_H
-#define QPID_BROKER_SESSIONMANAGER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <qpid/framing/Uuid.h>
-#include <qpid/sys/Time.h>
-#include <qpid/sys/Mutex.h>
-#include <qpid/RefCounted.h>
-
-#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-
-#include <set>
-#include <vector>
-#include <memory>
-
-namespace qpid {
-namespace broker {
-
-class SessionState;
-class SessionHandler;
-
-/**
- * Create and manage SessionState objects.
- */
-class SessionManager : private boost::noncopyable {
- public:
- /**
- * Observer notified of SessionManager events.
- */
- struct Observer : public RefCounted {
- virtual void opened(SessionState&) {}
- };
-
- SessionManager(uint32_t ack);
-
- ~SessionManager();
-
- /** Open a new active session, caller takes ownership */
- std::auto_ptr<SessionState> open(SessionHandler& c, uint32_t timeout_);
-
- /** Suspend a session, start it's timeout counter.
- * The factory takes ownership.
- */
- void suspend(std::auto_ptr<SessionState> session);
-
- /** Resume a suspended session.
- *@throw Exception if timed out or non-existant.
- */
- std::auto_ptr<SessionState> resume(const framing::Uuid&);
-
- /** Add an Observer. */
- void add(const intrusive_ptr<Observer>&);
-
- private:
- typedef boost::ptr_vector<SessionState> Suspended;
- typedef std::set<framing::Uuid> Active;
- typedef std::vector<intrusive_ptr<Observer> > Observers;
-
- void erase(const framing::Uuid&);
- void eraseExpired();
-
- sys::Mutex lock;
- Suspended suspended;
- Active active;
- uint32_t ack;
- Observers observers;
-
- friend class SessionState; // removes deleted sessions from active set.
-};
-
-
-
-}} // namespace qpid::broker
-
-
-
-
-
-#endif /*!QPID_BROKER_SESSIONMANAGER_H*/
diff --git a/qpid/cpp/src/qpid/broker/SessionState.cpp b/qpid/cpp/src/qpid/broker/SessionState.cpp
deleted file mode 100644
index 573a567da6..0000000000
--- a/qpid/cpp/src/qpid/broker/SessionState.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "SessionState.h"
-#include "Broker.h"
-#include "ConnectionState.h"
-#include "MessageDelivery.h"
-#include "SemanticHandler.h"
-#include "SessionManager.h"
-#include "SessionHandler.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/framing/ServerInvoker.h"
-
-#include <boost/bind.hpp>
-
-namespace qpid {
-namespace broker {
-
-using namespace framing;
-using sys::Mutex;
-using qpid::management::ManagementAgent;
-using qpid::management::ManagementObject;
-using qpid::management::Manageable;
-using qpid::management::Args;
-
-SessionState::SessionState(
- SessionManager* f, SessionHandler* h, uint32_t timeout_, uint32_t ack)
- : framing::SessionState(ack, timeout_ > 0),
- factory(f), handler(h), id(true), timeout(timeout_),
- broker(h->getConnection().broker),
- version(h->getConnection().getVersion()),
- semanticState(*this, *this),
- adapter(semanticState),
- msgBuilder(&broker.getStore(), broker.getStagingThreshold()),
- ackOp(boost::bind(&SemanticState::ackRange, &semanticState, _1, _2))
-{
- getConnection().outputTasks.addOutputTask(&semanticState);
-
- Manageable* parent = broker.GetVhostObject ();
-
- if (parent != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
-
- if (agent.get () != 0)
- {
- mgmtObject = management::Session::shared_ptr
- (new management::Session (this, parent, id.str ()));
- mgmtObject->set_attached (1);
- mgmtObject->set_clientRef (h->getConnection().GetManagementObject()->getObjectId());
- mgmtObject->set_channelId (h->getChannel());
- mgmtObject->set_detachedLifespan (getTimeout());
- agent->addObject (mgmtObject);
- }
- }
-}
-
-SessionState::~SessionState() {
- // Remove ID from active session list.
- if (factory)
- factory->erase(getId());
- if (mgmtObject.get () != 0)
- mgmtObject->resourceDestroy ();
-}
-
-SessionHandler* SessionState::getHandler() {
- return handler;
-}
-
-AMQP_ClientProxy& SessionState::getProxy() {
- assert(isAttached());
- return getHandler()->getProxy();
-}
-
-ConnectionState& SessionState::getConnection() {
- assert(isAttached());
- return getHandler()->getConnection();
-}
-
-void SessionState::detach() {
- getConnection().outputTasks.removeOutputTask(&semanticState);
- Mutex::ScopedLock l(lock);
- handler = 0;
- if (mgmtObject.get() != 0)
- {
- mgmtObject->set_attached (0);
- }
-}
-
-void SessionState::attach(SessionHandler& h) {
- {
- Mutex::ScopedLock l(lock);
- handler = &h;
- if (mgmtObject.get() != 0)
- {
- mgmtObject->set_attached (1);
- mgmtObject->set_clientRef (h.getConnection().GetManagementObject()->getObjectId());
- mgmtObject->set_channelId (h.getChannel());
- }
- }
- h.getConnection().outputTasks.addOutputTask(&semanticState);
-}
-
-void SessionState::activateOutput()
-{
- Mutex::ScopedLock l(lock);
- if (isAttached()) {
- getConnection().outputTasks.activateOutput();
- }
-}
- //This class could be used as the callback for queue notifications
- //if not attached, it can simply ignore the callback, else pass it
- //on to the connection
-
-ManagementObject::shared_ptr SessionState::GetManagementObject (void) const
-{
- return dynamic_pointer_cast<ManagementObject> (mgmtObject);
-}
-
-Manageable::status_t SessionState::ManagementMethod (uint32_t methodId,
- Args& /*args*/)
-{
- Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
-
- switch (methodId)
- {
- case management::Session::METHOD_DETACH :
- if (handler != 0)
- {
- handler->detach();
- }
- status = Manageable::STATUS_OK;
- break;
-
- case management::Session::METHOD_CLOSE :
- /*
- if (handler != 0)
- {
- handler->getConnection().closeChannel(handler->getChannel());
- }
- status = Manageable::STATUS_OK;
- break;
- */
-
- case management::Session::METHOD_SOLICITACK :
- case management::Session::METHOD_RESETLIFESPAN :
- status = Manageable::STATUS_NOT_IMPLEMENTED;
- break;
- }
-
- return status;
-}
-
-void SessionState::handleCommand(framing::AMQMethodBody* method)
-{
- SequenceNumber id = incoming.next();
- Invoker::Result invocation = invoke(adapter, *method);
- incoming.complete(id);
-
- if (!invocation.wasHandled()) {
- throw NotImplementedException("Not implemented");
- } else if (invocation.hasResult()) {
- getProxy().getExecution().result(id.getValue(), invocation.getResult());
- }
- if (method->isSync()) {
- incoming.sync(id);
- sendCompletion();
- }
- //TODO: if window gets too large send unsolicited completion
-}
-
-void SessionState::handleContent(AMQFrame& frame)
-{
- intrusive_ptr<Message> msg(msgBuilder.getMessage());
- if (!msg) {//start of frameset will be indicated by frame flags
- msgBuilder.start(incoming.next());
- msg = msgBuilder.getMessage();
- }
- msgBuilder.handle(frame);
- if (frame.getEof() && frame.getEos()) {//end of frameset will be indicated by frame flags
- msg->setPublisher(&getConnection());
- semanticState.handle(msg);
- msgBuilder.end();
- incoming.track(msg);
- if (msg->getFrames().getMethod()->isSync()) {
- incoming.sync(msg->getCommandId());
- sendCompletion();
- }
- }
-}
-
-void SessionState::handle(AMQFrame& frame)
-{
- //TODO: make command handling more uniform, regardless of whether
- //commands carry content. (For now, assume all single frame
- //assmblies are non-content bearing and all content-bearing
- //assmeblies will have more than one frame):
- if (frame.getBof() && frame.getEof()) {
- handleCommand(frame.getMethod());
- } else {
- handleContent(frame);
- }
-
-}
-
-DeliveryId SessionState::deliver(QueuedMessage& msg, DeliveryToken::shared_ptr token)
-{
- uint32_t maxFrameSize = getConnection().getFrameMax();
- MessageDelivery::deliver(msg, getProxy().getHandler(), ++outgoing.hwm, token, maxFrameSize);
- return outgoing.hwm;
-}
-
-void SessionState::sendCompletion()
-{
- SequenceNumber mark = incoming.getMark();
- SequenceNumberSet range = incoming.getRange();
- getProxy().getExecution().complete(mark.getValue(), range);
-}
-
-void SessionState::complete(uint32_t cumulative, const SequenceNumberSet& range)
-{
- //record:
- SequenceNumber mark(cumulative);
- if (outgoing.lwm < mark) {
- outgoing.lwm = mark;
- //ack messages:
- semanticState.ackCumulative(mark.getValue());
- }
- range.processRanges(ackOp);
-}
-
-void SessionState::flush()
-{
- incoming.flush();
- sendCompletion();
-}
-
-void SessionState::sync()
-{
- incoming.sync();
- sendCompletion();
-}
-
-void SessionState::noop()
-{
- incoming.noop();
-}
-
-
-}} // namespace qpid::broker
diff --git a/qpid/cpp/src/qpid/broker/SessionState.h b/qpid/cpp/src/qpid/broker/SessionState.h
deleted file mode 100644
index 98c21a8ab5..0000000000
--- a/qpid/cpp/src/qpid/broker/SessionState.h
+++ /dev/null
@@ -1,152 +0,0 @@
-#ifndef QPID_BROKER_SESSION_H
-#define QPID_BROKER_SESSION_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/Uuid.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/SessionState.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/Time.h"
-#include "qpid/management/Manageable.h"
-#include "qpid/management/Session.h"
-#include "BrokerAdapter.h"
-#include "DeliveryAdapter.h"
-#include "MessageBuilder.h"
-#include "SessionContext.h"
-#include "SemanticState.h"
-#include "IncomingExecutionContext.h"
-
-#include <boost/noncopyable.hpp>
-#include <boost/scoped_ptr.hpp>
-
-#include <set>
-#include <vector>
-#include <ostream>
-
-namespace qpid {
-
-namespace framing {
-class AMQP_ClientProxy;
-}
-
-namespace broker {
-
-class SessionHandler;
-class SessionManager;
-class Broker;
-class ConnectionState;
-
-/**
- * Broker-side session state includes sessions handler chains, which may
- * themselves have state.
- */
-class SessionState : public framing::SessionState,
- public SessionContext,
- public DeliveryAdapter,
- public management::Manageable
-{
- public:
- ~SessionState();
- bool isAttached() { return handler; }
-
- void detach();
- void attach(SessionHandler& handler);
-
-
- SessionHandler* getHandler();
-
- /** @pre isAttached() */
- framing::AMQP_ClientProxy& getProxy();
-
- /** @pre isAttached() */
- ConnectionState& getConnection();
-
- uint32_t getTimeout() const { return timeout; }
- Broker& getBroker() { return broker; }
- framing::ProtocolVersion getVersion() const { return version; }
-
- /** OutputControl **/
- void activateOutput();
-
- void handle(framing::AMQFrame& frame);
- void handleCommand(framing::AMQMethodBody* method);
- void handleContent(framing::AMQFrame& frame);
-
- void complete(uint32_t cumulativeExecutionMark, const framing::SequenceNumberSet& range);
- void flush();
- void noop();
- void sync();
- void sendCompletion();
-
- //delivery adapter methods:
- DeliveryId deliver(QueuedMessage& msg, DeliveryToken::shared_ptr token);
-
- // Manageable entry points
- management::ManagementObject::shared_ptr GetManagementObject (void) const;
- management::Manageable::status_t
- ManagementMethod (uint32_t methodId, management::Args& args);
-
- // Normally SessionManager creates sessions.
- SessionState(SessionManager*,
- SessionHandler* out,
- uint32_t timeout,
- uint32_t ackInterval);
-
-
- private:
- typedef boost::function<void(DeliveryId, DeliveryId)> RangedOperation;
-
- SessionManager* factory;
- SessionHandler* handler;
- framing::Uuid id;
- uint32_t timeout;
- sys::AbsTime expiry; // Used by SessionManager.
- Broker& broker;
- framing::ProtocolVersion version;
- sys::Mutex lock;
-
- SemanticState semanticState;
- BrokerAdapter adapter;
- MessageBuilder msgBuilder;
-
- //execution state
- IncomingExecutionContext incoming;
- framing::Window outgoing;
- RangedOperation ackOp;
-
- management::Session::shared_ptr mgmtObject;
-
- friend class SessionManager;
-};
-
-
-inline std::ostream& operator<<(std::ostream& out, const SessionState& session) {
- return out << session.getId();
-}
-
-}} // namespace qpid::broker
-
-
-
-#endif /*!QPID_BROKER_SESSION_H*/
diff --git a/qpid/cpp/src/qpid/broker/Timer.cpp b/qpid/cpp/src/qpid/broker/Timer.cpp
deleted file mode 100644
index 173f350cde..0000000000
--- a/qpid/cpp/src/qpid/broker/Timer.cpp
+++ /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.
- *
- */
-#include "Timer.h"
-#include <iostream>
-
-using qpid::sys::AbsTime;
-using qpid::sys::Duration;
-using qpid::sys::Monitor;
-using qpid::sys::Thread;
-using namespace qpid::broker;
-
-TimerTask::TimerTask(Duration timeout) :
- duration(timeout), time(AbsTime::now(), timeout), cancelled(false) {}
-
-TimerTask::TimerTask(AbsTime _time) :
- duration(0), time(_time), cancelled(false) {}
-
-TimerTask::~TimerTask(){}
-
-void TimerTask::reset() { time.reset(AbsTime::now(), duration); }
-
-Timer::Timer() : active(false)
-{
- start();
-}
-
-Timer::~Timer()
-{
- stop();
-}
-
-void Timer::run()
-{
- Monitor::ScopedLock l(monitor);
- while(active){
- if (tasks.empty()) {
- monitor.wait();
- } else {
- intrusive_ptr<TimerTask> t = tasks.top();
- if (t->cancelled) {
- tasks.pop();
- } else if(t->time < AbsTime::now()) {
- tasks.pop();
- t->fire();
- } else {
- monitor.wait(t->time);
- }
- }
- }
-}
-
-void Timer::add(intrusive_ptr<TimerTask> task)
-{
- Monitor::ScopedLock l(monitor);
- tasks.push(task);
- monitor.notify();
-}
-
-void Timer::start()
-{
- Monitor::ScopedLock l(monitor);
- if (!active) {
- active = true;
- runner = Thread(this);
- }
-}
-
-void Timer::stop()
-{
- {
- Monitor::ScopedLock l(monitor);
- if (!active) return;
- active = false;
- monitor.notifyAll();
- }
- runner.join();
-}
-
-bool Later::operator()(const intrusive_ptr<TimerTask>& a,
- const intrusive_ptr<TimerTask>& b) const
-{
- return a.get() && b.get() && a->time > b->time;
-}
-
diff --git a/qpid/cpp/src/qpid/broker/Timer.h b/qpid/cpp/src/qpid/broker/Timer.h
deleted file mode 100644
index dcb02a5e0a..0000000000
--- a/qpid/cpp/src/qpid/broker/Timer.h
+++ /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.
- *
- */
-#ifndef _Timer_
-#define _Timer_
-
-#include "qpid/sys/Monitor.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/RefCounted.h"
-
-#include <memory>
-#include <queue>
-
-namespace qpid {
-namespace broker {
-
-struct TimerTask : public RefCounted {
- const qpid::sys::Duration duration;
- qpid::sys::AbsTime time;
- volatile bool cancelled;
-
- TimerTask(qpid::sys::Duration timeout);
- TimerTask(qpid::sys::AbsTime time);
- virtual ~TimerTask();
- void reset();
- virtual void fire() = 0;
-};
-
-struct Later {
- bool operator()(const intrusive_ptr<TimerTask>& a,
- const intrusive_ptr<TimerTask>& b) const;
-};
-
-class Timer : private qpid::sys::Runnable {
- protected:
- qpid::sys::Monitor monitor;
- std::priority_queue<intrusive_ptr<TimerTask>,
- std::vector<intrusive_ptr<TimerTask> >,
- Later> tasks;
- qpid::sys::Thread runner;
- bool active;
-
- virtual void run();
-
- public:
- Timer();
- virtual ~Timer();
-
- void add(intrusive_ptr<TimerTask> task);
- void start();
- void stop();
-
-};
-
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/TopicExchange.cpp b/qpid/cpp/src/qpid/broker/TopicExchange.cpp
deleted file mode 100644
index 5330ee4fd0..0000000000
--- a/qpid/cpp/src/qpid/broker/TopicExchange.cpp
+++ /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.
- *
- */
-#include "TopicExchange.h"
-#include <algorithm>
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-// TODO aconway 2006-09-20: More efficient matching algorithm.
-// Areas for improvement:
-// - excessive string copying: should be 0 copy, match from original buffer.
-// - match/lookup: use descision tree or other more efficient structure.
-
-Tokens& Tokens::operator=(const std::string& s) {
- clear();
- if (s.empty()) return *this;
- std::string::const_iterator i = s.begin();
- while (true) {
- // Invariant: i is at the beginning of the next untokenized word.
- std::string::const_iterator j = find(i, s.end(), '.');
- push_back(std::string(i, j));
- if (j == s.end()) return *this;
- i = j + 1;
- }
- return *this;
-}
-
-TopicPattern& TopicPattern::operator=(const Tokens& tokens) {
- Tokens::operator=(tokens);
- normalize();
- return *this;
-}
-
-namespace {
-const std::string hashmark("#");
-const std::string star("*");
-}
-
-void TopicPattern::normalize() {
- std::string word;
- Tokens::iterator i = begin();
- while (i != end()) {
- if (*i == hashmark) {
- ++i;
- while (i != end()) {
- // Invariant: *(i-1)==#, [begin()..i-1] is normalized.
- if (*i == star) { // Move * before #.
- std::swap(*i, *(i-1));
- ++i;
- } else if (*i == hashmark) {
- erase(i); // Remove extra #
- } else {
- break;
- }
- }
- } else {
- i ++;
- }
- }
-}
-
-
-namespace {
-// TODO aconway 2006-09-20: Ineficient to convert every routingKey to a string.
-// Need StringRef class that operates on a string in place witout copy.
-// Should be applied everywhere strings are extracted from frames.
-//
-bool do_match(Tokens::const_iterator pattern_begin, Tokens::const_iterator pattern_end, Tokens::const_iterator target_begin, Tokens::const_iterator target_end)
-{
- // Invariant: [pattern_begin..p) matches [target_begin..t)
- Tokens::const_iterator p = pattern_begin;
- Tokens::const_iterator t = target_begin;
- while (p != pattern_end && t != target_end)
- {
- if (*p == star || *p == *t) {
- ++p, ++t;
- } else if (*p == hashmark) {
- ++p;
- if (do_match(p, pattern_end, t, target_end)) return true;
- while (t != target_end) {
- ++t;
- if (do_match(p, pattern_end, t, target_end)) return true;
- }
- return false;
- } else {
- return false;
- }
- }
- while (p != pattern_end && *p == hashmark) ++p; // Ignore trailing #
- return t == target_end && p == pattern_end;
-}
-}
-
-bool TopicPattern::match(const Tokens& target) const
-{
- return do_match(begin(), end(), target.begin(), target.end());
-}
-
-TopicExchange::TopicExchange(const string& _name, Manageable* _parent) : Exchange(_name, _parent)
-{
- if (mgmtExchange.get() != 0)
- mgmtExchange->set_type (typeName);
-}
-
-TopicExchange::TopicExchange(const std::string& _name, bool _durable,
- const FieldTable& _args, Manageable* _parent) :
- Exchange(_name, _durable, _args, _parent)
-{
- if (mgmtExchange.get() != 0)
- mgmtExchange->set_type (typeName);
-}
-
-bool TopicExchange::bind(Queue::shared_ptr queue, const string& routingKey, const FieldTable* /*args*/){
- RWlock::ScopedWlock l(lock);
- TopicPattern routingPattern(routingKey);
- if (isBound(queue, routingPattern)) {
- return false;
- } else {
- Binding::shared_ptr binding (new Binding (routingKey, queue, this));
- bindings[routingPattern].push_back(binding);
- if (mgmtExchange.get() != 0) {
- mgmtExchange->inc_bindings ();
- }
- return true;
- }
-}
-
-bool TopicExchange::unbind(Queue::shared_ptr queue, const string& routingKey, const FieldTable* /*args*/){
- RWlock::ScopedWlock l(lock);
- BindingMap::iterator bi = bindings.find(TopicPattern(routingKey));
- Binding::vector& qv(bi->second);
- if (bi == bindings.end()) return false;
-
- Binding::vector::iterator q;
- for (q = qv.begin(); q != qv.end(); q++)
- if ((*q)->queue == queue)
- break;
- if(q == qv.end()) return false;
- qv.erase(q);
- if(qv.empty()) bindings.erase(bi);
- if (mgmtExchange.get() != 0) {
- mgmtExchange->dec_bindings ();
- }
- return true;
-}
-
-bool TopicExchange::isBound(Queue::shared_ptr queue, TopicPattern& pattern)
-{
- BindingMap::iterator bi = bindings.find(pattern);
- if (bi == bindings.end()) return false;
- Binding::vector& qv(bi->second);
- Binding::vector::iterator q;
- for (q = qv.begin(); q != qv.end(); q++)
- if ((*q)->queue == queue)
- break;
- return q != qv.end();
-}
-
-void TopicExchange::route(Deliverable& msg, const string& routingKey, const FieldTable* /*args*/){
- RWlock::ScopedRlock l(lock);
- uint32_t count(0);
- Tokens tokens(routingKey);
-
- for (BindingMap::iterator i = bindings.begin(); i != bindings.end(); ++i) {
- if (i->first.match(tokens)) {
- Binding::vector& qv(i->second);
- for(Binding::vector::iterator j = qv.begin(); j != qv.end(); j++, count++){
- msg.deliverTo((*j)->queue);
- if ((*j)->mgmtBinding.get() != 0)
- (*j)->mgmtBinding->inc_msgMatched ();
- }
- }
- }
-
- if (mgmtExchange.get() != 0)
- {
- mgmtExchange->inc_msgReceives ();
- mgmtExchange->inc_byteReceives (msg.contentSize ());
- if (count == 0)
- {
- mgmtExchange->inc_msgDrops ();
- mgmtExchange->inc_byteDrops (msg.contentSize ());
- }
- else
- {
- mgmtExchange->inc_msgRoutes (count);
- mgmtExchange->inc_byteRoutes (count * msg.contentSize ());
- }
- }
-}
-
-bool TopicExchange::isBound(Queue::shared_ptr queue, const string* const routingKey, const FieldTable* const)
-{
- if (routingKey && queue) {
- TopicPattern key(*routingKey);
- return isBound(queue, key);
- } else if (!routingKey && !queue) {
- return bindings.size() > 0;
- } else if (routingKey) {
- for (BindingMap::iterator i = bindings.begin(); i != bindings.end(); ++i) {
- if (i->first.match(*routingKey)) {
- return true;
- }
- }
- } else {
- for (BindingMap::iterator i = bindings.begin(); i != bindings.end(); ++i) {
- Binding::vector& qv(i->second);
- Binding::vector::iterator q;
- for (q = qv.begin(); q != qv.end(); q++)
- if ((*q)->queue == queue)
- return true;
- }
- }
- return false;
-}
-
-TopicExchange::~TopicExchange() {}
-
-const std::string TopicExchange::typeName("topic");
-
-
diff --git a/qpid/cpp/src/qpid/broker/TopicExchange.h b/qpid/cpp/src/qpid/broker/TopicExchange.h
deleted file mode 100644
index 2e107142b7..0000000000
--- a/qpid/cpp/src/qpid/broker/TopicExchange.h
+++ /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.
- *
- */
-#ifndef _TopicExchange_
-#define _TopicExchange_
-
-#include <map>
-#include <vector>
-#include "Exchange.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/sys/Monitor.h"
-#include "Queue.h"
-
-namespace qpid {
-namespace broker {
-
-/** A vector of string tokens */
-class Tokens : public std::vector<std::string> {
- public:
- Tokens() {};
- // Default copy, assign, dtor are sufficient.
-
- /** Tokenize s, provides automatic conversion of string to Tokens */
- Tokens(const std::string& s) { operator=(s); }
- /** Tokenizing assignment operator s */
- Tokens & operator=(const std::string& s);
-
- private:
- size_t hash;
-};
-
-
-/**
- * Tokens that have been normalized as a pattern and can be matched
- * with topic Tokens. Normalized meands all sequences of mixed * and
- * # are reduced to a series of * followed by at most one #.
- */
-class TopicPattern : public Tokens
-{
- public:
- TopicPattern() {}
- // Default copy, assign, dtor are sufficient.
- TopicPattern(const Tokens& tokens) { operator=(tokens); }
- TopicPattern(const std::string& str) { operator=(str); }
- TopicPattern& operator=(const Tokens&);
- TopicPattern& operator=(const std::string& str) { return operator=(Tokens(str)); }
-
- /** Match a topic */
- bool match(const std::string& topic) { return match(Tokens(topic)); }
- bool match(const Tokens& topic) const;
-
- private:
- void normalize();
-};
-
-class TopicExchange : public virtual Exchange{
- typedef std::map<TopicPattern, Binding::vector> BindingMap;
- BindingMap bindings;
- qpid::sys::RWlock lock;
-
- bool isBound(Queue::shared_ptr queue, TopicPattern& pattern);
- public:
- static const std::string typeName;
-
- TopicExchange(const string& name, management::Manageable* parent = 0);
- TopicExchange(const string& _name, bool _durable,
- const qpid::framing::FieldTable& _args, management::Manageable* parent = 0);
-
- virtual std::string getType() const { return typeName; }
-
- virtual bool bind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual bool unbind(Queue::shared_ptr queue, const string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual void route(Deliverable& msg, const string& routingKey, const qpid::framing::FieldTable* args);
-
- virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args);
-
- virtual ~TopicExchange();
-};
-
-
-
-}
-}
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/TransactionalStore.h b/qpid/cpp/src/qpid/broker/TransactionalStore.h
deleted file mode 100644
index 2a2bac0c51..0000000000
--- a/qpid/cpp/src/qpid/broker/TransactionalStore.h
+++ /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.
- *
- */
-#ifndef _TransactionalStore_
-#define _TransactionalStore_
-
-#include <memory>
-#include <string>
-#include <set>
-
-namespace qpid {
-namespace broker {
-
-struct InvalidTransactionContextException : public std::exception {};
-
-class TransactionContext {
-public:
- virtual ~TransactionContext(){}
-};
-
-class TPCTransactionContext : public TransactionContext {
-public:
- virtual ~TPCTransactionContext(){}
-};
-
-class TransactionalStore {
-public:
- virtual std::auto_ptr<TransactionContext> begin() = 0;
- virtual std::auto_ptr<TPCTransactionContext> begin(const std::string& xid) = 0;
- virtual void prepare(TPCTransactionContext& txn) = 0;
- virtual void commit(TransactionContext& txn) = 0;
- virtual void abort(TransactionContext& txn) = 0;
-
- virtual void collectPreparedXids(std::set<std::string>& xids) = 0;
-
- virtual ~TransactionalStore(){}
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/TxAck.cpp b/qpid/cpp/src/qpid/broker/TxAck.cpp
deleted file mode 100644
index 40b9b0ff33..0000000000
--- a/qpid/cpp/src/qpid/broker/TxAck.cpp
+++ /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.
- *
- */
-#include "TxAck.h"
-#include "qpid/log/Statement.h"
-
-using std::bind1st;
-using std::bind2nd;
-using std::mem_fun_ref;
-using namespace qpid::broker;
-using qpid::framing::AccumulatedAck;
-
-TxAck::TxAck(AccumulatedAck& _acked, std::list<DeliveryRecord>& _unacked) :
- acked(_acked), unacked(_unacked){
-
-}
-
-bool TxAck::prepare(TransactionContext* ctxt) throw(){
- try{
- //dequeue all acked messages from their queues
- for (ack_iterator i = unacked.begin(); i != unacked.end(); i++) {
- if (i->coveredBy(&acked)) {
- i->dequeue(ctxt);
- }
- }
- return true;
- }catch(const std::exception& e){
- QPID_LOG(error, "Failed to prepare: " << e.what());
- return false;
- }catch(...){
- QPID_LOG(error, "Failed to prepare");
- return false;
- }
-}
-
-void TxAck::commit() throw(){
- //remove all acked records from the list
- unacked.remove_if(bind2nd(mem_fun_ref(&DeliveryRecord::coveredBy), &acked));
-}
-
-void TxAck::rollback() throw(){
-}
diff --git a/qpid/cpp/src/qpid/broker/TxAck.h b/qpid/cpp/src/qpid/broker/TxAck.h
deleted file mode 100644
index c8383b6314..0000000000
--- a/qpid/cpp/src/qpid/broker/TxAck.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _TxAck_
-#define _TxAck_
-
-#include <algorithm>
-#include <functional>
-#include <list>
-#include "qpid/framing/AccumulatedAck.h"
-#include "DeliveryRecord.h"
-#include "TxOp.h"
-
-namespace qpid {
- namespace broker {
- /**
- * Defines the transactional behaviour for acks received by a
- * transactional channel.
- */
- class TxAck : public TxOp{
- framing::AccumulatedAck& acked;
- std::list<DeliveryRecord>& unacked;
-
- public:
- /**
- * @param acked a representation of the accumulation of
- * acks received
- * @param unacked the record of delivered messages
- */
- TxAck(framing::AccumulatedAck& acked, std::list<DeliveryRecord>& unacked);
- virtual bool prepare(TransactionContext* ctxt) throw();
- virtual void commit() throw();
- virtual void rollback() throw();
- virtual ~TxAck(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/TxBuffer.cpp b/qpid/cpp/src/qpid/broker/TxBuffer.cpp
deleted file mode 100644
index 5b5b00e929..0000000000
--- a/qpid/cpp/src/qpid/broker/TxBuffer.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "TxBuffer.h"
-
-#include <boost/mem_fn.hpp>
-using boost::mem_fn;
-using namespace qpid::broker;
-
-bool TxBuffer::prepare(TransactionContext* const ctxt)
-{
- for(op_iterator i = ops.begin(); i < ops.end(); i++){
- if(!(*i)->prepare(ctxt)){
- return false;
- }
- }
- return true;
-}
-
-void TxBuffer::commit()
-{
- for_each(ops.begin(), ops.end(), mem_fn(&TxOp::commit));
- ops.clear();
-}
-
-void TxBuffer::rollback()
-{
- for_each(ops.begin(), ops.end(), mem_fn(&TxOp::rollback));
- ops.clear();
-}
-
-void TxBuffer::enlist(TxOp::shared_ptr op)
-{
- ops.push_back(op);
-}
-
-bool TxBuffer::commitLocal(TransactionalStore* const store)
-{
- std::auto_ptr<TransactionContext> ctxt;
- if(store) ctxt = store->begin();
- if (prepare(ctxt.get())) {
- if(store) store->commit(*ctxt);
- commit();
- return true;
- } else {
- if(store) store->abort(*ctxt);
- rollback();
- return false;
- }
-}
diff --git a/qpid/cpp/src/qpid/broker/TxBuffer.h b/qpid/cpp/src/qpid/broker/TxBuffer.h
deleted file mode 100644
index 361c47e92c..0000000000
--- a/qpid/cpp/src/qpid/broker/TxBuffer.h
+++ /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.
- *
- */
-#ifndef _TxBuffer_
-#define _TxBuffer_
-
-#include <algorithm>
-#include <functional>
-#include <vector>
-#include "TransactionalStore.h"
-#include "TxOp.h"
-
-/**
- * Represents a single transaction. As such, an instance of this class
- * will hold a list of operations representing the workload of the
- * transaction. This work can be committed or rolled back. Committing
- * is a two-stage process: first all the operations should be
- * prepared, then if that succeeds they can be committed.
- *
- * In the 2pc case, a successful prepare may be followed by either a
- * commit or a rollback.
- *
- * Atomicity of prepare is ensured by using a lower level
- * transactional facility. This saves explicitly rolling back all the
- * successfully prepared ops when one of them fails. i.e. we do not
- * use 2pc internally, we instead ensure that prepare is atomic at a
- * lower level. This makes individual prepare operations easier to
- * code.
- *
- * Transactions on a messaging broker effect three types of 'action':
- * (1) updates to persistent storage (2) updates to transient storage
- * or cached data (3) network writes.
- *
- * Of these, (1) should always occur atomically during prepare to
- * ensure that if the broker crashes while a transaction is being
- * completed the persistent state (which is all that then remains) is
- * consistent. (3) can only be done on commit, after a successful
- * prepare. There is a little more flexibility with (2) but any
- * changes made during prepare should be subject to the control of the
- * TransactionalStore in use.
- */
-namespace qpid {
- namespace broker {
- class TxBuffer{
- typedef std::vector<TxOp::shared_ptr>::iterator op_iterator;
- std::vector<TxOp::shared_ptr> ops;
- protected:
-
- public:
- typedef boost::shared_ptr<TxBuffer> shared_ptr;
- /**
- * Adds an operation to the transaction.
- */
- void enlist(TxOp::shared_ptr op);
-
- /**
- * Requests that all ops are prepared. This should
- * primarily involve making sure that a persistent record
- * of the operations is stored where necessary.
- *
- * Once prepared, a transaction can be committed (or in
- * the 2pc case, rolled back).
- *
- * @returns true if all the operations prepared
- * successfully, false if not.
- */
- bool prepare(TransactionContext* const ctxt);
-
- /**
- * Signals that the ops all prepared successfully and can
- * now commit, i.e. the operation can now be fully carried
- * out.
- *
- * Should only be called after a call to prepare() returns
- * true.
- */
- void commit();
-
- /**
- * Signals that all ops can be rolled back.
- *
- * Should only be called either after a call to prepare()
- * returns true (2pc) or instead of a prepare call
- * ('server-local')
- */
- void rollback();
-
- /**
- * Helper method for managing the process of server local
- * commit
- */
- bool commitLocal(TransactionalStore* const store);
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/TxOp.h b/qpid/cpp/src/qpid/broker/TxOp.h
deleted file mode 100644
index e687c437cc..0000000000
--- a/qpid/cpp/src/qpid/broker/TxOp.h
+++ /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.
- *
- */
-#ifndef _TxOp_
-#define _TxOp_
-
-#include "TransactionalStore.h"
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
- namespace broker {
- class TxOp{
- public:
- typedef boost::shared_ptr<TxOp> shared_ptr;
-
- virtual bool prepare(TransactionContext*) throw() = 0;
- virtual void commit() throw() = 0;
- virtual void rollback() throw() = 0;
- virtual ~TxOp(){}
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/TxPublish.cpp b/qpid/cpp/src/qpid/broker/TxPublish.cpp
deleted file mode 100644
index 0ad2eac080..0000000000
--- a/qpid/cpp/src/qpid/broker/TxPublish.cpp
+++ /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.
- *
- */
-#include "qpid/log/Statement.h"
-#include "TxPublish.h"
-
-using namespace qpid::broker;
-
-TxPublish::TxPublish(intrusive_ptr<Message> _msg) : msg(_msg) {}
-
-bool TxPublish::prepare(TransactionContext* ctxt) throw(){
- try{
- for_each(queues.begin(), queues.end(), Prepare(ctxt, msg));
- return true;
- }catch(...){
- QPID_LOG(error, "Failed to prepare");
- return false;
- }
-}
-
-void TxPublish::commit() throw(){
- for_each(queues.begin(), queues.end(), Commit(msg));
-}
-
-void TxPublish::rollback() throw(){
-}
-
-void TxPublish::deliverTo(Queue::shared_ptr& queue){
- queues.push_back(queue);
- delivered = true;
-}
-
-TxPublish::Prepare::Prepare(TransactionContext* _ctxt, intrusive_ptr<Message>& _msg)
- : ctxt(_ctxt), msg(_msg){}
-
-void TxPublish::Prepare::operator()(Queue::shared_ptr& queue){
- if (!queue->enqueue(ctxt, msg)){
- /**
- * if not store then mark message for ack and deleivery once
- * commit happens, as async IO will never set it when no store
- * exists
- */
- msg->enqueueComplete();
- }
-}
-
-TxPublish::Commit::Commit(intrusive_ptr<Message>& _msg) : msg(_msg){}
-
-void TxPublish::Commit::operator()(Queue::shared_ptr& queue){
- queue->process(msg);
-}
-
-uint64_t TxPublish::contentSize ()
-{
- return msg->contentSize ();
-}
diff --git a/qpid/cpp/src/qpid/broker/TxPublish.h b/qpid/cpp/src/qpid/broker/TxPublish.h
deleted file mode 100644
index 085dd28316..0000000000
--- a/qpid/cpp/src/qpid/broker/TxPublish.h
+++ /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.
- *
- */
-#ifndef _TxPublish_
-#define _TxPublish_
-
-#include <algorithm>
-#include <functional>
-#include <list>
-#include "Queue.h"
-#include "Deliverable.h"
-#include "Message.h"
-#include "MessageStore.h"
-#include "TxOp.h"
-
-namespace qpid {
- namespace broker {
- /**
- * Defines the behaviour for publish operations on a
- * transactional channel. Messages are routed through
- * exchanges when received but are not at that stage delivered
- * to the matching queues, rather the queues are held in an
- * instance of this class. On prepare() the message is marked
- * enqueued to the relevant queues in the MessagesStore. On
- * commit() the messages will be passed to the queue for
- * dispatch or to be added to the in-memory queue.
- */
- class TxPublish : public TxOp, public Deliverable{
- class Prepare{
- TransactionContext* ctxt;
- intrusive_ptr<Message>& msg;
- public:
- Prepare(TransactionContext* ctxt, intrusive_ptr<Message>& msg);
- void operator()(Queue::shared_ptr& queue);
- };
-
- class Commit{
- intrusive_ptr<Message>& msg;
- public:
- Commit(intrusive_ptr<Message>& msg);
- void operator()(Queue::shared_ptr& queue);
- };
-
- intrusive_ptr<Message> msg;
- std::list<Queue::shared_ptr> queues;
-
- public:
- TxPublish(intrusive_ptr<Message> msg);
- virtual bool prepare(TransactionContext* ctxt) throw();
- virtual void commit() throw();
- virtual void rollback() throw();
-
- virtual void deliverTo(Queue::shared_ptr& queue);
-
- virtual ~TxPublish(){}
-
- uint64_t contentSize();
- };
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/broker/Vhost.cpp b/qpid/cpp/src/qpid/broker/Vhost.cpp
deleted file mode 100644
index 06a8c8eca3..0000000000
--- a/qpid/cpp/src/qpid/broker/Vhost.cpp
+++ /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.
-//
-
-#include "Vhost.h"
-#include "qpid/management/ManagementAgent.h"
-
-using namespace qpid::broker;
-using qpid::management::ManagementAgent;
-
-Vhost::Vhost (management::Manageable* parentBroker)
-{
- if (parentBroker != 0)
- {
- ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
-
- if (agent.get () != 0)
- {
- mgmtObject = management::Vhost::shared_ptr
- (new management::Vhost (this, parentBroker, "/"));
- agent->addObject (mgmtObject, 2, 0);
- }
- }
-}
-
diff --git a/qpid/cpp/src/qpid/broker/Vhost.h b/qpid/cpp/src/qpid/broker/Vhost.h
deleted file mode 100644
index b702dcebf0..0000000000
--- a/qpid/cpp/src/qpid/broker/Vhost.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _Vhost_
-#define _Vhost_
-
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-#include "qpid/management/Manageable.h"
-#include "qpid/management/Vhost.h"
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace broker {
-
-class Vhost : public management::Manageable
-{
- private:
-
- management::Vhost::shared_ptr mgmtObject;
-
- public:
-
- typedef boost::shared_ptr<Vhost> shared_ptr;
-
- Vhost (management::Manageable* parentBroker);
-
- management::ManagementObject::shared_ptr GetManagementObject (void) const
- { return mgmtObject; }
-
- management::Manageable::status_t ManagementMethod (uint32_t, management::Args&)
- { return management::Manageable::STATUS_OK; }
-};
-
-}}
-
-#endif /*!_Vhost_*/
diff --git a/qpid/cpp/src/qpid/client/AckMode.h b/qpid/cpp/src/qpid/client/AckMode.h
deleted file mode 100644
index 944fba655d..0000000000
--- a/qpid/cpp/src/qpid/client/AckMode.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef _client_AckMode_h
-#define _client_AckMode_h
-
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-namespace qpid {
-namespace client {
-
-/**
- * DEPRECATED
- *
- * The available acknowledgements modes for Channel (now also deprecated).
- */
-enum AckMode {
- /** No acknowledgement will be sent, broker can
- discard messages as soon as they are delivered
- to a consumer using this mode. **/
- NO_ACK = 0,
- /** Each message will be automatically
- acknowledged as soon as it is delivered to the
- application **/
- AUTO_ACK = 1,
- /** Acknowledgements will be sent automatically,
- but not for each message. **/
- LAZY_ACK = 2,
- /** The application is responsible for explicitly
- acknowledging messages. **/
- CLIENT_ACK = 3
-};
-
-}} // namespace qpid::client
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/AckPolicy.h b/qpid/cpp/src/qpid/client/AckPolicy.h
deleted file mode 100644
index af17539ebe..0000000000
--- a/qpid/cpp/src/qpid/client/AckPolicy.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef QPID_CLIENT_ACKPOLICY_H
-#define QPID_CLIENT_ACKPOLICY_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-namespace qpid {
-namespace client {
-
-/**
- * Policy for automatic acknowledgement of messages.
- *
- * \ingroup clientapi
- */
-class AckPolicy
-{
- size_t interval;
- size_t count;
-
- public:
- /**
- *@param n: acknowledge every n messages.
- *n==0 means no automatick acknowledgement.
- */
- AckPolicy(size_t n=1) : interval(n), count(n) {}
-
- void ack(const Message& msg) {
- if (!interval) return;
- bool send=(--count==0);
- msg.acknowledge(true, send);
- if (send) count = interval;
- }
-};
-
-}} // namespace qpid::client
-
-
-
-#endif /*!QPID_CLIENT_ACKPOLICY_H*/
diff --git a/qpid/cpp/src/qpid/client/ChainableFrameHandler.h b/qpid/cpp/src/qpid/client/ChainableFrameHandler.h
deleted file mode 100644
index 29e16d53dc..0000000000
--- a/qpid/cpp/src/qpid/client/ChainableFrameHandler.h
+++ /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.
- *
- */
-
-#ifndef _ChainableFrameHandler_
-#define _ChainableFrameHandler_
-
-#include <boost/function.hpp>
-#include "qpid/framing/AMQFrame.h"
-
-namespace qpid {
-namespace client {
-
-struct ChainableFrameHandler
-{
- typedef boost::function<void(framing::AMQFrame&)> FrameDelegate;
-
- FrameDelegate in;
- FrameDelegate out;
-
- ChainableFrameHandler() {}
- ChainableFrameHandler(FrameDelegate i, FrameDelegate o): in(i), out(o) {}
- virtual ~ChainableFrameHandler() {}
-};
-
-}}
-
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Channel.cpp b/qpid/cpp/src/qpid/client/Channel.cpp
deleted file mode 100644
index 4af69c8552..0000000000
--- a/qpid/cpp/src/qpid/client/Channel.cpp
+++ /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.
- *
- */
-#include "qpid/log/Statement.h"
-#include <iostream>
-#include <sstream>
-#include "Channel.h"
-#include "qpid/sys/Monitor.h"
-#include "Message.h"
-#include "Connection.h"
-#include "Demux.h"
-#include "FutureResponse.h"
-#include "MessageListener.h"
-#include "MessageQueue.h"
-#include <boost/format.hpp>
-#include <boost/bind.hpp>
-#include "qpid/framing/all_method_bodies.h"
-
-using namespace std;
-using namespace boost;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-namespace qpid{
-namespace client{
-using namespace arg;
-
-const std::string empty;
-
-class ScopedSync
-{
- Session& session;
- public:
- ScopedSync(Session& s, bool enabled = true) : session(s) { session.setSynchronous(enabled); }
- ~ScopedSync() { session.setSynchronous(false); }
-};
-
-Channel::Channel(bool _transactional, u_int16_t _prefetch) :
- prefetch(_prefetch), transactional(_transactional), running(false),
- uniqueId(true)/*could eventually be the session id*/, nameCounter(0), active(false)
-{
-}
-
-Channel::~Channel()
-{
- join();
-}
-
-void Channel::open(const Session& s)
-{
- Mutex::ScopedLock l(stopLock);
- if (isOpen())
- throw ChannelBusyException();
- active = true;
- session = s;
- if(isTransactional()) {
- session.txSelect();
- }
-}
-
-bool Channel::isOpen() const {
- Mutex::ScopedLock l(stopLock);
- return active;
-}
-
-void Channel::setPrefetch(uint32_t _prefetch){
- prefetch = _prefetch;
-}
-
-void Channel::declareExchange(Exchange& _exchange, bool synch){
- ScopedSync s(session, synch);
- session.exchangeDeclare(exchange=_exchange.getName(), type=_exchange.getType());
-}
-
-void Channel::deleteExchange(Exchange& _exchange, bool synch){
- ScopedSync s(session, synch);
- session.exchangeDelete(exchange=_exchange.getName(), ifUnused=false);
-}
-
-void Channel::declareQueue(Queue& _queue, bool synch){
- if (_queue.getName().empty()) {
- stringstream uniqueName;
- uniqueName << uniqueId << "-queue-" << ++nameCounter;
- _queue.setName(uniqueName.str());
- }
-
- ScopedSync s(session, synch);
- session.queueDeclare(queue=_queue.getName(), passive=false/*passive*/, durable=_queue.isDurable(),
- exclusive=_queue.isExclusive(), autoDelete=_queue.isAutoDelete());
-
-}
-
-void Channel::deleteQueue(Queue& _queue, bool ifunused, bool ifempty, bool synch){
- ScopedSync s(session, synch);
- session.queueDelete(queue=_queue.getName(), ifUnused=ifunused, ifEmpty=ifempty);
-}
-
-void Channel::bind(const Exchange& exchange, const Queue& queue, const std::string& key, const FieldTable& args, bool synch){
- string e = exchange.getName();
- string q = queue.getName();
- ScopedSync s(session, synch);
- session.queueBind(0, q, e, key, args);
-}
-
-void Channel::commit(){
- session.txCommit();
-}
-
-void Channel::rollback(){
- session.txRollback();
-}
-
-void Channel::consume(
- Queue& _queue, const std::string& tag, MessageListener* listener,
- AckMode ackMode, bool noLocal, bool synch, const FieldTable* fields) {
-
- if (tag.empty()) {
- throw Exception("A tag must be specified for a consumer.");
- }
- {
- Mutex::ScopedLock l(lock);
- ConsumerMap::iterator i = consumers.find(tag);
- if (i != consumers.end())
- throw NotAllowedException(QPID_MSG("Consumer already exists with tag " << tag ));
- Consumer& c = consumers[tag];
- c.listener = listener;
- c.ackMode = ackMode;
- c.count = 0;
- }
- uint8_t confirmMode = ackMode == NO_ACK ? 0 : 1;
- ScopedSync s(session, synch);
- session.messageSubscribe(0, _queue.getName(), tag, noLocal,
- confirmMode, 0/*pre-acquire*/,
- false, fields ? *fields : FieldTable());
- if (!prefetch) {
- session.messageFlowMode(tag, 0/*credit based*/);
- }
-
- //allocate some credit:
- session.messageFlow(tag, 1/*BYTES*/, 0xFFFFFFFF);
- session.messageFlow(tag, 0/*MESSAGES*/, prefetch ? prefetch : 0xFFFFFFFF);
-}
-
-void Channel::cancel(const std::string& tag, bool synch) {
- Consumer c;
- {
- Mutex::ScopedLock l(lock);
- ConsumerMap::iterator i = consumers.find(tag);
- if (i == consumers.end())
- return;
- c = i->second;
- consumers.erase(i);
- }
- ScopedSync s(session, synch);
- session.messageCancel(tag);
-}
-
-bool Channel::get(Message& msg, const Queue& _queue, AckMode ackMode) {
- string tag = "get-handler";
- ScopedDivert handler(tag, session.getExecution().getDemux());
- Demux::QueuePtr incoming = handler.getQueue();
-
- session.messageSubscribe(destination=tag, queue=_queue.getName(), confirmMode=(ackMode == NO_ACK ? 0 : 1));
- session.messageFlow(tag, 1/*BYTES*/, 0xFFFFFFFF);
- session.messageFlow(tag, 0/*MESSAGES*/, 1);
- Completion status = session.messageFlush(tag);
- status.sync();
- session.messageCancel(tag);
-
- FrameSet::shared_ptr p;
- if (incoming->tryPop(p)) {
- msg.populate(*p);
- if (ackMode == AUTO_ACK) msg.acknowledge(session, false, true);
- return true;
- }
- else
- return false;
-}
-
-void Channel::publish(Message& msg, const Exchange& exchange,
- const std::string& routingKey,
- bool mandatory, bool /*?TODO-restore immediate?*/) {
-
- msg.getDeliveryProperties().setRoutingKey(routingKey);
- msg.getDeliveryProperties().setDiscardUnroutable(!mandatory);
- session.messageTransfer(destination=exchange.getName(), content=msg);
-}
-
-void Channel::close()
-{
- session.close();
- {
- Mutex::ScopedLock l(stopLock);
- active = false;
- }
- stop();
-}
-
-void Channel::start(){
- running = true;
- dispatcher = Thread(*this);
-}
-
-void Channel::stop() {
- gets.close();
- join();
-}
-
-void Channel::join() {
- Mutex::ScopedLock l(stopLock);
- if(running && dispatcher.id()) {
- dispatcher.join();
- running = false;
- }
-}
-
-void Channel::dispatch(FrameSet& content, const std::string& destination)
-{
- ConsumerMap::iterator i = consumers.find(destination);
- if (i != consumers.end()) {
- Message msg;
- msg.populate(content);
- MessageListener* listener = i->second.listener;
- listener->received(msg);
- if (isOpen() && i->second.ackMode != CLIENT_ACK) {
- bool send = i->second.ackMode == AUTO_ACK
- || (prefetch && ++(i->second.count) > (prefetch / 2));
- if (send) i->second.count = 0;
- session.getExecution().completed(content.getId(), true, send);
- }
- } else {
- QPID_LOG(warning, "Dropping message for unrecognised consumer: " << destination);
- }
-}
-
-void Channel::run() {
- try {
- while (true) {
- FrameSet::shared_ptr content = session.get();
- //need to dispatch this to the relevant listener:
- if (content->isA<MessageTransferBody>()) {
- dispatch(*content, content->as<MessageTransferBody>()->getDestination());
- } else {
- QPID_LOG(warning, "Dropping unsupported message type: " << content->getMethod());
- }
- }
- } catch (const ClosedException&) {}
-}
-
-}}
-
diff --git a/qpid/cpp/src/qpid/client/Channel.h b/qpid/cpp/src/qpid/client/Channel.h
deleted file mode 100644
index 2cda97dc63..0000000000
--- a/qpid/cpp/src/qpid/client/Channel.h
+++ /dev/null
@@ -1,316 +0,0 @@
-#ifndef _client_Channel_h
-#define _client_Channel_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <memory>
-#include <boost/scoped_ptr.hpp>
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/Uuid.h"
-#include "Exchange.h"
-#include "Message.h"
-#include "Queue.h"
-#include "ConnectionImpl.h"
-#include "qpid/client/Session.h"
-#include "qpid/Exception.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Thread.h"
-#include "AckMode.h"
-
-namespace qpid {
-
-namespace framing {
-class ChannelCloseBody;
-class AMQMethodBody;
-}
-
-namespace client {
-
-class Connection;
-class MessageChannel;
-class MessageListener;
-class ReturnedMessageHandler;
-
-/**
- * THIS CLASS IS DEPRECATED AND WILL BE SHORTLY REMOVED
- *
- * Represents an AMQP channel, i.e. loosely a session of work. It
- * is through a channel that most of the AMQP 'methods' are
- * exposed.
- *
- */
-class Channel : private sys::Runnable
-{
- private:
- struct Consumer{
- MessageListener* listener;
- AckMode ackMode;
- uint32_t count;
- };
- typedef std::map<std::string, Consumer> ConsumerMap;
-
- mutable sys::Mutex lock;
- sys::Thread dispatcher;
-
- uint32_t prefetch;
- const bool transactional;
- framing::ProtocolVersion version;
-
- mutable sys::Mutex stopLock;
- bool running;
-
- ConsumerMap consumers;
- Session session;
- framing::ChannelId channelId;
- sys::BlockingQueue<framing::FrameSet::shared_ptr> gets;
- framing::Uuid uniqueId;
- uint32_t nameCounter;
- bool active;
-
- void stop();
-
- void open(const Session& session);
- void closeInternal();
- void join();
-
- void dispatch(framing::FrameSet& msg, const std::string& destination);
-
- friend class Connection;
-
- public:
- /**
- * Creates a channel object.
- *
- * @param transactional if true, the publishing and acknowledgement
- * of messages will be transactional and can be committed or
- * aborted in atomic units (@see commit(), @see rollback())
- *
- * @param prefetch specifies the number of unacknowledged
- * messages the channel is willing to have sent to it
- * asynchronously
- */
- Channel(bool transactional = false, u_int16_t prefetch = 0);
-
- ~Channel();
-
- /**
- * Declares an exchange.
- *
- * In AMQP Exchanges are the destinations to which messages
- * are published. They have Queues bound to them and route
- * messages they receive to those queues. The routing rules
- * depend on the type of the exchange.
- *
- * @param exchange an Exchange object representing the
- * exchange to declare
- *
- * @param synch if true this call will block until a response
- * is received from the broker
- */
- void declareExchange(Exchange& exchange, bool synch = true);
- /**
- * Deletes an exchange
- *
- * @param exchange an Exchange object representing the exchange to delete
- *
- * @param synch if true this call will block until a response
- * is received from the broker
- */
- void deleteExchange(Exchange& exchange, bool synch = true);
- /**
- * Declares a Queue
- *
- * @param queue a Queue object representing the queue to declare
- *
- * @param synch if true this call will block until a response
- * is received from the broker
- */
- void declareQueue(Queue& queue, bool synch = true);
- /**
- * Deletes a Queue
- *
- * @param queue a Queue object representing the queue to delete
- *
- * @param synch if true this call will block until a response
- * is received from the broker
- */
- void deleteQueue(Queue& queue, bool ifunused = false, bool ifempty = false, bool synch = true);
- /**
- * Binds a queue to an exchange. The exact semantics of this
- * (in particular how 'routing keys' and 'binding arguments'
- * are used) depends on the type of the exchange.
- *
- * @param exchange an Exchange object representing the
- * exchange to bind to
- *
- * @param queue a Queue object representing the queue to be
- * bound
- *
- * @param key the 'routing key' for the binding
- *
- * @param args the 'binding arguments' for the binding
- *
- * @param synch if true this call will block until a response
- * is received from the broker
- */
- void bind(const Exchange& exchange, const Queue& queue,
- const std::string& key,
- const framing::FieldTable& args=framing::FieldTable(),
- bool synch = true);
-
- /**
- * For a transactional channel this will commit all
- * publications and acknowledgements since the last commit (or
- * the channel was opened if there has been no previous
- * commit). This will cause published messages to become
- * available to consumers and acknowledged messages to be
- * consumed and removed from the queues they were dispatched
- * from.
- *
- * Transactionailty of a channel is specified when the channel
- * object is created (@see Channel()).
- */
- void commit();
-
- /**
- * For a transactional channel, this will rollback any
- * publications or acknowledgements. It will be as if the
- * ppblished messages were never sent and the acknowledged
- * messages were never consumed.
- */
- void rollback();
-
- /**
- * Change the prefetch in use.
- */
- void setPrefetch(uint32_t prefetch);
-
- uint32_t getPrefetch() { return prefetch; }
-
- /**
- * Start message dispatching on a new thread
- */
- void start();
-
- /**
- * Close the channel. Closing a channel that is not open has no
- * effect.
- */
- void close();
-
- /** True if the channel is transactional */
- bool isTransactional() { return transactional; }
-
- /** True if the channel is open */
- bool isOpen() const;
-
- /** Return the protocol version */
- framing::ProtocolVersion getVersion() const { return version ; }
-
- /**
- * Creates a 'consumer' for a queue. Messages in (or arriving
- * at) that queue will be delivered to consumers
- * asynchronously.
- *
- * @param queue a Queue instance representing the queue to
- * consume from
- *
- * @param tag an identifier to associate with the consumer
- * that can be used to cancel its subscription (if empty, this
- * will be assigned by the broker)
- *
- * @param listener a pointer to an instance of an
- * implementation of the MessageListener interface. Messages
- * received from this queue for this consumer will result in
- * invocation of the received() method on the listener, with
- * the message itself passed in.
- *
- * @param ackMode the mode of acknowledgement that the broker
- * should assume for this consumer. @see AckMode
- *
- * @param noLocal if true, this consumer will not be sent any
- * message published by this connection
- *
- * @param synch if true this call will block until a response
- * is received from the broker
- */
- void consume(
- Queue& queue, const std::string& tag, MessageListener* listener,
- AckMode ackMode = NO_ACK, bool noLocal = false, bool synch = true,
- const framing::FieldTable* fields = 0);
-
- /**
- * Cancels a subscription previously set up through a call to consume().
- *
- * @param tag the identifier used (or assigned) in the consume
- * request that set up the subscription to be cancelled.
- *
- * @param synch if true this call will block until a response
- * is received from the broker
- */
- void cancel(const std::string& tag, bool synch = true);
- /**
- * Synchronous pull of a message from a queue.
- *
- * @param msg a message object that will contain the message
- * headers and content if the call completes.
- *
- * @param queue the queue to consume from
- *
- * @param ackMode the acknowledgement mode to use (@see
- * AckMode)
- *
- * @return true if a message was succcessfully dequeued from
- * the queue, false if the queue was empty.
- */
- bool get(Message& msg, const Queue& queue, AckMode ackMode = NO_ACK);
-
- /**
- * Publishes (i.e. sends a message to the broker).
- *
- * @param msg the message to publish
- *
- * @param exchange the exchange to publish the message to
- *
- * @param routingKey the routing key to publish with
- *
- * @param mandatory if true and the exchange to which this
- * publish is directed has no matching bindings, the message
- * will be returned (see setReturnedMessageHandler()).
- *
- * @param immediate if true and there is no consumer to
- * receive this message on publication, the message will be
- * returned (see setReturnedMessageHandler()).
- */
- void publish(Message& msg, const Exchange& exchange,
- const std::string& routingKey,
- bool mandatory = false, bool immediate = false);
-
- /**
- * Deliver incoming messages to the appropriate MessageListener.
- */
- void run();
-};
-
-}}
-
-#endif /*!_client_Channel_h*/
diff --git a/qpid/cpp/src/qpid/client/Completion.h b/qpid/cpp/src/qpid/client/Completion.h
deleted file mode 100644
index 4d324aaf28..0000000000
--- a/qpid/cpp/src/qpid/client/Completion.h
+++ /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.
- *
- */
-
-#ifndef _Completion_
-#define _Completion_
-
-#include <boost/shared_ptr.hpp>
-#include "Future.h"
-#include "SessionCore.h"
-
-namespace qpid {
-namespace client {
-
-class Completion
-{
-protected:
- Future future;
- shared_ptr<SessionCore> session;
-
-public:
- Completion() {}
-
- Completion(Future f, shared_ptr<SessionCore> s) : future(f), session(s) {}
-
- void sync()
- {
- future.sync(*session);
- }
-
- void wait()
- {
- future.wait(*session);
- }
-
- bool isComplete() {
- return future.isComplete(*session);
- }
-
- bool isCompleteUpTo() {
- return future.isCompleteUpTo(*session);
- }
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/CompletionTracker.cpp b/qpid/cpp/src/qpid/client/CompletionTracker.cpp
deleted file mode 100644
index 76ea9dec51..0000000000
--- a/qpid/cpp/src/qpid/client/CompletionTracker.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "CompletionTracker.h"
-#include <algorithm>
-
-using qpid::client::CompletionTracker;
-using namespace qpid::framing;
-using namespace boost;
-
-namespace
-{
-const std::string empty;
-}
-
-CompletionTracker::CompletionTracker() : closed(false) {}
-CompletionTracker::CompletionTracker(const SequenceNumber& m) : mark(m) {}
-
-void CompletionTracker::close()
-{
- sys::Mutex::ScopedLock l(lock);
- closed=true;
- while (!listeners.empty()) {
- Record r(listeners.front());
- {
- sys::Mutex::ScopedUnlock u(lock);
- r.completed();
- }
- listeners.pop_front();
- }
-}
-
-
-void CompletionTracker::completed(const SequenceNumber& _mark)
-{
- sys::Mutex::ScopedLock l(lock);
- mark = _mark;
- while (!listeners.empty() && !(listeners.front().id > mark)) {
- Record r(listeners.front());
- listeners.pop_front();
- {
- sys::Mutex::ScopedUnlock u(lock);
- r.completed();
- }
- }
-}
-
-void CompletionTracker::received(const SequenceNumber& id, const std::string& result)
-{
- sys::Mutex::ScopedLock l(lock);
- Listeners::iterator i = seek(id);
- if (i != listeners.end() && i->id == id) {
- i->received(result);
- listeners.erase(i);
- }
-}
-
-void CompletionTracker::listenForCompletion(const SequenceNumber& point, CompletionListener listener)
-{
- if (!add(Record(point, listener))) {
- listener();
- }
-}
-
-void CompletionTracker::listenForResult(const SequenceNumber& point, ResultListener listener)
-{
- if (!add(Record(point, listener))) {
- listener(empty);
- }
-}
-
-bool CompletionTracker::add(const Record& record)
-{
- sys::Mutex::ScopedLock l(lock);
- if (record.id <= mark || closed) {
- return false;
- } else {
- //insert at the correct position
- Listeners::iterator i = seek(record.id);
- if (i == listeners.end()) i = listeners.begin();
- listeners.insert(i, record);
- return true;
- }
-}
-
-CompletionTracker::Listeners::iterator CompletionTracker::seek(const framing::SequenceNumber& point)
-{
- Listeners::iterator i = listeners.begin();
- while (i != listeners.end() && i->id < point) i++;
- return i;
-}
-
-
-void CompletionTracker::Record::completed()
-{
- if (f) f();
- else if(g) g(empty);//won't get a result if command is now complete
-}
-
-void CompletionTracker::Record::received(const std::string& result)
-{
- if (g) g(result);
-}
diff --git a/qpid/cpp/src/qpid/client/CompletionTracker.h b/qpid/cpp/src/qpid/client/CompletionTracker.h
deleted file mode 100644
index 55f7ff7531..0000000000
--- a/qpid/cpp/src/qpid/client/CompletionTracker.h
+++ /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.
- *
- */
-
-#include <list>
-#include <boost/function.hpp>
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/sys/Mutex.h"
-
-#ifndef _CompletionTracker_
-#define _CompletionTracker_
-
-namespace qpid {
-namespace client {
-
-class CompletionTracker
-{
-public:
- typedef boost::function<void()> CompletionListener;
- typedef boost::function<void(const std::string&)> ResultListener;
-
- CompletionTracker();
- CompletionTracker(const framing::SequenceNumber& mark);
- void completed(const framing::SequenceNumber& mark);
- void received(const framing::SequenceNumber& id, const std::string& result);
- void listenForCompletion(const framing::SequenceNumber& point, CompletionListener l);
- void listenForResult(const framing::SequenceNumber& point, ResultListener l);
- void close();
-
-private:
- struct Record
- {
- framing::SequenceNumber id;
- CompletionListener f;
- ResultListener g;
-
- Record(const framing::SequenceNumber& _id, CompletionListener l) : id(_id), f(l) {}
- Record(const framing::SequenceNumber& _id, ResultListener l) : id(_id), g(l) {}
- void completed();
- void received(const std::string& result);
-
- };
-
- typedef std::list<Record> Listeners;
- bool closed;
-
- sys::Mutex lock;
- framing::SequenceNumber mark;
- Listeners listeners;
-
- bool add(const Record& r);
- Listeners::iterator seek(const framing::SequenceNumber&);
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Connection.cpp b/qpid/cpp/src/qpid/client/Connection.cpp
deleted file mode 100644
index 872e04b3b5..0000000000
--- a/qpid/cpp/src/qpid/client/Connection.cpp
+++ /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.
- *
- */
-#include <algorithm>
-#include <boost/format.hpp>
-#include <boost/bind.hpp>
-
-#include "Connection.h"
-#include "Channel.h"
-#include "Message.h"
-#include "SessionCore.h"
-#include "qpid/log/Logger.h"
-#include "qpid/log/Options.h"
-#include "qpid/log/Statement.h"
-#include "qpid/shared_ptr.h"
-#include <iostream>
-#include <sstream>
-#include <functional>
-
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-
-namespace qpid {
-namespace client {
-
-Connection::Connection(bool _debug, uint32_t _max_frame_size, framing::ProtocolVersion _version) :
- channelIdCounter(0), version(_version),
- max_frame_size(_max_frame_size),
- isOpen(false),
- impl(new ConnectionImpl(
- shared_ptr<Connector>(new Connector(_version, _debug))))
-{}
-
-Connection::Connection(shared_ptr<Connector> c) :
- channelIdCounter(0), version(framing::highestProtocolVersion),
- max_frame_size(65535),
- isOpen(false),
- impl(new ConnectionImpl(c))
-{}
-
-Connection::~Connection(){ }
-
-void Connection::open(
- const std::string& host, int port,
- const std::string& uid, const std::string& pwd, const std::string& vhost)
-{
- if (isOpen)
- throw Exception(QPID_MSG("Channel object is already open"));
-
- impl->open(host, port, uid, pwd, vhost);
- isOpen = true;
-}
-
-void Connection::openChannel(Channel& channel) {
- channel.open(newSession(ASYNC));
-}
-
-Session Connection::newSession(SynchronousMode sync,
- uint32_t detachedLifetime)
-{
- shared_ptr<SessionCore> core(
- new SessionCore(impl, ++channelIdCounter, max_frame_size));
- core->setSync(sync);
- impl->addSession(core);
- core->open(detachedLifetime);
- return Session(core);
-}
-
-void Connection::resume(Session& session) {
- session.impl->setChannel(++channelIdCounter);
- impl->addSession(session.impl);
- session.impl->resume(impl);
-}
-
-void Connection::close() {
- impl->close();
-}
-
-}} // namespace qpid::client
diff --git a/qpid/cpp/src/qpid/client/Connection.h b/qpid/cpp/src/qpid/client/Connection.h
deleted file mode 100644
index 81d9b972b6..0000000000
--- a/qpid/cpp/src/qpid/client/Connection.h
+++ /dev/null
@@ -1,149 +0,0 @@
-#ifndef _client_Connection_
-#define _client_Connection_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <map>
-#include <string>
-#include "Channel.h"
-#include "ConnectionImpl.h"
-#include "qpid/client/Session.h"
-#include "qpid/framing/AMQP_HighestVersion.h"
-#include "qpid/framing/Uuid.h"
-
-namespace qpid {
-
-/**
- * The client namespace contains all classes that make up a client
- * implementation of the AMQP protocol. The key classes that form
- * the basis of the client API to be used by applications are
- * Connection and Channel.
- */
-namespace client {
-
-/**
- * \defgroup clientapi Application API for an AMQP client
- */
-
-/**
- * Represents a connection to an AMQP broker. All communication is
- * initiated by establishing a connection, then opening one or
- * more Channels over that connection.
- *
- * \ingroup clientapi
- */
-class Connection
-{
- framing::ChannelId channelIdCounter;
- framing::ProtocolVersion version;
- const uint32_t max_frame_size;
- bool isOpen;
- bool debug;
-
- protected:
- boost::shared_ptr<ConnectionImpl> impl;
-
- public:
- /**
- * Creates a connection object, but does not open the
- * connection.
- *
- * @param _version the version of the protocol to connect with
- *
- * @param debug turns on tracing for the connection
- * (i.e. prints details of the frames sent and received to std
- * out). Optional and defaults to false.
- *
- * @param max_frame_size the maximum frame size that the
- * client will accept. Optional and defaults to 65535.
- */
- Connection(bool debug = false, uint32_t max_frame_size = 65535,
- framing::ProtocolVersion=framing::highestProtocolVersion);
- Connection(boost::shared_ptr<Connector>);
- ~Connection();
-
- /**
- * Opens a connection to a broker.
- *
- * @param host the host on which the broker is running
- *
- * @param port the port on the which the broker is listening
- *
- * @param uid the userid to connect with
- *
- * @param pwd the password to connect with (currently SASL
- * PLAIN is the only authentication method supported so this
- * is sent in clear text)
- *
- * @param virtualhost the AMQP virtual host to use (virtual
- * hosts, where implemented(!), provide namespace partitioning
- * within a single broker).
- */
- void open(const std::string& host, int port = 5672,
- const std::string& uid = "guest",
- const std::string& pwd = "guest",
- const std::string& virtualhost = "/");
-
- /**
- * Close the connection
- *
- * Any further use of this connection (without reopening it) will
- * not succeed.
- */
- void close();
-
- /**
- * Associate a Channel with this connection and open it for use.
- *
- * In AMQP channels are like multi-plexed 'sessions' of work over
- * a connection. Almost all the interaction with AMQP is done over
- * a channel.
- *
- * @param connection the connection object to be associated with
- * the channel. Call Channel::close() to close the channel.
- */
- void openChannel(Channel&);
-
- /**
- * Create a new session on this connection. Sessions allow
- * multiple streams of work to be multiplexed over the same
- * connection.
- *
- *@param detachedLifetime: A session may be detached from its
- * channel, either by calling Session::suspend() or because of a
- * network failure. The session state is perserved for
- * detachedLifetime seconds to allow a call to resume(). After
- * that the broker may discard the session state. Default is 0,
- * meaning the session cannot be resumed.
- */
- Session newSession(SynchronousMode sync, uint32_t detachedLifetime=0);
-
- /**
- * Resume a suspendded session. A session may be resumed
- * on a different connection to the one that created it.
- */
- void resume(Session& session);
-};
-
-}} // namespace qpid::client
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/ConnectionHandler.cpp b/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
deleted file mode 100644
index e1c50c14fc..0000000000
--- a/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "ConnectionHandler.h"
-#include "qpid/log/Statement.h"
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/AMQP_HighestVersion.h"
-#include "qpid/framing/all_method_bodies.h"
-
-using namespace qpid::client;
-using namespace qpid::framing;
-using namespace boost;
-
-namespace {
-const std::string OK("OK");
-}
-
-ConnectionHandler::ConnectionHandler()
- : StateManager(NOT_STARTED)
-{
-
- mechanism = "PLAIN";
- locale = "en_US";
- heartbeat = 0;
- maxChannels = 32767;
- maxFrameSize = 65535;
- insist = true;
- version = framing::highestProtocolVersion;
-
- ESTABLISHED.insert(FAILED);
- ESTABLISHED.insert(OPEN);
-}
-
-void ConnectionHandler::incoming(AMQFrame& frame)
-{
- if (getState() == CLOSED) {
- throw Exception("Connection is closed.");
- }
-
- AMQBody* body = frame.getBody();
- if (frame.getChannel() == 0) {
- if (body->getMethod()) {
- handle(body->getMethod());
- } else {
- error(503, "Cannot send content on channel zero.");
- }
- } else {
- switch(getState()) {
- case OPEN:
- try {
- in(frame);
- }catch(ConnectionException& e){
- error(e.code, e.what(), body);
- }catch(std::exception& e){
- error(541/*internal error*/, e.what(), body);
- }
- break;
- case CLOSING:
- QPID_LOG(warning, "Received frame on non-zero channel while closing connection; frame ignored.");
- break;
- default:
- //must be in connection initialisation:
- fail("Cannot receive frames on non-zero channel until connection is established.");
- }
- }
-}
-
-void ConnectionHandler::outgoing(AMQFrame& frame)
-{
- if (getState() == OPEN) {
- out(frame);
- } else {
- throw Exception("Connection is not open.");
- }
-}
-
-void ConnectionHandler::waitForOpen()
-{
- waitFor(ESTABLISHED);
- if (getState() == FAILED) {
- throw Exception("Failed to establish connection.");
- }
-}
-
-void ConnectionHandler::close()
-{
- switch (getState()) {
- case NEGOTIATING:
- case OPENING:
- setState(FAILED);
- break;
- case OPEN:
- setState(CLOSING);
- send(ConnectionCloseBody(version, 200, OK, 0, 0));
- waitFor(CLOSED);
- break;
- // Nothing to do for CLOSING, CLOSED, FAILED or NOT_STARTED
- }
-}
-
-void ConnectionHandler::send(const framing::AMQBody& body)
-{
- AMQFrame f(body);
- out(f);
-}
-
-void ConnectionHandler::error(uint16_t code, const std::string& message, uint16_t classId, uint16_t methodId)
-{
- setState(CLOSING);
- send(ConnectionCloseBody(version, code, message, classId, methodId));
-}
-
-void ConnectionHandler::error(uint16_t code, const std::string& message, AMQBody* body)
-{
- if (onError)
- onError(code, message);
- AMQMethodBody* method = body->getMethod();
- if (method)
- error(code, message, method->amqpClassId(), method->amqpMethodId());
- else
- error(code, message);
-}
-
-
-void ConnectionHandler::fail(const std::string& message)
-{
- QPID_LOG(warning, message);
- setState(FAILED);
-}
-
-void ConnectionHandler::handle(AMQMethodBody* method)
-{
- switch (getState()) {
- case NOT_STARTED:
- if (method->isA<ConnectionStartBody>()) {
- setState(NEGOTIATING);
- string response = ((char)0) + uid + ((char)0) + pwd;
- send(ConnectionStartOkBody(version, properties, mechanism, response, locale));
- } else {
- fail("Bad method sequence, expected connection-start.");
- }
- break;
- case NEGOTIATING:
- if (method->isA<ConnectionTuneBody>()) {
- ConnectionTuneBody* proposal=polymorphic_downcast<ConnectionTuneBody*>(method);
- heartbeat = proposal->getHeartbeat();
- maxChannels = proposal->getChannelMax();
- send(ConnectionTuneOkBody(version, maxChannels, maxFrameSize, heartbeat));
- setState(OPENING);
- send(ConnectionOpenBody(version, vhost, capabilities, insist));
- //TODO: support for further security challenges
- //} else if (method->isA<ConnectionSecureBody>()) {
- } else {
- fail("Unexpected method sequence, expected connection-tune.");
- }
- break;
- case OPENING:
- if (method->isA<ConnectionOpenOkBody>()) {
- setState(OPEN);
- //TODO: support for redirection
- //} else if (method->isA<ConnectionRedirectBody>()) {
- } else {
- fail("Unexpected method sequence, expected connection-open-ok.");
- }
- break;
- case OPEN:
- if (method->isA<ConnectionCloseBody>()) {
- send(ConnectionCloseOkBody(version));
- setState(CLOSED);
- ConnectionCloseBody* c=polymorphic_downcast<ConnectionCloseBody*>(method);
- QPID_LOG(warning, "Broker closed connection: " << c->getReplyCode()
- << ", " << c->getReplyText());
- if (onError) {
- onError(c->getReplyCode(), c->getReplyText());
- }
- } else {
- error(503, "Unexpected method on channel zero.", method->amqpClassId(), method->amqpMethodId());
- }
- break;
- case CLOSING:
- if (method->isA<ConnectionCloseOkBody>()) {
- if (onClose) {
- onClose();
- }
- setState(CLOSED);
- } else {
- QPID_LOG(warning, "Received frame on channel zero while closing connection; frame ignored.");
- }
- break;
- }
-}
diff --git a/qpid/cpp/src/qpid/client/ConnectionHandler.h b/qpid/cpp/src/qpid/client/ConnectionHandler.h
deleted file mode 100644
index bb50495c06..0000000000
--- a/qpid/cpp/src/qpid/client/ConnectionHandler.h
+++ /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.
- *
- */
-#ifndef _ConnectionHandler_
-#define _ConnectionHandler_
-
-#include "Connector.h"
-#include "StateManager.h"
-#include "ChainableFrameHandler.h"
-#include "qpid/framing/InputHandler.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/AMQMethodBody.h"
-
-namespace qpid {
-namespace client {
-
-struct ConnectionProperties
-{
- std::string uid;
- std::string pwd;
- std::string vhost;
- framing::FieldTable properties;
- std::string mechanism;
- std::string locale;
- std::string capabilities;
- uint16_t heartbeat;
- uint16_t maxChannels;
- uint64_t maxFrameSize;
- bool insist;
- framing::ProtocolVersion version;
-};
-
-class ConnectionHandler : private StateManager,
- public ConnectionProperties,
- public ChainableFrameHandler,
- public framing::InputHandler
-{
- enum STATES {NOT_STARTED, NEGOTIATING, OPENING, OPEN, CLOSING, CLOSED, FAILED};
- std::set<int> ESTABLISHED;
-
- void handle(framing::AMQMethodBody* method);
- void send(const framing::AMQBody& body);
- void error(uint16_t code, const std::string& message, uint16_t classId = 0, uint16_t methodId = 0);
- void error(uint16_t code, const std::string& message, framing::AMQBody* body);
-
-public:
- using InputHandler::handle;
- typedef boost::function<void()> CloseListener;
- typedef boost::function<void(uint16_t, const std::string&)> ErrorListener;
-
- ConnectionHandler();
-
- void received(framing::AMQFrame& f) { incoming(f); }
-
- void incoming(framing::AMQFrame& frame);
- void outgoing(framing::AMQFrame& frame);
-
- void waitForOpen();
- void close();
- void fail(const std::string& message);
-
- CloseListener onClose;
- ErrorListener onError;
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
deleted file mode 100644
index b248de8744..0000000000
--- a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/log/Statement.h"
-#include "qpid/framing/constants.h"
-#include "qpid/framing/reply_exceptions.h"
-
-#include "ConnectionImpl.h"
-#include "SessionCore.h"
-
-#include <boost/bind.hpp>
-#include <boost/format.hpp>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-ConnectionImpl::ConnectionImpl(boost::shared_ptr<Connector> c)
- : connector(c), isClosed(false), isClosing(false)
-{
- handler.in = boost::bind(&ConnectionImpl::incoming, this, _1);
- handler.out = boost::bind(&Connector::send, connector, _1);
- handler.onClose = boost::bind(&ConnectionImpl::closed, this,
- REPLY_SUCCESS, std::string());
- handler.onError = boost::bind(&ConnectionImpl::closed, this, _1, _2);
- connector->setInputHandler(&handler);
- connector->setTimeoutHandler(this);
- connector->setShutdownHandler(this);
-}
-
-ConnectionImpl::~ConnectionImpl() {
- // Important to close the connector first, to ensure the
- // connector thread does not call on us while the destructor
- // is running.
- connector->close();
-}
-
-void ConnectionImpl::addSession(const boost::shared_ptr<SessionCore>& session)
-{
- Mutex::ScopedLock l(lock);
- boost::weak_ptr<SessionCore>& s = sessions[session->getChannel()];
- if (s.lock()) throw ChannelBusyException();
- s = session;
-}
-
-void ConnectionImpl::handle(framing::AMQFrame& frame)
-{
- handler.outgoing(frame);
-}
-
-void ConnectionImpl::incoming(framing::AMQFrame& frame)
-{
- boost::shared_ptr<SessionCore> s;
- {
- Mutex::ScopedLock l(lock);
- s = sessions[frame.getChannel()].lock();
- }
- if (!s)
- throw ChannelErrorException(QPID_MSG("Invalid channel: " << frame.getChannel()));
- s->in(frame);
-}
-
-void ConnectionImpl::open(const std::string& host, int port,
- const std::string& uid, const std::string& pwd,
- const std::string& vhost)
-{
- //TODO: better management of connection properties
- handler.uid = uid;
- handler.pwd = pwd;
- handler.vhost = vhost;
-
- QPID_LOG(info, "Connecting to " << host << ":" << port);
- connector->connect(host, port);
- connector->init();
- handler.waitForOpen();
-}
-
-void ConnectionImpl::idleIn()
-{
- close();
-}
-
-void ConnectionImpl::idleOut()
-{
- AMQFrame frame(in_place<AMQHeartbeatBody>());
- connector->send(frame);
-}
-
-void ConnectionImpl::close()
-{
- Mutex::ScopedLock l(lock);
- if (isClosing || isClosed) return;
- isClosing = true;
- {
- Mutex::ScopedUnlock u(lock);
- handler.close();
- }
- closed(REPLY_SUCCESS, "Closed by client");
-}
-
-// Set closed flags and erase the sessions map, but keep the contents
-// so sessions can be updated outside the lock.
-ConnectionImpl::SessionVector ConnectionImpl::closeInternal(const Mutex::ScopedLock&) {
- isClosed = true;
- connector->close();
- SessionVector save;
- for (SessionMap::iterator i = sessions.begin(); i != sessions.end(); ++i) {
- boost::shared_ptr<SessionCore> s = i->second.lock();
- if (s) save.push_back(s);
- }
- sessions.clear();
- return save;
-}
-
-void ConnectionImpl::closed(uint16_t code, const std::string& text)
-{
- Mutex::ScopedLock l(lock);
- if (isClosed) return;
- SessionVector save(closeInternal(l));
- Mutex::ScopedUnlock u(lock);
- std::for_each(save.begin(), save.end(), boost::bind(&SessionCore::connectionClosed, _1, code, text));
-}
-
-static const std::string CONN_CLOSED("Connection closed by broker");
-
-void ConnectionImpl::shutdown()
-{
- Mutex::ScopedLock l(lock);
- if (isClosed) return;
- SessionVector save(closeInternal(l));
- handler.fail(CONN_CLOSED);
- Mutex::ScopedUnlock u(lock);
- std::for_each(save.begin(), save.end(),
- boost::bind(&SessionCore::connectionBroke, _1, INTERNAL_ERROR, CONN_CLOSED));
-}
-
-void ConnectionImpl::erase(uint16_t ch) {
- Mutex::ScopedLock l(lock);
- sessions.erase(ch);
-}
-
diff --git a/qpid/cpp/src/qpid/client/ConnectionImpl.h b/qpid/cpp/src/qpid/client/ConnectionImpl.h
deleted file mode 100644
index bf8226a776..0000000000
--- a/qpid/cpp/src/qpid/client/ConnectionImpl.h
+++ /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.
- *
- */
-
-#ifndef _ConnectionImpl_
-#define _ConnectionImpl_
-
-#include <map>
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/ShutdownHandler.h"
-#include "qpid/sys/TimeoutHandler.h"
-#include "ConnectionHandler.h"
-#include "Connector.h"
-
-namespace qpid {
-namespace client {
-
-class SessionCore;
-
-class ConnectionImpl : public framing::FrameHandler,
- public sys::TimeoutHandler,
- public sys::ShutdownHandler
-
-{
- typedef std::map<uint16_t, boost::weak_ptr<SessionCore> > SessionMap;
- typedef std::vector<boost::shared_ptr<SessionCore> > SessionVector;
-
- SessionMap sessions;
- ConnectionHandler handler;
- boost::shared_ptr<Connector> connector;
- framing::ProtocolVersion version;
- sys::Mutex lock;
- bool isClosed;
- bool isClosing;
-
- template <class F> void detachAll(const F&);
-
- SessionVector closeInternal(const sys::Mutex::ScopedLock&);
- void incoming(framing::AMQFrame& frame);
- void closed(uint16_t, const std::string&);
- void idleOut();
- void idleIn();
- void shutdown();
- bool setClosing();
-
- public:
- typedef boost::shared_ptr<ConnectionImpl> shared_ptr;
-
- ConnectionImpl(boost::shared_ptr<Connector> c);
- ~ConnectionImpl();
-
- void addSession(const boost::shared_ptr<SessionCore>&);
-
- void open(const std::string& host, int port = 5672,
- const std::string& uid = "guest",
- const std::string& pwd = "guest",
- const std::string& virtualhost = "/");
- void close();
- void handle(framing::AMQFrame& frame);
- void erase(uint16_t channel);
- boost::shared_ptr<Connector> getConnector() { return connector; }
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Connector.cpp b/qpid/cpp/src/qpid/client/Connector.cpp
deleted file mode 100644
index a0be05fbbc..0000000000
--- a/qpid/cpp/src/qpid/client/Connector.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <iostream>
-#include "qpid/log/Statement.h"
-#include "qpid/sys/Time.h"
-#include "qpid/framing/AMQFrame.h"
-#include "Connector.h"
-
-#include "qpid/sys/AsynchIO.h"
-#include "qpid/sys/Dispatcher.h"
-#include "qpid/sys/Poller.h"
-#include "qpid/Msg.h"
-#include <boost/bind.hpp>
-#include <boost/format.hpp>
-
-namespace qpid {
-namespace client {
-
-using namespace qpid::sys;
-using namespace qpid::framing;
-using boost::format;
-using boost::str;
-
-Connector::Connector(
- ProtocolVersion ver, bool _debug, uint32_t buffer_size
-) : debug(_debug),
- receive_buffer_size(buffer_size),
- send_buffer_size(buffer_size),
- version(ver),
- closed(true),
- joined(true),
- timeout(0),
- idleIn(0), idleOut(0),
- timeoutHandler(0),
- shutdownHandler(0),
- aio(0)
-{}
-
-Connector::~Connector() {
- close();
-}
-
-void Connector::connect(const std::string& host, int port){
- Mutex::ScopedLock l(closedLock);
- assert(closed);
- socket.connect(host, port);
- identifier=str(format("[%1% %2%]") % socket.getLocalPort() % socket.getPeerAddress());
- closed = false;
- poller = Poller::shared_ptr(new Poller);
- aio = new AsynchIO(socket,
- boost::bind(&Connector::readbuff, this, _1, _2),
- boost::bind(&Connector::eof, this, _1),
- boost::bind(&Connector::eof, this, _1),
- 0, // closed
- 0, // nobuffs
- boost::bind(&Connector::writebuff, this, _1));
- writer.setAio(aio);
-}
-
-void Connector::init(){
- Mutex::ScopedLock l(closedLock);
- assert(joined);
- ProtocolInitiation init(version);
- writeDataBlock(init);
- joined = false;
- receiver = Thread(this);
-}
-
-bool Connector::closeInternal() {
- Mutex::ScopedLock l(closedLock);
- bool ret = !closed;
- if (!closed) {
- closed = true;
- poller->shutdown();
- }
- if (!joined && receiver.id() != Thread::current().id()) {
- joined = true;
- Mutex::ScopedUnlock u(closedLock);
- receiver.join();
- }
- return ret;
-}
-
-void Connector::close() {
- closeInternal();
-}
-
-void Connector::setInputHandler(InputHandler* handler){
- input = handler;
-}
-
-void Connector::setShutdownHandler(ShutdownHandler* handler){
- shutdownHandler = handler;
-}
-
-OutputHandler* Connector::getOutputHandler(){
- return this;
-}
-
-void Connector::send(AMQFrame& frame) {
- writer.handle(frame);
-}
-
-void Connector::handleClosed() {
- if (closeInternal() && shutdownHandler)
- shutdownHandler->shutdown();
-}
-
-// TODO: astitcher 20070908: This version of the code can never time out, so the idle processing
-// can never be called. The timeut processing needs to be added into the underlying Dispatcher code
-//
-// TODO: astitcher 20070908: EOF is dealt with separately now via a callback to eof
-void Connector::checkIdle(ssize_t status){
- if(timeoutHandler){
- AbsTime t = now();
- if(status == Socket::SOCKET_TIMEOUT) {
- if(idleIn && (Duration(lastIn, t) > idleIn)){
- timeoutHandler->idleIn();
- }
- }
- else if(status == 0 || status == Socket::SOCKET_EOF) {
- handleClosed();
- }
- else {
- lastIn = t;
- }
- if(idleOut && (Duration(lastOut, t) > idleOut)){
- timeoutHandler->idleOut();
- }
- }
-}
-
-void Connector::setReadTimeout(uint16_t t){
- idleIn = t * TIME_SEC;//t is in secs
- if(idleIn && (!timeout || idleIn < timeout)){
- timeout = idleIn;
- setSocketTimeout();
- }
-
-}
-
-void Connector::setWriteTimeout(uint16_t t){
- idleOut = t * TIME_SEC;//t is in secs
- if(idleOut && (!timeout || idleOut < timeout)){
- timeout = idleOut;
- setSocketTimeout();
- }
-}
-
-void Connector::setSocketTimeout(){
- socket.setTimeout(timeout);
-}
-
-void Connector::setTimeoutHandler(TimeoutHandler* handler){
- timeoutHandler = handler;
-}
-
-struct Connector::Buff : public AsynchIO::BufferBase {
- Buff() : AsynchIO::BufferBase(new char[65536], 65536) {}
- ~Buff() { delete [] bytes;}
-};
-
-Connector::Writer::Writer() : aio(0), buffer(0), lastEof(0)
-{
-}
-
-Connector::Writer::~Writer() { delete buffer; }
-
-void Connector::Writer::setAio(sys::AsynchIO* a) {
- Mutex::ScopedLock l(lock);
- aio = a;
- newBuffer(l);
- identifier = str(format("[%1% %2%]") % aio->getSocket().getLocalPort() % aio->getSocket().getPeerAddress());
-}
-
-void Connector::Writer::handle(framing::AMQFrame& frame) {
- Mutex::ScopedLock l(lock);
- frames.push_back(frame);
- if (frame.getEof()) {
- lastEof = frames.size();
- aio->notifyPendingWrite();
- }
- QPID_LOG(trace, "SENT " << identifier << ": " << frame);
-}
-
-void Connector::Writer::writeOne(const Mutex::ScopedLock& l) {
- assert(buffer);
- QPID_LOG(trace, "Write buffer " << encode.getPosition()
- << " bytes " << framesEncoded << " frames ");
- framesEncoded = 0;
-
- buffer->dataStart = 0;
- buffer->dataCount = encode.getPosition();
- aio->queueWrite(buffer);
- newBuffer(l);
-}
-
-void Connector::Writer::newBuffer(const Mutex::ScopedLock&) {
- buffer = aio->getQueuedBuffer();
- if (!buffer) buffer = new Buff();
- encode = framing::Buffer(buffer->bytes, buffer->byteCount);
- framesEncoded = 0;
-}
-
-// Called in IO thread.
-void Connector::Writer::write(sys::AsynchIO&) {
- Mutex::ScopedLock l(lock);
- assert(buffer);
- for (size_t i = 0; i < lastEof; ++i) {
- AMQFrame& frame = frames[i];
- if (frame.size() > encode.available()) writeOne(l);
- assert(frame.size() <= encode.available());
- frame.encode(encode);
- ++framesEncoded;
- }
- frames.erase(frames.begin(), frames.begin()+lastEof);
- lastEof = 0;
- if (encode.getPosition() > 0) writeOne(l);
-}
-
-void Connector::readbuff(AsynchIO& aio, AsynchIO::BufferBase* buff) {
- framing::Buffer in(buff->bytes+buff->dataStart, buff->dataCount);
-
- AMQFrame frame;
- while(frame.decode(in)){
- QPID_LOG(trace, "RECV " << identifier << ": " << frame);
- input->received(frame);
- }
- // TODO: unreading needs to go away, and when we can cope
- // with multiple sub-buffers in the general buffer scheme, it will
- if (in.available() != 0) {
- // Adjust buffer for used bytes and then "unread them"
- buff->dataStart += buff->dataCount-in.available();
- buff->dataCount = in.available();
- aio.unread(buff);
- } else {
- // Give whole buffer back to aio subsystem
- aio.queueReadBuffer(buff);
- }
-}
-
-void Connector::writebuff(AsynchIO& aio_) {
- writer.write(aio_);
-}
-
-void Connector::writeDataBlock(const AMQDataBlock& data) {
- AsynchIO::BufferBase* buff = new Buff;
- framing::Buffer out(buff->bytes, buff->byteCount);
- data.encode(out);
- buff->dataCount = data.size();
- aio->queueWrite(buff);
-}
-
-void Connector::eof(AsynchIO&) {
- handleClosed();
-}
-
-// TODO: astitcher 20070908 This version of the code can never time out, so the idle processing
-// will never be called
-void Connector::run(){
- try {
- Dispatcher d(poller);
-
- for (int i = 0; i < 32; i++) {
- aio->queueReadBuffer(new Buff);
- }
-
- aio->start(poller);
- d.run();
- aio->queueForDeletion();
- socket.close();
- } catch (const std::exception& e) {
- QPID_LOG(error, e.what());
- handleClosed();
- }
-}
-
-
-}} // namespace qpid::client
diff --git a/qpid/cpp/src/qpid/client/Connector.h b/qpid/cpp/src/qpid/client/Connector.h
deleted file mode 100644
index ffddbfd1be..0000000000
--- a/qpid/cpp/src/qpid/client/Connector.h
+++ /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.
- *
- */
-#ifndef _Connector_
-#define _Connector_
-
-
-#include "qpid/framing/InputHandler.h"
-#include "qpid/framing/OutputHandler.h"
-#include "qpid/framing/InitiationHandler.h"
-#include "qpid/framing/ProtocolInitiation.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/sys/ShutdownHandler.h"
-#include "qpid/sys/TimeoutHandler.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid/sys/Socket.h"
-#include "qpid/sys/Time.h"
-#include "qpid/sys/AsynchIO.h"
-
-#include <queue>
-
-namespace qpid {
-
-namespace client {
-
-class Connector : public framing::OutputHandler,
- private sys::Runnable
-{
- struct Buff;
-
- /** Batch up frames for writing to aio. */
- class Writer : public framing::FrameHandler {
- typedef sys::AsynchIO::BufferBase BufferBase;
- typedef std::vector<framing::AMQFrame> Frames;
-
- sys::Mutex lock;
- sys::AsynchIO* aio;
- BufferBase* buffer;
- Frames frames;
- size_t lastEof; // Position after last EOF in frames
- framing::Buffer encode;
- size_t framesEncoded;
- std::string identifier;
-
- void writeOne(const sys::Mutex::ScopedLock&);
- void newBuffer(const sys::Mutex::ScopedLock&);
-
- public:
-
- Writer();
- ~Writer();
- void setAio(sys::AsynchIO*);
- void handle(framing::AMQFrame&);
- void write(sys::AsynchIO&);
- };
-
- const bool debug;
- const int receive_buffer_size;
- const int send_buffer_size;
- framing::ProtocolVersion version;
-
- sys::Mutex closedLock;
- bool closed;
- bool joined;
-
- sys::AbsTime lastIn;
- sys::AbsTime lastOut;
- sys::Duration timeout;
- sys::Duration idleIn;
- sys::Duration idleOut;
-
- sys::TimeoutHandler* timeoutHandler;
- sys::ShutdownHandler* shutdownHandler;
- framing::InputHandler* input;
- framing::InitiationHandler* initialiser;
- framing::OutputHandler* output;
-
- Writer writer;
-
- sys::Thread receiver;
-
- sys::Socket socket;
-
- sys::AsynchIO* aio;
- sys::Poller::shared_ptr poller;
-
- void checkIdle(ssize_t status);
- void setSocketTimeout();
-
- void run();
- void handleClosed();
- bool closeInternal();
-
- void readbuff(qpid::sys::AsynchIO&, qpid::sys::AsynchIO::BufferBase*);
- void writebuff(qpid::sys::AsynchIO&);
- void writeDataBlock(const framing::AMQDataBlock& data);
- void eof(qpid::sys::AsynchIO&);
-
- std::string identifier;
-
- friend class Channel;
-
- public:
- Connector(framing::ProtocolVersion pVersion,
- bool debug = false, uint32_t buffer_size = 1024);
- virtual ~Connector();
- virtual void connect(const std::string& host, int port);
- virtual void init();
- virtual void close();
- virtual void setInputHandler(framing::InputHandler* handler);
- virtual void setTimeoutHandler(sys::TimeoutHandler* handler);
- virtual void setShutdownHandler(sys::ShutdownHandler* handler);
- virtual sys::ShutdownHandler* getShutdownHandler() { return shutdownHandler; }
- virtual framing::OutputHandler* getOutputHandler();
- virtual void send(framing::AMQFrame& frame);
- virtual void setReadTimeout(uint16_t timeout);
- virtual void setWriteTimeout(uint16_t timeout);
- const std::string& getIdentifier() const { return identifier; }
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Correlator.cpp b/qpid/cpp/src/qpid/client/Correlator.cpp
deleted file mode 100644
index f30c92b992..0000000000
--- a/qpid/cpp/src/qpid/client/Correlator.cpp
+++ /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.
- *
- */
-
-#include "Correlator.h"
-
-using qpid::client::Correlator;
-using namespace qpid::framing;
-using namespace boost;
-
-bool Correlator::receive(const AMQMethodBody* response)
-{
- if (listeners.empty()) {
- return false;
- } else {
- Listener l = listeners.front();
- if (l) l(response);
- listeners.pop();
- return true;
- }
-}
-
-void Correlator::listen(Listener l)
-{
- listeners.push(l);
-}
-
-
diff --git a/qpid/cpp/src/qpid/client/Correlator.h b/qpid/cpp/src/qpid/client/Correlator.h
deleted file mode 100644
index 45b22fb2fe..0000000000
--- a/qpid/cpp/src/qpid/client/Correlator.h
+++ /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.
- *
- */
-
-#include <memory>
-#include <queue>
-#include <set>
-#include <boost/function.hpp>
-#include "qpid/framing/AMQMethodBody.h"
-#include "qpid/sys/Monitor.h"
-
-#ifndef _Correlator_
-#define _Correlator_
-
-namespace qpid {
-namespace client {
-
-
-class Correlator
-{
-public:
- typedef boost::function<void(const framing::AMQMethodBody*)> Listener;
-
- bool receive(const framing::AMQMethodBody*);
- void listen(Listener l);
-
-private:
- std::queue<Listener> listeners;
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Demux.cpp b/qpid/cpp/src/qpid/client/Demux.cpp
deleted file mode 100644
index cb9372cee7..0000000000
--- a/qpid/cpp/src/qpid/client/Demux.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Demux.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/MessageTransferBody.h"
-
-#include <iostream>
-
-namespace qpid {
-namespace client {
-
-ByTransferDest::ByTransferDest(const std::string& d) : dest(d) {}
-bool ByTransferDest::operator()(const framing::FrameSet& frameset) const
-{
- return frameset.isA<framing::MessageTransferBody>() &&
- frameset.as<framing::MessageTransferBody>()->getDestination() == dest;
-}
-
-ScopedDivert::ScopedDivert(const std::string& _dest, Demux& _demuxer) : dest(_dest), demuxer(_demuxer)
-{
- queue = demuxer.add(dest, ByTransferDest(dest));
-}
-
-ScopedDivert::~ScopedDivert()
-{
- demuxer.remove(dest);
-}
-
-Demux::Demux() : defaultQueue(new Queue()) {}
-
-Demux::~Demux() { close(); }
-
-Demux::QueuePtr ScopedDivert::getQueue()
-{
- return queue;
-}
-
-void Demux::handle(framing::FrameSet::shared_ptr frameset)
-{
- sys::Mutex::ScopedLock l(lock);
- bool matched = false;
- for (iterator i = records.begin(); i != records.end() && !matched; i++) {
- if (i->condition && i->condition(*frameset)) {
- matched = true;
- i->queue->push(frameset);
- }
- }
- if (!matched) {
- defaultQueue->push(frameset);
- }
-}
-
-void Demux::close()
-{
- sys::Mutex::ScopedLock l(lock);
- for (iterator i = records.begin(); i != records.end(); i++) {
- i->queue->close();
- }
- defaultQueue->close();
-}
-
-void Demux::open()
-{
- sys::Mutex::ScopedLock l(lock);
- for (iterator i = records.begin(); i != records.end(); i++) {
- i->queue->open();
- }
- defaultQueue->open();
-}
-
-Demux::QueuePtr Demux::add(const std::string& name, Condition condition)
-{
- sys::Mutex::ScopedLock l(lock);
- iterator i = std::find_if(records.begin(), records.end(), Find(name));
- if (i == records.end()) {
- Record r(name, condition);
- records.push_back(r);
- return r.queue;
- } else {
- throw Exception("Queue already exists for " + name);
- }
-}
-
-void Demux::remove(const std::string& name)
-{
- sys::Mutex::ScopedLock l(lock);
- records.remove_if(Find(name));
-}
-
-Demux::QueuePtr Demux::get(const std::string& name)
-{
- sys::Mutex::ScopedLock l(lock);
- iterator i = std::find_if(records.begin(), records.end(), Find(name));
- if (i == records.end()) {
- throw Exception("No queue for " + name);
- }
- return i->queue;
-}
-
-Demux::QueuePtr Demux::getDefault()
-{
- return defaultQueue;
-}
-
-Demux::Find::Find(const std::string& n) : name(n) {}
-
-bool Demux::Find::operator()(const Record& record) const
-{
- return record.name == name;
-}
-
-}}
-
diff --git a/qpid/cpp/src/qpid/client/Demux.h b/qpid/cpp/src/qpid/client/Demux.h
deleted file mode 100644
index dce24223f2..0000000000
--- a/qpid/cpp/src/qpid/client/Demux.h
+++ /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.
- *
- */
-
-#include <list>
-#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
-#include "qpid/framing/FrameSet.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/BlockingQueue.h"
-
-#ifndef _Demux_
-#define _Demux_
-
-namespace qpid {
-namespace client {
-
-class ByTransferDest
-{
- const std::string dest;
-public:
- ByTransferDest(const std::string& dest);
- bool operator()(const framing::FrameSet& frameset) const;
-};
-
-class Demux
-{
-public:
- typedef boost::function<bool(const framing::FrameSet&)> Condition;
- typedef sys::BlockingQueue<framing::FrameSet::shared_ptr> Queue;
- typedef boost::shared_ptr<Queue> QueuePtr;
-
- Demux();
- ~Demux();
-
- void handle(framing::FrameSet::shared_ptr);
- void close();
- void open();
-
- QueuePtr add(const std::string& name, Condition);
- void remove(const std::string& name);
- QueuePtr get(const std::string& name);
- QueuePtr getDefault();
-
-private:
- struct Record
- {
- const std::string name;
- Condition condition;
- QueuePtr queue;
-
- Record(const std::string& n, Condition c) : name(n), condition(c), queue(new Queue()) {}
- };
-
- sys::Mutex lock;
- std::list<Record> records;
- QueuePtr defaultQueue;
-
- typedef std::list<Record>::iterator iterator;
-
- struct Find
- {
- const std::string name;
- Find(const std::string& name);
- bool operator()(const Record& record) const;
- };
-};
-
-class ScopedDivert
-{
- const std::string dest;
- Demux& demuxer;
- Demux::QueuePtr queue;
-public:
- ScopedDivert(const std::string& dest, Demux& demuxer);
- ~ScopedDivert();
- Demux::QueuePtr getQueue();
-};
-
-}} // namespace qpid::client
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Dispatcher.cpp b/qpid/cpp/src/qpid/client/Dispatcher.cpp
deleted file mode 100644
index 2484dabf1f..0000000000
--- a/qpid/cpp/src/qpid/client/Dispatcher.cpp
+++ /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.
- *
- */
-#include "Dispatcher.h"
-
-#include "qpid/framing/FrameSet.h"
-#include "qpid/framing/MessageTransferBody.h"
-#include "qpid/log/Statement.h"
-#include "qpid/sys/BlockingQueue.h"
-#include "Message.h"
-
-#include <boost/state_saver.hpp>
-
-using qpid::framing::FrameSet;
-using qpid::framing::MessageTransferBody;
-using qpid::sys::Mutex;
-using qpid::sys::ScopedLock;
-using qpid::sys::Thread;
-
-namespace qpid {
-namespace client {
-
-Subscriber::Subscriber(Session& s, MessageListener* l, AckPolicy a) : session(s), listener(l), autoAck(a) {}
-
-void Subscriber::received(Message& msg)
-{
- if (listener) {
- listener->received(msg);
- autoAck.ack(msg);
- }
-}
-
-Dispatcher::Dispatcher(Session& s, const std::string& q)
- : session(s), running(false), autoStop(true)
-{
- queue = q.empty() ?
- session.getExecution().getDemux().getDefault() :
- session.getExecution().getDemux().get(q);
-}
-
-void Dispatcher::start()
-{
- worker = Thread(this);
-}
-
-void Dispatcher::run()
-{
- Mutex::ScopedLock l(lock);
- if (running)
- throw Exception("Dispatcher is already running.");
- boost::state_saver<bool> reset(running); // Reset to false on exit.
- running = true;
- try {
- while (!queue->isClosed()) {
- Mutex::ScopedUnlock u(lock);
- FrameSet::shared_ptr content = queue->pop();
- if (content->isA<MessageTransferBody>()) {
- Message msg(*content, session);
- Subscriber::shared_ptr listener = find(msg.getDestination());
- if (!listener) {
- QPID_LOG(error, "No listener found for destination " << msg.getDestination());
- } else {
- assert(listener);
- listener->received(msg);
- }
- } else {
- if (handler.get()) {
- handler->handle(*content);
- } else {
- QPID_LOG(error, "No handler found for " << *(content->getMethod()));
- }
- }
- }
- } catch (const ClosedException&) {
- //ignore it and return
- }
-}
-
-void Dispatcher::stop()
-{
- ScopedLock<Mutex> l(lock);
- queue->close(); // Will interrupt thread blocked in pop()
-}
-
-void Dispatcher::setAutoStop(bool b)
-{
- ScopedLock<Mutex> l(lock);
- autoStop = b;
-}
-
-Subscriber::shared_ptr Dispatcher::find(const std::string& name)
-{
- ScopedLock<Mutex> l(lock);
- Listeners::iterator i = listeners.find(name);
- if (i == listeners.end()) {
- return defaultListener;
- }
- return i->second;
-}
-
-void Dispatcher::listen(
- MessageListener* listener, AckPolicy autoAck
-)
-{
- ScopedLock<Mutex> l(lock);
- defaultListener = Subscriber::shared_ptr(
- new Subscriber(session, listener, autoAck));
-}
-
-void Dispatcher::listen(const std::string& destination, MessageListener* listener, AckPolicy autoAck)
-{
- ScopedLock<Mutex> l(lock);
- listeners[destination] = Subscriber::shared_ptr(
- new Subscriber(session, listener, autoAck));
-}
-
-void Dispatcher::cancel(const std::string& destination)
-{
- ScopedLock<Mutex> l(lock);
- listeners.erase(destination);
- if (autoStop && listeners.empty())
- queue->close();
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/client/Dispatcher.h b/qpid/cpp/src/qpid/client/Dispatcher.h
deleted file mode 100644
index e23d0c198c..0000000000
--- a/qpid/cpp/src/qpid/client/Dispatcher.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _Dispatcher_
-#define _Dispatcher_
-
-#include <map>
-#include <memory>
-#include <string>
-#include <boost/shared_ptr.hpp>
-#include "qpid/client/Session.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Thread.h"
-#include "MessageListener.h"
-#include "AckPolicy.h"
-
-namespace qpid {
-namespace client {
-
-class Subscriber : public MessageListener
-{
- Session& session;
- MessageListener* const listener;
- AckPolicy autoAck;
-
-public:
- typedef boost::shared_ptr<Subscriber> shared_ptr;
- Subscriber(Session& session, MessageListener* listener, AckPolicy);
- void received(Message& msg);
-
-};
-
-typedef framing::Handler<framing::FrameSet> FrameSetHandler;
-
-class Dispatcher : public sys::Runnable
-{
- typedef std::map<std::string, Subscriber::shared_ptr> Listeners;
- sys::Mutex lock;
- sys::Thread worker;
- Session& session;
- Demux::QueuePtr queue;
- bool running;
- bool autoStop;
- Listeners listeners;
- Subscriber::shared_ptr defaultListener;
- std::auto_ptr<FrameSetHandler> handler;
-
- Subscriber::shared_ptr find(const std::string& name);
- bool isStopped();
-
-public:
- Dispatcher(Session& session, const std::string& queue = "");
-
- void start();
- void run();
- void stop();
- void setAutoStop(bool b);
-
- void listen(MessageListener* listener, AckPolicy autoAck=AckPolicy());
- void listen(const std::string& destination, MessageListener* listener, AckPolicy autoAck=AckPolicy());
- void cancel(const std::string& destination);
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Exchange.cpp b/qpid/cpp/src/qpid/client/Exchange.cpp
deleted file mode 100644
index e7fbdeb47e..0000000000
--- a/qpid/cpp/src/qpid/client/Exchange.cpp
+++ /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.
- *
- */
-#include "Exchange.h"
-
-qpid::client::Exchange::Exchange(std::string _name, std::string _type) : name(_name), type(_type){}
-const std::string& qpid::client::Exchange::getName() const { return name; }
-const std::string& qpid::client::Exchange::getType() const { return type; }
-
-const std::string qpid::client::Exchange::DIRECT_EXCHANGE = "direct";
-const std::string qpid::client::Exchange::TOPIC_EXCHANGE = "topic";
-const std::string qpid::client::Exchange::HEADERS_EXCHANGE = "headers";
-
-const qpid::client::Exchange qpid::client::Exchange::DEFAULT_EXCHANGE("", DIRECT_EXCHANGE);
-const qpid::client::Exchange qpid::client::Exchange::STANDARD_DIRECT_EXCHANGE("amq.direct", DIRECT_EXCHANGE);
-const qpid::client::Exchange qpid::client::Exchange::STANDARD_TOPIC_EXCHANGE("amq.topic", TOPIC_EXCHANGE);
-const qpid::client::Exchange qpid::client::Exchange::STANDARD_HEADERS_EXCHANGE("amq.headers", HEADERS_EXCHANGE);
diff --git a/qpid/cpp/src/qpid/client/Exchange.h b/qpid/cpp/src/qpid/client/Exchange.h
deleted file mode 100644
index 0640e4fe2c..0000000000
--- a/qpid/cpp/src/qpid/client/Exchange.h
+++ /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.
- *
- */
-#include <string>
-
-#ifndef _Exchange_
-#define _Exchange_
-
-namespace qpid {
-namespace client {
-
- /**
- * DEPRECATED
- *
- * A 'handle' used to represent an AMQP exchange in the Channel
- * methods. Exchanges are the destinations to which messages are
- * published.
- *
- * There are different types of exchange (the standard types are
- * available as static constants, see DIRECT_EXCHANGE,
- * TOPIC_EXCHANGE and HEADERS_EXCHANGE). A Queue can be bound to
- * an exchange using Channel::bind() and messages published to
- * that exchange are then routed to the queue based on the details
- * of the binding and the type of exchange.
- *
- * There are some standard exchange instances that are predeclared
- * on all AMQP brokers. These are defined as static members
- * STANDARD_DIRECT_EXCHANGE, STANDARD_TOPIC_EXCHANGE and
- * STANDARD_HEADERS_EXCHANGE. There is also the 'default' exchange
- * (member DEFAULT_EXCHANGE) which is nameless and of type
- * 'direct' and has every declared queue bound to it by queue
- * name.
- */
- class Exchange{
- const std::string name;
- const std::string type;
-
- public:
- /**
- * A direct exchange routes messages published with routing
- * key X to any queue bound with key X (i.e. an exact match is
- * used).
- */
- static const std::string DIRECT_EXCHANGE;
- /**
- * A topic exchange treat the key with which a queue is bound
- * as a pattern and routes all messages whose routing keys
- * match that pattern to the bound queue. The routing key for
- * a message must consist of zero or more alpha-numeric words
- * delimited by dots. The pattern is of a similar form but *
- * can be used to match excatly one word and # can be used to
- * match zero or more words.
- */
- static const std::string TOPIC_EXCHANGE;
- /**
- * The headers exchange routes messages based on whether their
- * headers match the binding arguments specified when
- * binding. (see the AMQP spec for more details).
- */
- static const std::string HEADERS_EXCHANGE;
-
- /**
- * The 'default' exchange, nameless and of type 'direct'. Has
- * every declared queue bound to it by name.
- */
- static const Exchange DEFAULT_EXCHANGE;
- /**
- * The standard direct exchange, named amq.direct.
- */
- static const Exchange STANDARD_DIRECT_EXCHANGE;
- /**
- * The standard topic exchange, named amq.topic.
- */
- static const Exchange STANDARD_TOPIC_EXCHANGE;
- /**
- * The standard headers exchange, named amq.header.
- */
- static const Exchange STANDARD_HEADERS_EXCHANGE;
-
- Exchange(std::string name, std::string type = DIRECT_EXCHANGE);
- const std::string& getName() const;
- const std::string& getType() const;
- };
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Execution.h b/qpid/cpp/src/qpid/client/Execution.h
deleted file mode 100644
index 5f717de586..0000000000
--- a/qpid/cpp/src/qpid/client/Execution.h
+++ /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.
- *
- */
-#ifndef _Execution_
-#define _Execution_
-
-#include "qpid/framing/SequenceNumber.h"
-#include "Demux.h"
-
-namespace qpid {
-namespace client {
-
-/**
- * Provides more detailed access to the amqp 'execution layer'.
- */
-class Execution
-{
-public:
- virtual ~Execution() {}
- virtual void sendSyncRequest() = 0;
- virtual void sendFlushRequest() = 0;
- virtual void completed(const framing::SequenceNumber& id, bool cumulative, bool send) = 0;
- virtual Demux& getDemux() = 0;
- virtual bool isComplete(const framing::SequenceNumber& id) = 0;
- virtual bool isCompleteUpTo(const framing::SequenceNumber& id) = 0;
- virtual void setCompletionListener(boost::function<void()>) = 0;
- virtual void syncWait(const framing::SequenceNumber& id) = 0;
- virtual framing::SequenceNumber lastSent() const = 0;
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/ExecutionHandler.cpp b/qpid/cpp/src/qpid/client/ExecutionHandler.cpp
deleted file mode 100644
index afdd13c9e9..0000000000
--- a/qpid/cpp/src/qpid/client/ExecutionHandler.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "ExecutionHandler.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/BasicDeliverBody.h"
-#include "qpid/framing/MessageTransferBody.h"
-#include "qpid/framing/AMQP_HighestVersion.h"
-#include "qpid/framing/all_method_bodies.h"
-#include "qpid/framing/ServerInvoker.h"
-#include "qpid/client/FutureCompletion.h"
-#include <boost/bind.hpp>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-using namespace boost;
-using qpid::sys::Mutex;
-
-bool isMessageMethod(AMQMethodBody* method)
-{
- return method->isA<BasicDeliverBody>() || method->isA<MessageTransferBody>() || method->isA<BasicGetOkBody>();
-}
-
-bool isMessageMethod(AMQBody* body)
-{
- AMQMethodBody* method=body->getMethod();
- return method && isMessageMethod(method);
-}
-
-bool isContentFrame(AMQFrame& frame)
-{
- AMQBody* body = frame.getBody();
- uint8_t type = body->type();
- return type == HEADER_BODY || type == CONTENT_BODY || isMessageMethod(body);
-}
-
-ExecutionHandler::ExecutionHandler(uint64_t _maxFrameSize) :
- version(framing::highestProtocolVersion), maxFrameSize(_maxFrameSize) {}
-
-//incoming:
-void ExecutionHandler::handle(AMQFrame& frame)
-{
- if (!invoke(*this, *frame.getBody())) {
- if (!arriving) {
- arriving = FrameSet::shared_ptr(new FrameSet(++incomingCounter));
- }
- arriving->append(frame);
- if (arriving->isComplete()) {
- if (arriving->isContentBearing() || !correlation.receive(arriving->getMethod())) {
- demux.handle(arriving);
- }
- arriving.reset();
- }
- }
-}
-
-void ExecutionHandler::complete(uint32_t cumulative, const SequenceNumberSet& range)
-{
- if (range.size() % 2) { //must be even number
- throw NotAllowedException(QPID_MSG("Received odd number of elements in ranged mark"));
- } else {
- SequenceNumber mark(cumulative);
- {
- Mutex::ScopedLock l(lock);
- outgoingCompletionStatus.update(mark, range);
- }
- if (completionListener) completionListener();
- completion.completed(outgoingCompletionStatus.mark);
- //TODO: signal listeners of early notification?
- }
-}
-
-void ExecutionHandler::flush()
-{
- sendCompletion();
-}
-
-void ExecutionHandler::noop()
-{
- //do nothing
-}
-
-void ExecutionHandler::result(uint32_t command, const std::string& data)
-{
- completion.received(command, data);
-}
-
-void ExecutionHandler::sync()
-{
- //TODO: implement - need to note the mark requested and then
- //remember to send a response when that point is reached
-}
-
-void ExecutionHandler::flushTo(const framing::SequenceNumber& point)
-{
- Mutex::ScopedLock l(lock);
- if (point > outgoingCompletionStatus.mark) {
- sendFlushRequest();
- }
-}
-
-void ExecutionHandler::sendFlushRequest()
-{
- Mutex::ScopedLock l(lock);
- AMQFrame frame(in_place<ExecutionFlushBody>());
- out(frame);
-}
-
-void ExecutionHandler::syncTo(const framing::SequenceNumber& point)
-{
- Mutex::ScopedLock l(lock);
- if (point > outgoingCompletionStatus.mark) {
- sendSyncRequest();
- }
-}
-
-
-void ExecutionHandler::sendSyncRequest()
-{
- Mutex::ScopedLock l(lock);
- AMQFrame frame(in_place<ExecutionSyncBody>());
- out(frame);
-}
-
-void ExecutionHandler::completed(const SequenceNumber& id, bool cumulative, bool send)
-{
- {
- Mutex::ScopedLock l(lock);
- if (id > incomingCompletionStatus.mark) {
- if (cumulative) {
- incomingCompletionStatus.update(incomingCompletionStatus.mark, id);
- } else {
- incomingCompletionStatus.update(id, id);
- }
- }
- }
- if (send) {
- sendCompletion();
- }
-}
-
-
-void ExecutionHandler::sendCompletion()
-{
- Mutex::ScopedLock l(lock);
- SequenceNumberSet range;
- incomingCompletionStatus.collectRanges(range);
- AMQFrame frame(
- in_place<ExecutionCompleteBody>(
- version, incomingCompletionStatus.mark.getValue(), range));
- out(frame);
-}
-
-SequenceNumber ExecutionHandler::lastSent() const { return outgoingCounter; }
-
-SequenceNumber ExecutionHandler::send(const AMQBody& command, CompletionTracker::ResultListener listener)
-{
- Mutex::ScopedLock l(lock);
- return send(command, listener, false);
-}
-
-SequenceNumber ExecutionHandler::send(const AMQBody& command, CompletionTracker::ResultListener l, bool hasContent)
-{
- SequenceNumber id = ++outgoingCounter;
- if(l) {
- completion.listenForResult(id, l);
- }
- AMQFrame frame(command);
- if (hasContent) {
- frame.setEof(false);
- }
- out(frame);
- return id;
-}
-
-SequenceNumber ExecutionHandler::send(const AMQBody& command, const MethodContent& content,
- CompletionTracker::ResultListener listener)
-{
- Mutex::ScopedLock l(lock);
- SequenceNumber id = send(command, listener, true);
- sendContent(content);
- return id;
-}
-
-void ExecutionHandler::sendContent(const MethodContent& content)
-{
- AMQFrame header(content.getHeader());
- header.setBof(false);
- u_int64_t data_length = content.getData().length();
- if(data_length > 0){
- header.setEof(false);
- out(header);
- const u_int32_t frag_size = maxFrameSize - (AMQFrame::frameOverhead() - 1 /*end of frame marker included in overhead but not in size*/);
- if(data_length < frag_size){
- AMQFrame frame(in_place<AMQContentBody>(content.getData()));
- frame.setBof(false);
- out(frame);
- }else{
- u_int32_t offset = 0;
- u_int32_t remaining = data_length - offset;
- while (remaining > 0) {
- u_int32_t length = remaining > frag_size ? frag_size : remaining;
- string frag(content.getData().substr(offset, length));
- AMQFrame frame(in_place<AMQContentBody>(frag));
- frame.setBof(false);
- if (offset > 0) {
- frame.setBos(false);
- }
- offset += length;
- remaining = data_length - offset;
- if (remaining) {
- frame.setEos(false);
- frame.setEof(false);
- }
- out(frame);
- }
- }
- } else {
- out(header);
- }
-}
-
-bool ExecutionHandler::isComplete(const SequenceNumber& id)
-{
- Mutex::ScopedLock l(lock);
- return outgoingCompletionStatus.covers(id);
-}
-
-bool ExecutionHandler::isCompleteUpTo(const SequenceNumber& id)
-{
- Mutex::ScopedLock l(lock);
- return outgoingCompletionStatus.mark >= id;
-}
-
-void ExecutionHandler::setCompletionListener(boost::function<void()> l)
-{
- completionListener = l;
-}
-
-
-void ExecutionHandler::syncWait(const SequenceNumber& id) {
- syncTo(id);
- FutureCompletion fc;
- completion.listenForCompletion(
- id, boost::bind(&FutureCompletion::completed, &fc)
- );
- fc.waitForCompletion();
- assert(isCompleteUpTo(id));
-}
diff --git a/qpid/cpp/src/qpid/client/ExecutionHandler.h b/qpid/cpp/src/qpid/client/ExecutionHandler.h
deleted file mode 100644
index d9113b683b..0000000000
--- a/qpid/cpp/src/qpid/client/ExecutionHandler.h
+++ /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.
- *
- */
-#ifndef _ExecutionHandler_
-#define _ExecutionHandler_
-
-#include <queue>
-#include "qpid/framing/AccumulatedAck.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/FrameSet.h"
-#include "qpid/framing/MethodContent.h"
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/sys/Mutex.h"
-#include "ChainableFrameHandler.h"
-#include "CompletionTracker.h"
-#include "Correlator.h"
-#include "Demux.h"
-#include "Execution.h"
-
-namespace qpid {
-namespace client {
-
-class ExecutionHandler :
- public framing::AMQP_ServerOperations::ExecutionHandler,
- public framing::FrameHandler,
- public Execution
-{
- framing::SequenceNumber incomingCounter;
- framing::AccumulatedAck incomingCompletionStatus;
- framing::SequenceNumber outgoingCounter;
- framing::AccumulatedAck outgoingCompletionStatus;
- framing::FrameSet::shared_ptr arriving;
- Correlator correlation;
- CompletionTracker completion;
- Demux demux;
- sys::Mutex lock;
- framing::ProtocolVersion version;
- uint64_t maxFrameSize;
- boost::function<void()> completionListener;
-
- void complete(uint32_t mark, const framing::SequenceNumberSet& range);
- void flush();
- void noop();
- void result(uint32_t command, const std::string& data);
- void sync();
-
- void sendCompletion();
-
- framing::SequenceNumber send(const framing::AMQBody&, CompletionTracker::ResultListener, bool hasContent);
- void sendContent(const framing::MethodContent&);
-
-public:
- typedef CompletionTracker::ResultListener ResultListener;
-
- // Allow other classes to set the out handler.
- framing::FrameHandler::Chain out;
-
- ExecutionHandler(uint64_t maxFrameSize = 65535);
-
- // Incoming handler.
- void handle(framing::AMQFrame& frame);
-
- framing::SequenceNumber send(const framing::AMQBody& command, ResultListener=ResultListener());
- framing::SequenceNumber send(const framing::AMQBody& command, const framing::MethodContent& content,
- ResultListener=ResultListener());
- framing::SequenceNumber lastSent() const;
- void sendSyncRequest();
- void sendFlushRequest();
- void completed(const framing::SequenceNumber& id, bool cumulative, bool send);
- void syncTo(const framing::SequenceNumber& point);
- void flushTo(const framing::SequenceNumber& point);
- void syncWait(const framing::SequenceNumber& id);
-
- bool isComplete(const framing::SequenceNumber& id);
- bool isCompleteUpTo(const framing::SequenceNumber& id);
-
- void setMaxFrameSize(uint64_t size) { maxFrameSize = size; }
- Correlator& getCorrelator() { return correlation; }
- CompletionTracker& getCompletionTracker() { return completion; }
- Demux& getDemux() { return demux; }
-
- void setCompletionListener(boost::function<void()>);
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Future.h b/qpid/cpp/src/qpid/client/Future.h
deleted file mode 100644
index d07f9f149c..0000000000
--- a/qpid/cpp/src/qpid/client/Future.h
+++ /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.
- *
- */
-
-#ifndef _Future_
-#define _Future_
-
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-#include "qpid/Exception.h"
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/framing/StructHelper.h"
-#include "FutureCompletion.h"
-#include "FutureResponse.h"
-#include "FutureResult.h"
-#include "SessionCore.h"
-
-namespace qpid {
-namespace client {
-
-class Future : private framing::StructHelper
-{
- framing::SequenceNumber command;
- boost::shared_ptr<FutureResponse> response;
- boost::shared_ptr<FutureResult> result;
- bool complete;
-
-public:
- Future() : complete(false) {}
- Future(const framing::SequenceNumber& id) : command(id), complete(false) {}
-
- void sync(SessionCore& session)
- {
- if (!isComplete(session)) {
- session.getExecution().syncTo(command);
- wait(session);
- }
- }
-
- void wait(SessionCore& session)
- {
- if (!isComplete(session)) {
- FutureCompletion callback;
- session.getExecution().getCompletionTracker().listenForCompletion(
- command,
- boost::bind(&FutureCompletion::completed, &callback)
- );
- callback.waitForCompletion();
- session.assertOpen();
- complete = true;
- }
- }
-
- framing::AMQMethodBody* getResponse(SessionCore& session)
- {
- if (response) {
- session.getExecution().getCompletionTracker().listenForCompletion(
- command,
- boost::bind(&FutureResponse::completed, response)
- );
- return response->getResponse(session);
- } else {
- throw Exception("Response not expected");
- }
- }
-
- template <class T> void decodeResult(T& value, SessionCore& session)
- {
- if (result) {
- decode(value, result->getResult(session));
- } else {
- throw Exception("Result not expected");
- }
- }
-
- bool isComplete(SessionCore& session) {
- return complete || session.getExecution().isComplete(command);
- }
-
- bool isCompleteUpTo(SessionCore& session) {
- return complete || session.getExecution().isCompleteUpTo(command);
- }
-
- void setCommandId(const framing::SequenceNumber& id) { command = id; }
- void setFutureResponse(boost::shared_ptr<FutureResponse> r) { response = r; }
- void setFutureResult(boost::shared_ptr<FutureResult> r) { result = r; }
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/FutureCompletion.cpp b/qpid/cpp/src/qpid/client/FutureCompletion.cpp
deleted file mode 100644
index 130c65d6aa..0000000000
--- a/qpid/cpp/src/qpid/client/FutureCompletion.cpp
+++ /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.
- *
- */
-
-#include "FutureCompletion.h"
-
-using namespace qpid::client;
-using namespace qpid::sys;
-
-FutureCompletion::FutureCompletion() : complete(false) {}
-
-bool FutureCompletion::isComplete() const
-{
- Monitor::ScopedLock l(lock);
- return complete;
-}
-
-void FutureCompletion::completed()
-{
- Monitor::ScopedLock l(lock);
- complete = true;
- lock.notifyAll();
-}
-
-void FutureCompletion::waitForCompletion() const
-{
- Monitor::ScopedLock l(lock);
- while (!complete) {
- lock.wait();
- }
-}
diff --git a/qpid/cpp/src/qpid/client/FutureCompletion.h b/qpid/cpp/src/qpid/client/FutureCompletion.h
deleted file mode 100644
index 1897230230..0000000000
--- a/qpid/cpp/src/qpid/client/FutureCompletion.h
+++ /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.
- *
- */
-
-#ifndef _FutureCompletion_
-#define _FutureCompletion_
-
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/sys/Monitor.h"
-
-namespace qpid {
-namespace client {
-
-class FutureCompletion
-{
-protected:
- mutable sys::Monitor lock;
- bool complete;
-
-public:
- FutureCompletion();
- virtual ~FutureCompletion(){}
- bool isComplete() const;
- void waitForCompletion() const;
- void completed();
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/FutureFactory.cpp b/qpid/cpp/src/qpid/client/FutureFactory.cpp
deleted file mode 100644
index 7f9d51e77f..0000000000
--- a/qpid/cpp/src/qpid/client/FutureFactory.cpp
+++ /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.
- *
- */
-
-#include "FutureFactory.h"
-
-using namespace qpid::client;
-using namespace boost;
-
-shared_ptr<FutureCompletion> FutureFactory::createCompletion()
-{
- shared_ptr<FutureCompletion> f(new FutureCompletion());
- weak_ptr<FutureCompletion> w(f);
- set.push_back(w);
- return f;
-}
-
-shared_ptr<FutureResponse> FutureFactory::createResponse()
-{
- shared_ptr<FutureResponse> f(new FutureResponse());
- weak_ptr<FutureCompletion> w(static_pointer_cast<FutureCompletion>(f));
- set.push_back(w);
- return f;
-}
-
-void FutureFactory::close(uint16_t code, const std::string& text)
-{
- for (WeakPtrSet::iterator i = set.begin(); i != set.end(); i++) {
- shared_ptr<FutureCompletion> p = i->lock();
- if (p) {
- p->close(code, text);
- }
- }
-}
diff --git a/qpid/cpp/src/qpid/client/FutureFactory.h b/qpid/cpp/src/qpid/client/FutureFactory.h
deleted file mode 100644
index b126e296fd..0000000000
--- a/qpid/cpp/src/qpid/client/FutureFactory.h
+++ /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.
- *
- */
-
-#ifndef _FutureFactory_
-#define _FutureFactory_
-
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-#include "FutureCompletion.h"
-#include "FutureResponse.h"
-
-namespace qpid {
-namespace client {
-
-class FutureFactory
-{
- typedef std::vector< boost::weak_ptr<FutureCompletion> > WeakPtrSet;
- WeakPtrSet set;
-
-public:
- boost::shared_ptr<FutureCompletion> createCompletion();
- boost::shared_ptr<FutureResponse> createResponse();
- void close(uint16_t code, const std::string& text);
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/FutureResponse.cpp b/qpid/cpp/src/qpid/client/FutureResponse.cpp
deleted file mode 100644
index 32d99531fa..0000000000
--- a/qpid/cpp/src/qpid/client/FutureResponse.cpp
+++ /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.
- *
- */
-
-#include "FutureResponse.h"
-
-#include "SessionCore.h"
-
-using namespace qpid::client;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-
-AMQMethodBody* FutureResponse::getResponse(SessionCore& session)
-{
- waitForCompletion();
- session.assertOpen();
- return response.getMethod();
-}
-
-void FutureResponse::received(const AMQMethodBody* r)
-{
- Monitor::ScopedLock l(lock);
- response.setBody(*r);
- complete = true;
- lock.notifyAll();
-}
-
diff --git a/qpid/cpp/src/qpid/client/FutureResponse.h b/qpid/cpp/src/qpid/client/FutureResponse.h
deleted file mode 100644
index 534ca01bb7..0000000000
--- a/qpid/cpp/src/qpid/client/FutureResponse.h
+++ /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.
- *
- */
-
-#ifndef _FutureResponse_
-#define _FutureResponse_
-
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/BodyHolder.h"
-#include "FutureCompletion.h"
-
-namespace qpid {
-namespace client {
-
-class SessionCore;
-
-class FutureResponse : public FutureCompletion
-{
- framing::BodyHolder response;
-public:
- framing::AMQMethodBody* getResponse(SessionCore& session);
- void received(const framing::AMQMethodBody* response);
-};
-
-}}
-
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/FutureResult.cpp b/qpid/cpp/src/qpid/client/FutureResult.cpp
deleted file mode 100644
index 681202edea..0000000000
--- a/qpid/cpp/src/qpid/client/FutureResult.cpp
+++ /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.
- *
- */
-
-#include "FutureResult.h"
-
-#include "SessionCore.h"
-
-using namespace qpid::client;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-const std::string& FutureResult::getResult(SessionCore& session) const
-{
- waitForCompletion();
- session.assertOpen();
- return result;
-}
-
-void FutureResult::received(const std::string& r)
-{
- Monitor::ScopedLock l(lock);
- result = r;
- complete = true;
- lock.notifyAll();
-}
diff --git a/qpid/cpp/src/qpid/client/FutureResult.h b/qpid/cpp/src/qpid/client/FutureResult.h
deleted file mode 100644
index 3117b63802..0000000000
--- a/qpid/cpp/src/qpid/client/FutureResult.h
+++ /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.
- *
- */
-
-#ifndef _FutureResult_
-#define _FutureResult_
-
-#include <string>
-#include "qpid/framing/amqp_framing.h"
-#include "FutureCompletion.h"
-
-namespace qpid {
-namespace client {
-
-class SessionCore;
-
-class FutureResult : public FutureCompletion
-{
- std::string result;
-public:
- const std::string& getResult(SessionCore& session) const;
- void received(const std::string& result);
-};
-
-}}
-
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/LocalQueue.cpp b/qpid/cpp/src/qpid/client/LocalQueue.cpp
deleted file mode 100644
index 951996f005..0000000000
--- a/qpid/cpp/src/qpid/client/LocalQueue.cpp
+++ /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.
- *
- */
-#include "LocalQueue.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/FrameSet.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace client {
-
-using namespace framing;
-
-LocalQueue::LocalQueue(AckPolicy a) : autoAck(a) {}
-LocalQueue::~LocalQueue() {}
-
-Message LocalQueue::pop() {
- if (!queue)
- throw ClosedException();
- FrameSet::shared_ptr content = queue->pop();
- if (content->isA<MessageTransferBody>()) {
- Message m(*content, session);
- autoAck.ack(m);
- return m;
- }
- else
- throw CommandInvalidException(
- QPID_MSG("Unexpected method: " << content->getMethod()));
-}
-
-void LocalQueue::setAckPolicy(AckPolicy a) { autoAck=a; }
-
-bool LocalQueue::empty() const
-{
- if (!queue)
- throw ClosedException();
- return queue->empty();
-}
-
-size_t LocalQueue::size() const
-{
- if (!queue)
- throw ClosedException();
- return queue->size();
-}
-
-}} // namespace qpid::client
diff --git a/qpid/cpp/src/qpid/client/LocalQueue.h b/qpid/cpp/src/qpid/client/LocalQueue.h
deleted file mode 100644
index f8b2c2e0b3..0000000000
--- a/qpid/cpp/src/qpid/client/LocalQueue.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef QPID_CLIENT_LOCALQUEUE_H
-#define QPID_CLIENT_LOCALQUEUE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/client/Message.h"
-#include "qpid/client/Demux.h"
-#include "qpid/client/AckPolicy.h"
-
-namespace qpid {
-namespace client {
-
-/**
- * Local representation of a remote queue.
- *
- * \ingroup clientapi
- */
-class LocalQueue
-{
- public:
- LocalQueue(AckPolicy=AckPolicy());
- ~LocalQueue();
-
- /** Pop the next message off the queue.
- *@exception ClosedException if subscription has been closed.
- */
- Message pop();
- bool empty() const;
- size_t size() const;
- void setAckPolicy(AckPolicy);
-
- private:
- friend class SubscriptionManager;
- Session session;
- Demux::QueuePtr queue;
- AckPolicy autoAck;
-};
-
-}} // namespace qpid::client
-
-#endif /*!QPID_CLIENT_LOCALQUEUE_H*/
diff --git a/qpid/cpp/src/qpid/client/Message.h b/qpid/cpp/src/qpid/client/Message.h
deleted file mode 100644
index daac30ba36..0000000000
--- a/qpid/cpp/src/qpid/client/Message.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef _client_Message_h
-#define _client_Message_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <string>
-#include "qpid/client/Session.h"
-#include "qpid/framing/MessageTransferBody.h"
-#include "qpid/framing/TransferContent.h"
-
-namespace qpid {
-namespace client {
-
-/**
- * A representation of messages for sent or recived through the
- * client api.
- *
- * \ingroup clientapi
- */
-class Message : public framing::TransferContent
-{
-public:
- Message(const std::string& data_=std::string(),
- const std::string& routingKey=std::string(),
- const std::string& exchange=std::string()
- ) : TransferContent(data_, routingKey, exchange) {}
-
- std::string getDestination() const
- {
- return method.getDestination();
- }
-
- bool isRedelivered() const
- {
- return hasDeliveryProperties() && getDeliveryProperties().getRedelivered();
- }
-
- void setRedelivered(bool redelivered)
- {
- getDeliveryProperties().setRedelivered(redelivered);
- }
-
- framing::FieldTable& getHeaders()
- {
- return getMessageProperties().getApplicationHeaders();
- }
-
- void acknowledge(Session& session, bool cumulative = true, bool send = true) const
- {
- session.getExecution().completed(id, cumulative, send);
- }
-
- void acknowledge(bool cumulative = true, bool send = true) const
- {
- const_cast<Session&>(session).getExecution().completed(id, cumulative, send);
- }
-
- /**@internal for incoming messages */
- Message(const framing::FrameSet& frameset, Session s) :
- method(*frameset.as<framing::MessageTransferBody>()), id(frameset.getId()), session(s)
- {
- populate(frameset);
- }
-
- const framing::MessageTransferBody& getMethod() const
- {
- return method;
- }
-
- const framing::SequenceNumber& getId() const
- {
- return id;
- }
-
- /**@internal use for incoming messages. */
- void setSession(Session s) { session=s; }
-private:
- //method and id are only set for received messages:
- framing::MessageTransferBody method;
- framing::SequenceNumber id;
- Session session;
-};
-
-}}
-
-#endif /*!_client_Message_h*/
diff --git a/qpid/cpp/src/qpid/client/MessageListener.cpp b/qpid/cpp/src/qpid/client/MessageListener.cpp
deleted file mode 100644
index 68ebedeb0d..0000000000
--- a/qpid/cpp/src/qpid/client/MessageListener.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "MessageListener.h"
-
-qpid::client::MessageListener::~MessageListener() {}
diff --git a/qpid/cpp/src/qpid/client/MessageListener.h b/qpid/cpp/src/qpid/client/MessageListener.h
deleted file mode 100644
index 86e5dd63dc..0000000000
--- a/qpid/cpp/src/qpid/client/MessageListener.h
+++ /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.
- *
- */
-#include <string>
-
-#ifndef _MessageListener_
-#define _MessageListener_
-
-#include "Message.h"
-
-namespace qpid {
-namespace client {
-
- /**
- * An interface through which asynchronously delivered messages
- * can be received by an application.
- *
- * @see Channel::consume()
- *
- * \ingroup clientapi
- */
- class MessageListener{
- public:
- virtual ~MessageListener();
- virtual void received(Message& msg) = 0;
- };
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/MessageQueue.h b/qpid/cpp/src/qpid/client/MessageQueue.h
deleted file mode 100644
index e9b7a9fe58..0000000000
--- a/qpid/cpp/src/qpid/client/MessageQueue.h
+++ /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.
- *
- */
-
-#ifndef _MessageQueue_
-#define _MessageQueue_
-#include <iostream>
-#include "qpid/sys/BlockingQueue.h"
-#include "MessageListener.h"
-
-namespace qpid {
-namespace client {
-
-/**
- * A MessageListener implementation that simply queues up
- * messages.
- *
- * \ingroup clientapi
- */
-class MessageQueue : public sys::BlockingQueue<Message>, public MessageListener
-{
- public:
- void received(Message& msg)
- {
- push(msg);
- }
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Queue.cpp b/qpid/cpp/src/qpid/client/Queue.cpp
deleted file mode 100644
index 1752a48a3a..0000000000
--- a/qpid/cpp/src/qpid/client/Queue.cpp
+++ /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.
- *
- */
-#include "Queue.h"
-
-qpid::client::Queue::Queue() : name(""), autodelete(true), exclusive(true), durable(false){}
-
-qpid::client::Queue::Queue(std::string _name) : name(_name), autodelete(false), exclusive(false), durable(false){}
-
-qpid::client::Queue::Queue(std::string _name, bool temp) : name(_name), autodelete(temp), exclusive(temp), durable(false){}
-
-qpid::client::Queue::Queue(std::string _name, bool _autodelete, bool _exclusive, bool _durable)
- : name(_name), autodelete(_autodelete), exclusive(_exclusive), durable(_durable){}
-
-const std::string& qpid::client::Queue::getName() const{
- return name;
-}
-
-void qpid::client::Queue::setName(const std::string& _name){
- name = _name;
-}
-
-bool qpid::client::Queue::isAutoDelete() const{
- return autodelete;
-}
-
-bool qpid::client::Queue::isExclusive() const{
- return exclusive;
-}
-
-bool qpid::client::Queue::isDurable() const{
- return durable;
-}
-
-void qpid::client::Queue::setDurable(bool _durable){
- durable = _durable;
-}
-
-
-
-
diff --git a/qpid/cpp/src/qpid/client/Queue.h b/qpid/cpp/src/qpid/client/Queue.h
deleted file mode 100644
index 078e04c29e..0000000000
--- a/qpid/cpp/src/qpid/client/Queue.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef _client_Queue_h
-#define _client_Queue_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <string>
-
-namespace qpid {
-namespace client {
-
- /**
- * DEPRECATED
- *
- * A 'handle' used to represent an AMQP queue in the Channel
- * methods. Creating an instance of this class does not cause the
- * queue to be created on the broker. Rather, an instance of this
- * class should be passed to Channel::declareQueue() to ensure
- * that the queue exists or is created.
- *
- * Queues hold messages and allow clients to consume
- * (see Channel::consume()) or get (see Channel::get()) those messags. A
- * queue receives messages by being bound to one or more Exchange;
- * messages published to that exchange may then be routed to the
- * queue based on the details of the binding and the type of the
- * exchange (see Channel::bind()).
- *
- * Queues are identified by a name. They can be exclusive (in which
- * case they can only be used in the context of the connection
- * over which they were declared, and are deleted when then
- * connection closes), or they can be shared. Shared queues can be
- * auto deleted when they have no consumers.
- *
- * We use the term 'temporary queue' to refer to an exclusive
- * queue.
- */
- class Queue{
- std::string name;
- const bool autodelete;
- const bool exclusive;
- bool durable;
-
- public:
-
- /**
- * Creates an unnamed, non-durable, temporary queue. A name
- * will be assigned to this queue instance by a call to
- * Channel::declareQueue().
- */
- Queue();
- /**
- * Creates a shared, non-durable, queue with a given name,
- * that will not be autodeleted.
- *
- * @param name the name of the queue
- */
- Queue(std::string name);
- /**
- * Creates a non-durable queue with a given name.
- *
- * @param name the name of the queue
- *
- * @param temp if true the queue will be a temporary queue, if
- * false it will be shared and not autodeleted.
- */
- Queue(std::string name, bool temp);
- /**
- * This constructor allows the autodelete, exclusive and
- * durable propeties to be explictly set. Note however that if
- * exclusive is true, autodelete has no meaning as exclusive
- * queues are always destroyed when the connection that
- * created them is closed.
- */
- Queue(std::string name, bool autodelete, bool exclusive, bool durable);
- const std::string& getName() const;
- void setName(const std::string&);
- bool isAutoDelete() const;
- bool isExclusive() const;
- bool isDurable() const;
- void setDurable(bool durable);
- };
-
-}
-}
-
-#endif /*!_client_Queue_h*/
diff --git a/qpid/cpp/src/qpid/client/Response.h b/qpid/cpp/src/qpid/client/Response.h
deleted file mode 100644
index 2b7d55ec1f..0000000000
--- a/qpid/cpp/src/qpid/client/Response.h
+++ /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.
- *
- */
-
-#ifndef _Response_
-#define _Response_
-
-#include <boost/shared_ptr.hpp>
-#include "qpid/framing/amqp_framing.h"
-#include "Completion.h"
-
-namespace qpid {
-namespace client {
-
-class Response : public Completion
-{
-public:
- Response(Future f, shared_ptr<SessionCore> s) : Completion(f, s) {}
-
- template <class T> T& as()
- {
- framing::AMQMethodBody* response(future.getResponse(*session));
- return *boost::polymorphic_downcast<T*>(response);
- }
-
- template <class T> bool isA()
- {
- framing::AMQMethodBody* response(future.getResponse(*session));
- return response && response->isA<T>();
- }
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/Session.h b/qpid/cpp/src/qpid/client/Session.h
deleted file mode 100644
index 5d91f289e2..0000000000
--- a/qpid/cpp/src/qpid/client/Session.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef QPID_CLIENT_SESSION_H
-#define QPID_CLIENT_SESSION_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/client/Session_99_0.h"
-
-namespace qpid {
-namespace client {
-
-/**
- * Session is currently just an alias for Session_99_0
- *
- * \ingroup clientapi
- */
-typedef Session_99_0 Session;
-
-}} // namespace qpid::client
-
-#endif /*!QPID_CLIENT_SESSION_H*/
diff --git a/qpid/cpp/src/qpid/client/SessionBase.cpp b/qpid/cpp/src/qpid/client/SessionBase.cpp
deleted file mode 100644
index 0e1fa67bda..0000000000
--- a/qpid/cpp/src/qpid/client/SessionBase.cpp
+++ /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.
- *
- */
-#include "SessionBase.h"
-
-namespace qpid {
-namespace client {
-using namespace framing;
-
-SessionBase::SessionBase() {}
-SessionBase::~SessionBase() {}
-SessionBase::SessionBase(shared_ptr<SessionCore> core) : impl(core) {}
-void SessionBase::suspend() { impl->suspend(); }
-void SessionBase::close() { impl->close(); }
-
-void SessionBase::setSynchronous(bool isSync) { impl->setSync(isSync); }
-void SessionBase::setSynchronous(SynchronousMode m) { impl->setSync(m); }
-bool SessionBase::isSynchronous() const { return impl->isSync(); }
-SynchronousMode SessionBase::getSynchronous() const {
- return SynchronousMode(impl->isSync());
-}
-
-Execution& SessionBase::getExecution() { return impl->getExecution(); }
-Uuid SessionBase::getId() const { return impl->getId(); }
-framing::FrameSet::shared_ptr SessionBase::get() { return impl->get(); }
-
-void SessionBase::sync() {
- Execution& ex = getExecution();
- ex.syncWait(ex.lastSent());
- impl->assertOpen();
-}
-
-}} // namespace qpid::client
diff --git a/qpid/cpp/src/qpid/client/SessionBase.h b/qpid/cpp/src/qpid/client/SessionBase.h
deleted file mode 100644
index 3565145bb9..0000000000
--- a/qpid/cpp/src/qpid/client/SessionBase.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef QPID_CLIENT_SESSIONBASE_H
-#define QPID_CLIENT_SESSIONBASE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/Uuid.h"
-#include "qpid/framing/amqp_structs.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/framing/MethodContent.h"
-#include "qpid/framing/TransferContent.h"
-#include "qpid/client/Completion.h"
-#include "qpid/client/ConnectionImpl.h"
-#include "qpid/client/Response.h"
-#include "qpid/client/SessionCore.h"
-#include "qpid/client/TypedResult.h"
-#include "qpid/shared_ptr.h"
-#include <string>
-
-namespace qpid {
-namespace client {
-
-using std::string;
-using framing::Content;
-using framing::FieldTable;
-using framing::MethodContent;
-using framing::SequenceNumberSet;
-using framing::Uuid;
-
-/** \defgroup clientapi Synchronous mode of a session.
- *
- * SYNC means that Session functions do not return until the remote
- * broker has confirmed that the command was executed.
- *
- * ASYNC means that the client sends commands asynchronously, Session
- * functions return immediately.
- *
- * ASYNC mode gives better performance for high-volume traffic, but
- * requires some additional caution:
- *
- * Session functions return immediately. If the command causes an
- * exception on the broker, the exception will be thrown on a
- * <em>later</em> function call.
- *
- * If you need to notify some extenal agent that some actions have
- * been taken (e.g. binding queues to exchanages), you must call
- * Session::sync() first, to ensure that all the commands are complete.
- *
- * You can freely switch between modes by calling Session::setSynchronous()
- *
- * @see Session::sync(), Session::setSynchronous()
- */
-enum SynchronousMode { SYNC=true, ASYNC=false };
-
-
-/**
- * Basic session operations that are not derived from AMQP XML methods.
- */
-class SessionBase
-{
- public:
- SessionBase();
- ~SessionBase();
-
- /** Get the next message frame-set from the session. */
- framing::FrameSet::shared_ptr get();
-
- /** Get the session ID */
- Uuid getId() const;
-
- /**
- * In synchronous mode, wait for the broker's response before
- * returning. Note this gives lower throughput than asynchronous
- * mode.
- *
- * In asynchronous mode commands are sent without waiting
- * for a respose (you can use the returned Completion object
- * to wait for completion.)
- *
- * @see SynchronousMode
- */
- void setSynchronous(SynchronousMode mode);
- void setSynchronous(bool set);
- bool isSynchronous() const;
- SynchronousMode getSynchronous() const;
-
- /**
- * Suspend the session, can be resumed on a different connection.
- * @see Connection::resume()
- */
- void suspend();
-
- /** Close the session */
- void close();
-
- /**
- * Synchronize with the broker. Wait for all commands issued so far in
- * the session to complete.
- * @see SynchronousMode
- */
- void sync();
-
- Execution& getExecution();
-
- typedef framing::TransferContent DefaultContent;
-
- protected:
- shared_ptr<SessionCore> impl;
- framing::ProtocolVersion version;
- friend class Connection;
- SessionBase(shared_ptr<SessionCore>);
-};
-
-}} // namespace qpid::client
-
-#endif /*!QPID_CLIENT_SESSIONBASE_H*/
diff --git a/qpid/cpp/src/qpid/client/SessionCore.cpp b/qpid/cpp/src/qpid/client/SessionCore.cpp
deleted file mode 100644
index 5079c47b5e..0000000000
--- a/qpid/cpp/src/qpid/client/SessionCore.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "SessionCore.h"
-#include "Future.h"
-#include "FutureResponse.h"
-#include "FutureResult.h"
-#include "ConnectionImpl.h"
-#include "qpid/framing/FrameSet.h"
-#include "qpid/framing/constants.h"
-#include "qpid/framing/ClientInvoker.h"
-#include "qpid/log/Statement.h"
-
-#include <boost/bind.hpp>
-
-namespace qpid {
-namespace client {
-
-using namespace qpid::framing;
-
-namespace { const std::string OK="ok"; }
-
-typedef sys::Monitor::ScopedLock Lock;
-typedef sys::Monitor::ScopedUnlock UnLock;
-
-inline void SessionCore::invariant() const {
- switch (state.get()) {
- case OPENING:
- assert(!session);
- assert(code==REPLY_SUCCESS);
- assert(connection);
- assert(channel.get());
- assert(channel.next == connection.get());
- break;
- case RESUMING:
- assert(session);
- assert(session->getState() == SessionState::RESUMING);
- assert(code==REPLY_SUCCESS);
- assert(connection);
- assert(channel.get());
- assert(channel.next == connection.get());
- break;
- case OPEN:
- case CLOSING:
- case SUSPENDING:
- assert(session);
- assert(connection);
- assert(channel.get());
- assert(channel.next == connection.get());
- break;
- case SUSPENDED:
- assert(session);
- assert(!connection);
- break;
- case CLOSED:
- assert(!session);
- assert(!connection);
- break;
- }
-}
-
-inline void SessionCore::setState(State s) {
- state = s;
- invariant();
-}
-
-inline void SessionCore::waitFor(State s) {
- invariant();
- // We can be CLOSED or SUSPENDED by error at any time.
- state.waitFor(States(s, CLOSED, SUSPENDED));
- check();
- invariant();
-}
-
-SessionCore::SessionCore(shared_ptr<ConnectionImpl> conn,
- uint16_t ch, uint64_t maxFrameSize)
- : l3(maxFrameSize),
- sync(false),
- channel(ch),
- proxy(channel),
- state(OPENING),
- detachedLifetime(0)
-{
- l3.out = &out;
- attaching(conn);
-}
-
-void SessionCore::attaching(shared_ptr<ConnectionImpl> c) {
- assert(c);
- assert(channel.get());
- connection = c;
- channel.next = connection.get();
- code = REPLY_SUCCESS;
- text = OK;
- state = session ? RESUMING : OPENING;
- invariant();
-}
-
-SessionCore::~SessionCore() {
- Lock l(state);
- detach(COMMAND_INVALID, "Session deleted");
- state.waitWaiters();
-}
-
-void SessionCore::detach(int c, const std::string& t) {
- connection.reset();
- channel.next = 0;
- code=c;
- text=t;
- l3.getDemux().close();
-}
-
-void SessionCore::doClose(int code, const std::string& text) {
- if (state != CLOSED) {
- session.reset();
- detach(code, text);
- setState(CLOSED);
- l3.getCompletionTracker().close();
- }
- invariant();
-}
-
-void SessionCore::doSuspend(int code, const std::string& text) {
- if (state != CLOSED && state != SUSPENDED) {
- detach(code, text);
- session->suspend();
- setState(SUSPENDED);
- }
- invariant();
-}
-
-ExecutionHandler& SessionCore::getExecution() { // user thread
- return l3;
-}
-
-void SessionCore::setSync(bool s) { // user thread
- sync = s;
-}
-
-bool SessionCore::isSync() { // user thread
- return sync;
-}
-
-FrameSet::shared_ptr SessionCore::get() { // user thread
- // No lock here: pop does a blocking wait.
- return l3.getDemux().getDefault()->pop();
-}
-
-static const std::string CANNOT_REOPEN_SESSION="Cannot re-open a session.";
-
-void SessionCore::open(uint32_t timeout) { // user thread
- Lock l(state);
- check(state==OPENING && !session,
- COMMAND_INVALID, CANNOT_REOPEN_SESSION);
- detachedLifetime=timeout;
- proxy.open(detachedLifetime);
- waitFor(OPEN);
-}
-
-void SessionCore::close() { // user thread
- Lock l(state);
- check();
- if (state==OPEN) {
- setState(CLOSING);
- proxy.close();
- waitFor(CLOSED);
- }
- else
- doClose(REPLY_SUCCESS, OK);
-}
-
-void SessionCore::suspend() { // user thread
- Lock l(state);
- checkOpen();
- setState(SUSPENDING);
- proxy.suspend();
- waitFor(SUSPENDED);
-}
-
-void SessionCore::setChannel(uint16_t ch) { channel=ch; }
-
-static const std::string CANNOT_RESUME_SESSION("Session cannot be resumed.");
-
-void SessionCore::resume(shared_ptr<ConnectionImpl> c) {
- // user thread
- {
- Lock l(state);
- if (state==SUSPENDED) { // Clear error that caused suspend
- code=REPLY_SUCCESS;
- text=OK;
- }
- check(state==SUSPENDED, COMMAND_INVALID, CANNOT_RESUME_SESSION);
- SequenceNumber sendAck=session->resuming();
- attaching(c);
- proxy.resume(getId());
- waitFor(OPEN);
- proxy.ack(sendAck, SequenceNumberSet());
- // TODO aconway 2007-10-23: Replay inside the lock might be a prolem
- // for large replay sets.
- SessionState::Replay replay=session->replay();
- for (SessionState::Replay::iterator i = replay.begin();
- i != replay.end(); ++i)
- {
- invariant();
- channel.handle(*i); // Direct to channel.
- check();
- }
- l3.getDemux().open();
- }
-}
-
-void SessionCore::assertOpen() const {
- Lock l(state);
- checkOpen();
-}
-
-static const std::string UNEXPECTED_SESSION_ATTACHED(
- "Received unexpected session.attached");
-
-static const std::string INVALID_SESSION_RESUME_ID(
- "session.resumed has invalid ID.");
-
-// network thread
-void SessionCore::attached(const Uuid& sessionId,
- uint32_t /*detachedLifetime*/)
-{
- Lock l(state);
- invariant();
- check(state == OPENING || state == RESUMING,
- COMMAND_INVALID, UNEXPECTED_SESSION_ATTACHED);
- if (state==OPENING) { // New session
- // TODO aconway 2007-10-17: 0 disables sesskon.ack for now.
- // If AMQP WG decides to keep it, we need to add configuration
- // for the ack rate.
- session=in_place<SessionState>(0, detachedLifetime > 0, sessionId);
- setState(OPEN);
- }
- else { // RESUMING
- check(sessionId == session->getId(),
- INVALID_ARGUMENT, INVALID_SESSION_RESUME_ID);
- // Don't setState yet, wait for first incoming ack.
- }
-}
-
-static const std::string UNEXPECTED_SESSION_DETACHED(
- "Received unexpected session.detached.");
-
-static const std::string UNEXPECTED_SESSION_ACK(
- "Received unexpected session.ack");
-
-void SessionCore::detached() { // network thread
- Lock l(state);
- check(state == SUSPENDING,
- COMMAND_INVALID, UNEXPECTED_SESSION_DETACHED);
- doSuspend(REPLY_SUCCESS, OK);
-}
-
-void SessionCore::ack(uint32_t ack, const SequenceNumberSet&) {
- Lock l(state);
- invariant();
- check(state==OPEN || state==RESUMING,
- COMMAND_INVALID, UNEXPECTED_SESSION_ACK);
- session->receivedAck(ack);
- if (state==RESUMING) {
- setState(OPEN);
- }
- invariant();
-}
-
-void SessionCore::closed(uint16_t code, const std::string& text)
-{ // network thread
- Lock l(state);
- invariant();
- doClose(code, text);
-}
-
-// closed by connection
-void SessionCore::connectionClosed(uint16_t code, const std::string& text) {
- Lock l(state);
- try {
- doClose(code, text);
- } catch(...) { assert (0); }
-}
-
-void SessionCore::connectionBroke(uint16_t code, const std::string& text) {
- Lock l(state);
- try {
- doSuspend(code, text);
- } catch (...) { assert(0); }
-}
-
-void SessionCore::check() const { // Called with lock held.
- invariant();
- if (code != REPLY_SUCCESS)
- throwReplyException(code, text);
-}
-
-void SessionCore::check(bool cond, int newCode, const std::string& msg) const {
- check();
- if (!cond) {
- const_cast<SessionCore*>(this)->doClose(newCode, msg);
- throwReplyException(code, text);
- }
-}
-
-static const std::string SESSION_NOT_OPEN("Session is not open");
-
-void SessionCore::checkOpen() const {
- if (state==SUSPENDED) {
- std::string cause;
- if (code != REPLY_SUCCESS)
- cause=" by :"+text;
- throw CommandInvalidException(QPID_MSG("Session is suspended" << cause));
- }
- check(state==OPEN, COMMAND_INVALID, SESSION_NOT_OPEN);
-}
-
-Future SessionCore::send(const AMQBody& command)
-{
- Lock l(state);
- checkOpen();
- command.getMethod()->setSync(sync);
- Future f;
- //any result/response listeners must be set before the command is sent
- if (command.getMethod()->resultExpected()) {
- boost::shared_ptr<FutureResult> r(new FutureResult());
- f.setFutureResult(r);
- //result listener is tied to command id, and is set when that
- //is allocated by the execution handler, so pass it to send
- f.setCommandId(l3.send(command, boost::bind(&FutureResult::received, r, _1)));
- } else {
- if (command.getMethod()->responseExpected()) {
- boost::shared_ptr<FutureResponse> r(new FutureResponse());
- f.setFutureResponse(r);
- l3.getCorrelator().listen(boost::bind(&FutureResponse::received, r, _1));
- }
-
- f.setCommandId(l3.send(command));
- }
- return f;
-}
-
-Future SessionCore::send(const AMQBody& command, const MethodContent& content)
-{
- Lock l(state);
- checkOpen();
- //content bearing methods don't currently have responses or
- //results, if that changes should follow procedure for the other
- //send method impl:
- return Future(l3.send(command, content));
-}
-
-namespace {
-bool isCloseResponse(const AMQFrame& frame) {
- return frame.getMethod() &&
- frame.getMethod()->amqpClassId() == SESSION_CLASS_ID &&
- frame.getMethod()->amqpMethodId() == SESSION_CLOSED_METHOD_ID;
-}
-}
-
-// Network thread.
-void SessionCore::handleIn(AMQFrame& frame) {
- ConnectionImpl::shared_ptr save;
- {
- Lock l(state);
- save=connection;
- // Ignore frames received while closing other than closed response.
- if (state==CLOSING && !isCloseResponse(frame))
- return;
- }
- try {
- // Cast to expose private SessionHandler functions.
- if (invoke(static_cast<SessionHandler&>(*this), *frame.getBody())) {
- // If we were detached by a session command, tell the connection.
- if (!connection) save->erase(channel);
- }
- else {
- session->received(frame);
- l3.handle(frame);
- }
- } catch (const ChannelException& e) {
- QPID_LOG(error, "Channel exception:" << e.what());
- doClose(e.code, e.what());
- }
-}
-
-void SessionCore::handleOut(AMQFrame& frame)
-{
- Lock l(state);
- if (state==OPEN) {
- if (detachedLifetime > 0 && session->sent(frame))
- proxy.solicitAck();
- channel.handle(frame);
- }
-}
-
-void SessionCore::solicitAck( ) {
- Lock l(state);
- checkOpen();
- proxy.ack(session->sendingAck(), SequenceNumberSet());
-}
-
-void SessionCore::flow(bool) {
- assert(0); throw NotImplementedException("session.flow");
-}
-
-void SessionCore::flowOk(bool /*active*/) {
- assert(0); throw NotImplementedException("session.flow");
-}
-
-void SessionCore::highWaterMark(uint32_t /*lastSentMark*/) {
- // TODO aconway 2007-10-02: may be removed from spec.
- assert(0); throw NotImplementedException("session.highWaterMark");
-}
-
-const Uuid SessionCore::getId() const {
- if (session)
- return session->getId();
- throw Exception(QPID_MSG("Closed session, no ID."));
-}
-
-}} // namespace qpid::client
diff --git a/qpid/cpp/src/qpid/client/SessionCore.h b/qpid/cpp/src/qpid/client/SessionCore.h
deleted file mode 100644
index 2bb0f41fbf..0000000000
--- a/qpid/cpp/src/qpid/client/SessionCore.h
+++ /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.
- *
- */
-
-#ifndef _SessionCore_
-#define _SessionCore_
-
-#include "qpid/shared_ptr.h"
-#include "qpid/framing/FrameHandler.h"
-#include "qpid/framing/ChannelHandler.h"
-#include "qpid/framing/SessionState.h"
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/framing/AMQP_ClientOperations.h"
-#include "qpid/framing/AMQP_ServerProxy.h"
-#include "qpid/sys/StateMonitor.h"
-#include "ExecutionHandler.h"
-
-#include <boost/optional.hpp>
-
-namespace qpid {
-namespace framing {
-class FrameSet;
-class MethodContent;
-class SequenceNumberSet;
-}
-
-namespace client {
-
-class Future;
-class ConnectionImpl;
-
-/**
- * Session implementation, sets up handler chains.
- * Attaches to a SessionHandler when active, detaches
- * when closed.
- */
-class SessionCore : public framing::FrameHandler::InOutHandler,
- private framing::AMQP_ClientOperations::SessionHandler
-{
- public:
- SessionCore(shared_ptr<ConnectionImpl>, uint16_t channel, uint64_t maxFrameSize);
- ~SessionCore();
-
- framing::FrameSet::shared_ptr get();
- const framing::Uuid getId() const;
- uint16_t getChannel() const { return channel; }
- void assertOpen() const;
-
- // NOTE: Public functions called in user thread.
- void open(uint32_t detachedLifetime);
- void close();
- void resume(shared_ptr<ConnectionImpl>);
- void suspend();
- void setChannel(uint16_t channel);
-
- void setSync(bool s);
- bool isSync();
- ExecutionHandler& getExecution();
-
- Future send(const framing::AMQBody& command);
-
- Future send(const framing::AMQBody& command, const framing::MethodContent& content);
-
- void connectionClosed(uint16_t code, const std::string& text);
- void connectionBroke(uint16_t code, const std::string& text);
-
- private:
- enum State {
- OPENING,
- RESUMING,
- OPEN,
- CLOSING,
- SUSPENDING,
- SUSPENDED,
- CLOSED
- };
- typedef framing::AMQP_ClientOperations::SessionHandler SessionHandler;
- typedef sys::StateMonitor<State, CLOSED> StateMonitor;
- typedef StateMonitor::Set States;
-
- inline void invariant() const;
- inline void setState(State s);
- inline void waitFor(State);
- void doClose(int code, const std::string& text);
- void doSuspend(int code, const std::string& text);
-
- /** If there is an error, throw the exception */
- void check(bool condition, int code, const std::string& text) const;
- /** Throw if *error */
- void check() const;
-
- void handleIn(framing::AMQFrame& frame);
- void handleOut(framing::AMQFrame& frame);
-
- // Private functions are called by broker in network thread.
- void attached(const framing::Uuid& sessionId, uint32_t detachedLifetime);
- void flow(bool active);
- void flowOk(bool active);
- void detached();
- void ack(uint32_t cumulativeSeenMark,
- const framing::SequenceNumberSet& seenFrameSet);
- void highWaterMark(uint32_t lastSentMark);
- void solicitAck();
- void closed(uint16_t code, const std::string& text);
-
- void attaching(shared_ptr<ConnectionImpl>);
- void detach(int code, const std::string& text);
- void checkOpen() const;
-
- int code; // Error code
- std::string text; // Error text
- boost::optional<framing::SessionState> session;
- shared_ptr<ConnectionImpl> connection;
- ExecutionHandler l3;
- volatile bool sync;
- framing::ChannelHandler channel;
- framing::AMQP_ServerProxy::Session proxy;
- mutable StateMonitor state;
- uint32_t detachedLifetime;
-};
-
-}} // namespace qpid::client
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/StateManager.cpp b/qpid/cpp/src/qpid/client/StateManager.cpp
deleted file mode 100644
index 0cb3c6b9d4..0000000000
--- a/qpid/cpp/src/qpid/client/StateManager.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "StateManager.h"
-#include "qpid/framing/amqp_framing.h"
-
-using namespace qpid::client;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-StateManager::StateManager(int s) : state(s) {}
-
-void StateManager::waitForStateChange(int current)
-{
- Monitor::ScopedLock l(stateLock);
- while (state == current) {
- stateLock.wait();
- }
-}
-
-void StateManager::waitFor(int desired)
-{
- Monitor::ScopedLock l(stateLock);
- while (state != desired) {
- stateLock.wait();
- }
-}
-
-void StateManager::waitFor(std::set<int> desired)
-{
- Monitor::ScopedLock l(stateLock);
- while (desired.find(state) == desired.end()) {
- stateLock.wait();
- }
-}
-
-
-void StateManager::setState(int s)
-{
- Monitor::ScopedLock l(stateLock);
- state = s;
- stateLock.notifyAll();
-}
-
-int StateManager::getState() const
-{
- Monitor::ScopedLock l(stateLock);
- return state;
-}
-
diff --git a/qpid/cpp/src/qpid/client/StateManager.h b/qpid/cpp/src/qpid/client/StateManager.h
deleted file mode 100644
index 2f8ecb772c..0000000000
--- a/qpid/cpp/src/qpid/client/StateManager.h
+++ /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.
- *
- */
-#ifndef _StateManager_
-#define _StateManager_
-
-#include <set>
-#include "qpid/sys/Monitor.h"
-
-namespace qpid {
-namespace client {
-
-class StateManager
-{
- int state;
- mutable sys::Monitor stateLock;
-
-public:
- StateManager(int initial);
- void setState(int state);
- int getState() const ;
- void waitForStateChange(int current);
- void waitFor(std::set<int> states);
- void waitFor(int state);
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/SubscriptionManager.cpp b/qpid/cpp/src/qpid/client/SubscriptionManager.cpp
deleted file mode 100644
index f14344225c..0000000000
--- a/qpid/cpp/src/qpid/client/SubscriptionManager.cpp
+++ /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.
- *
- */
-#ifndef _Subscription_
-#define _Subscription_
-
-#include "SubscriptionManager.h"
-#include <qpid/client/Dispatcher.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/MessageListener.h>
-#include <set>
-#include <sstream>
-
-
-namespace qpid {
-namespace client {
-
-SubscriptionManager::SubscriptionManager(Session& s)
- : dispatcher(s), session(s),
- messages(UNLIMITED), bytes(UNLIMITED), window(true),
- confirmMode(true), acquireMode(false),
- autoStop(true)
-{}
-
-Completion SubscriptionManager::subscribeInternal(
- const std::string& q, const std::string& dest)
-{
- Completion c = session.messageSubscribe(arg::queue=q, arg::destination=dest,
- arg::confirmMode=confirmMode, arg::acquireMode=acquireMode);
- setFlowControl(dest, messages, bytes, window);
- return c;
-}
-
-Completion SubscriptionManager::subscribe(
- MessageListener& listener, const std::string& q, const std::string& d)
-{
- std::string dest=d.empty() ? q:d;
- dispatcher.listen(dest, &listener, autoAck);
- return subscribeInternal(q, dest);
-}
-
-Completion SubscriptionManager::subscribe(
- LocalQueue& lq, const std::string& q, const std::string& d)
-{
- std::string dest=d.empty() ? q:d;
- lq.session=session;
- lq.queue=session.getExecution().getDemux().add(dest, ByTransferDest(dest));
- return subscribeInternal(q, dest);
-}
-
-void SubscriptionManager::setFlowControl(
- const std::string& dest, uint32_t messages, uint32_t bytes, bool window)
-{
- session.messageFlowMode(dest, window);
- session.messageFlow(dest, 0, messages);
- session.messageFlow(dest, 1, bytes);
-}
-
-void SubscriptionManager::setFlowControl(
- uint32_t messages_, uint32_t bytes_, bool window_)
-{
- messages=messages_;
- bytes=bytes_;
- window=window_;
-}
-
-void SubscriptionManager::setConfirmMode(bool c) { confirmMode=c; }
-
-void SubscriptionManager::setAcquireMode(bool a) { acquireMode=a; }
-
-void SubscriptionManager::setAckPolicy(const AckPolicy& a) { autoAck=a; }
-
-void SubscriptionManager::cancel(const std::string dest)
-{
- dispatcher.cancel(dest);
- session.messageCancel(dest);
-}
-
-void SubscriptionManager::setAutoStop(bool set) { autoStop=set; }
-
-void SubscriptionManager::run()
-{
- dispatcher.setAutoStop(autoStop);
- dispatcher.run();
-}
-
-void SubscriptionManager::stop()
-{
- dispatcher.stop();
-}
-
-}} // namespace qpid::client
-
-#endif
diff --git a/qpid/cpp/src/qpid/client/SubscriptionManager.h b/qpid/cpp/src/qpid/client/SubscriptionManager.h
deleted file mode 100644
index 1741796f4f..0000000000
--- a/qpid/cpp/src/qpid/client/SubscriptionManager.h
+++ /dev/null
@@ -1,141 +0,0 @@
-#ifndef QPID_CLIENT_SUBSCRIPTIONMANAGER_H
-#define QPID_CLIENT_SUBSCRIPTIONMANAGER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/sys/Mutex.h"
-#include <qpid/client/Dispatcher.h>
-#include <qpid/client/Completion.h>
-#include <qpid/client/Session.h>
-#include <qpid/client/MessageListener.h>
-#include <qpid/client/LocalQueue.h>
-#include <qpid/sys/Runnable.h>
-
-#include <set>
-#include <sstream>
-
-namespace qpid {
-namespace client {
-
-/**
- * Utility to assist with creating subscriptions.
- *
- * \ingroup clientapi
- */
-class SubscriptionManager : public sys::Runnable
-{
- typedef sys::Mutex::ScopedLock Lock;
- typedef sys::Mutex::ScopedUnlock Unlock;
-
- Completion subscribeInternal(const std::string& q, const std::string& dest);
-
- qpid::client::Dispatcher dispatcher;
- qpid::client::Session& session;
- uint32_t messages;
- uint32_t bytes;
- bool window;
- AckPolicy autoAck;
- bool confirmMode;
- bool acquireMode;
- bool autoStop;
-
- public:
- SubscriptionManager(Session& session);
-
- /**
- * Subscribe a MessagesListener to receive messages from queue.
- *
- *@param listener Listener object to receive messages.
- *@param queue Name of the queue to subscribe to.
- *@param tag Unique destination tag for the listener.
- * If not specified, the queue name is used.
- */
- Completion subscribe(MessageListener& listener,
- const std::string& queue,
- const std::string& tag=std::string());
-
- /**
- * Subscribe a LocalQueue to receive messages from queue.
- *
- *@param queue Name of the queue to subscribe to.
- *@param tag Unique destination tag for the listener.
- * If not specified, the queue name is used.
- */
- Completion subscribe(LocalQueue& localQueue,
- const std::string& queue,
- const std::string& tag=std::string());
-
- /** Cancel a subscription. */
- void cancel(const std::string tag);
-
- /** Deliver messages until stop() is called. */
- void run();
-
- /** If set true, run() will stop when all subscriptions
- * are cancelled. If false, run will only stop when stop()
- * is called. True by default.
- */
- void setAutoStop(bool set=true);
-
- /** Cause run() to return */
- void stop();
-
-
- static const uint32_t UNLIMITED=0xFFFFFFFF;
-
- /** Set the flow control for destination tag.
- *@param tag: name of the destination.
- *@param messages: message credit.
- *@param bytes: byte credit.
- *@param window: if true use window-based flow control.
- */
- void setFlowControl(const std::string& tag, uint32_t messages, uint32_t bytes, bool window=true);
-
- /** Set the initial flow control settings to be applied to each new subscribtion.
- *@param messages: message credit.
- *@param bytes: byte credit.
- *@param window: if true use window-based flow control.
- */
- void setFlowControl(uint32_t messages, uint32_t bytes, bool window=true);
-
- /** Set the confirm-mode for new subscriptions. Defaults to true.
- *@param confirm: if true messages must be confirmed by calling
- *Message::acknowledge() or automatically, see setAckPolicy()
- */
- void setConfirmMode(bool confirm);
-
- /** Set the acquire-mode for new subscriptions. Defaults to false.
- *@param acquire: if false messages pre-acquired, if true
- * messages are dequed on acknowledgement or on transfer
- * depending on confirmMode.
- */
- void setAcquireMode(bool acquire);
-
- /** Set the acknowledgement policy for new subscriptions.
- * Default is to acknowledge every message automatically.
- */
- void setAckPolicy(const AckPolicy& autoAck);
-};
-
-
-}} // namespace qpid::client
-
-#endif /*!QPID_CLIENT_SUBSCRIPTIONMANAGER_H*/
diff --git a/qpid/cpp/src/qpid/client/TypedResult.h b/qpid/cpp/src/qpid/client/TypedResult.h
deleted file mode 100644
index edcf728c54..0000000000
--- a/qpid/cpp/src/qpid/client/TypedResult.h
+++ /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.
- *
- */
-
-#ifndef _TypedResult_
-#define _TypedResult_
-
-#include "Completion.h"
-
-namespace qpid {
-namespace client {
-
-template <class T> class TypedResult : public Completion
-{
- T result;
- bool decoded;
-
-public:
- TypedResult(Future f, shared_ptr<SessionCore> s) : Completion(f, s), decoded(false) {}
-
- T& get()
- {
- if (!decoded) {
- future.decodeResult(result, *session);
- decoded = true;
- }
-
- return result;
- }
-};
-
-}}
-
-#endif
diff --git a/qpid/cpp/src/qpid/cluster/ClassifierHandler.cpp b/qpid/cpp/src/qpid/cluster/ClassifierHandler.cpp
deleted file mode 100644
index a4ea257f0c..0000000000
--- a/qpid/cpp/src/qpid/cluster/ClassifierHandler.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "ClassifierHandler.h"
-
-#include "qpid/framing/FrameDefaultVisitor.h"
-#include "qpid/framing/AMQFrame.h"
-
-namespace qpid {
-namespace cluster {
-
-using namespace framing;
-
-struct ClassifierHandler::Visitor : public FrameDefaultVisitor {
- Visitor(AMQFrame& f, ClassifierHandler& c)
- : chosen(0), frame(f), classifier(c) { f.getBody()->accept(*this); }
-
- void visit(const ExchangeDeclareBody&) { chosen=&classifier.wiring; }
- void visit(const ExchangeDeleteBody&) { chosen=&classifier.wiring; }
- void visit(const QueueBindBody&) { chosen=&classifier.wiring; }
- void visit(const QueueDeclareBody&) { chosen=&classifier.wiring; }
- void visit(const QueueDeleteBody&) { chosen=&classifier.wiring; }
- void visit(const QueueUnbindBody&) { chosen=&classifier.wiring; }
- void defaultVisit(const AMQBody&) { chosen=&classifier.other; }
-
- using framing::FrameDefaultVisitor::visit;
- using framing::FrameDefaultVisitor::defaultVisit;
-
- FrameHandler::Chain chosen;
- AMQFrame& frame;
- ClassifierHandler& classifier;
-};
-
-void ClassifierHandler::handle(AMQFrame& f) { Visitor(f, *this).chosen(f); }
-
-}} // namespace qpid::cluster
diff --git a/qpid/cpp/src/qpid/cluster/ClassifierHandler.h b/qpid/cpp/src/qpid/cluster/ClassifierHandler.h
deleted file mode 100644
index 696e457c04..0000000000
--- a/qpid/cpp/src/qpid/cluster/ClassifierHandler.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef QPID_CLUSTER_CLASSIFIERHANDLER_H
-#define QPID_CLUSTER_CLASSIFIERHANDLER_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/framing/FrameHandler.h"
-
-namespace qpid {
-namespace cluster {
-
-/**
- * Classify frames and forward to the appropriate handler.
- */
-class ClassifierHandler : public framing::FrameHandler
-{
- public:
- ClassifierHandler(framing::FrameHandler& wiring_,
- framing::FrameHandler& other_)
- : wiring(wiring_), other(other_) {}
-
- void handle(framing::AMQFrame&);
-
- private:
- struct Visitor;
- friend struct Visitor;
- framing::FrameHandler& wiring;
- framing::FrameHandler& other;
-};
-
-}} // namespace qpid::cluster
-
-
-
-#endif /*!QPID_CLUSTER_CLASSIFIERHANDLER_H*/
diff --git a/qpid/cpp/src/qpid/cluster/Cluster.cpp b/qpid/cpp/src/qpid/cluster/Cluster.cpp
deleted file mode 100644
index 5152aa2e43..0000000000
--- a/qpid/cpp/src/qpid/cluster/Cluster.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Cluster.h"
-#include "qpid/broker/PreviewSessionState.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/ClusterNotifyBody.h"
-#include "qpid/log/Statement.h"
-#include <boost/bind.hpp>
-#include <boost/scoped_array.hpp>
-#include <algorithm>
-#include <iterator>
-#include <map>
-
-namespace qpid {
-namespace cluster {
-using namespace qpid::framing;
-using namespace qpid::sys;
-using namespace std;
-using broker::PreviewSessionState;
-
-namespace {
-
-// Beginning of inbound chain: send to cluster.
-struct ClusterSendHandler : public FrameHandler {
- PreviewSessionState& session;
- Cluster& cluster;
- bool busy;
- Monitor lock;
-
- ClusterSendHandler(PreviewSessionState& s, Cluster& c) : session(s), cluster(c), busy(false) {}
-
- void handle(AMQFrame& f) {
- Mutex::ScopedLock l(lock);
- assert(!busy);
- // FIXME aconway 2008-01-29: refcount Sessions.
- // session.addRef(); // Keep the session till the message is self delivered.
- cluster.send(f, next); // Indirectly send to next via cluster.
-
- // FIXME aconway 2008-01-29: need to get this blocking out of the loop.
- // But cluster needs to agree on order of side-effects on the shared model.
- // OK for wiring to block, for messages use queue tokens?
- // Both in & out transfers must be orderd per queue.
- // May need out-of-order completion.
- busy=true;
- while (busy) lock.wait();
- }
-};
-
-// Next in inbound chain, self delivered from cluster.
-struct ClusterDeliverHandler : public FrameHandler {
- Cluster& cluster;
- ClusterSendHandler& sender;
-
- ClusterDeliverHandler(ClusterSendHandler& prev, Cluster& c) : cluster(c), sender(prev) {}
-
- void handle(AMQFrame& f) {
- next->handle(f);
- Mutex::ScopedLock l(sender.lock);
- sender.busy=false;
- sender.lock.notify();
- }
-};
-
-// FIXME aconway 2008-01-29: IList
-void insert(FrameHandler::Chain& c, FrameHandler* h) {
- h->next = c.next;
- c.next = h;
-}
-
-struct SessionObserver : public broker::PreviewSessionManager::Observer {
- Cluster& cluster;
- SessionObserver(Cluster& c) : cluster(c) {}
-
- void opened(PreviewSessionState& s) {
- // FIXME aconway 2008-01-29: IList for memory management.
- ClusterSendHandler* sender=new ClusterSendHandler(s, cluster);
- ClusterDeliverHandler* deliverer=new ClusterDeliverHandler(*sender, cluster);
- insert(s.in, deliverer);
- insert(s.in, sender);
- }
-};
-}
-
-ostream& operator <<(ostream& out, const Cluster& cluster) {
- return out << "cluster[" << cluster.name.str() << " " << cluster.self << "]";
-}
-
-ostream& operator<<(ostream& out, const Cluster::MemberMap::value_type& m) {
- return out << m.first << "=" << m.second.url;
-}
-
-ostream& operator <<(ostream& out, const Cluster::MemberMap& members) {
- ostream_iterator<Cluster::MemberMap::value_type> o(out, " ");
- copy(members.begin(), members.end(), o);
- return out;
-}
-
-Cluster::Cluster(const std::string& name_, const Url& url_, broker::Broker&) :
- cpg(*this),
- name(name_),
- url(url_),
- observer(new SessionObserver(*this))
-{
- QPID_LOG(trace, *this << " Joining cluster: " << name_);
- cpg.join(name);
- notify();
- dispatcher=Thread(*this);
- // Wait till we show up in the cluster map.
- {
- Mutex::ScopedLock l(lock);
- while (empty())
- lock.wait();
- }
-}
-
-Cluster::~Cluster() {
- QPID_LOG(trace, *this << " Leaving cluster.");
- try {
- cpg.leave(name);
- dispatcher.join();
- }
- catch (const std::exception& e) {
- QPID_LOG(error, "Exception leaving cluster " << *this << ": "
- << e.what());
- }
-}
-
-void Cluster::send(AMQFrame& frame, FrameHandler* next) {
- QPID_LOG(trace, *this << " SEND: " << frame);
- char data[65536]; // FIXME aconway 2008-01-29: Better buffer handling.
- Buffer buf(data);
- frame.encode(buf);
- buf.putRawData((uint8_t*)&next, sizeof(next)); // Tag the frame with the next pointer.
- iovec iov = { data, frame.size()+sizeof(next) };
- cpg.mcast(name, &iov, 1);
-}
-
-void Cluster::notify() {
- AMQFrame frame(in_place<ClusterNotifyBody>(ProtocolVersion(), url.str()));
- send(frame, 0);
-}
-
-size_t Cluster::size() const {
- Mutex::ScopedLock l(lock);
- return members.size();
-}
-
-Cluster::MemberList Cluster::getMembers() const {
- Mutex::ScopedLock l(lock);
- MemberList result(members.size());
- std::transform(members.begin(), members.end(), result.begin(),
- boost::bind(&MemberMap::value_type::second, _1));
- return result;
-}
-
-void Cluster::deliver(
- cpg_handle_t /*handle*/,
- cpg_name* /*group*/,
- uint32_t nodeid,
- uint32_t pid,
- void* msg,
- int msg_len)
-{
- try {
- Id from(nodeid, pid);
- Buffer buf(static_cast<char*>(msg), msg_len);
- AMQFrame frame;
- frame.decode(buf);
- QPID_LOG(trace, *this << " RECV: " << frame << " from: " << from);
- if (frame.getChannel() == 0)
- handleClusterFrame(from, frame);
- else if (from == self) {
- FrameHandler* next;
- buf.getRawData((uint8_t*)&next, sizeof(next));
- next->handle(frame);
- }
- // FIXME aconway 2008-01-30: apply frames from foreign sessions.
- }
- catch (const std::exception& e) {
- // FIXME aconway 2008-01-30: exception handling.
- QPID_LOG(error, "Error handling frame from cluster " << e.what());
- }
-}
-
-bool Cluster::wait(boost::function<bool(const Cluster&)> predicate,
- Duration timeout) const
-{
- AbsTime deadline(now(), timeout);
- Mutex::ScopedLock l(lock);
- while (!predicate(*this) && lock.wait(deadline))
- ;
- return (predicate(*this));
-}
-
-// Handle cluster control frame from the null session.
-void Cluster::handleClusterFrame(Id from, AMQFrame& frame) {
- // TODO aconway 2007-06-20: use visitor pattern here.
- ClusterNotifyBody* notifyIn=
- dynamic_cast<ClusterNotifyBody*>(frame.getBody());
- assert(notifyIn);
- MemberList list;
- {
- Mutex::ScopedLock l(lock);
- members[from].url=notifyIn->getUrl();
- if (!self.id && notifyIn->getUrl() == url.str())
- self=from;
- lock.notifyAll();
- QPID_LOG(trace, *this << ": members joined: " << members);
- }
-}
-
-void Cluster::configChange(
- cpg_handle_t /*handle*/,
- cpg_name */*group*/,
- cpg_address */*current*/, int /*nCurrent*/,
- cpg_address *left, int nLeft,
- cpg_address *joined, int nJoined)
-{
- bool newMembers=false;
- MemberList updated;
- {
- Mutex::ScopedLock l(lock);
- if (nLeft) {
- for (int i = 0; i < nLeft; ++i)
- members.erase(Id(left[i]));
- QPID_LOG(trace, *this << ": members left: " << members);
- lock.notifyAll();
- }
- newMembers = nJoined > 1 || (nJoined==1 && Id(joined[0]) != self);
- // We don't record members joining here, we record them when
- // we get their ClusterNotify message.
- }
- if (newMembers) // Notify new members of my presence.
- notify();
-}
-
-void Cluster::run() {
- cpg.dispatchBlocking();
-}
-
-}} // namespace qpid::cluster
-
-
-
diff --git a/qpid/cpp/src/qpid/cluster/Cluster.h b/qpid/cpp/src/qpid/cluster/Cluster.h
deleted file mode 100644
index 733db8003d..0000000000
--- a/qpid/cpp/src/qpid/cluster/Cluster.h
+++ /dev/null
@@ -1,130 +0,0 @@
-#ifndef QPID_CLUSTER_CLUSTER_H
-#define QPID_CLUSTER_CLUSTER_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Cpg.h"
-
-#include "qpid/broker/Broker.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/log/Logger.h"
-#include "qpid/Url.h"
-
-
-#include <boost/optional.hpp>
-#include <boost/function.hpp>
-
-#include <map>
-#include <vector>
-
-namespace qpid { namespace cluster {
-
-/**
- * Connection to the cluster.
- * Keeps cluster membership data.
- */
-class Cluster : private sys::Runnable, private Cpg::Handler
-{
- public:
- /** Details of a cluster member */
- struct Member {
- Member(const Url& url_=Url()) : url(url_) {}
- Url url; ///< Broker address.
- };
-
- typedef std::vector<Member> MemberList;
-
- /**
- * Join a cluster.
- * @param name of the cluster.
- * @param url of this broker, sent to the cluster.
- */
- Cluster(const std::string& name, const Url& url, broker::Broker&);
-
- virtual ~Cluster();
-
- // FIXME aconway 2008-01-29:
- intrusive_ptr<broker::PreviewSessionManager::Observer> getObserver() { return observer; }
-
- /** Get the current cluster membership. */
- MemberList getMembers() const;
-
- /** Number of members in the cluster. */
- size_t size() const;
-
- bool empty() const { return size() == 0; }
-
- /** Wait for predicate(*this) to be true, up to timeout.
- *@return True if predicate became true, false if timed out.
- *Note the predicate may not be true after wait returns,
- *all the caller can say is it was true at some earlier point.
- */
- bool wait(boost::function<bool(const Cluster&)> predicate,
- sys::Duration timeout=sys::TIME_INFINITE) const;
-
- /** Send frame to the cluster */
- void send(framing::AMQFrame&, framing::FrameHandler*);
-
- private:
- typedef Cpg::Id Id;
- typedef std::map<Id, Member> MemberMap;
-
- void notify(); ///< Notify cluster of my details.
-
- void deliver(
- cpg_handle_t /*handle*/,
- struct cpg_name *group,
- uint32_t /*nodeid*/,
- uint32_t /*pid*/,
- void* /*msg*/,
- int /*msg_len*/);
-
- void configChange(
- cpg_handle_t /*handle*/,
- struct cpg_name */*group*/,
- struct cpg_address */*members*/, int /*nMembers*/,
- struct cpg_address */*left*/, int /*nLeft*/,
- struct cpg_address */*joined*/, int /*nJoined*/
- );
-
- void run();
- void handleClusterFrame(Id from, framing::AMQFrame&);
-
- mutable sys::Monitor lock;
- Cpg cpg;
- Cpg::Name name;
- Url url;
- Id self;
- MemberMap members;
- sys::Thread dispatcher;
- boost::function<void()> callback;
- intrusive_ptr<broker::PreviewSessionManager::Observer> observer;
-
- friend std::ostream& operator <<(std::ostream&, const Cluster&);
- friend std::ostream& operator <<(std::ostream&, const MemberMap::value_type&);
- friend std::ostream& operator <<(std::ostream&, const MemberMap&);
-};
-
-}} // namespace qpid::cluster
-
-
-
-#endif /*!QPID_CLUSTER_CLUSTER_H*/
diff --git a/qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp b/qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp
deleted file mode 100644
index 0ea3953175..0000000000
--- a/qpid/cpp/src/qpid/cluster/ClusterPlugin.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include <boost/program_options/value_semantic.hpp>
-
-
-
-#include "qpid/broker/Broker.h"
-#include "qpid/cluster/Cluster.h"
-#include "qpid/Plugin.h"
-#include "qpid/Options.h"
-#include "qpid/shared_ptr.h"
-
-#include <boost/optional.hpp>
-#include <boost/utility/in_place_factory.hpp>
-
-
-namespace qpid {
-namespace cluster {
-
-using namespace std;
-
-struct ClusterOptions : public Options {
- string name;
- string url;
-
- ClusterOptions() : Options("Cluster Options") {
- addOptions()
- ("cluster-name", optValue(name, "NAME"), "Name of cluster to join")
- ("cluster-url", optValue(url,"URL"),
- "URL of this broker, advertized to the cluster.\n"
- "Defaults to a URL listing all the local IP addresses\n");
- }
-
- Url getUrl(uint16_t port) const {
- if (url.empty()) return Url::getIpAddressesUrl(port);
- return Url(url);
- }
-};
-
-struct ClusterPlugin : public Plugin {
-
- ClusterOptions options;
- boost::optional<Cluster> cluster;
-
- Options* getOptions() { return &options; }
-
- void earlyInitialize(Plugin::Target&) {}
-
- void initialize(Plugin::Target& target) {
- broker::Broker* broker = dynamic_cast<broker::Broker*>(&target);
- // Only provide to a Broker, and only if the --cluster config is set.
- if (broker && !options.name.empty()) {
- assert(!cluster); // A process can only belong to one cluster.
- cluster = boost::in_place(options.name,
- options.getUrl(broker->getPort()),
- boost::ref(*broker));
- broker->getPreviewSessionManager().add(cluster->getObserver());
- }
- }
-};
-
-static ClusterPlugin instance; // Static initialization.
-
-}} // namespace qpid::cluster
diff --git a/qpid/cpp/src/qpid/cluster/Cpg.cpp b/qpid/cpp/src/qpid/cluster/Cpg.cpp
deleted file mode 100644
index 01d97d2a17..0000000000
--- a/qpid/cpp/src/qpid/cluster/Cpg.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Cpg.h"
-
-#include "qpid/sys/Mutex.h"
-#include "qpid/log/Statement.h"
-
-#include <vector>
-#include <limits>
-#include <iterator>
-
-#include <unistd.h>
-
-namespace qpid {
-namespace cluster {
-
-using namespace std;
-
-// Global vector of Cpg pointers by handle.
-// TODO aconway 2007-06-12: Replace this with cpg_get/set_context,
-// coming in in RHEL 5.1.
-class Cpg::Handles
-{
- public:
- void put(cpg_handle_t handle, Cpg::Handler* handler) {
- sys::Mutex::ScopedLock l(lock);
- uint32_t index=uint32_t(handle); // Lower 32 bits is an array index.
- if (index >= handles.size())
- handles.resize(index+1, 0);
- handles[index] = handler;
- }
-
- Cpg::Handler* get(cpg_handle_t handle) {
- sys::Mutex::ScopedLock l(lock);
- uint32_t index=uint32_t(handle); // Lower 32 bits is an array index.
- assert(index < handles.size());
- assert(handles[index]);
- return handles[index];
- }
-
- private:
- sys::Mutex lock;
- vector<Cpg::Handler*> handles;
-};
-
-Cpg::Handles Cpg::handles;
-
-// Global callback functions call per-object callbacks via handles vector.
-void Cpg::globalDeliver (
- cpg_handle_t handle,
- struct cpg_name *group,
- uint32_t nodeid,
- uint32_t pid,
- void* msg,
- int msg_len)
-{
- Cpg::Handler* handler=handles.get(handle);
- if (handler)
- handler->deliver(handle, group, nodeid, pid, msg, msg_len);
-}
-
-void Cpg::globalConfigChange(
- cpg_handle_t handle,
- struct cpg_name *group,
- struct cpg_address *members, int nMembers,
- struct cpg_address *left, int nLeft,
- struct cpg_address *joined, int nJoined
-)
-{
- Cpg::Handler* handler=handles.get(handle);
- if (handler)
- handler->configChange(handle, group, members, nMembers, left, nLeft, joined, nJoined);
-}
-
-Cpg::Cpg(Handler& h) : handler(h) {
- cpg_callbacks_t callbacks = { &globalDeliver, &globalConfigChange };
- check(cpg_initialize(&handle, &callbacks), "Cannot initialize CPG");
- handles.put(handle, &handler);
- QPID_LOG(debug, "Initialize CPG handle " << handle);
-}
-
-Cpg::~Cpg() {
- try {
- shutdown();
- } catch (const std::exception& e) {
- QPID_LOG(error, "Exception in Cpg destructor: " << e.what());
- }
-}
-
-void Cpg::shutdown() {
- QPID_LOG(debug, "Shutdown CPG handle " << handle);
- if (handles.get(handle)) {
- QPID_LOG(debug, "Finalize CPG handle " << handle);
- handles.put(handle, 0);
- check(cpg_finalize(handle), "Error in shutdown of CPG");
- }
-}
-
-string Cpg::errorStr(cpg_error_t err, const std::string& msg) {
- switch (err) {
- case CPG_OK: return msg+": ok";
- case CPG_ERR_LIBRARY: return msg+": library";
- case CPG_ERR_TIMEOUT: return msg+": timeout";
- case CPG_ERR_TRY_AGAIN: return msg+": timeout. The aisexec daemon may not be running";
- case CPG_ERR_INVALID_PARAM: return msg+": invalid param";
- case CPG_ERR_NO_MEMORY: return msg+": no memory";
- case CPG_ERR_BAD_HANDLE: return msg+": bad handle";
- case CPG_ERR_ACCESS: return msg+": access denied. You may need to set your group ID to 'ais'";
- case CPG_ERR_NOT_EXIST: return msg+": not exist";
- case CPG_ERR_EXIST: return msg+": exist";
- case CPG_ERR_NOT_SUPPORTED: return msg+": not supported";
- case CPG_ERR_SECURITY: return msg+": security";
- case CPG_ERR_TOO_MANY_GROUPS: return msg+": too many groups";
- default:
- assert(0);
- return ": unknown";
- };
-}
-
-std::string Cpg::cantJoinMsg(const Name& group) {
- return "Cannot join CPG group "+group.str();
-}
-
-std::string Cpg::cantLeaveMsg(const Name& group) {
- return "Cannot leave CPG group "+group.str();
-}
-
-std::string Cpg::cantMcastMsg(const Name& group) {
- return "Cannot mcast to CPG group "+group.str();
-}
-
-ostream& operator<<(ostream& o, std::pair<cpg_address*,int> a) {
- ostream_iterator<Cpg::Id> i(o, " ");
- std::copy(a.first, a.first+a.second, i);
- return o;
-}
-
-static int popbyte(uint32_t& n) {
- uint8_t b=n&0xff;
- n>>=8;
- return b;
-}
-
-ostream& operator <<(ostream& out, const Cpg::Id& id) {
- uint32_t node=id.nodeId();
- out << popbyte(node);
- for (int i = 0; i < 3; i++)
- out << "." << popbyte(node);
- return out << ":" << id.pid();
-}
-
-ostream& operator <<(ostream& out, const cpg_name& name) {
- return out << string(name.value, name.length);
-}
-
-
-}} // namespace qpid::cluster
-
-
-
diff --git a/qpid/cpp/src/qpid/cluster/Cpg.h b/qpid/cpp/src/qpid/cluster/Cpg.h
deleted file mode 100644
index 09b6996cc0..0000000000
--- a/qpid/cpp/src/qpid/cluster/Cpg.h
+++ /dev/null
@@ -1,184 +0,0 @@
-#ifndef CPG_H
-#define CPG_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include "qpid/cluster/Dispatchable.h"
-
-#include <cassert>
-
-extern "C" {
-#include <openais/cpg.h>
-}
-
-namespace qpid {
-namespace cluster {
-
-/**
- * Lightweight C++ interface to cpg.h operations.
- * Manages a single CPG handle, initialized in ctor, finialzed in destructor.
- * On error all functions throw Cpg::Exception
- */
-class Cpg : public Dispatchable {
- public:
- struct Exception : public ::qpid::Exception {
- Exception(const std::string& msg) : ::qpid::Exception(msg) {}
- };
-
- struct Name : public cpg_name {
- Name(const char* s) { copy(s, strlen(s)); }
- Name(const char* s, size_t n) { copy(s,n); }
- Name(const std::string& s) { copy(s.data(), s.size()); }
- void copy(const char* s, size_t n) {
- assert(n < CPG_MAX_NAME_LENGTH);
- memcpy(value, s, n);
- length=n;
- }
-
- std::string str() const { return std::string(value, length); }
- };
-
- struct Id {
- uint64_t id;
- Id(uint64_t n=0) : id(n) {}
- Id(uint32_t nodeid, uint32_t pid) { id=(uint64_t(nodeid)<<32)+ pid; }
- Id(const cpg_address& addr) : id(Id(addr.nodeid, addr.pid)) {}
-
- operator uint64_t() const { return id; }
- uint32_t nodeId() const { return id >> 32; }
- pid_t pid() const { return id & 0xFFFF; }
- };
-
- static std::string str(const cpg_name& n) {
- return std::string(n.value, n.length);
- }
-
- struct Handler {
- virtual ~Handler() {};
- virtual void deliver(
- cpg_handle_t /*handle*/,
- struct cpg_name *group,
- uint32_t /*nodeid*/,
- uint32_t /*pid*/,
- void* /*msg*/,
- int /*msg_len*/) = 0;
-
- virtual void configChange(
- cpg_handle_t /*handle*/,
- struct cpg_name */*group*/,
- struct cpg_address */*members*/, int /*nMembers*/,
- struct cpg_address */*left*/, int /*nLeft*/,
- struct cpg_address */*joined*/, int /*nJoined*/
- ) = 0;
- };
-
- /** Open a CPG handle.
- *@param handler for CPG events.
- */
- Cpg(Handler&);
-
- /** Destructor calls shutdown. */
- ~Cpg();
-
- /** Disconnect from CPG */
- void shutdown();
-
- /** Dispatch CPG events.
- *@param type one of
- * - CPG_DISPATCH_ONE - dispatch exactly one event.
- * - CPG_DISPATCH_ALL - dispatch all available events, don't wait.
- * - CPG_DISPATCH_BLOCKING - blocking dispatch loop.
- */
- void dispatch(cpg_dispatch_t type) {
- check(cpg_dispatch(handle,type), "Error in CPG dispatch");
- }
-
- void dispatchOne() { dispatch(CPG_DISPATCH_ONE); }
- void dispatchAll() { dispatch(CPG_DISPATCH_ALL); }
- void dispatchBlocking() { dispatch(CPG_DISPATCH_BLOCKING); }
-
- void join(const Name& group) {
- check(cpg_join(handle, const_cast<Name*>(&group)),cantJoinMsg(group));
- };
-
- void leave(const Name& group) {
- check(cpg_leave(handle,const_cast<Name*>(&group)),cantLeaveMsg(group));
- }
-
- void mcast(const Name& group, const iovec* iov, int iovLen) {
- check(cpg_mcast_joined(
- handle, CPG_TYPE_AGREED, const_cast<iovec*>(iov), iovLen),
- cantMcastMsg(group));
- }
-
- cpg_handle_t getHandle() const { return handle; }
-
- private:
- class Handles;
- struct ClearHandleOnExit;
- friend class Handles;
- friend struct ClearHandleOnExit;
-
- static std::string errorStr(cpg_error_t err, const std::string& msg);
- static std::string cantJoinMsg(const Name&);
- static std::string cantLeaveMsg(const Name&);
- static std::string cantMcastMsg(const Name&);
-
- static void check(cpg_error_t result, const std::string& msg) {
- // TODO aconway 2007-06-01: Logging and exceptions.
- if (result != CPG_OK)
- throw Exception(errorStr(result, msg));
- }
-
- static void globalDeliver(
- cpg_handle_t /*handle*/,
- struct cpg_name *group,
- uint32_t /*nodeid*/,
- uint32_t /*pid*/,
- void* /*msg*/,
- int /*msg_len*/);
-
- static void globalConfigChange(
- cpg_handle_t /*handle*/,
- struct cpg_name */*group*/,
- struct cpg_address */*members*/, int /*nMembers*/,
- struct cpg_address */*left*/, int /*nLeft*/,
- struct cpg_address */*joined*/, int /*nJoined*/
- );
-
- static Handles handles;
- cpg_handle_t handle;
- Handler& handler;
-};
-
-std::ostream& operator <<(std::ostream& out, const cpg_name& name);
-std::ostream& operator <<(std::ostream& out, const Cpg::Id& id);
-std::ostream& operator <<(std::ostream& out, const std::pair<cpg_address*,int> addresses);
-
-inline bool operator==(const cpg_name& a, const cpg_name& b) {
- return a.length==b.length && strncmp(a.value, b.value, a.length) == 0;
-}
-inline bool operator!=(const cpg_name& a, const cpg_name& b) { return !(a == b); }
-
-}} // namespace qpid::cluster
-
-
-
-#endif /*!CPG_H*/
diff --git a/qpid/cpp/src/qpid/cluster/Dispatchable.h b/qpid/cpp/src/qpid/cluster/Dispatchable.h
deleted file mode 100644
index e7f0df4218..0000000000
--- a/qpid/cpp/src/qpid/cluster/Dispatchable.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef QPID_CLUSTER_DISPATCHABLE_H
-#define QPID_CLUSTER_DISPATCHABLE_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace qpid {
-namespace cluster {
-
-/**
- * Interface for classes that have some "events" that need dispatching
- * in a thread.
- */
-class Dispatchable
-{
- public:
- virtual ~Dispatchable() {}
-
- /** Dispatch one event in current thread. */
- virtual void dispatchOne() = 0;
- /** Dispatch all available events, don't block. */
- virtual void dispatchAll() = 0;
- /** Blocking loop to dispatch cluster events */
- virtual void dispatchBlocking() = 0;
-
- /** Wait for at least one event, then dispatch all available events.
- * Don't block. Useful for tests.
- */
- virtual void dispatchSome() { dispatchOne(); dispatchAll(); }
-
-};
-
-}} // namespace qpid::cluster
-
-
-
-#endif /*!QPID_CLUSTER_DISPATCHABLE_H*/
diff --git a/qpid/cpp/src/qpid/doxygen_mainpage.h b/qpid/cpp/src/qpid/doxygen_mainpage.h
deleted file mode 100644
index b354238cd0..0000000000
--- a/qpid/cpp/src/qpid/doxygen_mainpage.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// This header file is just for doxygen documentation purposes.
-
-/*!\mainpage Qpid C++ Developer Kit.
- *
- *\section intro_sec Introduction
- *
- * The <a href=http://incubator.apache.org/qpid/index.html>Qpid project</a> provides implementations of the <a href="http://amqp.org/">AMQP messaging specification</a> in several programming language.
- *
- * Qpidc provides APIs and libraries to implement AMQP
- * clients in C++. Qpidc clients can interact with any compliant AMQP
- * message broker. The Qpid project also provides an AMQP broker
- * daemon called qpidd that you can use with your qpidc clients.
- *
- *\section install_sec Installation
- *
- * If you are installing from the source distribution
- <pre>
- > ./configure && make
- > make install </pre>
- * This will build and install the client development kit and the broker
- * in standard places. Use
- * <code>./configure --help</code> for more options.
- *
- * You can also install from RPMs with the <code>rpm -i</code> command.
- * You will need
- * - <code>qpidc</code> for core libraries.
- * - <code>qpidc-devel</code> for header files and developer documentation.
- * - <code>qpidd</code> for the broker daemon.
- *
- *\section getstart_sec Getting Started
- *
- * If you have installed in the standard places you should use
- * these compile flags:
- *
- *<code> -I/usr/include/qpidc -I/usr/include/qpidc/framing -I/usr/include/qpidc/sys</code>
- *
- * and these link flags:
- *
- *<code> -lqpidcommon -lqpidclient</code>
- *
- * If you have installed somewhere else you should modify the flags
- * appropriately.
- *
- * See the \ref clientapi "client API module" for more on the client API.
- */
diff --git a/qpid/cpp/src/qpid/framing/AMQBody.cpp b/qpid/cpp/src/qpid/framing/AMQBody.cpp
deleted file mode 100644
index b3eeae0615..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQBody.cpp
+++ /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.
- *
- */
-
-#include "qpid/framing/AMQBody.h"
-#include "qpid/framing/AMQMethodBody.h"
-#include "qpid/framing/AMQHeaderBody.h"
-#include "qpid/framing/AMQContentBody.h"
-#include "qpid/framing/AMQHeartbeatBody.h"
-#include <iostream>
-
-namespace qpid {
-namespace framing {
-
-std::ostream& operator<<(std::ostream& out, const AMQBody& body)
-{
- body.print(out);
- return out;
-}
-
-AMQBody::~AMQBody() {}
-
-namespace {
-struct MatchBodies : public AMQBodyConstVisitor {
- const AMQBody& body;
- bool match;
-
- MatchBodies(const AMQBody& b) : body(b), match(false) {}
- virtual ~MatchBodies() {}
-
- virtual void visit(const AMQHeaderBody&) { match=dynamic_cast<const AMQHeaderBody*>(&body); }
- virtual void visit(const AMQContentBody&) { match=dynamic_cast<const AMQContentBody*>(&body); }
- virtual void visit(const AMQHeartbeatBody&) { match=dynamic_cast<const AMQHeartbeatBody*>(&body); }
- virtual void visit(const AMQMethodBody& x) {
- const AMQMethodBody* y=dynamic_cast<const AMQMethodBody*>(&body);
- match = (y && y->amqpMethodId() == x.amqpMethodId() && y->amqpClassId() == x.amqpClassId());
- }
-};
-
-}
-bool AMQBody::match(const AMQBody& a, const AMQBody& b) {
- MatchBodies matcher(a);
- b.accept(matcher);
- return matcher.match;
-}
-
-}} // namespace
diff --git a/qpid/cpp/src/qpid/framing/AMQBody.h b/qpid/cpp/src/qpid/framing/AMQBody.h
deleted file mode 100644
index f3bf65470c..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQBody.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef QPID_FRAMING_AMQBODY_H
-#define QPID_FRAMING_AMQBODY_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/framing/amqp_types.h"
-
-#include <ostream>
-
-namespace qpid {
-namespace framing {
-
-class Buffer;
-
-class AMQMethodBody;
-class AMQHeaderBody;
-class AMQContentBody;
-class AMQHeartbeatBody;
-
-struct AMQBodyConstVisitor {
- virtual ~AMQBodyConstVisitor() {}
- virtual void visit(const AMQHeaderBody&) = 0;
- virtual void visit(const AMQContentBody&) = 0;
- virtual void visit(const AMQHeartbeatBody&) = 0;
- virtual void visit(const AMQMethodBody&) = 0;
-};
-
-class AMQBody
-{
- public:
- virtual ~AMQBody();
-
- virtual uint8_t type() const = 0;
-
- virtual void encode(Buffer& buffer) const = 0;
- virtual void decode(Buffer& buffer, uint32_t=0) = 0;
- virtual uint32_t size() const = 0;
-
- virtual void print(std::ostream& out) const = 0;
- virtual void accept(AMQBodyConstVisitor&) const = 0;
-
- virtual AMQMethodBody* getMethod() { return 0; }
- virtual const AMQMethodBody* getMethod() const { return 0; }
-
- /** Match if same type and same class/method ID for methods */
- static bool match(const AMQBody& , const AMQBody& );
-};
-
-std::ostream& operator<<(std::ostream& out, const AMQBody& body) ;
-
-enum BodyTypes {
- METHOD_BODY = 1,
- HEADER_BODY = 2,
- CONTENT_BODY = 3,
- HEARTBEAT_BODY = 8
-};
-
-}} // namespace qpid::framing
-
-#endif /*!QPID_FRAMING_AMQBODY_H*/
diff --git a/qpid/cpp/src/qpid/framing/AMQContentBody.cpp b/qpid/cpp/src/qpid/framing/AMQContentBody.cpp
deleted file mode 100644
index 59f3619ef2..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQContentBody.cpp
+++ /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.
- *
- */
-#include "AMQContentBody.h"
-#include <iostream>
-
-qpid::framing::AMQContentBody::AMQContentBody(){
-}
-
-qpid::framing::AMQContentBody::AMQContentBody(const string& _data) : data(_data){
-}
-
-uint32_t qpid::framing::AMQContentBody::size() const{
- return data.size();
-}
-void qpid::framing::AMQContentBody::encode(Buffer& buffer) const{
- buffer.putRawData(data);
-}
-void qpid::framing::AMQContentBody::decode(Buffer& buffer, uint32_t _size){
- buffer.getRawData(data, _size);
-}
-
-void qpid::framing::AMQContentBody::print(std::ostream& out) const
-{
- out << "content (" << size() << " bytes)";
- out << " " << data.substr(0,16) << "...";
-}
diff --git a/qpid/cpp/src/qpid/framing/AMQContentBody.h b/qpid/cpp/src/qpid/framing/AMQContentBody.h
deleted file mode 100644
index 5d530a1b9a..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQContentBody.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "amqp_types.h"
-#include "AMQBody.h"
-#include "Buffer.h"
-
-#ifndef _AMQContentBody_
-#define _AMQContentBody_
-
-namespace qpid {
-namespace framing {
-
-class AMQContentBody : public AMQBody
-{
- string data;
-
-public:
- AMQContentBody();
- AMQContentBody(const string& data);
- inline virtual ~AMQContentBody(){}
- inline uint8_t type() const { return CONTENT_BODY; };
- inline const string& getData() const { return data; }
- inline string& getData() { return data; }
- uint32_t size() const;
- void encode(Buffer& buffer) const;
- void decode(Buffer& buffer, uint32_t size);
- void print(std::ostream& out) const;
- void accept(AMQBodyConstVisitor& v) const { v.visit(*this); }
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/AMQDataBlock.h b/qpid/cpp/src/qpid/framing/AMQDataBlock.h
deleted file mode 100644
index 9b6fdfd966..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQDataBlock.h
+++ /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.
- *
- */
-#include "Buffer.h"
-
-#ifndef _AMQDataBlock_
-#define _AMQDataBlock_
-
-namespace qpid {
-namespace framing {
-
-class AMQDataBlock
-{
-public:
- virtual ~AMQDataBlock() {}
- virtual void encode(Buffer& buffer) const = 0;
- virtual bool decode(Buffer& buffer) = 0;
- virtual uint32_t size() const = 0;
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/AMQFrame.cpp b/qpid/cpp/src/qpid/framing/AMQFrame.cpp
deleted file mode 100644
index 3750f4a9a8..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQFrame.cpp
+++ /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.
- *
- */
-#include "AMQFrame.h"
-
-#include "qpid/framing/variant.h"
-#include "qpid/framing/AMQMethodBody.h"
-#include "qpid/framing/reply_exceptions.h"
-
-#include <boost/format.hpp>
-
-#include <iostream>
-
-namespace qpid {
-namespace framing {
-
-AMQFrame::~AMQFrame() {}
-
-void AMQFrame::setBody(const AMQBody& b) { body = new BodyHolder(b); }
-
-void AMQFrame::setMethod(ClassId c, MethodId m) { body = new BodyHolder(c,m); }
-
-// This is now misleadingly named as it is not the frame size as
-// defined in the spec (as it also includes the end marker)
-uint32_t AMQFrame::size() const {
- return frameOverhead() + body->size();
-}
-
-uint32_t AMQFrame::frameOverhead() {
- return 12 /*frame header*/ + 1/*0xCE*/;
-}
-
-void AMQFrame::encode(Buffer& buffer) const
-{
- uint8_t flags = (bof ? 0x08 : 0) | (eof ? 0x04 : 0) | (bos ? 0x02 : 0) | (eos ? 0x01 : 0);
- buffer.putOctet(flags);
- buffer.putOctet(getBody()->type());
- buffer.putShort(size() - 1); // Don't include end marker (it's not part of the frame itself)
- buffer.putOctet(0);
- buffer.putOctet(0x0f & subchannel);
- buffer.putShort(channel);
- buffer.putLong(0);
- body->encode(buffer);
- buffer.putOctet(0xCE);
-}
-
-bool AMQFrame::decode(Buffer& buffer)
-{
- if(buffer.available() < frameOverhead() - 1)
- return false;
- buffer.record();
-
- uint8_t flags = buffer.getOctet();
- uint8_t framing_version = (flags & 0xc0) >> 6;
- if (framing_version != 0)
- throw SyntaxErrorException(QPID_MSG("Framing version unsupported"));
- bof = flags & 0x08;
- eof = flags & 0x04;
- bos = flags & 0x02;
- eos = flags & 0x01;
- uint8_t type = buffer.getOctet();
- uint16_t frame_size = buffer.getShort();
- if (frame_size < frameOverhead()-1)
- throw SyntaxErrorException(QPID_MSG("Frame size too small"));
- uint8_t reserved1 = buffer.getOctet();
- uint8_t field1 = buffer.getOctet();
- subchannel = field1 & 0x0f;
- channel = buffer.getShort();
- (void) buffer.getLong(); // reserved2
-
- // Verify that the protocol header meets current spec
- // TODO: should we check reserved2 against zero as well? - the
- // spec isn't clear
- if ((flags & 0x30) != 0 || reserved1 != 0 || (field1 & 0xf0) != 0)
- throw SyntaxErrorException(QPID_MSG("Reserved bits not zero"));
-
- // TODO: should no longer care about body size and only pass up
- // B,E,b,e flags
- uint16_t body_size = frame_size + 1 - frameOverhead();
- if (buffer.available() < body_size+1u){
- buffer.restore();
- return false;
- }
- body = new BodyHolder();
- body->decode(type,buffer, body_size);
- uint8_t end = buffer.getOctet();
- if (end != 0xCE)
- throw SyntaxErrorException(QPID_MSG("Frame end not found"));
- return true;
-}
-
-std::ostream& operator<<(std::ostream& out, const AMQFrame& f)
-{
- return
- out << "Frame["
- << (f.getBof() ? "B" : "") << (f.getEof() ? "E" : "")
- << (f.getBos() ? "b" : "") << (f.getEos() ? "e" : "") << "; "
- << "channel=" << f.getChannel() << "; " << *f.getBody()
- << "]";
-}
-
-
-}} // namespace qpid::framing
diff --git a/qpid/cpp/src/qpid/framing/AMQFrame.h b/qpid/cpp/src/qpid/framing/AMQFrame.h
deleted file mode 100644
index 1c65988b3d..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQFrame.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef _AMQFrame_
-#define _AMQFrame_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "AMQDataBlock.h"
-#include "AMQHeaderBody.h"
-#include "AMQContentBody.h"
-#include "AMQHeartbeatBody.h"
-#include "ProtocolVersion.h"
-#include "BodyHolder.h"
-
-#include <boost/cast.hpp>
-
-namespace qpid {
-namespace framing {
-
-class BodyHolder;
-
-class AMQFrame : public AMQDataBlock
-{
- public:
- AMQFrame(intrusive_ptr<BodyHolder> b=0) : body(b) { init(); }
- AMQFrame(const AMQBody& b) { setBody(b); init(); }
- ~AMQFrame();
-
- template <class InPlace>
- AMQFrame(const InPlace& ip, typename EnableInPlace<InPlace>::type* =0) {
- init(); setBody(ip);
- }
-
- ChannelId getChannel() const { return channel; }
- void setChannel(ChannelId c) { channel = c; }
-
- intrusive_ptr<BodyHolder> getHolder() { return body; }
-
- AMQBody* getBody() { return body ? body->get() : 0; }
- const AMQBody* getBody() const { return body ? body->get() : 0; }
-
- AMQMethodBody* getMethod() { return getBody()->getMethod(); }
- const AMQMethodBody* getMethod() const { return getBody()->getMethod(); }
-
- void setBody(const AMQBody& b);
-
- template <class InPlace>
- typename EnableInPlace<InPlace>::type setBody(const InPlace& ip) {
- body = new BodyHolder(ip);
- }
-
- void setMethod(ClassId c, MethodId m);
-
- template <class T> T* castBody() {
- return boost::polymorphic_downcast<T*>(getBody());
- }
-
- template <class T> const T* castBody() const {
- return boost::polymorphic_downcast<const T*>(getBody());
- }
-
- void encode(Buffer& buffer) const;
- bool decode(Buffer& buffer);
- uint32_t size() const;
-
- bool getBof() const { return bof; }
- void setBof(bool isBof) { bof = isBof; }
- bool getEof() const { return eof; }
- void setEof(bool isEof) { eof = isEof; }
-
- bool getBos() const { return bos; }
- void setBos(bool isBos) { bos = isBos; }
- bool getEos() const { return eos; }
- void setEos(bool isEos) { eos = isEos; }
-
- static uint32_t frameOverhead();
-
- private:
- void init() { bof = eof = bos = eos = true; subchannel=0; channel=0; }
-
- intrusive_ptr<BodyHolder> body;
- uint16_t channel : 16;
- uint8_t subchannel : 8;
- bool bof : 1;
- bool eof : 1;
- bool bos : 1;
- bool eos : 1;
-};
-
-std::ostream& operator<<(std::ostream&, const AMQFrame&);
-
-}} // namespace qpid::framing
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/AMQHeaderBody.cpp b/qpid/cpp/src/qpid/framing/AMQHeaderBody.cpp
deleted file mode 100644
index 724c288705..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQHeaderBody.cpp
+++ /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.
- *
- */
-#include "AMQHeaderBody.h"
-#include "qpid/Exception.h"
-#include "qpid/log/Statement.h"
-
-uint32_t qpid::framing::AMQHeaderBody::size() const {
- return properties.size();
-}
-
-void qpid::framing::AMQHeaderBody::encode(Buffer& buffer) const {
- properties.encode(buffer);
-}
-
-void qpid::framing::AMQHeaderBody::decode(Buffer& buffer, uint32_t size) {
- uint32_t limit = buffer.available() - size;
- while (buffer.available() > limit + 2) {
- uint32_t len = buffer.getLong();
- uint16_t type = buffer.getShort();
- if (!properties.decode(buffer, len, type)) {
- // TODO: should just skip & keep for later dispatch.
- throw Exception(QPID_MSG("Unexpected property type: " << type));
- }
- }
-}
-
-uint64_t qpid::framing::AMQHeaderBody::getContentLength() const
-{
- const MessageProperties* mProps = get<MessageProperties>();
- if (mProps)
- return mProps->getContentLength();
- return 0;
-}
-
-void qpid::framing::AMQHeaderBody::print(std::ostream& out) const
-{
- out << "header (" << size() << " bytes)";
- out << "; properties={";
- properties.print(out);
- out << "}";
-}
-
-void qpid::framing::AMQHeaderBody::accept(AMQBodyConstVisitor& v) const {
- v.visit(*this);
-}
diff --git a/qpid/cpp/src/qpid/framing/AMQHeaderBody.h b/qpid/cpp/src/qpid/framing/AMQHeaderBody.h
deleted file mode 100644
index 96bd396330..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQHeaderBody.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef QPID_FRAMING_AMQHEADERBODY_H
-#define QPID_FRAMING_AMQHEADERBODY_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "amqp_types.h"
-#include "AMQBody.h"
-#include "Buffer.h"
-#include "qpid/framing/DeliveryProperties.h"
-#include "qpid/framing/MessageProperties.h"
-#include <iostream>
-
-#include <boost/optional.hpp>
-
-
-namespace qpid {
-namespace framing {
-
-enum DeliveryMode { TRANSIENT = 1, PERSISTENT = 2};
-
-class AMQHeaderBody : public AMQBody
-{
- template <class T> struct OptProps { boost::optional<T> props; };
- template <class Base, class T>
- struct PropSet : public Base, public OptProps<T> {
- uint32_t size() const {
- const boost::optional<T>& p=this->OptProps<T>::props;
- return (p ? p->size() : 0) + Base::size();
- }
- void encode(Buffer& buffer) const {
- const boost::optional<T>& p=this->OptProps<T>::props;
- if (p) p->encode(buffer);
- Base::encode(buffer);
- }
- bool decode(Buffer& buffer, uint32_t size, uint16_t type) {
- boost::optional<T>& p=this->OptProps<T>::props;
- if (type == T::TYPE) {
- p=T();
- p->decodeStructBody(buffer, size);
- return true;
- }
- else
- return Base::decode(buffer, size, type);
- }
- void print(std::ostream& out) const {
- const boost::optional<T>& p=this->OptProps<T>::props;
- if (p) out << *p;
- Base::print(out);
- }
- };
-
- struct Empty {
- uint32_t size() const { return 0; }
- void encode(Buffer&) const {};
- bool decode(Buffer&, uint32_t, uint16_t) const { return false; };
- void print(std::ostream&) const {}
- };
-
- // Could use boost::mpl::fold to construct a larger set.
- typedef PropSet<PropSet<Empty, DeliveryProperties>,
- MessageProperties> Properties;
-
- Properties properties;
-
-public:
-
- inline uint8_t type() const { return HEADER_BODY; }
-
- uint32_t size() const;
- void encode(Buffer& buffer) const;
- void decode(Buffer& buffer, uint32_t size);
- uint64_t getContentLength() const;
- void print(std::ostream& out) const;
- void accept(AMQBodyConstVisitor&) const;
-
- template <class T> T* get(bool create) {
- boost::optional<T>& p=properties.OptProps<T>::props;
- if (create && !p) p=T();
- return p.get_ptr();
- }
-
- template <class T> const T* get() const {
- return properties.OptProps<T>::props.get_ptr();
- }
-};
-
-}}
-
-
-
-#endif /*!QPID_FRAMING_AMQHEADERBODY_H*/
diff --git a/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.cpp b/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.cpp
deleted file mode 100644
index 140ce2e794..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.cpp
+++ /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.
- *
- */
-
-#include "AMQHeartbeatBody.h"
-#include <iostream>
-
-qpid::framing::AMQHeartbeatBody::~AMQHeartbeatBody() {}
-
-void qpid::framing::AMQHeartbeatBody::print(std::ostream& out) const {
- out << "heartbeat";
-}
diff --git a/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h b/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h
deleted file mode 100644
index a2701c3398..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h
+++ /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.
- *
- */
-#include "amqp_types.h"
-#include "AMQBody.h"
-#include "Buffer.h"
-
-#ifndef _AMQHeartbeatBody_
-#define _AMQHeartbeatBody_
-
-namespace qpid {
-namespace framing {
-
-class AMQHeartbeatBody : public AMQBody
-{
-public:
- virtual ~AMQHeartbeatBody();
- inline uint32_t size() const { return 0; }
- inline uint8_t type() const { return HEARTBEAT_BODY; }
- inline void encode(Buffer& ) const {}
- inline void decode(Buffer& , uint32_t /*size*/) {}
- virtual void print(std::ostream& out) const;
- void accept(AMQBodyConstVisitor& v) const { v.visit(*this); }
-};
-
-}
-}
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/AMQMethodBody.cpp b/qpid/cpp/src/qpid/framing/AMQMethodBody.cpp
deleted file mode 100644
index 924d906d43..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQMethodBody.cpp
+++ /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.
- *
- */
-#include "AMQMethodBody.h"
-
-namespace qpid {
-namespace framing {
-
-AMQMethodBody::~AMQMethodBody() {}
-
-}} // namespace qpid::framing
diff --git a/qpid/cpp/src/qpid/framing/AMQMethodBody.h b/qpid/cpp/src/qpid/framing/AMQMethodBody.h
deleted file mode 100644
index da28ee3aa9..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQMethodBody.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef _AMQMethodBody_
-#define _AMQMethodBody_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "amqp_types.h"
-#include "AMQBody.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/shared_ptr.h"
-
-#include <ostream>
-
-#include <assert.h>
-
-namespace qpid {
-namespace framing {
-
-class Buffer;
-class AMQP_ServerOperations;
-class MethodBodyConstVisitor;
-
-class AMQMethodBody : public AMQBody {
- public:
- AMQMethodBody() {}
- virtual ~AMQMethodBody();
-
- virtual void accept(MethodBodyConstVisitor&) const = 0;
-
- virtual MethodId amqpMethodId() const = 0;
- virtual ClassId amqpClassId() const = 0;
- virtual bool isContentBearing() const = 0;
- virtual bool resultExpected() const = 0;
- virtual bool responseExpected() const = 0;
-
- template <class T> bool isA() const {
- return amqpClassId()==T::CLASS_ID && amqpMethodId()==T::METHOD_ID;
- }
-
- virtual uint32_t size() const = 0;
- virtual uint8_t type() const { return METHOD_BODY; }
-
- virtual bool isSync() const { return false; /*only ModelMethods can have the sync flag set*/ }
- virtual void setSync(bool) const { /*only ModelMethods can have the sync flag set*/ }
-
- AMQMethodBody* getMethod() { return this; }
- const AMQMethodBody* getMethod() const { return this; }
- void accept(AMQBodyConstVisitor& v) const { v.visit(*this); }
-};
-
-
-}} // namespace qpid::framing
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/AMQP_HighestVersion.h b/qpid/cpp/src/qpid/framing/AMQP_HighestVersion.h
deleted file mode 100644
index b15e14d6f6..0000000000
--- a/qpid/cpp/src/qpid/framing/AMQP_HighestVersion.h
+++ /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.
- *
- */
-
-/*
- * This file used to be auto-generated by Qpid Gentools v.0.1
- * its here temporarily until we get a full solution to multi-version support
- */
-#ifndef qpid_framing_highestProtocolVersion__
-#define qpid_framing_highestProtocolVersion__
-
-#include "qpid/framing/ProtocolVersion.h"
-
-
-namespace qpid {
-namespace framing {
-
-static ProtocolVersion highestProtocolVersion(99, 0);
-//static ProtocolVersion highestProtocolVersion(0, 10);
-
-} /* namespace framing */
-} /* namespace qpid */
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/AccumulatedAck.cpp b/qpid/cpp/src/qpid/framing/AccumulatedAck.cpp
deleted file mode 100644
index bf53bf0cd6..0000000000
--- a/qpid/cpp/src/qpid/framing/AccumulatedAck.cpp
+++ /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.
- *
- */
-#include "AccumulatedAck.h"
-
-#include <assert.h>
-#include <iostream>
-#include <boost/bind.hpp>
-
-using std::list;
-using std::max;
-using std::min;
-using namespace qpid::framing;
-
-AccumulatedAck::AccumulatedAck(SequenceNumber r) : mark(r) {}
-
-void AccumulatedAck::update(SequenceNumber first, SequenceNumber last){
- assert(first <= last);
- if (last < mark) return;
-
-
- Range r(first, last);
- bool handled = false;
- bool markMerged = false;
- list<Range>::iterator merged = ranges.end();
- if (r.mergeable(mark)) {
- mark = r.end;
- markMerged = true;
- handled = true;
- } else {
- for (list<Range>::iterator i = ranges.begin(); i != ranges.end() && !handled; i++) {
- if (i->merge(r)) {
- merged = i;
- handled = true;
- } else if (r.start < i->start) {
- ranges.insert(i, r);
- handled = true;
- }
- }
- }
- if (!handled) {
- ranges.push_back(r);
- } else {
- while (!ranges.empty() && ranges.front().end <= mark) {
- ranges.pop_front();
- }
- if (markMerged) {
- //new range is incorporated, but may be possible to consolidate
- merged = ranges.begin();
- while (merged != ranges.end() && merged->mergeable(mark)) {
- mark = merged->end;
- merged = ranges.erase(merged);
- }
- }
- if (merged != ranges.end()) {
- //consolidate ranges
- list<Range>::iterator i = merged;
- list<Range>::iterator j = i++;
- while (i != ranges.end() && j->merge(*i)) {
- j = i++;
- }
- }
- }
-}
-
-void AccumulatedAck::consolidate(){}
-
-void AccumulatedAck::clear(){
- mark = 0;//not sure that this is valid when wraparound is a possibility
- ranges.clear();
-}
-
-bool AccumulatedAck::covers(SequenceNumber tag) const{
- if (tag <= mark) return true;
- for (list<Range>::const_iterator i = ranges.begin(); i != ranges.end(); i++) {
- if (i->contains(tag)) return true;
- }
- return false;
-}
-
-void AccumulatedAck::collectRanges(SequenceNumberSet& set) const
-{
- for (list<Range>::const_iterator i = ranges.begin(); i != ranges.end(); i++) {
- set.push_back(i->start);
- set.push_back(i->end);
- }
-}
-
-void AccumulatedAck::update(const SequenceNumber cumulative, const SequenceNumberSet& range)
-{
- update(mark, cumulative);
- range.processRanges(*this);
-}
-
-
-bool Range::contains(SequenceNumber i) const
-{
- return i >= start && i <= end;
-}
-
-bool Range::intersect(const Range& r) const
-{
- return r.contains(start) || r.contains(end) || contains(r.start) || contains(r.end);
-}
-
-bool Range::merge(const Range& r)
-{
- if (intersect(r) || mergeable(r.end) || r.mergeable(end)) {
- start = min(start, r.start);
- end = max(end, r.end);
- return true;
- } else {
- return false;
- }
-}
-
-bool Range::mergeable(const SequenceNumber& s) const
-{
- if (contains(s) || start - s == 1) {
- return true;
- } else {
- return false;
- }
-}
-
-Range::Range(SequenceNumber s, SequenceNumber e) : start(s), end(e) {}
-
-
-namespace qpid{
-namespace framing{
- std::ostream& operator<<(std::ostream& out, const Range& r)
- {
- out << "[" << r.start.getValue() << "-" << r.end.getValue() << "]";
- return out;
- }
-
- std::ostream& operator<<(std::ostream& out, const AccumulatedAck& a)
- {
- out << "{mark: " << a.mark.getValue() << ", ranges: (";
- for (list<Range>::const_iterator i = a.ranges.begin(); i != a.ranges.end(); i++) {
- if (i != a.ranges.begin()) out << ", ";
- out << *i;
- }
- out << ")]";
- return out;
- }
-}}
diff --git a/qpid/cpp/src/qpid/framing/AccumulatedAck.h b/qpid/cpp/src/qpid/framing/AccumulatedAck.h
deleted file mode 100644
index a635d2ea04..0000000000
--- a/qpid/cpp/src/qpid/framing/AccumulatedAck.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _AccumulatedAck_
-#define _AccumulatedAck_
-
-#include <algorithm>
-#include <functional>
-#include <list>
-#include <ostream>
-#include "SequenceNumber.h"
-#include "SequenceNumberSet.h"
-
-namespace qpid {
- namespace framing {
-
- struct Range
- {
- SequenceNumber start;
- SequenceNumber end;
-
- Range(SequenceNumber s, SequenceNumber e);
- bool contains(SequenceNumber i) const;
- bool intersect(const Range& r) const;
- bool merge(const Range& r);
- bool mergeable(const SequenceNumber& r) const;
- };
- /**
- * Keeps an accumulated record of acked messages (by delivery
- * tag).
- */
- class AccumulatedAck {
- public:
- /**
- * Everything up to this value has been acked.
- */
- SequenceNumber mark;
- /**
- * List of individually acked messages greater than the
- * 'mark'.
- */
- std::list<Range> ranges;
-
- explicit AccumulatedAck(SequenceNumber r = SequenceNumber());
- void update(SequenceNumber firstTag, SequenceNumber lastTag);
- void consolidate();
- void clear();
- bool covers(SequenceNumber tag) const;
- void collectRanges(SequenceNumberSet& set) const;
- void update(const SequenceNumber cumulative, const SequenceNumberSet& range);
- void operator()(SequenceNumber first, SequenceNumber last) { update(first, last); }
- };
- std::ostream& operator<<(std::ostream&, const Range&);
- std::ostream& operator<<(std::ostream&, const AccumulatedAck&);
- }
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/Array.cpp b/qpid/cpp/src/qpid/framing/Array.cpp
deleted file mode 100644
index 1215c8a28b..0000000000
--- a/qpid/cpp/src/qpid/framing/Array.cpp
+++ /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.
- *
- */
-#include "Array.h"
-#include "Buffer.h"
-#include "FieldValue.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/reply_exceptions.h"
-#include <assert.h>
-
-namespace qpid {
-namespace framing {
-
-Array::Array() : typeOctet(0xF0/*void*/) {}
-
-Array::Array(const std::vector<std::string>& in)
-{
- typeOctet = 0xA4;
- for (std::vector<std::string>::const_iterator i = in.begin(); i != in.end(); ++i) {
- ValuePtr value(new StringValue(*i));
- values.push_back(value);
- }
-}
-
-uint32_t Array::size() const {
- //note: size is only included when used as a 'top level' type
- uint32_t len(4/*size*/ + 1/*type*/ + 4/*count*/);
- for(ValueVector::const_iterator i = values.begin(); i != values.end(); ++i) {
- len += (*i)->getData().size();
- }
- return len;
-}
-
-int Array::count() const {
- return values.size();
-}
-
-std::ostream& operator<<(std::ostream& out, const Array& t) {
- out << "{";
- for(Array::ValueVector::const_iterator i = t.values.begin(); i != t.values.end(); ++i) {
- if (i != t.values.begin()) out << ", ";
- out << *(i->get());
- }
- return out << "}";
-}
-
-void Array::encode(Buffer& buffer) const{
- buffer.putLong(size() - 4);//size added only when array is a top-level type
- buffer.putOctet(typeOctet);
- buffer.putLong(count());
- for (ValueVector::const_iterator i = values.begin(); i!=values.end(); ++i) {
- (*i)->getData().encode(buffer);
- }
-}
-
-void Array::decode(Buffer& buffer){
- uint32_t size = buffer.getLong();//size added only when array is a top-level type
- uint32_t available = buffer.available();
- if (available < size) {
- throw SyntaxErrorException(QPID_MSG("Not enough data for array, expected "
- << size << " bytes but only " << available << " available"));
- }
- typeOctet = buffer.getOctet();
- uint32_t count = buffer.getLong();
-
- FieldValue dummy;
- dummy.setType(typeOctet);
- available = buffer.available();
- if (available < count * dummy.getData().size()) {
- throw SyntaxErrorException(QPID_MSG("Not enough data for array, expected "
- << count << " items of " << dummy.getData().size()
- << " bytes each but only " << available << " bytes available"));
- }
-
- for (uint32_t i = 0; i < count; i++) {
- ValuePtr value(new FieldValue);
- value->setType(typeOctet);
- value->getData().decode(buffer);
- values.push_back(ValuePtr(value));
- }
-}
-
-
-bool Array::operator==(const Array& x) const {
- if (typeOctet != x.typeOctet) return false;
- if (values.size() != x.values.size()) return false;
-
- for (ValueVector::const_iterator i = values.begin(), j = x.values.begin(); i != values.end(); ++i, ++j) {
- if (*(i->get()) != *(j->get())) return false;
- }
-
- return true;
-}
-
-
-}
-}
diff --git a/qpid/cpp/src/qpid/framing/Array.h b/qpid/cpp/src/qpid/framing/Array.h
deleted file mode 100644
index 6a13c63672..0000000000
--- a/qpid/cpp/src/qpid/framing/Array.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <iostream>
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#include <map>
-#include "amqp_types.h"
-#include "FieldValue.h"
-
-#ifndef _Array_
-#define _Array_
-
-namespace qpid {
-namespace framing {
-
-class Buffer;
-
-class Array
-{
- public:
- typedef boost::shared_ptr<FieldValue> ValuePtr;
- typedef std::vector<ValuePtr> ValueVector;
-
- uint32_t size() const;
- void encode(Buffer& buffer) const;
- void decode(Buffer& buffer);
-
- int count() const;
- bool operator==(const Array& other) const;
-
- Array();
- //only long string arrays can currently be created (any type can be decoded)
- Array(const std::vector<std::string>& in);
-
- template <class T>
- void collect(std::vector<T>& out)
- {
- for (ValueVector::const_iterator i = values.begin(); i != values.end(); ++i) {
- out.push_back((*i)->get<T>());
- }
- }
-
- private:
- uint8_t typeOctet;
- ValueVector values;
-
- ValueVector::const_iterator begin() const { return values.begin(); }
- ValueVector::const_iterator end() const { return values.end(); }
-
- friend std::ostream& operator<<(std::ostream& out, const Array& body);
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/Blob.cpp b/qpid/cpp/src/qpid/framing/Blob.cpp
deleted file mode 100644
index 388d4b64ef..0000000000
--- a/qpid/cpp/src/qpid/framing/Blob.cpp
+++ /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.
- *
- */
-
-#include "Blob.h"
-
-
-namespace qpid {
-namespace framing {
-
-void BlobHelper<void>::destroy(void*) {}
-
-void BlobHelper<void>::copy(void*, const void*) {}
-
-}} // namespace qpid::framing
diff --git a/qpid/cpp/src/qpid/framing/Blob.h b/qpid/cpp/src/qpid/framing/Blob.h
deleted file mode 100644
index 344e4ac4db..0000000000
--- a/qpid/cpp/src/qpid/framing/Blob.h
+++ /dev/null
@@ -1,191 +0,0 @@
-#ifndef QPID_FRAMING_BLOB_H
-#define QPID_FRAMING_BLOB_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/static_assert.hpp>
-#include <boost/aligned_storage.hpp>
-#include <boost/checked_delete.hpp>
-#include <boost/utility/typed_in_place_factory.hpp>
-#include <boost/type_traits/is_base_and_derived.hpp>
-#include <boost/utility/enable_if.hpp>
-
-#include <new>
-
-#include <assert.h>
-
-
-namespace qpid {
-namespace framing {
-
-using boost::in_place;
-using boost::typed_in_place_factory_base;
-
-/** 0-arg typed_in_place_factory, missing in boost. */
-template <class T>
-struct typed_in_place_factory0 : public typed_in_place_factory_base {
- typedef T value_type ;
- void apply ( void* address ) const { new (address) T(); }
-};
-
-/** 0-arg in_place<T>() function, missing from boost. */
-template<class T>
-typed_in_place_factory0<T> in_place() { return typed_in_place_factory0<T>(); }
-
-template <class T, class R=void>
-struct EnableInPlace
- : public boost::enable_if<boost::is_base_and_derived<
- typed_in_place_factory_base, T>,
- R>
-{};
-
-template <class T, class R=void>
-struct DisableInPlace
- : public boost::disable_if<boost::is_base_and_derived<
- typed_in_place_factory_base, T>,
- R>
-{};
-
-template <class T> struct BlobHelper {
- static void destroy(void* ptr) { static_cast<T*>(ptr)->~T(); }
- static void copy(void* dest, const void* src) {
- new (dest) T(*static_cast<const T*>(src));
- }
-};
-
-template <> struct BlobHelper<void> {
- static void destroy(void*);
- static void copy(void* to, const void* from);
-};
-
-/**
- * A "blob" is a chunk of memory which can contain a single object at
- * a time arbitrary type, provided sizeof(T)<=blob.size(). Blob
- * ensures proper construction and destruction of its contents,
- * and proper copying between Blobs, but nothing else.
- *
- * In particular the user must ensure the blob is big enough for its
- * contents and must know the type of object in the blob to cast get().
- *
- * Objects can be allocated directly in place using
- * construct(in_place<T>(...)) or copied using operator=.
- * Constructing a new object in the blob destroys the old one.
- *
- * If BaseType is specified then only object that can be
- * safely static_cast to BaseType may be stored in the Blob.
- */
-template <size_t Size, class BaseType=void>
-class Blob
-{
- boost::aligned_storage<Size> store;
- BaseType* basePtr;
-
- void (*destroy)(void*);
- void (*copy)(void*, const void*);
-
- template <class T>void setType() {
- BOOST_STATIC_ASSERT(sizeof(T) <= Size);
- destroy=&BlobHelper<T>::destroy;
- copy=&BlobHelper<T>::copy;
- // Base pointer may be offeset from store.address()
- basePtr = reinterpret_cast<T*>(store.address());
- }
-
- void initialize() {
- destroy=&BlobHelper<void>::destroy;
- copy=&BlobHelper<void>::copy;
- basePtr=0;
- }
-
- template<class Factory>
- typename EnableInPlace<Factory>::type apply(const Factory& factory)
- {
- typedef typename Factory::value_type T;
- assert(empty());
- factory.apply(store.address());
- setType<T>();
- }
-
- void assign(const Blob& b) {
- assert(empty());
- b.copy(this->store.address(), b.store.address());
- copy = b.copy;
- destroy = b.destroy;
- basePtr = reinterpret_cast<BaseType*>(
- ((char*)this)+ ((char*)(b.basePtr) - (char*)(&b)));
- }
-
- public:
- /** Construct an empty blob. */
- Blob() { initialize(); }
-
- /** Copy a blob. */
- Blob(const Blob& b) { initialize(); assign(b); }
-
- /** @see construct() */
- template<class InPlace>
- Blob(const InPlace & expr, typename EnableInPlace<InPlace>::type* =0) {
- initialize(); apply(expr);
- }
-
- ~Blob() { clear(); }
-
- /** Assign from another blob. */
- Blob& operator=(const Blob& b) {
- clear();
- assign(b);
- return *this;
- }
-
- /** Assign from an in_place constructor expression. */
- template<class InPlace>
- typename EnableInPlace<InPlace,Blob&>::type operator=(const InPlace& expr) {
- clear(); apply(expr); return *this;
- }
-
- /** Assign from an object of type T. */
- template <class T>
- typename DisableInPlace<T, Blob&>::type operator=(const T& x) {
- clear(); apply(in_place<T>(x)); return *this;
- }
-
- /** Get pointer to blob contents, returns 0 if empty. */
- BaseType* get() { return basePtr; }
-
- /** Get pointer to blob contents, returns 0 if empty. */
- const BaseType* get() const { return basePtr; }
-
- /** Destroy the object in the blob making it empty. */
- void clear() {
- void (*oldDestroy)(void*) = destroy;
- initialize();
- oldDestroy(store.address());
- }
-
- bool empty() const { return destroy==BlobHelper<void>::destroy; }
-
- static size_t size() { return Size; }
-};
-
-}} // namespace qpid::framing
-
-
-#endif /*!QPID_FRAMING_BLOB_H*/
diff --git a/qpid/cpp/src/qpid/framing/BodyHandler.cpp b/qpid/cpp/src/qpid/framing/BodyHandler.cpp
deleted file mode 100644
index fb84be7cd6..0000000000
--- a/qpid/cpp/src/qpid/framing/BodyHandler.cpp
+++ /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.
- *
- */
-#include "BodyHandler.h"
-#include "AMQMethodBody.h"
-#include "AMQHeaderBody.h"
-#include "AMQContentBody.h"
-#include "AMQHeartbeatBody.h"
-#include <boost/cast.hpp>
-#include "qpid/framing/reply_exceptions.h"
-
-using namespace qpid::framing;
-using namespace boost;
-
-BodyHandler::~BodyHandler() {}
-
-// TODO aconway 2007-08-13: Replace with visitor.
-void BodyHandler::handleBody(AMQBody* body) {
- switch(body->type())
- {
- case METHOD_BODY:
- handleMethod(polymorphic_downcast<AMQMethodBody*>(body));
- break;
- case HEADER_BODY:
- handleHeader(polymorphic_downcast<AMQHeaderBody*>(body));
- break;
- case CONTENT_BODY:
- handleContent(polymorphic_downcast<AMQContentBody*>(body));
- break;
- case HEARTBEAT_BODY:
- handleHeartbeat(polymorphic_downcast<AMQHeartbeatBody*>(body));
- break;
- default:
- throw SyntaxErrorException(
- QPID_MSG("Invalid frame type " << body->type()));
- }
-}
-
diff --git a/qpid/cpp/src/qpid/framing/BodyHandler.h b/qpid/cpp/src/qpid/framing/BodyHandler.h
deleted file mode 100644
index 9ded737195..0000000000
--- a/qpid/cpp/src/qpid/framing/BodyHandler.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef _BodyHandler_
-#define _BodyHandler_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace framing {
-class AMQBody;
-class AMQMethodBody;
-class AMQHeaderBody;
-class AMQContentBody;
-class AMQHeartbeatBody;
-
-// TODO aconway 2007-08-10: rework using Visitor pattern?
-
-/**
- * Interface to handle incoming frame bodies.
- * Derived classes provide logic for each frame type.
- */
-class BodyHandler {
- public:
- virtual ~BodyHandler();
- virtual void handleBody(AMQBody* body);
-
- protected:
- virtual void handleMethod(AMQMethodBody*) = 0;
- virtual void handleHeader(AMQHeaderBody*) = 0;
- virtual void handleContent(AMQContentBody*) = 0;
- virtual void handleHeartbeat(AMQHeartbeatBody*) = 0;
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/BodyHolder.cpp b/qpid/cpp/src/qpid/framing/BodyHolder.cpp
deleted file mode 100644
index f66f29d36a..0000000000
--- a/qpid/cpp/src/qpid/framing/BodyHolder.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "BodyHolder.h"
-#include "AMQMethodBody.h"
-#include "AMQHeaderBody.h"
-#include "AMQContentBody.h"
-#include "AMQHeartbeatBody.h"
-#include "Buffer.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace framing {
-
-
-// BodyHolder::operator=(const AMQBody&) is defined
-// in generated file BodyHolder_gen.cpp
-
-
-void BodyHolder::encode(Buffer& b) const {
- const AMQMethodBody* method=getMethod();
- if (method) {
- b.putOctet(method->amqpClassId());
- b.putOctet(method->amqpMethodId());
- method->encode(b);
- }
- else
- get()->encode(b);
-}
-
-void BodyHolder::decode(uint8_t type, Buffer& buffer, uint32_t size) {
- switch(type)
- {
- case METHOD_BODY: {
- ClassId c = buffer.getOctet();
- MethodId m = buffer.getOctet();
- setMethod(c, m);
- break;
- }
- case HEADER_BODY: *this=in_place<AMQHeaderBody>(); break;
- case CONTENT_BODY: *this=in_place<AMQContentBody>(); break;
- case HEARTBEAT_BODY: *this=in_place<AMQHeartbeatBody>(); break;
- default:
- throw SyntaxErrorException(QPID_MSG("Invalid frame type " << type));
- }
- get()->decode(buffer, size);
-}
-
-uint32_t BodyHolder::size() const {
- const AMQMethodBody* method=getMethod();
- if (method)
- return sizeof(ClassId)+sizeof(MethodId)+method->size();
- else
- return get()->size();
-}
-
-}} // namespace qpid::framing
-
diff --git a/qpid/cpp/src/qpid/framing/BodyHolder.h b/qpid/cpp/src/qpid/framing/BodyHolder.h
deleted file mode 100644
index 65029e5675..0000000000
--- a/qpid/cpp/src/qpid/framing/BodyHolder.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef QPID_FRAMING_BODYHOLDER_H
-#define QPID_FRAMING_BODYHOLDER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/AMQBody.h"
-#include "qpid/framing/Blob.h"
-#include "qpid/framing/MaxMethodBodySize.h" // Generated file.
-#include "qpid/framing/amqp_types.h"
-#include "qpid/RefCounted.h"
-
-
-namespace qpid {
-namespace framing {
-
-class AMQMethodBody;
-class AMQBody;
-class Buffer;
-
-/**
- * Holder for arbitrary frame body.
- */
-class BodyHolder : public RefCounted
-{
- public:
- // default copy, assign dtor ok.
- BodyHolder() {}
- BodyHolder(const AMQBody& b) { setBody(b); }
- BodyHolder(ClassId c, MethodId m) { setMethod(c,m); }
-
- /** Construct from an in_place constructor expression */
- template <class InPlace>
- BodyHolder(const InPlace& ip, typename EnableInPlace<InPlace>::type* =0)
- : blob(ip) {}
-
- void setBody(const AMQBody& b);
-
- /** Assign from an in_place constructor expression */
- template <class InPlace>
- typename EnableInPlace<InPlace,BodyHolder&>::type
- operator=(const InPlace& ip) { blob=ip; return *this; }
-
- /** Assign by copying. */
- template <class T>
- typename DisableInPlace<T,BodyHolder&>::type operator=(const T& x)
- { blob=in_place<T>(x); return *this; }
-
- /** Set to method with ClassId c, MethodId m. */
- void setMethod(ClassId c, MethodId m);
-
- void encode(Buffer&) const;
- void decode(uint8_t frameType, Buffer&, uint32_t=0);
- uint32_t size() const;
-
- /** Return body pointer or 0 if empty. */
- AMQBody* get() { return blob.get(); }
- const AMQBody* get() const { return blob.get(); }
-
- /** Return method pointer or 0 if not a method. */
- AMQMethodBody* getMethod() { return get()->getMethod(); }
- const AMQMethodBody* getMethod() const { return get()->getMethod(); }
-
- private:
- Blob<MAX_METHOD_BODY_SIZE, AMQBody> blob;
-};
-
-}} // namespace qpid::framing
-
-#endif /*!QPID_FRAMING_BODYHOLDER_H*/
diff --git a/qpid/cpp/src/qpid/framing/Buffer.cpp b/qpid/cpp/src/qpid/framing/Buffer.cpp
deleted file mode 100644
index 7eadf377b9..0000000000
--- a/qpid/cpp/src/qpid/framing/Buffer.cpp
+++ /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.
- *
- */
-#include "Buffer.h"
-#include "FramingContent.h"
-#include "FieldTable.h"
-
-namespace qpid {
-
-namespace framing {
-
-Buffer::Buffer(char* _data, uint32_t _size)
- : size(_size), data(_data), position(0) {
-}
-
-void Buffer::record(){
- r_position = position;
-}
-
-void Buffer::restore(bool reRecord){
- uint32_t savedPosition = position;
-
- position = r_position;
-
- if (reRecord)
- r_position = savedPosition;
-}
-
-void Buffer::reset(){
- position = 0;
-}
-
-///////////////////////////////////////////////////
-
-void Buffer::putOctet(uint8_t i){
- data[position++] = i;
-}
-
-void Buffer::putShort(uint16_t i){
- uint16_t b = i;
- data[position++] = (uint8_t) (0xFF & (b >> 8));
- data[position++] = (uint8_t) (0xFF & b);
-}
-
-void Buffer::putLong(uint32_t i){
- uint32_t b = i;
- data[position++] = (uint8_t) (0xFF & (b >> 24));
- data[position++] = (uint8_t) (0xFF & (b >> 16));
- data[position++] = (uint8_t) (0xFF & (b >> 8));
- data[position++] = (uint8_t) (0xFF & b);
-}
-
-void Buffer::putLongLong(uint64_t i){
- uint32_t hi = i >> 32;
- uint32_t lo = i;
- putLong(hi);
- putLong(lo);
-}
-
-uint8_t Buffer::getOctet(){
- return (uint8_t) data[position++];
-}
-
-uint16_t Buffer::getShort(){
- uint16_t hi = (unsigned char) data[position++];
- hi = hi << 8;
- hi |= (unsigned char) data[position++];
- return hi;
-}
-
-uint32_t Buffer::getLong(){
- uint32_t a = (unsigned char) data[position++];
- uint32_t b = (unsigned char) data[position++];
- uint32_t c = (unsigned char) data[position++];
- uint32_t d = (unsigned char) data[position++];
- a = a << 24;
- a |= b << 16;
- a |= c << 8;
- a |= d;
- return a;
-}
-
-uint64_t Buffer::getLongLong(){
- uint64_t hi = getLong();
- uint64_t lo = getLong();
- hi = hi << 32;
- return hi | lo;
-}
-
-template <>
-uint64_t Buffer::getUInt<1>() {
- return getOctet();
-}
-
-template <>
-uint64_t Buffer::getUInt<2>() {
- return getShort();
-}
-
-template <>
-uint64_t Buffer::getUInt<4>() {
- return getLong();
-}
-
-template <>
-uint64_t Buffer::getUInt<8>() {
- return getLongLong();
-}
-
-template <>
-void Buffer::putUInt<1>(uint64_t i) {
- putOctet(i);
-}
-
-template <>
-void Buffer::putUInt<2>(uint64_t i) {
- putShort(i);
-}
-
-template <>
-void Buffer::putUInt<4>(uint64_t i) {
- putLong(i);
-}
-
-template <>
-void Buffer::putUInt<8>(uint64_t i) {
- putLongLong(i);
-}
-
-void Buffer::putShortString(const string& s){
- uint8_t len = s.length();
- putOctet(len);
- s.copy(data + position, len);
- position += len;
-}
-
-void Buffer::putLongString(const string& s){
- uint32_t len = s.length();
- putLong(len);
- s.copy(data + position, len);
- position += len;
-}
-
-void Buffer::getShortString(string& s){
- uint8_t len = getOctet();
- checkAvailable(len);
- s.assign(data + position, len);
- position += len;
-}
-
-void Buffer::getLongString(string& s){
- uint32_t len = getLong();
- checkAvailable(len);
- s.assign(data + position, len);
- position += len;
-}
-
-void Buffer::putRawData(const string& s){
- uint32_t len = s.length();
- s.copy(data + position, len);
- position += len;
-}
-
-void Buffer::getRawData(string& s, uint32_t len){
- checkAvailable(len);
- s.assign(data + position, len);
- position += len;
-}
-
-void Buffer::putRawData(const uint8_t* s, size_t len){
- memcpy(data + position, s, len);
- position += len;
-}
-
-void Buffer::getRawData(uint8_t* s, size_t len){
- checkAvailable(len);
- memcpy(s, data + position, len);
- position += len;
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/framing/Buffer.h b/qpid/cpp/src/qpid/framing/Buffer.h
deleted file mode 100644
index 5ab897d351..0000000000
--- a/qpid/cpp/src/qpid/framing/Buffer.h
+++ /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.
- *
- */
-#include "amqp_types.h"
-#include "qpid/Exception.h"
-
-#ifndef _Buffer_
-#define _Buffer_
-
-namespace qpid {
-namespace framing {
-
-struct OutOfBounds : qpid::Exception {};
-
-class Content;
-class FieldTable;
-
-class Buffer
-{
- uint32_t size;
- char* data;
- uint32_t position;
- uint32_t r_position;
-
- void checkAvailable(uint32_t count) { if (position + count > size) throw OutOfBounds(); }
-
-public:
-
- Buffer(char* data=0, uint32_t size=0);
-
- void record();
- void restore(bool reRecord = false);
- void reset();
-
- uint32_t available() { return size - position; }
- uint32_t getSize() { return size; }
- uint32_t getPosition() { return position; }
-
- void putOctet(uint8_t i);
- void putShort(uint16_t i);
- void putLong(uint32_t i);
- void putLongLong(uint64_t i);
-
- uint8_t getOctet();
- uint16_t getShort();
- uint32_t getLong();
- uint64_t getLongLong();
-
- template <int n>
- uint64_t getUInt();
-
- template <int n>
- void putUInt(uint64_t);
-
- void putShortString(const string& s);
- void putLongString(const string& s);
- void getShortString(string& s);
- void getLongString(string& s);
-
- void putRawData(const string& s);
- void getRawData(string& s, uint32_t size);
-
- void putRawData(const uint8_t* data, size_t size);
- void getRawData(uint8_t* data, size_t size);
-
- template <class T> void put(const T& data) { data.encode(*this); }
- template <class T> void get(T& data) { data.decode(*this); }
-};
-
-}} // namespace qpid::framing
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/ChannelHandler.h b/qpid/cpp/src/qpid/framing/ChannelHandler.h
deleted file mode 100644
index 69aaeac492..0000000000
--- a/qpid/cpp/src/qpid/framing/ChannelHandler.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef QPID_FRAMING_CHANNELHANDLER_H
-#define QPID_FRAMING_CHANNELHANDLER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "FrameHandler.h"
-#include "AMQFrame.h"
-
-namespace qpid {
-namespace framing {
-
-/**
- * Sets the channel number on outgoing frames.
- */
-class ChannelHandler : public FrameHandler
-{
- public:
- ChannelHandler(uint16_t channelId=0, FrameHandler* next=0)
- : FrameHandler(next), channel(channelId) {}
- void handle(AMQFrame& frame) {
- frame.setChannel(channel);
- next->handle(frame);
- }
- uint16_t get() const { return channel; }
- ChannelHandler& set(uint16_t ch) { channel=ch; return *this; }
- operator uint16_t() const { return get(); }
- ChannelHandler& operator=(uint16_t ch) { return set(ch); }
-
- private:
- uint16_t channel;
-};
-
-}} // namespace qpid::framing
-
-#endif /*!QPID_FRAMING_CHANNELHANDLER_H*/
diff --git a/qpid/cpp/src/qpid/framing/FieldTable.cpp b/qpid/cpp/src/qpid/framing/FieldTable.cpp
deleted file mode 100644
index 089bc5d4a5..0000000000
--- a/qpid/cpp/src/qpid/framing/FieldTable.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "FieldTable.h"
-#include "Buffer.h"
-#include "FieldValue.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/reply_exceptions.h"
-#include <assert.h>
-
-namespace qpid {
-namespace framing {
-
-FieldTable::~FieldTable() {}
-
-uint32_t FieldTable::size() const {
- uint32_t len(4);
- for(ValueMap::const_iterator i = values.begin(); i != values.end(); ++i) {
- // shortstr_len_byte + key size + value size
- len += 1 + (i->first).size() + (i->second)->size();
- }
- return len;
-}
-
-int FieldTable::count() const {
- return values.size();
-}
-
-namespace
-{
-std::ostream& operator<<(std::ostream& out, const FieldTable::ValueMap::value_type& i) {
- return out << i.first << ":" << *i.second;
-}
-}
-
-std::ostream& operator<<(std::ostream& out, const FieldTable& t) {
- out << "{";
- FieldTable::ValueMap::const_iterator i = t.begin();
- if (i != t.end()) out << *i++;
- while (i != t.end())
- {
- out << "," << *i++;
- }
- return out << "}";
-}
-
-void FieldTable::set(const std::string& name, const ValuePtr& value){
- values[name] = value;
-}
-
-void FieldTable::setString(const std::string& name, const std::string& value){
- values[name] = ValuePtr(new StringValue(value));
-}
-
-void FieldTable::setInt(const std::string& name, int value){
- values[name] = ValuePtr(new IntegerValue(value));
-}
-
-void FieldTable::setTimestamp(const std::string& name, uint64_t value){
- values[name] = ValuePtr(new TimeValue(value));
-}
-
-void FieldTable::setTable(const std::string& name, const FieldTable& value){
- values[name] = ValuePtr(new FieldTableValue(value));
-}
-
-FieldTable::ValuePtr FieldTable::get(const std::string& name) const
-{
- ValuePtr value;
- ValueMap::const_iterator i = values.find(name);
- if ( i!=values.end() )
- value = i->second;
- return value;
-}
-
-namespace {
- template <class T> T default_value() { return T(); }
- template <> int default_value<int>() { return 0; }
- template <> uint64_t default_value<uint64_t>() { return 0; }
-}
-
-template <class T>
-T getValue(const FieldTable::ValuePtr value)
-{
- if (!value || !value->convertsTo<T>())
- return default_value<T>();
-
- return value->get<T>();
-}
-
-std::string FieldTable::getString(const std::string& name) const {
- return getValue<std::string>(get(name));
-}
-
-int FieldTable::getInt(const std::string& name) const {
- return getValue<int>(get(name));
-}
-
-//uint64_t FieldTable::getTimestamp(const std::string& name) const {
-// return getValue<uint64_t>(name);
-//}
-//
-//void FieldTable::getTable(const std::string& name, FieldTable& value) const {
-// value = getValue<FieldTable>(name);
-//}
-
-void FieldTable::encode(Buffer& buffer) const{
- buffer.putLong(size() - 4);
- for (ValueMap::const_iterator i = values.begin(); i!=values.end(); ++i) {
- buffer.putShortString(i->first);
- i->second->encode(buffer);
- }
-}
-
-void FieldTable::decode(Buffer& buffer){
- uint32_t len = buffer.getLong();
- uint32_t available = buffer.available();
- if (available < len)
- throw SyntaxErrorException(QPID_MSG("Not enough data for field table."));
- uint32_t leftover = available - len;
- while(buffer.available() > leftover){
- std::string name;
- ValuePtr value(new FieldValue);
-
- buffer.getShortString(name);
- value->decode(buffer);
- values[name] = ValuePtr(value);
- }
-}
-
-
-bool FieldTable::operator==(const FieldTable& x) const {
- if (values.size() != x.values.size()) return false;
- for (ValueMap::const_iterator i = values.begin(); i != values.end(); ++i) {
- ValueMap::const_iterator j = x.values.find(i->first);
- if (j == x.values.end()) return false;
- if (*(i->second) != *(j->second)) return false;
- }
- return true;
-}
-
-//void FieldTable::erase(const std::string& name)
-//{
-// values.erase(values.find(name));
-//}
-
-}
-}
diff --git a/qpid/cpp/src/qpid/framing/FieldTable.h b/qpid/cpp/src/qpid/framing/FieldTable.h
deleted file mode 100644
index 707496a861..0000000000
--- a/qpid/cpp/src/qpid/framing/FieldTable.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <iostream>
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#include <map>
-#include "amqp_types.h"
-
-#ifndef _FieldTable_
-#define _FieldTable_
-
-namespace qpid {
- /**
- * The framing namespace contains classes that are used to create,
- * send and receive the basic packets from which AMQP is built.
- */
-namespace framing {
-
-class FieldValue;
-class Buffer;
-
-/**
- * A set of name-value pairs. (See the AMQP spec for more details on
- * AMQP field tables).
- *
- * \ingroup clientapi
- */
-class FieldTable
-{
- public:
- typedef boost::shared_ptr<FieldValue> ValuePtr;
- typedef std::map<std::string, ValuePtr> ValueMap;
-
- ~FieldTable();
- uint32_t size() const;
- void encode(Buffer& buffer) const;
- void decode(Buffer& buffer);
-
- int count() const;
- void set(const std::string& name, const ValuePtr& value);
- ValuePtr get(const std::string& name) const;
-
- void setString(const std::string& name, const std::string& value);
- void setInt(const std::string& name, int value);
- void setTimestamp(const std::string& name, uint64_t value);
- void setTable(const std::string& name, const FieldTable& value);
- //void setDecimal(string& name, xxx& value);
-
- std::string getString(const std::string& name) const;
- int getInt(const std::string& name) const;
-// uint64_t getTimestamp(const std::string& name) const;
-// void getTable(const std::string& name, FieldTable& value) const;
-// //void getDecimal(string& name, xxx& value);
-// //void erase(const std::string& name);
-
-
- bool operator==(const FieldTable& other) const;
-
- // Map-like interface.
- // TODO: may need to duplicate into versions that return mutable iterator
- ValueMap::const_iterator begin() const { return values.begin(); }
- ValueMap::const_iterator end() const { return values.end(); }
- ValueMap::const_iterator find(const std::string& s) const { return values.find(s); }
-
- private:
- ValueMap values;
-
- friend std::ostream& operator<<(std::ostream& out, const FieldTable& body);
-};
-
-//class FieldNotFoundException{};
-//class UnknownFieldName : public FieldNotFoundException{};
-//class IncorrectFieldType : public FieldNotFoundException{};
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/FieldValue.cpp b/qpid/cpp/src/qpid/framing/FieldValue.cpp
deleted file mode 100644
index 961b6017cd..0000000000
--- a/qpid/cpp/src/qpid/framing/FieldValue.cpp
+++ /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.
- *
- */
-#include "FieldValue.h"
-#include "Buffer.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace framing {
-
-void FieldValue::setType(uint8_t type)
-{
- typeOctet = type;
-
- uint8_t lenType = typeOctet >> 4;
- switch(lenType){
- case 0:
- data.reset(new FixedWidthValue<1>());
- break;
- case 1:
- data.reset(new FixedWidthValue<2>());
- break;
- case 2:
- data.reset(new FixedWidthValue<4>());
- break;
- case 3:
- data.reset(new FixedWidthValue<8>());
- break;
- case 4:
- data.reset(new FixedWidthValue<16>());
- break;
- case 5:
- data.reset(new FixedWidthValue<32>());
- break;
- case 6:
- data.reset(new FixedWidthValue<64>());
- break;
- case 7:
- data.reset(new FixedWidthValue<128>());
- break;
- case 8:
- data.reset(new VariableWidthValue<1>());
- break;
- case 9:
- data.reset(new VariableWidthValue<2>());
- break;
- case 0xA:
- data.reset(new VariableWidthValue<4>());
- break;
- case 0xC:
- data.reset(new FixedWidthValue<5>());
- break;
- case 0xD:
- data.reset(new FixedWidthValue<9>());
- break;
- case 0xF:
- data.reset(new FixedWidthValue<0>());
- break;
- default:
- throw SyntaxErrorException(QPID_MSG("Unknown field table value type: " << (int)typeOctet));
- }
-}
-
-void FieldValue::decode(Buffer& buffer)
-{
- setType(buffer.getOctet());
- data->decode(buffer);
-}
-
-void FieldValue::encode(Buffer& buffer)
-{
- buffer.putOctet(typeOctet);
- data->encode(buffer);
-}
-
-bool FieldValue::operator==(const FieldValue& v) const
-{
- return
- typeOctet == v.typeOctet &&
- *data == *v.data;
-}
-
-StringValue::StringValue(const std::string& v) :
- FieldValue(
- 0xA4,
- new VariableWidthValue<4>(
- reinterpret_cast<const uint8_t*>(v.data()),
- reinterpret_cast<const uint8_t*>(v.data()+v.size())))
-{
-}
-
-IntegerValue::IntegerValue(int v) :
- FieldValue(0x21, new FixedWidthValue<4>(v))
-{
-}
-
-TimeValue::TimeValue(uint64_t v) :
- FieldValue(0x32, new FixedWidthValue<8>(v))
-{
-}
-
-FieldTableValue::FieldTableValue(const FieldTable&) : FieldValue()
-{
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/framing/FieldValue.h b/qpid/cpp/src/qpid/framing/FieldValue.h
deleted file mode 100644
index 3ec95a99e1..0000000000
--- a/qpid/cpp/src/qpid/framing/FieldValue.h
+++ /dev/null
@@ -1,229 +0,0 @@
-#ifndef _framing_FieldValue_h
-#define _framing_FieldValue_h
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include "Buffer.h"
-#include "amqp_types.h"
-
-#include "assert.h"
-
-#include <iostream>
-#include <memory>
-#include <vector>
-
-namespace qpid {
-namespace framing {
-
-/**
- * Exception that is base exception for all field table errors
- *
- * \ingroup clientapi
- */
-class FieldValueException : public qpid::Exception {};
-
-/**
- * Exception thrown when we can't perform requested conversion
- *
- * \ingroup clientapi
- */
-struct InvalidConversionException : public FieldValueException {
- InvalidConversionException() {}
-};
-
-/**
- * Value that can appear in an AMQP field table
- *
- * \ingroup clientapi
- */
-class FieldValue {
- public:
- /*
- * Abstract type for content of different types
- */
- class Data {
- public:
- virtual ~Data() {};
- virtual uint32_t size() const = 0;
- virtual void encode(Buffer& buffer) = 0;
- virtual void decode(Buffer& buffer) = 0;
- virtual bool operator==(const Data&) const = 0;
-
- virtual bool convertsToInt() const { return false; }
- virtual bool convertsToString() const { return false; }
- virtual int64_t getInt() const { throw InvalidConversionException();}
- virtual std::string getString() const { throw InvalidConversionException(); }
-
- virtual void print(std::ostream& out) const = 0;
- };
-
- FieldValue(): data(0) {};
- // Default assignment operator is fine
- void setType(uint8_t type);
- Data& getData() { return *data; }
- uint32_t size() const { return 1 + data->size(); };
- bool empty() const { return data.get() == 0; }
- void encode(Buffer& buffer);
- void decode(Buffer& buffer);
- bool operator==(const FieldValue&) const;
- bool operator!=(const FieldValue& v) const { return !(*this == v); }
- void print(std::ostream& out) const { out << "(0x" << std::hex << int(typeOctet) << ")"; data->print(out); }
-
- template <typename T> bool convertsTo() const { return false; }
- template <typename T> T get() const { throw InvalidConversionException(); }
-
- protected:
- FieldValue(uint8_t t, Data* d): typeOctet(t), data(d) {}
-
- private:
- uint8_t typeOctet;
- std::auto_ptr<Data> data;
-};
-
-template <>
-inline bool FieldValue::convertsTo<int>() const { return data->convertsToInt(); }
-
-template <>
-inline bool FieldValue::convertsTo<std::string>() const { return data->convertsToString(); }
-
-template <>
-inline int FieldValue::get<int>() const { return data->getInt(); }
-
-template <>
-inline std::string FieldValue::get<std::string>() const { return data->getString(); }
-
-inline std::ostream& operator<<(std::ostream& out, const FieldValue& v) {
- v.print(out);
- return out;
-}
-
-template <int width>
-class FixedWidthValue : public FieldValue::Data {
- uint8_t octets[width];
-
- public:
- FixedWidthValue() {}
- FixedWidthValue(const uint8_t (&data)[width]) : octets(data) {}
- FixedWidthValue(uint64_t v)
- {
- for (int i = width; i > 0; --i) {
- octets[i-1] = (uint8_t) (0xFF & v); v >>= 8;
- }
- octets[0] = (uint8_t) (0xFF & v);
- }
-
- uint32_t size() const { return width; }
- void encode(Buffer& buffer) { buffer.putRawData(octets, width); }
- void decode(Buffer& buffer) { buffer.getRawData(octets, width); }
- bool operator==(const Data& d) const {
- const FixedWidthValue<width>* rhs = dynamic_cast< const FixedWidthValue<width>* >(&d);
- if (rhs == 0) return false;
- else return std::equal(&octets[0], &octets[width], &rhs->octets[0]);
- }
-
- bool convertsToInt() const { return true; }
- int64_t getInt() const
- {
- int64_t v = 0;
- for (int i = 0; i < width-1; ++i) {
- v |= octets[i]; v <<= 8;
- }
- v |= octets[width-1];
- return v;
- }
-
- void print(std::ostream& o) const { o << "F" << width << ":"; };
-};
-
-template <>
-class FixedWidthValue<0> : public FieldValue::Data {
- public:
- // Implicit default constructor is fine
- uint32_t size() const { return 0; }
- void encode(Buffer&) {};
- void decode(Buffer&) {};
- bool operator==(const Data& d) const {
- const FixedWidthValue<0>* rhs = dynamic_cast< const FixedWidthValue<0>* >(&d);
- return rhs != 0;
- }
- void print(std::ostream& o) const { o << "F0"; };
-};
-
-template <int lenwidth>
-class VariableWidthValue : public FieldValue::Data {
- std::vector<uint8_t> octets;
-
- public:
- VariableWidthValue() {}
- VariableWidthValue(const std::vector<uint8_t>& data) : octets(data) {}
- VariableWidthValue(const uint8_t* start, const uint8_t* end) : octets(start, end) {}
- uint32_t size() const { return lenwidth + octets.size(); }
- void encode(Buffer& buffer) {
- buffer.putUInt<lenwidth>(octets.size());
- buffer.putRawData(&octets[0], octets.size());
- };
- void decode(Buffer& buffer) {
- uint32_t len = buffer.getUInt<lenwidth>();
- octets.resize(len);
- buffer.getRawData(&octets[0], len);
- }
- bool operator==(const Data& d) const {
- const VariableWidthValue<lenwidth>* rhs = dynamic_cast< const VariableWidthValue<lenwidth>* >(&d);
- if (rhs == 0) return false;
- else return octets==rhs->octets;
- }
-
- bool convertsToString() const { return true; }
- std::string getString() const { return std::string(octets.begin(), octets.end()); }
-
- void print(std::ostream& o) const { o << "V" << lenwidth << ":" << octets.size() << ":"; };
-};
-
-/*
- * Basic string value encodes as iso-8859-15 with 32 bit length
- */
-class StringValue : public FieldValue {
- public:
- StringValue(const std::string& v);
-};
-
-/*
- * Basic integer value encodes as signed 32 bit
- */
-class IntegerValue : public FieldValue {
- public:
- IntegerValue(int v);
-};
-
-class TimeValue : public FieldValue {
- public:
- TimeValue(uint64_t v);
-};
-
-class FieldTableValue : public FieldValue {
- public:
- FieldTableValue(const FieldTable&);
-};
-
-}} // qpid::framing
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/FrameDefaultVisitor.h b/qpid/cpp/src/qpid/framing/FrameDefaultVisitor.h
deleted file mode 100644
index 07e1d6d997..0000000000
--- a/qpid/cpp/src/qpid/framing/FrameDefaultVisitor.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef QPID_FRAMING_FRAMEVISITOR_H
-#define QPID_FRAMING_FRAMEVISITOR_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/MethodBodyDefaultVisitor.h"
-#include "qpid/framing/AMQBody.h"
-#include "qpid/framing/AMQMethodBody.h"
-#include "qpid/framing/AMQHeaderBody.h"
-#include "qpid/framing/AMQContentBody.h"
-#include "qpid/framing/AMQHeartbeatBody.h"
-
-namespace qpid {
-namespace framing {
-/**
- * Visitor for all concrete frame body types, combines
- * AMQBodyConstVisitor and MethodBodyDefaultVisitor.
- *
- * Derived classes may override visit methods to specify actions.
- * Derived classes must override defaultVisit(), which is called
- * for any non-overridden visit functions.
- *
- */
-struct FrameDefaultVisitor : public AMQBodyConstVisitor,
- protected MethodBodyDefaultVisitor
-{
- virtual void defaultVisit(const AMQBody&) = 0;
- void defaultVisit(const AMQMethodBody& method) { defaultVisit(static_cast<const AMQBody&>(method)); }
-
- void visit(const AMQHeaderBody& b) { defaultVisit(b); }
- void visit(const AMQContentBody& b) { defaultVisit(b); }
- void visit(const AMQHeartbeatBody& b) { defaultVisit(b); }
- void visit(const AMQMethodBody& b) { b.accept(static_cast<MethodBodyDefaultVisitor&>(*this)); }
-
- using AMQBodyConstVisitor::visit;
- using MethodBodyDefaultVisitor::visit;
-};
-
-}} // namespace qpid::framing
-
-
-#endif /*!QPID_FRAMING_FRAMEVISITOR_H*/
diff --git a/qpid/cpp/src/qpid/framing/FrameHandler.h b/qpid/cpp/src/qpid/framing/FrameHandler.h
deleted file mode 100644
index 457968c35e..0000000000
--- a/qpid/cpp/src/qpid/framing/FrameHandler.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef QPID_FRAMING_FRAMEHANDLER_H
-#define QPID_FRAMING_FRAMEHANDLER_H
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "Handler.h"
-
-namespace qpid {
-namespace framing {
-
-class AMQFrame;
-typedef Handler<AMQFrame&> FrameHandler;
-
-
-}}
-#endif /*!QPID_FRAMING_FRAMEHANDLER_H*/
diff --git a/qpid/cpp/src/qpid/framing/FrameSet.cpp b/qpid/cpp/src/qpid/framing/FrameSet.cpp
deleted file mode 100644
index 0e1c9da922..0000000000
--- a/qpid/cpp/src/qpid/framing/FrameSet.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "FrameSet.h"
-#include "qpid/framing/all_method_bodies.h"
-#include "qpid/framing/frame_functors.h"
-#include "qpid/framing/MessageProperties.h"
-#include "qpid/framing/TypeFilter.h"
-
-using namespace qpid::framing;
-using namespace boost;
-
-FrameSet::FrameSet(const SequenceNumber& _id) : id(_id) {parts.reserve(4);}
-
-void FrameSet::append(AMQFrame& part)
-{
- parts.push_back(part);
-}
-
-bool FrameSet::isComplete() const
-{
- return !parts.empty() && parts.back().getEof() && parts.back().getEos();
-}
-
-bool FrameSet::isContentBearing() const
-{
- const AMQMethodBody* method = getMethod();
- return method && method->isContentBearing();
-}
-
-const AMQMethodBody* FrameSet::getMethod() const
-{
- return parts.empty() ? 0 : parts[0].getMethod();
-}
-
-const AMQHeaderBody* FrameSet::getHeaders() const
-{
- return parts.size() < 2 ? 0 : parts[1].castBody<AMQHeaderBody>();
-}
-
-AMQHeaderBody* FrameSet::getHeaders()
-{
- return parts.size() < 2 ? 0 : parts[1].castBody<AMQHeaderBody>();
-}
-
-uint64_t FrameSet::getContentSize() const
-{
- SumBodySize sum;
- map_if(sum, TypeFilter<CONTENT_BODY>());
- return sum.getSize();
-}
-
-void FrameSet::getContent(std::string& out) const {
- out.clear();
- out.reserve(getContentSize());
- for(Frames::const_iterator i = parts.begin(); i != parts.end(); i++) {
- if (i->getBody()->type() == CONTENT_BODY)
- out += i->castBody<AMQContentBody>()->getData();
- }
-}
-
-std::string FrameSet::getContent() const {
- std::string out;
- getContent(out);
- return out;
-}
diff --git a/qpid/cpp/src/qpid/framing/FrameSet.h b/qpid/cpp/src/qpid/framing/FrameSet.h
deleted file mode 100644
index 8ba22f07cb..0000000000
--- a/qpid/cpp/src/qpid/framing/FrameSet.h
+++ /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.
- *
- */
-#include <string>
-#include <vector>
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/SequenceNumber.h"
-
-#ifndef _FrameSet_
-#define _FrameSet_
-
-namespace qpid {
-namespace framing {
-
-/**
- * Collects the frames representing a message.
- */
-class FrameSet
-{
- typedef std::vector<AMQFrame> Frames;
- const SequenceNumber id;
- Frames parts;
-
-public:
- typedef boost::shared_ptr<FrameSet> shared_ptr;
-
- FrameSet(const SequenceNumber& id);
- void append(AMQFrame& part);
- bool isComplete() const;
-
- uint64_t getContentSize() const;
- void getContent(std::string&) const;
- std::string getContent() const;
-
- bool isContentBearing() const;
-
- const AMQMethodBody* getMethod() const;
- const AMQHeaderBody* getHeaders() const;
- AMQHeaderBody* getHeaders();
-
- template <class T> bool isA() const {
- const AMQMethodBody* method = getMethod();
- return method && method->isA<T>();
- }
-
- template <class T> const T* as() const {
- const AMQMethodBody* method = getMethod();
- return (method && method->isA<T>()) ? dynamic_cast<const T*>(method) : 0;
- }
-
- template <class T> const T* getHeaderProperties() const {
- const AMQHeaderBody* header = getHeaders();
- return header ? header->get<T>() : 0;
- }
-
- const SequenceNumber& getId() const { return id; }
-
- template <class P> void remove(P predicate) {
- parts.erase(remove_if(parts.begin(), parts.end(), predicate), parts.end());
- }
-
- template <class F> void map(F& functor) {
- for_each(parts.begin(), parts.end(), functor);
- }
-
- template <class F> void map(F& functor) const {
- for_each(parts.begin(), parts.end(), functor);
- }
-
- template <class F, class P> void map_if(F& functor, P predicate) {
- for(Frames::iterator i = parts.begin(); i != parts.end(); i++) {
- if (predicate(*i)) functor(*i);
- }
- }
-
- template <class F, class P> void map_if(F& functor, P predicate) const {
- for(Frames::const_iterator i = parts.begin(); i != parts.end(); i++) {
- if (predicate(*i)) functor(*i);
- }
- }
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/FramingContent.cpp b/qpid/cpp/src/qpid/framing/FramingContent.cpp
deleted file mode 100644
index cd134b0e89..0000000000
--- a/qpid/cpp/src/qpid/framing/FramingContent.cpp
+++ /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.
- *
- */
-#include "Buffer.h"
-#include "FramingContent.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace framing {
-
-Content::Content() : discriminator(0) {}
-
-Content::Content(uint8_t _discriminator, const string& _value): discriminator(_discriminator), value(_value) {
- validate();
-}
-
-void Content::validate() {
- if (discriminator == REFERENCE) {
- if(value.empty()) {
- throw InvalidArgumentException(
- QPID_MSG("Reference cannot be empty"));
- }
- }else if (discriminator != INLINE) {
- throw SyntaxErrorException(
- QPID_MSG("Invalid discriminator: " << discriminator));
- }
-}
-
-Content::~Content() {}
-
-void Content::encode(Buffer& buffer) const {
- buffer.putOctet(discriminator);
- buffer.putLongString(value);
-}
-
-void Content::decode(Buffer& buffer) {
- discriminator = buffer.getOctet();
- buffer.getLongString(value);
- validate();
-}
-
-size_t Content::size() const {
- return 1/*discriminator*/ + 4/*for recording size of long string*/ + value.size();
-}
-
-std::ostream& operator<<(std::ostream& out, const Content& content) {
- if (content.discriminator == REFERENCE) {
- out << "{REF:" << content.value << "}";
- } else if (content.discriminator == INLINE) {
- out << "{INLINE:" << content.value.size() << " bytes}";
- }
- return out;
-}
-
-}} // namespace framing::qpid
diff --git a/qpid/cpp/src/qpid/framing/FramingContent.h b/qpid/cpp/src/qpid/framing/FramingContent.h
deleted file mode 100644
index 9315a7716f..0000000000
--- a/qpid/cpp/src/qpid/framing/FramingContent.h
+++ /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.
- *
- */
-#ifndef _framing_FramingContent_h
-#define _framing_FramingContent_h
-
-#include <ostream>
-
-namespace qpid {
-namespace framing {
-
-class Buffer;
-
-enum discriminator_types { INLINE = 0, REFERENCE = 1 };
-
-/**
- * A representation of the AMQP 'content' data type (used for message
- * bodies) which can hold inline data or a reference.
- */
-class Content
-{
- uint8_t discriminator;
- string value;
-
- void validate();
-
- public:
- Content();
- Content(uint8_t _discriminator, const string& _value);
- ~Content();
-
- void encode(Buffer& buffer) const;
- void decode(Buffer& buffer);
- size_t size() const;
- bool isInline() const { return discriminator == INLINE; }
- bool isReference() const { return discriminator == REFERENCE; }
- const string& getValue() const { return value; }
- void setValue(const string& newValue) { value = newValue; }
-
- friend std::ostream& operator<<(std::ostream&, const Content&);
-};
-
-}} // namespace qpid::framing
-
-
-#endif /*!_framing_FramingContent_h*/
diff --git a/qpid/cpp/src/qpid/framing/Handler.h b/qpid/cpp/src/qpid/framing/Handler.h
deleted file mode 100644
index fbf3c0b7ca..0000000000
--- a/qpid/cpp/src/qpid/framing/Handler.h
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef QPID_FRAMING_HANDLER_H
-#define QPID_FRAMING_HANDLER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/shared_ptr.h"
-#include <boost/type_traits/remove_reference.hpp>
-#include <assert.h>
-
-namespace qpid {
-namespace framing {
-
-/** Generic handler that can be linked into chains. */
-template <class T>
-struct Handler {
- typedef T HandledType;
- typedef void handleFptr(T);
- typedef void result_type; // Compatible with std/boost functors.
-
- Handler(Handler<T>* next_=0) : next(next_) {}
- virtual ~Handler() {}
- virtual void handle(T) = 0;
-
- /** Allow functor syntax for calling handle */
- void operator()(T t) { handle(t); }
-
-
- /** Pointer to next handler in a linked list. */
- Handler<T>* next;
-
- /** A Chain is a handler that forwards to a modifiable
- * linked list of handlers.
- */
- struct Chain : public Handler<T> {
- Chain(Handler<T>* first=0) : Handler(first) {}
- void operator=(Handler<T>* h) { next = h; }
- void handle(T t) { next->handle(t); }
- // TODO aconway 2007-08-29: chain modifier ops here.
- };
-
- /** In/out pair of handler chains. */
- struct Chains {
- Chains(Handler<T>* in_=0, Handler<T>* out_=0) : in(in_), out(out_) {}
- void reset(Handler<T>* in_=0, Handler<T>* out_=0) { in = in_; out = out_; }
- Chain in;
- Chain out;
- };
-
- /** Adapt any void(T) functor as a Handler.
- * Functor<F>(f) will copy f.
- * Functor<F&>(f) will only take a reference to x.
- */
- template <class F> class Functor : public Handler<T> {
- public:
- Functor(F f, Handler<T>* next=0) : Handler<T>(next), functor(f) {}
- void handle(T t) { functor(t); }
- private:
- F functor;
- };
-
- /** Adapt a member function of X as a Handler.
- * Only holds a reference to its target, not a copy.
- */
- template <class X, void (X::*F)(T)>
- class MemFunRef : public Handler<T> {
- public:
- MemFunRef(X& x, Handler<T>* next=0) : Handler(next), target(x) {}
- void handle(T t) { (target.*F)(t); }
-
- /** Allow calling with -> syntax, compatible with Chains */
- MemFunRef* operator->() { return this; }
-
- private:
- X& target;
- };
-
- /** Interface for a handler that implements a
- * pair of in/out handle operations.
- * @see InOutHandler
- */
- class InOutHandlerInterface {
- public:
- virtual ~InOutHandlerInterface() {}
- virtual void handleIn(T) = 0;
- virtual void handleOut(T) = 0;
- };
-
- /** Support for implementing an in-out handler pair as a single class.
- * Public interface is Handler<T>::Chains pair, but implementation
- * overrides handleIn, handleOut functions in a single class.
- */
- struct InOutHandler : protected InOutHandlerInterface {
- InOutHandler(Handler<T>* nextIn=0, Handler<T>* nextOut=0) : in(*this, nextIn), out(*this, nextOut) {}
- MemFunRef<InOutHandlerInterface, &InOutHandlerInterface::handleIn> in;
- MemFunRef<InOutHandlerInterface, &InOutHandlerInterface::handleOut> out;
- };
-
-};
-
-
-
-}}
-#endif /*!QPID_FRAMING_HANDLER_H*/
-//
diff --git a/qpid/cpp/src/qpid/framing/HeaderProperties.h b/qpid/cpp/src/qpid/framing/HeaderProperties.h
deleted file mode 100644
index 0c805922e8..0000000000
--- a/qpid/cpp/src/qpid/framing/HeaderProperties.h
+++ /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.
- *
- */
-#include "amqp_types.h"
-#include "Buffer.h"
-
-#ifndef _HeaderProperties_
-#define _HeaderProperties_
-
-namespace qpid {
-namespace framing {
-
- enum header_classes{BASIC = 60};
-
- class HeaderProperties
- {
-
- public:
- inline virtual ~HeaderProperties(){}
- virtual uint8_t classId() const = 0;
- virtual uint32_t size() const = 0;
- virtual void encode(Buffer& buffer) const = 0;
- virtual void decode(Buffer& buffer, uint32_t size) = 0;
- };
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/InitiationHandler.cpp b/qpid/cpp/src/qpid/framing/InitiationHandler.cpp
deleted file mode 100644
index eceeaf4abc..0000000000
--- a/qpid/cpp/src/qpid/framing/InitiationHandler.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "InitiationHandler.h"
-
-qpid::framing::InitiationHandler::~InitiationHandler() {}
diff --git a/qpid/cpp/src/qpid/framing/InitiationHandler.h b/qpid/cpp/src/qpid/framing/InitiationHandler.h
deleted file mode 100644
index 16a6b502e8..0000000000
--- a/qpid/cpp/src/qpid/framing/InitiationHandler.h
+++ /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.
- *
- */
-#include <string>
-
-#ifndef _InitiationHandler_
-#define _InitiationHandler_
-
-#include "ProtocolInitiation.h"
-
-namespace qpid {
-namespace framing {
-
- class InitiationHandler{
- public:
- virtual ~InitiationHandler();
- virtual void initiated(const ProtocolInitiation&) = 0;
- };
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/InputHandler.h b/qpid/cpp/src/qpid/framing/InputHandler.h
deleted file mode 100644
index 3a6d786a24..0000000000
--- a/qpid/cpp/src/qpid/framing/InputHandler.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _InputHandler_
-#define _InputHandler_
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "FrameHandler.h"
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
-namespace framing {
-
-// TODO aconway 2007-08-29: Eliminate, replace with FrameHandler.
-class InputHandler : public FrameHandler {
- public:
- virtual ~InputHandler() {}
- virtual void received(AMQFrame&) = 0;
- void handle(AMQFrame& f) { received(f); }
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/Invoker.h b/qpid/cpp/src/qpid/framing/Invoker.h
deleted file mode 100644
index e6467ab3c4..0000000000
--- a/qpid/cpp/src/qpid/framing/Invoker.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef QPID_FRAMING_INVOKER_H
-#define QPID_FRAMING_INVOKER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/framing/AMQMethodBody.h"
-#include "qpid/framing/MethodBodyDefaultVisitor.h"
-#include "qpid/framing/StructHelper.h"
-
-#include <boost/optional.hpp>
-
-namespace qpid {
-namespace framing {
-
-class AMQMethodBody;
-
-/**
- * Base class for invoker visitors.
- */
-class Invoker: public MethodBodyDefaultVisitor, protected StructHelper
-{
- public:
- struct Result {
- public:
- Result() : handled(false) {}
- const std::string& getResult() const { return result; }
- const bool hasResult() const { return !result.empty(); }
- bool wasHandled() const { return handled; }
- operator bool() const { return handled; }
-
- std::string result;
- bool handled;
- };
-
- void defaultVisit(const AMQMethodBody&) {}
- Result getResult() const { return result; }
-
- protected:
- Result result;
-};
-
-/**
- * Invoke on an invocable object.
- * Invocable classes must provide a nested type Invoker.
- */
-template <class Invocable>
-Invoker::Result invoke(Invocable& target, const AMQMethodBody& body) {
- typename Invocable::Invoker invoker(target);
- body.accept(invoker);
- return invoker.getResult();
-}
-
-/**
- * Invoke on an invocable object.
- * Invocable classes must provide a nested type Invoker.
- */
-template <class Invocable>
-Invoker::Result invoke(Invocable& target, const AMQBody& body) {
- typename Invocable::Invoker invoker(target);
- const AMQMethodBody* method = body.getMethod();
- if (method)
- method->accept(invoker);
- return invoker.getResult();
-}
-
-}} // namespace qpid::framing
-
-#endif /*!QPID_FRAMING_INVOKER_H*/
diff --git a/qpid/cpp/src/qpid/framing/MethodContent.h b/qpid/cpp/src/qpid/framing/MethodContent.h
deleted file mode 100644
index 737c0d6b7b..0000000000
--- a/qpid/cpp/src/qpid/framing/MethodContent.h
+++ /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.
- *
- */
-#ifndef _MethodContent_
-#define _MethodContent_
-
-#include <string>
-#include "AMQHeaderBody.h"
-
-namespace qpid {
-namespace framing {
-
-class MethodContent
-{
-public:
- virtual ~MethodContent() {}
- //TODO: rethink this interface
- virtual AMQHeaderBody getHeader() const = 0;
- virtual const std::string& getData() const = 0;
-};
-
-}}
-#endif
diff --git a/qpid/cpp/src/qpid/framing/ModelMethod.h b/qpid/cpp/src/qpid/framing/ModelMethod.h
deleted file mode 100644
index f3c0fa5d65..0000000000
--- a/qpid/cpp/src/qpid/framing/ModelMethod.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef _ModelMethod_
-#define _ModelMethod_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "AMQMethodBody.h"
-#include "qpid/framing/ExecutionHeader.h"
-
-namespace qpid {
-namespace framing {
-
-
-class ModelMethod : public AMQMethodBody
-{
- mutable ExecutionHeader header;
-public:
- virtual ~ModelMethod() {}
- virtual void encode(Buffer& buffer) const { header.encode(buffer); }
- virtual void decode(Buffer& buffer, uint32_t size=0) { header.decode(buffer, size); }
- virtual uint32_t size() const { return header.size(); }
- virtual bool isSync() const { return header.getSync(); }
- virtual void setSync(bool on) const { header.setSync(on); }
- ExecutionHeader& getHeader() { return header; }
- const ExecutionHeader& getHeader() const { return header; }
-};
-
-
-}} // namespace qpid::framing
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/OutputHandler.h b/qpid/cpp/src/qpid/framing/OutputHandler.h
deleted file mode 100644
index 6f4b27fb72..0000000000
--- a/qpid/cpp/src/qpid/framing/OutputHandler.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _OutputHandler_
-#define _OutputHandler_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <boost/noncopyable.hpp>
-#include "FrameHandler.h"
-
-namespace qpid {
-namespace framing {
-
-// TODO aconway 2007-08-29: Replace with FrameHandler.
-class OutputHandler : public FrameHandler {
- public:
- virtual ~OutputHandler() {}
- virtual void send(AMQFrame&) = 0;
- void handle(AMQFrame& f) { send(f); }
-};
-
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/ProtocolInitiation.cpp b/qpid/cpp/src/qpid/framing/ProtocolInitiation.cpp
deleted file mode 100644
index 7164bceb12..0000000000
--- a/qpid/cpp/src/qpid/framing/ProtocolInitiation.cpp
+++ /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.
- *
- */
-#include "ProtocolInitiation.h"
-
-namespace qpid {
-namespace framing {
-
-ProtocolInitiation::ProtocolInitiation(){}
-
-ProtocolInitiation::ProtocolInitiation(uint8_t _major, uint8_t _minor) : version(_major, _minor) {}
-
-ProtocolInitiation::ProtocolInitiation(ProtocolVersion p) : version(p) {}
-
-ProtocolInitiation::~ProtocolInitiation(){}
-
-void ProtocolInitiation::encode(Buffer& buffer) const {
- buffer.putOctet('A');
- buffer.putOctet('M');
- buffer.putOctet('Q');
- buffer.putOctet('P');
- buffer.putOctet(1);//class
- buffer.putOctet(1);//instance
- buffer.putOctet(version.getMajor());
- buffer.putOctet(version.getMinor());
-}
-
-bool ProtocolInitiation::decode(Buffer& buffer){
- if(buffer.available() >= 8){
- buffer.getOctet();//A
- buffer.getOctet();//M
- buffer.getOctet();//Q
- buffer.getOctet();//P
- buffer.getOctet();//class
- buffer.getOctet();//instance
- version.setMajor(buffer.getOctet());
- version.setMinor(buffer.getOctet());
- return true;
- }else{
- return false;
- }
-}
-
-//TODO: this should prbably be generated from the spec at some point to keep the version numbers up to date
-
-}} // namespace qpid::framing
diff --git a/qpid/cpp/src/qpid/framing/ProtocolInitiation.h b/qpid/cpp/src/qpid/framing/ProtocolInitiation.h
deleted file mode 100644
index 31c73eb124..0000000000
--- a/qpid/cpp/src/qpid/framing/ProtocolInitiation.h
+++ /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.
- *
- */
-#include "amqp_types.h"
-#include "Buffer.h"
-#include "AMQDataBlock.h"
-#include "ProtocolVersion.h"
-
-#ifndef _ProtocolInitiation_
-#define _ProtocolInitiation_
-
-namespace qpid {
-namespace framing {
-
-class ProtocolInitiation : public AMQDataBlock
-{
-private:
- ProtocolVersion version;
-
-public:
- ProtocolInitiation();
- ProtocolInitiation(uint8_t major, uint8_t minor);
- ProtocolInitiation(ProtocolVersion p);
- virtual ~ProtocolInitiation();
- virtual void encode(Buffer& buffer) const;
- virtual bool decode(Buffer& buffer);
- inline virtual uint32_t size() const { return 8; }
- inline uint8_t getMajor() const { return version.getMajor(); }
- inline uint8_t getMinor() const { return version.getMinor(); }
- inline ProtocolVersion getVersion() const { return version; }
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/ProtocolVersion.cpp b/qpid/cpp/src/qpid/framing/ProtocolVersion.cpp
deleted file mode 100644
index 7a96bfa925..0000000000
--- a/qpid/cpp/src/qpid/framing/ProtocolVersion.cpp
+++ /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.
- *
- */
-#include "ProtocolVersion.h"
-#include <sstream>
-
-using namespace qpid::framing;
-
-const std::string ProtocolVersion::toString() const
-{
- std::stringstream ss;
- ss << major_ << "-" << minor_;
- return ss.str();
-}
-
-ProtocolVersion& ProtocolVersion::operator=(ProtocolVersion p)
-{
- major_ = p.major_;
- minor_ = p.minor_;
- return *this;
-}
-
-bool ProtocolVersion::operator==(ProtocolVersion p) const
-{
- return major_ == p.major_ && minor_ == p.minor_;
-}
-
diff --git a/qpid/cpp/src/qpid/framing/ProtocolVersion.h b/qpid/cpp/src/qpid/framing/ProtocolVersion.h
deleted file mode 100644
index a2a755397b..0000000000
--- a/qpid/cpp/src/qpid/framing/ProtocolVersion.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _ProtocolVersion_
-#define _ProtocolVersion_
-
-#include "amqp_types.h"
-
-namespace qpid
-{
-namespace framing
-{
-
-class ProtocolVersion
-{
-private:
- uint8_t major_;
- uint8_t minor_;
-
-public:
- ProtocolVersion(uint8_t _major=0, uint8_t _minor=0)
- : major_(_major), minor_(_minor) {}
-
- uint8_t getMajor() const { return major_; }
- void setMajor(uint8_t major) { major_ = major; }
- uint8_t getMinor() const { return minor_; }
- void setMinor(uint8_t minor) { minor_ = minor; }
- const std::string toString() const;
-
- ProtocolVersion& operator=(ProtocolVersion p);
-
- bool operator==(ProtocolVersion p) const;
- bool operator!=(ProtocolVersion p) const { return ! (*this == p); }
-};
-
-} // namespace framing
-} // namespace qpid
-
-
-#endif // ifndef _ProtocolVersion_
diff --git a/qpid/cpp/src/qpid/framing/Proxy.cpp b/qpid/cpp/src/qpid/framing/Proxy.cpp
deleted file mode 100644
index b47060028f..0000000000
--- a/qpid/cpp/src/qpid/framing/Proxy.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Proxy.h"
-#include "AMQFrame.h"
-
-namespace qpid {
-namespace framing {
-
-Proxy::~Proxy() {}
-
-void Proxy::send(const AMQBody& b) {
- AMQFrame f(b);
- out.handle(f);
-}
-
-
-ProtocolVersion Proxy::getVersion() const {
- return ProtocolVersion();
-}
-
-}} // namespace qpid::framing
diff --git a/qpid/cpp/src/qpid/framing/Proxy.h b/qpid/cpp/src/qpid/framing/Proxy.h
deleted file mode 100644
index 86b99a83b0..0000000000
--- a/qpid/cpp/src/qpid/framing/Proxy.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _framing_Proxy_h
-#define _framing_Proxy_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "FrameHandler.h"
-#include "ProtocolVersion.h"
-
-namespace qpid {
-namespace framing {
-
-class AMQBody;
-
-/**
- * Base class for proxies.
- */
-class Proxy
-{
- public:
- Proxy(FrameHandler& h) : out(h) {}
- virtual ~Proxy();
-
- void send(const AMQBody&);
-
- ProtocolVersion getVersion() const;
- FrameHandler& getHandler() { return out; }
-
- protected:
- FrameHandler& out;
-};
-
-}} // namespace qpid::framing
-
-
-
-#endif /*!_framing_Proxy_h*/
diff --git a/qpid/cpp/src/qpid/framing/SendContent.cpp b/qpid/cpp/src/qpid/framing/SendContent.cpp
deleted file mode 100644
index a62e4eeb72..0000000000
--- a/qpid/cpp/src/qpid/framing/SendContent.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "SendContent.h"
-
-qpid::framing::SendContent::SendContent(FrameHandler& h, uint16_t mfs, uint efc) : handler(h),
- maxFrameSize(mfs),
- expectedFrameCount(efc), frameCount(0) {}
-
-void qpid::framing::SendContent::operator()(const AMQFrame& f)
-{
- bool first = frameCount == 0;
- bool last = ++frameCount == expectedFrameCount;
-
- /*end of frame marker is included in frameOverhead() but not in
- real frame size, hence substract -1 from frameOverhead()*/
- uint16_t maxContentSize = maxFrameSize - (AMQFrame::frameOverhead() - 1);
- const AMQContentBody* body(f.castBody<AMQContentBody>());
- if (body->size() > maxContentSize) {
- uint32_t offset = 0;
- for (int chunk = body->size() / maxContentSize; chunk > 0; chunk--) {
- sendFragment(*body, offset, maxContentSize, first && offset == 0, last && offset + maxContentSize == body->size());
- offset += maxContentSize;
- }
- uint32_t remainder = body->size() % maxContentSize;
- if (remainder) {
- sendFragment(*body, offset, remainder, first && offset == 0, last);
- }
- } else {
- AMQFrame copy(f);
- setFlags(copy, first, last);
- handler.handle(copy);
- }
-}
-
-void qpid::framing::SendContent::sendFragment(const AMQContentBody& body, uint32_t offset, uint16_t size, bool first, bool last) const
-{
- AMQFrame fragment(in_place<AMQContentBody>(
- body.getData().substr(offset, size)));
- setFlags(fragment, first, last);
- handler.handle(fragment);
-}
-
-void qpid::framing::SendContent::setFlags(AMQFrame& f, bool first, bool last) const
-{
- f.setBof(false);
- f.setBos(first);
- f.setEof(true);//content is always the last segment
- f.setEos(last);
-}
-
diff --git a/qpid/cpp/src/qpid/framing/SendContent.h b/qpid/cpp/src/qpid/framing/SendContent.h
deleted file mode 100644
index dcd5202b3e..0000000000
--- a/qpid/cpp/src/qpid/framing/SendContent.h
+++ /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.
- *
- */
-#include <string>
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/FrameHandler.h"
-
-#ifndef _SendContent_
-#define _SendContent_
-
-namespace qpid {
-namespace framing {
-
-/**
- * Functor that sends frame to handler, refragmenting if
- * necessary. Currently only works on content frames but this could be
- * changed once we support multi-frame segments in general.
- */
-class SendContent
-{
- mutable FrameHandler& handler;
- const uint16_t maxFrameSize;
- uint expectedFrameCount;
- uint frameCount;
-
- void sendFragment(const AMQContentBody& body, uint32_t offset, uint16_t size, bool first, bool last) const;
- void setFlags(AMQFrame& f, bool first, bool last) const;
-public:
- SendContent(FrameHandler& _handler, uint16_t _maxFrameSize, uint frameCount);
- void operator()(const AMQFrame& f);
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/SequenceNumber.cpp b/qpid/cpp/src/qpid/framing/SequenceNumber.cpp
deleted file mode 100644
index 3172246cc2..0000000000
--- a/qpid/cpp/src/qpid/framing/SequenceNumber.cpp
+++ /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.
- *
- */
-
-#include "SequenceNumber.h"
-
-using qpid::framing::SequenceNumber;
-
-SequenceNumber::SequenceNumber() : value(0 - 1) {}
-
-SequenceNumber::SequenceNumber(uint32_t v) : value((int32_t) v) {}
-
-bool SequenceNumber::operator==(const SequenceNumber& other) const
-{
- return value == other.value;
-}
-
-bool SequenceNumber::operator!=(const SequenceNumber& other) const
-{
- return !(value == other.value);
-}
-
-
-SequenceNumber& SequenceNumber::operator++()
-{
- value = value + 1;
- return *this;
-}
-
-const SequenceNumber SequenceNumber::operator++(int)
-{
- SequenceNumber old(value);
- value = value + 1;
- return old;
-}
-
-SequenceNumber SequenceNumber::operator+(uint32_t i) const
-{
- return SequenceNumber(value + i);
-}
-
-bool SequenceNumber::operator<(const SequenceNumber& other) const
-{
- return (value - other.value) < 0;
-}
-
-bool SequenceNumber::operator>(const SequenceNumber& other) const
-{
- return other < *this;
-}
-
-bool SequenceNumber::operator<=(const SequenceNumber& other) const
-{
- return *this == other || *this < other;
-}
-
-bool SequenceNumber::operator>=(const SequenceNumber& other) const
-{
- return *this == other || *this > other;
-}
-
-namespace qpid {
-namespace framing {
-
-int32_t operator-(const SequenceNumber& a, const SequenceNumber& b)
-{
- int32_t result = a.value - b.value;
- return result;
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/framing/SequenceNumber.h b/qpid/cpp/src/qpid/framing/SequenceNumber.h
deleted file mode 100644
index b2594452d0..0000000000
--- a/qpid/cpp/src/qpid/framing/SequenceNumber.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _framing_SequenceNumber_h
-#define _framing_SequenceNumber_h
-
-#include "amqp_types.h"
-
-namespace qpid {
-namespace framing {
-
-/**
- * 4-byte sequence number that 'wraps around'.
- */
-class SequenceNumber
-{
- int32_t value;
-
- public:
- SequenceNumber();
- SequenceNumber(uint32_t v);
-
- SequenceNumber& operator++();//prefix ++
- const SequenceNumber operator++(int);//postfix ++
- SequenceNumber operator+(uint32_t) const;
- bool operator==(const SequenceNumber& other) const;
- bool operator!=(const SequenceNumber& other) const;
- bool operator<(const SequenceNumber& other) const;
- bool operator>(const SequenceNumber& other) const;
- bool operator<=(const SequenceNumber& other) const;
- bool operator>=(const SequenceNumber& other) const;
- uint32_t getValue() const { return (uint32_t) value; }
- operator uint32_t() const { return (uint32_t) value; }
-
- friend int32_t operator-(const SequenceNumber& a, const SequenceNumber& b);
-
- template <class S> void serialize(S& s) { s(value); }
-};
-
-struct Window
-{
- SequenceNumber hwm;
- SequenceNumber lwm;
-};
-
-}} // namespace qpid::framing
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/SequenceNumberSet.cpp b/qpid/cpp/src/qpid/framing/SequenceNumberSet.cpp
deleted file mode 100644
index afab9033e5..0000000000
--- a/qpid/cpp/src/qpid/framing/SequenceNumberSet.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "SequenceNumberSet.h"
-
-using namespace qpid::framing;
-
-void SequenceNumberSet::encode(Buffer& buffer) const
-{
- buffer.putShort(size() * 4);
- for (const_iterator i = begin(); i != end(); i++) {
- buffer.putLong(i->getValue());
- }
-}
-
-void SequenceNumberSet::decode(Buffer& buffer)
-{
- uint16_t count = (buffer.getShort() / 4);
- for (uint16_t i = 0; i < count; i++) {
- push_back(SequenceNumber(buffer.getLong()));
- }
-}
-
-uint32_t SequenceNumberSet::encodedSize() const
-{
- return 2 /*count*/ + (size() * 4);
-}
-
-SequenceNumberSet SequenceNumberSet::condense() const
-{
- SequenceNumberSet result;
- const_iterator last = end();
- const_iterator start = end();
- for (const_iterator i = begin(); i != end(); i++) {
- if (start == end()) {
- start = i;
- } else if (*i - *last > 1) {
- result.push_back(*start);
- result.push_back(*last);
- start = i;
- }
- last = i;
- }
- if (start != end()) {
- result.push_back(*start);
- result.push_back(*last);
- }
- return result;
-}
-
-void SequenceNumberSet::addRange(const SequenceNumber& start, const SequenceNumber& end)
-{
- push_back(start);
- push_back(end);
-}
-
-namespace qpid{
-namespace framing{
-
-std::ostream& operator<<(std::ostream& out, const SequenceNumberSet& set) {
- out << "{";
- for (SequenceNumberSet::const_iterator i = set.begin(); i != set.end(); i++) {
- if (i != set.begin()) out << ", ";
- out << (i->getValue());
- }
- out << "}";
- return out;
-}
-
-}
-}
diff --git a/qpid/cpp/src/qpid/framing/SequenceNumberSet.h b/qpid/cpp/src/qpid/framing/SequenceNumberSet.h
deleted file mode 100644
index 666307f9d9..0000000000
--- a/qpid/cpp/src/qpid/framing/SequenceNumberSet.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _framing_SequenceNumberSet_h
-#define _framing_SequenceNumberSet_h
-
-#include <ostream>
-#include "amqp_types.h"
-#include "Buffer.h"
-#include "SequenceNumber.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/InlineVector.h"
-
-namespace qpid {
-namespace framing {
-
-class SequenceNumberSet : public InlineVector<SequenceNumber, 2>
-{
- typedef InlineVector<SequenceNumber, 2> Base;
-public:
- typedef Base::const_iterator const_iterator;
- typedef Base::iterator iterator;
-
- void encode(Buffer& buffer) const;
- void decode(Buffer& buffer);
- uint32_t encodedSize() const;
- SequenceNumberSet condense() const;
- void addRange(const SequenceNumber& start, const SequenceNumber& end);
-
- template <class T>
- void processRanges(T& t) const
- {
- if (size() % 2) { //must be even number
- throw InvalidArgumentException("SequenceNumberSet contains odd number of elements");
- }
-
- for (SequenceNumberSet::const_iterator i = begin(); i != end(); i++) {
- SequenceNumber first = *(i);
- SequenceNumber last = *(++i);
- t(first, last);
- }
- }
-
- friend std::ostream& operator<<(std::ostream&, const SequenceNumberSet&);
-};
-
-
-}} // namespace qpid::framing
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/SerializeHandler.h b/qpid/cpp/src/qpid/framing/SerializeHandler.h
deleted file mode 100644
index 55bd7da08c..0000000000
--- a/qpid/cpp/src/qpid/framing/SerializeHandler.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef QPID_FRAMING_SERIALIZEHANDLER_H
-#define QPID_FRAMING_SERIALIZEHANDLER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/sys/Serializer.h"
-#include "qpid/framing/Handler.h"
-
-#include <boost/bind.hpp>
-
-namespace qpid {
-namespace framing {
-
-
-/** Serializer that can be inserted into a Handler chain */
-template <class T>
-struct SerializeHandler : public framing::Handler<T>, public sys::Serializer {
- SerializeHandler(typename framing::Handler<T>::Chain next)
- : framing::Handler<T>(next) {}
- void handle(T value) {
- execute(boost::bind(&framing::Handler<T>::handle, this->next.get(), value));
- }
-};
-
-}} // namespace qpid::framing
-
-
-
-
-
-#endif /*!QPID_FRAMING_SERIALIZEHANDLER_H*/
diff --git a/qpid/cpp/src/qpid/framing/SessionState.cpp b/qpid/cpp/src/qpid/framing/SessionState.cpp
deleted file mode 100644
index f9019b036c..0000000000
--- a/qpid/cpp/src/qpid/framing/SessionState.cpp
+++ /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 WARRANTIE4bS OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "SessionState.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/framing/constants.h"
-#include "qpid/framing/AMQMethodBody.h"
-#include "qpid/log/Statement.h"
-
-#include <algorithm>
-
-#include <boost/bind.hpp>
-#include <boost/none.hpp>
-
-namespace qpid {
-namespace framing {
-
-SessionState::SessionState(uint32_t ack, bool enableReplay, const Uuid& uuid) :
- state(ATTACHED),
- id(uuid),
- lastReceived(-1),
- lastSent(-1),
- ackInterval(ack),
- sendAckAt(lastReceived+ackInterval),
- solicitAckAt(lastSent+ackInterval),
- ackSolicited(false),
- resumable(enableReplay)
-{}
-
-SessionState::SessionState(const Uuid& uuid) :
- state(ATTACHED),
- id(uuid),
- lastReceived(-1),
- lastSent(-1),
- ackInterval(0),
- sendAckAt(0),
- solicitAckAt(0),
- ackSolicited(false),
- resumable(false)
-{
-}
-namespace {
-bool isSessionCommand(const AMQFrame& f) {
- return f.getMethod() && f.getMethod()->amqpClassId() == SESSION_CLASS_ID;
-}
-}
-
-boost::optional<SequenceNumber> SessionState::received(const AMQFrame& f) {
- if (isSessionCommand(f))
- return boost::none;
- if (state==RESUMING)
- throw CommandInvalidException(
- QPID_MSG("Invalid frame: Resuming session, expected session-ack"));
- assert(state = ATTACHED);
- ++lastReceived;
- if (ackInterval && lastReceived == sendAckAt)
- return sendingAck();
- else
- return boost::none;
-}
-
-bool SessionState::sent(const AMQFrame& f) {
- if (isSessionCommand(f))
- return false;
- if (resumable) {
- sys::Mutex::ScopedLock l(unackedLock);
- unackedOut.push_back(f);
- }
- ++lastSent;
- return ackInterval &&
- (state!=RESUMING) &&
- (lastSent == solicitAckAt) &&
- sendingSolicit();
-}
-
-SessionState::Replay SessionState::replay() {
- sys::Mutex::ScopedLock l(unackedLock);
- Replay r(unackedOut.size());
- std::copy(unackedOut.begin(), unackedOut.end(), r.begin());
- return r;
-}
-
-void SessionState::receivedAck(SequenceNumber acked) {
- if (state==RESUMING) state=ATTACHED;
- assert(state==ATTACHED);
- if (lastSent < acked)
- throw InvalidArgumentException("Invalid sequence number in ack");
- size_t keep = lastSent - acked;
- if (keep < unackedOut.size()) {
- sys::Mutex::ScopedLock l(unackedLock);
- unackedOut.erase(unackedOut.begin(), unackedOut.end()-keep);
- }
- solicitAckAt = std::max(solicitAckAt, SequenceNumber(acked+ackInterval));
-}
-
-SequenceNumber SessionState::sendingAck() {
- sendAckAt = lastReceived+ackInterval;
- return lastReceived;
-}
-
-bool SessionState::sendingSolicit() {
- assert(state == ATTACHED);
- if (ackSolicited)
- return false;
- solicitAckAt = lastSent + ackInterval;
- return ackInterval != 0;
-}
-
-SequenceNumber SessionState::resuming() {
- if (!resumable)
- throw InternalErrorException("Session is not resumable");
- state = RESUMING;
- return sendingAck();
-}
-
-void SessionState::suspend() {
- state = SUSPENDED;
-}
-
-}} // namespace qpid::framing
diff --git a/qpid/cpp/src/qpid/framing/SessionState.h b/qpid/cpp/src/qpid/framing/SessionState.h
deleted file mode 100644
index 066bece003..0000000000
--- a/qpid/cpp/src/qpid/framing/SessionState.h
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifndef QPID_FRAMING_SESSIONSTATE_H
-#define QPID_FRAMING_SESSIONSTATE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/framing/Uuid.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/sys/Mutex.h"
-
-#include <boost/optional.hpp>
-
-#include <deque>
-
-namespace qpid {
-namespace framing {
-
-/**
- * Session state common to client and broker.
- * Stores replay frames, implements session ack/resume protcools.
- *
- * A SessionState is always associated with an _open_ session (attached or
- * suspended) it is destroyed when the session is closed.
- *
- */
-class SessionState
-{
- public:
- typedef std::vector<AMQFrame> Replay;
-
- /** States of a session. */
- enum State {
- SUSPENDED, ///< Suspended, detached from any channel.
- RESUMING, ///< Resuming: waiting for initial ack from peer.
- ATTACHED ///< Attached to channel and operating normally.
- };
-
- /**
- *Create a newly opened active session.
- *@param ackInterval send/solicit an ack whenever N unacked frames
- * have been received/sent.
- *
- * N=0 disables voluntary send/solict ack.
- */
- SessionState(uint32_t ackInterval, bool enableReplay = true, const framing::Uuid& id=framing::Uuid(true));
-
- /**
- * Create a non-resumable session. Does not store session frames,
- * never volunteers ack or solicit-ack.
- */
- SessionState(const framing::Uuid& id=framing::Uuid(true));
-
- const framing::Uuid& getId() const { return id; }
- State getState() const { return state; }
-
- /** Received incoming L3 frame.
- * @return SequenceNumber if an ack should be sent, empty otherwise.
- * SessionState assumes that acks are sent whenever it returns
- * a seq. number.
- */
- boost::optional<SequenceNumber> received(const AMQFrame&);
-
- /** Sent outgoing L3 frame.
- *@return true if solicit-ack should be sent. Note the SessionState
- *assumes that a solicit-ack is sent every time it returns true.
- */
- bool sent(const AMQFrame&);
-
- /** Received normal incoming ack. */
- void receivedAck(SequenceNumber);
-
- /** Frames to replay
- *@pre getState()==ATTACHED
- */
- Replay replay();
-
- /** Suspend the session. */
- void suspend();
-
- /** Start resume protocol for the session.
- *@returns sequence number to ack immediately. */
- SequenceNumber resuming();
-
- /** About to send an unscheduled ack, e.g. to respond to a solicit-ack.
- *
- * Note: when received() returns a sequence number this function
- * should not be called. SessionState assumes that the ack is sent
- * every time received() returns a sequence number.
- */
- SequenceNumber sendingAck();
-
- SequenceNumber getLastSent() const { return lastSent; }
- SequenceNumber getLastReceived() const { return lastReceived; }
-
- private:
- typedef std::deque<AMQFrame> Unacked;
-
- bool sendingSolicit();
-
- State state;
- framing::Uuid id;
-
- Unacked unackedOut;
- SequenceNumber lastReceived;
- SequenceNumber lastSent;
- uint32_t ackInterval;
- SequenceNumber sendAckAt;
- SequenceNumber solicitAckAt;
- bool ackSolicited;
- bool suspending;
- bool resumable;
- sys::Mutex unackedLock;
-};
-
-
-}} // namespace qpid::common
-
-
-#endif /*!QPID_FRAMING_SESSIONSTATE_H*/
diff --git a/qpid/cpp/src/qpid/framing/StructHelper.h b/qpid/cpp/src/qpid/framing/StructHelper.h
deleted file mode 100644
index ad6ba89906..0000000000
--- a/qpid/cpp/src/qpid/framing/StructHelper.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _StructHelper_
-#define _StructHelper_
-
-#include "qpid/Exception.h"
-#include "Buffer.h"
-
-#include <stdlib.h> // For alloca
-
-namespace qpid {
-namespace framing {
-
-class StructHelper
-{
-public:
-
- template <class T> void encode(const T t, std::string& data) {
- uint32_t size = t.size() + 2/*type*/;
- data.resize(size);
- Buffer wbuffer(const_cast<char*>(data.data()), size);
- wbuffer.putShort(T::TYPE);
- t.encodeStructBody(wbuffer);
- }
-
- template <class T> void decode(T& t, const std::string& data) {
- Buffer rbuffer(const_cast<char*>(data.data()), data.length());
- uint16_t type = rbuffer.getShort();
- if (type == T::TYPE) {
- t.decodeStructBody(rbuffer);
- } else {
- throw Exception("Type code does not match");
- }
- }
-};
-
-}}
-#endif
diff --git a/qpid/cpp/src/qpid/framing/TemplateVisitor.h b/qpid/cpp/src/qpid/framing/TemplateVisitor.h
deleted file mode 100644
index 8c719e5110..0000000000
--- a/qpid/cpp/src/qpid/framing/TemplateVisitor.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef QPID_FRAMING_TEMPLATEVISITOR_H
-#define QPID_FRAMING_TEMPLATEVISITOR_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <boost/mpl/fold.hpp>
-#include <boost/utility/value_init.hpp>
-
-namespace qpid {
-namespace framing {
-
-/**
- * Metafunction to generate a visitor class derived from Base with a
- * visit for each type in TypeList calling functor F. TypeList may be
- * any boost::mpl type collection e.g. mpl::list.
- *
- * Generated class is: TemplateVisitor<Base, F, TypeList>::type
- *
- * @see make_visitor
- */
-template <class VisitTemplate, class TypeList, class F>
-class TemplateVisitor
-{
- struct Base : public VisitorBase {
- F action;
- Base(F f) : action(f) {}
- using VisitorBase::visit;
- };
-
- template <class B, class T> struct Visit : public B {
- Visit(F action) : B(action) {}
- using B::visit;
- void visit(const T& body) { action(body); }
- };
-
- typedef typename boost::mpl::fold<
- TypeList, Base, Visit<boost::mpl::placeholders::_1,
- boost::mpl::placeholders::_2>
- >::type type;
-};
-
-/**
- * Construct a TemplateVisitor to perform the given action,
- * for example:
- * @code
- */
-template <class VisitorBase, class TypeList, class F>
-TemplateVisitor<VisitorBase,TypeList,F>::type make_visitor(F action) {
- return TemplateVisitor<VisitorBase,TypeList,F>::type(action);
-};
-
-/**
- * For method body classes in TypeList, invoke the corresponding function
- * on Target and return true. For other body types return false.
- */
-template <class TypeList, class Target>
-bool invoke(const AMQBody& body, Target& target) {
- typename InvokeVisitor<TypeList, Target>::type v(target);
- body.accept(v);
- return v.target;
-}
-
-}} // namespace qpid::framing
-
-
-#endif /*!QPID_FRAMING_INVOKEVISITOR_H*/
-
-}} // namespace qpid::framing
-
-
-
-#endif /*!QPID_FRAMING_TEMPLATEVISITOR_H*/
diff --git a/qpid/cpp/src/qpid/framing/TransferContent.cpp b/qpid/cpp/src/qpid/framing/TransferContent.cpp
deleted file mode 100644
index 99f5d365e8..0000000000
--- a/qpid/cpp/src/qpid/framing/TransferContent.cpp
+++ /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.
- *
- */
-
-#include "TransferContent.h"
-
-namespace qpid {
-namespace framing {
-
-TransferContent::TransferContent(const std::string& data,
- const std::string& routingKey,
- const std::string& exchange)
-{
- setData(data);
- if (routingKey.size()) getDeliveryProperties().setRoutingKey(routingKey);
- if (exchange.size()) getDeliveryProperties().setExchange(exchange);
-}
-
-AMQHeaderBody TransferContent::getHeader() const
-{
- return header;
-}
-
-const std::string& TransferContent::getData() const
-{
- return data;
-}
-
-void TransferContent::setData(const std::string& _data)
-{
- data = _data;
- header.get<MessageProperties>(true)->setContentLength(data.size());
-}
-
-void TransferContent::appendData(const std::string& _data)
-{
- data += _data;
- header.get<MessageProperties>(true)->setContentLength(data.size());
-}
-
-MessageProperties& TransferContent::getMessageProperties()
-{
- return *header.get<MessageProperties>(true);
-}
-
-DeliveryProperties& TransferContent::getDeliveryProperties()
-{
- return *header.get<DeliveryProperties>(true);
-}
-
-void TransferContent::populate(const FrameSet& frameset)
-{
- const AMQHeaderBody* h = frameset.getHeaders();
- if (h) {
- header = *h;
- }
- frameset.getContent(data);
-}
-
-const MessageProperties& TransferContent::getMessageProperties() const
-{
- const MessageProperties* props = header.get<MessageProperties>();
- if (!props) throw Exception("No message properties.");
- return *props;
-}
-
-const DeliveryProperties& TransferContent::getDeliveryProperties() const
-{
- const DeliveryProperties* props = header.get<DeliveryProperties>();
- if (!props) throw Exception("No message properties.");
- return *props;
-}
-
-bool TransferContent::hasMessageProperties() const
-{
- return header.get<MessageProperties>();
-}
-
-bool TransferContent::hasDeliveryProperties() const
-{
- return header.get<DeliveryProperties>();
-}
-
-
-}}
diff --git a/qpid/cpp/src/qpid/framing/TransferContent.h b/qpid/cpp/src/qpid/framing/TransferContent.h
deleted file mode 100644
index 88f45b7e0a..0000000000
--- a/qpid/cpp/src/qpid/framing/TransferContent.h
+++ /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.
- *
- */
-#ifndef _TransferContent_
-#define _TransferContent_
-
-#include "FrameSet.h"
-#include "MethodContent.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/MessageProperties.h"
-#include "qpid/framing/DeliveryProperties.h"
-
-namespace qpid {
-namespace framing {
-
-class TransferContent : public MethodContent
-{
- AMQHeaderBody header;
- std::string data;
-public:
- TransferContent(const std::string& data = std::string(),
- const std::string& routingKey = std::string(),
- const std::string& exchange = std::string());
-
- AMQHeaderBody getHeader() const;
- void setData(const std::string&);
- void appendData(const std::string&);
- MessageProperties& getMessageProperties();
- DeliveryProperties& getDeliveryProperties();
-
- const std::string& getData() const;
- const MessageProperties& getMessageProperties() const;
- const DeliveryProperties& getDeliveryProperties() const;
- bool hasMessageProperties() const;
- bool hasDeliveryProperties() const;
-
- void populate(const FrameSet& frameset);
-};
-
-}}
-#endif
diff --git a/qpid/cpp/src/qpid/framing/TypeFilter.h b/qpid/cpp/src/qpid/framing/TypeFilter.h
deleted file mode 100644
index d1c42de583..0000000000
--- a/qpid/cpp/src/qpid/framing/TypeFilter.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef QPID_FRAMING_TYPEFILTER_H
-#define QPID_FRAMING_TYPEFILTER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <string>
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/FrameHandler.h"
-
-namespace qpid {
-namespace framing {
-
-/**
- * Predicate that selects frames by type
- */
-template <uint8_t Type>
-struct TypeFilter {
- bool operator()(const AMQFrame& f) const {
- return f.getBody()->type() == Type;
- }
-};
-
-template <uint8_t T1, uint8_t T2>
-struct TypeFilter2 {
- bool operator()(const AMQFrame& f) const {
- return f.getBody()->type() == T1 || f.getBody()->type() == T2;
- }
-};
-
-}} // namespace qpid::framing
-
-#endif /*!QPID_FRAMING_TYPEFILTER_H*/
diff --git a/qpid/cpp/src/qpid/framing/Uuid.cpp b/qpid/cpp/src/qpid/framing/Uuid.cpp
deleted file mode 100644
index 2918c48ce3..0000000000
--- a/qpid/cpp/src/qpid/framing/Uuid.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Uuid.h"
-#include "qpid/Exception.h"
-#include "qpid/framing/Buffer.h"
-#include "qpid/framing/reply_exceptions.h"
-
-namespace qpid {
-namespace framing {
-
-using namespace std;
-
-static const size_t UNPARSED_SIZE=36;
-
-void Uuid::encode(Buffer& buf) const {
- buf.putRawData(data(), size());
-}
-
-void Uuid::decode(Buffer& buf) {
- if (buf.available() < size())
- throw SyntaxErrorException(QPID_MSG("Not enough data for UUID."));
- buf.getRawData(c_array(), size());
-}
-
-ostream& operator<<(ostream& out, const Uuid& uuid) {
- char unparsed[UNPARSED_SIZE + 1];
- uuid_unparse(uuid.data(), unparsed);
- return out << unparsed;
-}
-
-istream& operator>>(istream& in, Uuid& uuid) {
- char unparsed[UNPARSED_SIZE + 1] = {0};
- in.get(unparsed, sizeof(unparsed));
- if (uuid_parse(unparsed, uuid.c_array()) != 0)
- in.setstate(ios::failbit);
- return in;
-}
-
-std::string Uuid::str() const {
- std::ostringstream os;
- os << *this;
- return os.str();
-}
-
-}} // namespace qpid::framing
diff --git a/qpid/cpp/src/qpid/framing/Uuid.h b/qpid/cpp/src/qpid/framing/Uuid.h
deleted file mode 100644
index 278a60c439..0000000000
--- a/qpid/cpp/src/qpid/framing/Uuid.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef QPID_FRAMING_UUID_H
-#define QPID_FRAMING_UUID_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <boost/array.hpp>
-
-#include <ostream>
-#include <istream>
-
-#include <uuid/uuid.h>
-
-namespace qpid {
-namespace framing {
-
-class Buffer;
-
-/**
- * A UUID is represented as a boost::array of 16 bytes.
- *
- * Full value semantics, operators ==, < etc. are provided by
- * boost::array so Uuid can be the key type in a map etc.
- */
-struct Uuid : public boost::array<uint8_t, 16> {
- /** If unique is true, generate a unique ID else a null ID. */
- Uuid(bool unique=false) { if (unique) generate(); else clear(); }
-
- /** Copy from 16 bytes of data */
- Uuid(const uint8_t* data) { assign(data); }
-
- /** Copy from 16 bytes of data */
- void assign(const uint8_t* data) { uuid_copy(c_array(), data); }
-
- /** Set to a new unique identifier */
- void generate() { uuid_generate(c_array()); }
-
- /** Set to all zeros */
- void clear() { uuid_clear(c_array()); }
-
- /** Test for null (all zeros) */
- bool isNull() const { return uuid_is_null(data()); }
-
- // Default op= and copy ctor are fine.
- // boost::array gives us ==, < etc.
-
- void encode(framing::Buffer& buf) const;
-
- void decode(framing::Buffer& buf);
-
- /** String value in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb */
- std::string str() const;
-
- template <class S> void serialize(S& s) {
- s(static_cast<boost::array<uint8_t, 16>&>(*this));
- }
-};
-
-/** Print in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb */
-std::ostream& operator<<(std::ostream&, const Uuid&);
-
-/** Read from format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb */
-std::istream& operator>>(std::istream&, Uuid&);
-
-}} // namespace qpid::framing
-
-
-
-#endif /*!QPID_FRAMING_UUID_H*/
diff --git a/qpid/cpp/src/qpid/framing/Visitor.h b/qpid/cpp/src/qpid/framing/Visitor.h
deleted file mode 100644
index 9753b21954..0000000000
--- a/qpid/cpp/src/qpid/framing/Visitor.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef QPID_FRAMING_VISITOR_H
-#define QPID_FRAMING_VISITOR_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/mpl/vector.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/preprocessor/seq/for_each.hpp>
-
-namespace qpid {
-namespace framing {
-
-/** @file Generic visitor pattern. */
-
-/** visit() interface for type T (optional return type R, default void.)
- * To create a visitor for a set of types T1, T2 ... do this:
- * struct MyVisitor : public Visit<T1>, public Visit<T2> ... {};
- *@param T Type to visit, must be forward declared, need not be defined.
- */
-template <class T, class R=void> struct Visit {
- typedef R ReturnType;
- typedef T VisitType;
-
- virtual ~Visit() {}
- virtual R visit(T&) = 0;
-};
-
-
-#define QPID_VISITOR_DECL(_1,_2,T) class T;
-
-#define QPID_VISITOR_BASE(_1,_2,T) , public ::qpid::framing::Visit<T>
-
-/** Convenience macro to generate a visitor interface.
- * QPID_VISITOR(MyVisitor,(A)(B)(C)); is equivalent to:
- * @code
- * class A; class B; class C;
- * class MyVisitor : public Visit<A> , public Visit<B> , public Visit<C> {};
- * @endcode
- * @param visitor name of the generated visitor class.
- * @param bases a sequence of visitable types in the form (T1)(T2)...
- * The odd parenthesized notation is due to quirks of the preprocesser.
- */
-#define QPID_VISITOR(visitor,types) \
- BOOST_PP_SEQ_FOR_EACH(QPID_VISITOR_DECL, _, types) \
- class visitor : public ::qpid::framing::Visit<BOOST_PP_SEQ_HEAD(types)> \
- BOOST_PP_SEQ_FOR_EACH(QPID_VISITOR_BASE, _, BOOST_PP_SEQ_TAIL(types)) \
- {}
-
-/** Root class for hierarchy of objects visitable by Visitor V.
- * Defines virtual accept()
- */
-template <class V, class R=void>
-struct VisitableRoot {
- typedef V VisitorType;
- typedef R ReturnType;
- virtual ~VisitableRoot() {}
- virtual R accept(V& v) = 0;
-};
-
-/** Base class for concrete visitable classes, implements accept().
- * @param T type of visitable class (CRTP)
- * @param Base base class to inherit from.
- */
-template <class T, class Base>
-struct Visitable : public Base {
- void accept(typename Base::VisitorType& v) {
- static_cast<Visit<T>& >(v).visit(static_cast<T&>(*this));
- }
-};
-
-}} // namespace qpid::framing
-
-#endif /*!QPID_FRAMING_VISITOR_H*/
diff --git a/qpid/cpp/src/qpid/framing/amqp_framing.h b/qpid/cpp/src/qpid/framing/amqp_framing.h
deleted file mode 100644
index 9ce148a37b..0000000000
--- a/qpid/cpp/src/qpid/framing/amqp_framing.h
+++ /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.
- *
- */
-#include "amqp_types.h"
-#include "AMQFrame.h"
-#include "AMQBody.h"
-#include "BodyHandler.h"
-#include "AMQMethodBody.h"
-#include "AMQHeaderBody.h"
-#include "AMQContentBody.h"
-#include "AMQHeartbeatBody.h"
-#include "InputHandler.h"
-#include "OutputHandler.h"
-#include "InitiationHandler.h"
-#include "ProtocolInitiation.h"
-#include "ProtocolVersion.h"
diff --git a/qpid/cpp/src/qpid/framing/amqp_types.h b/qpid/cpp/src/qpid/framing/amqp_types.h
deleted file mode 100644
index 94442aa357..0000000000
--- a/qpid/cpp/src/qpid/framing/amqp_types.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef AMQP_TYPES_H
-#define AMQP_TYPES_H
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/** \file
- * Type definitions and forward declarations of all types used to
- * in AMQP messages.
- */
-
-#include <string>
-#ifdef _WINDOWS
-#include "windows.h"
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned __int64 uint64_t;
-#endif
-#ifndef _WINDOWS
-#include <stdint.h>
-#endif
-
-namespace qpid {
-namespace framing {
-
-using std::string;
-typedef uint8_t FrameType;
-typedef uint16_t ChannelId;
-typedef uint32_t BatchOffset;
-typedef uint8_t ClassId;
-typedef uint8_t MethodId;
-typedef uint16_t ReplyCode;
-
-// Types represented by classes.
-class Content;
-class FieldTable;
-class SequenceNumberSet;
-class Uuid;
-
-// Useful constants
-
-/** Maximum channel ID used by broker. Reserve high bit for internal use.*/
-const ChannelId CHANNEL_MAX=(ChannelId(~1))>>1;
-const ChannelId CHANNEL_HIGH_BIT= ChannelId(~CHANNEL_MAX);
-
-// Forward declare class types
-class FramingContent;
-class FieldTable;
-class SequenceNumberSet;
-class Uuid;
-
-}} // namespace qpid::framing
-#endif
diff --git a/qpid/cpp/src/qpid/framing/amqp_types_full.h b/qpid/cpp/src/qpid/framing/amqp_types_full.h
deleted file mode 100644
index f1ed44ec05..0000000000
--- a/qpid/cpp/src/qpid/framing/amqp_types_full.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef _framing_amqp_types_decl_h
-#define _framing_amqp_types_decl_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/** \file
- * Type definitions and full declarations of all types used to
- * in AMQP messages.
- *
- * Its better to include amqp_types.h in another header instead of this file
- * unless the header actually needs the full declarations. Including
- * full declarations when forward declarations would do increases compile
- * times.
- */
-
-#include "amqp_types.h"
-#include "Array.h"
-#include "FramingContent.h"
-#include "FieldTable.h"
-#include "SequenceNumberSet.h"
-#include "Uuid.h"
-
-#endif /*!_framing_amqp_types_decl_h*/
diff --git a/qpid/cpp/src/qpid/framing/frame_functors.h b/qpid/cpp/src/qpid/framing/frame_functors.h
deleted file mode 100644
index d915a270c2..0000000000
--- a/qpid/cpp/src/qpid/framing/frame_functors.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <string>
-#include <ostream>
-#include <iostream>
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/Buffer.h"
-
-#ifndef _frame_functors_
-#define _frame_functors_
-
-namespace qpid {
-namespace framing {
-
-class SumFrameSize
-{
- uint64_t size;
-public:
- SumFrameSize() : size(0) {}
- void operator()(const AMQFrame& f) { size += f.size(); }
- uint64_t getSize() { return size; }
-};
-
-class SumBodySize
-{
- uint64_t size;
-public:
- SumBodySize() : size(0) {}
- void operator()(const AMQFrame& f) { size += f.getBody()->size(); }
- uint64_t getSize() { return size; }
-};
-
-class Count
-{
- uint count;
-public:
- Count() : count(0) {}
- void operator()(const AMQFrame&) { count++; }
- uint getCount() { return count; }
-};
-
-class EncodeFrame
-{
- Buffer& buffer;
-public:
- EncodeFrame(Buffer& b) : buffer(b) {}
- void operator()(const AMQFrame& f) { f.encode(buffer); }
-};
-
-class EncodeBody
-{
- Buffer& buffer;
-public:
- EncodeBody(Buffer& b) : buffer(b) {}
- void operator()(const AMQFrame& f) { f.getBody()->encode(buffer); }
-};
-
-/**
- * Sends a copy of the frame its applied to to the specified handler
- */
-class Relay
-{
- FrameHandler& handler;
-
-public:
- Relay(FrameHandler& h) : handler(h) {}
-
- void operator()(const AMQFrame& f)
- {
- AMQFrame copy(f);
- handler.handle(copy);
- }
-};
-
-class Print
-{
- std::ostream& out;
-public:
- Print(std::ostream& o) : out(o) {}
-
- void operator()(const AMQFrame& f)
- {
- out << f << std::endl;
- }
-};
-
-class MarkLastSegment
-{
-public:
- void operator()(AMQFrame& f) const { f.setEof(true); }
-};
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/framing/variant.h b/qpid/cpp/src/qpid/framing/variant.h
deleted file mode 100644
index ceaed2c529..0000000000
--- a/qpid/cpp/src/qpid/framing/variant.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef QPID_FRAMING_VARIANT_H
-#define QPID_FRAMING_VARIANT_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/**@file Tools for using boost::variant */
-
-
-#include <boost/variant.hpp>
-
-namespace qpid {
-namespace framing {
-class Buffer;
-
-/** boost::static_visitor that throws exception if variant contains blank.
- * Sublclasses need to have a using() declaration, can be generated
- * with QPID_USING_NOBLANK(R)
- */
-template <class R=void>
-struct NoBlankVisitor : public boost::static_visitor<R> {
- R foundBlank() const {
- assert(0);
- throw Exception(QPID_MSG("Invalid variant value."));
- }
- R operator()(const boost::blank&) const { return foundBlank(); }
- R operator()(boost::blank&) const { return foundBlank(); }
-};
-
-
-}} // qpid::framing
-
-
-/** Generate using statement needed in visitors inheriting NoBlankVisitor
- * @param R return type.
- */
-#define QPID_USING_NOBLANK(R) using ::qpid::framing::NoBlankVisitor<R>::operator()
-
-namespace qpid {
-namespace framing {
-
-/** Convert the variant value to type R. */
-template <class R> struct ConvertVisitor : public NoBlankVisitor<R> {
- QPID_USING_NOBLANK(R);
- template <class T> R operator()(T& t) const { return t; }
-};
-
-/** Convert address of variant value to type R. */
-template <class R> struct AddressVisitor : public NoBlankVisitor<R> {
- QPID_USING_NOBLANK(R);
- template <class T> R operator()(T& t) const { return &t; }
-};
-
-/** Apply a visitor to the nested variant in a variant of variants */
-template<class V>
-struct ApplyVisitor : public NoBlankVisitor<typename V::result_type> {
- QPID_USING_NOBLANK(typename V::result_type);
- const V& visitor;
- ApplyVisitor(const V& v) : visitor(v) {}
- template <class T> typename V::result_type operator()(T& t) const {
- return boost::apply_visitor(visitor, t);
- }
-};
-
-/** Convenience function to construct and apply an ApplyVisitor */
-template <class Visitor, class Visitable>
-typename Visitor::result_type applyApplyVisitor(const Visitor& visitor, Visitable& visitable) {
- return boost::apply_visitor(ApplyVisitor<Visitor>(visitor), visitable);
-}
-
-}} // namespace qpid::framing
-
-
-#endif /*!QPID_FRAMING_VARIANT_H*/
diff --git a/qpid/cpp/src/qpid/log/Helpers.h b/qpid/cpp/src/qpid/log/Helpers.h
deleted file mode 100644
index 82ef8244be..0000000000
--- a/qpid/cpp/src/qpid/log/Helpers.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef QPID_LOG_HELPERS_H
-#define QPID_LOG_HELPERS_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/range.hpp>
-
-#include <ostream>
-
-namespace qpid {
-namespace log {
-
-/** @file Helper classes for logging complex types */
-
-/// @internal
-template <class Range>
-struct ListFormatter {
- typedef typename boost::range_const_iterator<Range>::type Iterator;
- boost::iterator_range<Iterator> range;
- const char* separator;
-
- ListFormatter(const Range& r, const char* s=", ") : range(r), separator(s) {}
-};
-
-/// @internal
-template <class Range>
-std::ostream& operator<<(std::ostream& out, const ListFormatter<Range>& sl) {
- typename ListFormatter<Range>::Iterator i = sl.range.begin();
- if (i != sl.range.end()) out << *(i++);
- while (i != sl.range.end()) out << sl.separator << *(i++);
- return out;
-}
-
-/** Return a formatting object with operator <<
- * to stream range as a separated list.
- *@param range: a range - all standard containers are ranges,
- * as is a pair of iterators.
- *@param separator: printed between elements, default ", "
- */
-template <class Range>
-ListFormatter<Range> formatList(const Range& range, const char* separator=", ") {
- return ListFormatter<Range>(range, separator);
-}
-
-/** Return a formatting object with operator <<
- * to stream the range defined by iterators [begin, end)
- * as a separated list.
- *@param begin, end: Beginning and end of range.
- *@param separator: printed between elements, default ", "
- */
-template <class U, class V>
-ListFormatter<std::pair<U,V> > formatList(U begin, V end, const char* separator=", ") {
- return formatList(std::make_pair(begin,end), separator);
-}
-
-
-}} // namespace qpid::log
-
-
-
-#endif /*!QPID_LOG_HELPERS_H*/
diff --git a/qpid/cpp/src/qpid/log/Logger.cpp b/qpid/cpp/src/qpid/log/Logger.cpp
deleted file mode 100644
index b51bb0427b..0000000000
--- a/qpid/cpp/src/qpid/log/Logger.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Logger.h"
-#include "Options.h"
-#include "qpid/memory.h"
-#include "qpid/sys/Thread.h"
-#include <boost/pool/detail/singleton.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <algorithm>
-#include <sstream>
-#include <fstream>
-#include <iomanip>
-#include <stdexcept>
-#include <syslog.h>
-
-
-namespace qpid {
-namespace log {
-
-using namespace std;
-
-typedef sys::Mutex::ScopedLock ScopedLock;
-
-inline void Logger::enable_unlocked(Statement* s) {
- s->enabled=selector.isEnabled(s->level, s->function);
-}
-
-struct OstreamOutput : public Logger::Output {
- OstreamOutput(std::ostream& o) : out(&o) {}
-
- OstreamOutput(const string& file)
- : out(new ofstream(file.c_str())), mine(out)
- {
- if (!out->good())
- throw std::runtime_error("Can't open log file: "+file);
- }
-
- void log(const Statement&, const std::string& m) {
- *out << m << flush;
- }
-
- ostream* out;
- boost::scoped_ptr<ostream> mine;
-};
-
-struct SyslogOutput : public Logger::Output {
- SyslogOutput(const std::string& name, int facility_=LOG_USER)
- : progName(name), facility(facility_)
- {
- ::openlog(name.c_str(), LOG_PID, facility);
- }
-
- ~SyslogOutput() {
- ::closelog();
- }
-
- void log(const Statement& s, const std::string& m)
- {
- syslog(LevelTraits::priority(s.level), "%s", m.c_str());
- }
-
- std::string progName;
- int facility;
-};
-
-Logger& Logger::instance() {
- return boost::details::pool::singleton_default<Logger>::instance();
-}
-
-Logger::Logger() : flags(0) {
- // Initialize myself from env variables so all programs
- // (e.g. tests) can use logging even if they don't parse
- // command line args.
- Options opts;
- opts.parse(0, 0);
- configure(opts,"");
-}
-
-Logger::~Logger() {}
-
-void Logger::select(const Selector& s) {
- ScopedLock l(lock);
- selector=s;
- std::for_each(statements.begin(), statements.end(),
- boost::bind(&Logger::enable_unlocked, this, _1));
-}
-
-Logger::Output::Output() {}
-Logger::Output::~Output() {}
-
-void Logger::log(const Statement& s, const std::string& msg) {
- // Format the message outside the lock.
- std::ostringstream os;
- if (flags&TIME)
- os << boost::posix_time::second_clock::local_time() << " ";
- if (flags&LEVEL)
- os << LevelTraits::name(s.level) << " ";
- if (flags&THREAD)
- os << "[" << qpid::sys::Thread::logId() << "] ";
- if (flags&FILE)
- os << s.file << ":";
- if (flags&LINE)
- os << dec << s.line << ":";
- if (flags&FUNCTION)
- os << s.function << ":";
- if (flags & (FILE|LINE|FUNCTION))
- os << " ";
- os << msg << endl;
- std::string formatted=os.str();
-
- {
- ScopedLock l(lock);
- std::for_each(outputs.begin(), outputs.end(),
- boost::bind(&Output::log, _1, s, formatted));
- }
-}
-
-void Logger::output(std::auto_ptr<Output> out) {
- ScopedLock l(lock);
- outputs.push_back(out.release());
-}
-
-void Logger::output(std::ostream& out) {
- output(make_auto_ptr<Output>(new OstreamOutput(out)));
-}
-
-void Logger::syslog(const std::string& progName) {
- output(make_auto_ptr<Output>(new SyslogOutput(progName)));
-}
-
-void Logger::output(const std::string& name) {
- if (name=="stderr")
- output(clog);
- else if (name=="stdout")
- output(cout);
- else if (name=="syslog")
- syslog(syslogName);
- else
- output(make_auto_ptr<Output>(new OstreamOutput(name)));
-}
-
-void Logger::clear() {
- select(Selector()); // locked
- format(0); // locked
- ScopedLock l(lock);
- outputs.clear();
-}
-
-void Logger::format(int formatFlags) {
- ScopedLock l(lock);
- flags=formatFlags;
-}
-
-static int bitIf(bool test, int bit) {
- return test ? bit : 0;
-}
-
-int Logger::format(const Options& opts) {
- int flags=
- bitIf(opts.level, LEVEL) |
- bitIf(opts.time, TIME) |
- bitIf(opts.source, (FILE|LINE)) |
- bitIf(opts.function, FUNCTION) |
- bitIf(opts.thread, THREAD);
- format(flags);
- return flags;
-}
-
-void Logger::add(Statement& s) {
- ScopedLock l(lock);
- enable_unlocked(&s);
- statements.insert(&s);
-}
-
-void Logger::configure(const Options& opts, const std::string& prog)
-{
- clear();
- Options o(opts);
- if (o.trace)
- o.selectors.push_back("trace+");
- {
- ScopedLock l(lock);
- syslogName=prog;
- }
- format(o);
- select(Selector(o));
- void (Logger::* outputFn)(const std::string&) = &Logger::output;
- for_each(o.outputs.begin(), o.outputs.end(),
- boost::bind(outputFn, this, _1));
-}
-
-}} // namespace qpid::log
diff --git a/qpid/cpp/src/qpid/log/Logger.h b/qpid/cpp/src/qpid/log/Logger.h
deleted file mode 100644
index 7851c65406..0000000000
--- a/qpid/cpp/src/qpid/log/Logger.h
+++ /dev/null
@@ -1,113 +0,0 @@
-#ifndef LOGGER_H
-#define LOGGER_H
-
-/*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Selector.h"
-#include "qpid/sys/Mutex.h"
-#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/noncopyable.hpp>
-#include <set>
-
-namespace qpid {
-namespace log {
-
-class Options;
-
-/**
- * Central logging agent.
- *
- * Thread safe, singleton.
- */
-class Logger : private boost::noncopyable {
- public:
- /** Flags indicating what to include in the log output */
- enum FormatFlag { FILE=1, LINE=2, FUNCTION=4, LEVEL=8, TIME=16, THREAD=32};
-
- /** Interface for log output destination.
- *
- * Implementations must be thread safe.
- */
- class Output {
- public:
- Output();
- virtual ~Output();
- /** Receives the statemnt of origin and formatted message to log. */
- virtual void log(const Statement&, const std::string&) =0;
- };
-
- static Logger& instance();
-
- Logger();
- ~Logger();
-
- /** Select the messages to be logged. */
- void select(const Selector& s);
-
- /** Set the formatting flags, bitwise OR of FormatFlag values. */
- void format(int formatFlags);
-
- /** Set format flags from options object.
- *@returns computed flags.
- */
- int format(const Options&);
-
- /** Configure logger from Options */
- void configure(const Options& o, const std::string& progname);
-
- /** Add a statement. */
- void add(Statement& s);
-
- /** Log a message. */
- void log(const Statement&, const std::string&);
-
- /** Add an ostream to outputs.
- *
- * The ostream must not be destroyed while the Logger might
- * still be using it. This is the case for std streams cout,
- * cerr, clog.
- */
- void output(std::ostream&);
-
- /** Add syslog to outputs. */
- void syslog(const std::string& programName);
-
- /** Add an output.
- *@param name a file name or one of the special tokens:
- *stdout, stderr, syslog.
- */
- void output(const std::string& name);
-
- /** Add an output destination for messages */
- void output(std::auto_ptr<Output> out);
-
- /** Reset the logger to it's original state. */
- void clear();
-
- private:
- typedef boost::ptr_vector<Output> Outputs;
- typedef std::set<Statement*> Statements;
-
- sys::Mutex lock;
- inline void enable_unlocked(Statement* s);
-
- std::string syslogName;
- Statements statements;
- Outputs outputs;
- Selector selector;
- int flags;
-};
-
-}} // namespace qpid::log
-
-
-#endif /*!LOGGER_H*/
diff --git a/qpid/cpp/src/qpid/log/Options.cpp b/qpid/cpp/src/qpid/log/Options.cpp
deleted file mode 100644
index dd296f3a93..0000000000
--- a/qpid/cpp/src/qpid/log/Options.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Options.h"
-#include "Statement.h"
-#include "qpid/Options.h"
-
-namespace qpid {
-namespace log {
-
-using namespace std;
-
-Options::Options(const std::string& name) : qpid::Options(name),
- time(true), level(true), thread(false), source(false), function(false), trace(false)
-{
- outputs.push_back("stderr");
- selectors.push_back("error+");
-
- ostringstream levels;
- levels << LevelTraits::name(Level(0));
- for (int i = 1; i < LevelTraits::COUNT; ++i)
- levels << " " << LevelTraits::name(Level(i));
- addOptions()
- ("log-output", optValue(outputs, "FILE"),
- "Send log output to FILE. "
- "FILE can be a file name or one of the special values:\n"
- "stderr, stdout, syslog")
- ("trace,t", optValue(trace), "Enables all logging" )
- ("log-enable", optValue(selectors, "RULE"),
- ("Enables logging for selected levels and components. "
- "RULE is in the form 'LEVEL[+][:PATTERN]' "
- "Levels are one of: \n\t "+levels.str()+"\n"
- "For example:\n"
- "\t'--log-enable warning+' "
- "logs all warning, error and critical messages.\n"
- "\t'--log-enable debug:framing' "
- "logs debug messages from the framing namespace. "
- "This option can be used multiple times").c_str())
- ("log-time", optValue(time, "yes|no"),
- "Include time in log messages")
- ("log-level", optValue(level,"yes|no"),
- "Include severity level in log messages")
- ("log-source", optValue(source,"yes|no"),
- "Include source file:line in log messages")
- ("log-thread", optValue(thread,"yes|no"),
- "Include thread ID in log messages")
- ("log-function", optValue(function,"yes|no"),
- "Include function signature in log messages");
-}
-
-}} // namespace qpid::log
diff --git a/qpid/cpp/src/qpid/log/Options.h b/qpid/cpp/src/qpid/log/Options.h
deleted file mode 100644
index 441c6e8a8d..0000000000
--- a/qpid/cpp/src/qpid/log/Options.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef OPTIONS_H
-#define OPTIONS_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include "qpid/Options.h"
-
-
-namespace qpid {
-namespace log {
-
-/** Logging options for config parser. */
-struct Options : public qpid::Options {
- Options(const std::string& name="Logging options");
-
- std::vector<std::string> selectors;
- std::vector<std::string> outputs;
- bool time, level, thread, source, function;
- bool trace;
-};
-
-
-}} // namespace qpid::log
-
-
-
-#endif /*!OPTIONS_H*/
diff --git a/qpid/cpp/src/qpid/log/Selector.cpp b/qpid/cpp/src/qpid/log/Selector.cpp
deleted file mode 100644
index 994421d0ff..0000000000
--- a/qpid/cpp/src/qpid/log/Selector.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Selector.h"
-#include "Options.h"
-#include <boost/bind.hpp>
-#include <algorithm>
-
-namespace qpid {
-namespace log {
-
-using namespace std;
-
-void Selector::enable(const string& enableStr) {
- string level, pattern;
- size_t c=enableStr.find(':');
- if (c==string::npos) {
- level=enableStr;
- }
- else {
- level=enableStr.substr(0,c);
- pattern=enableStr.substr(c+1);
- }
- if (!level.empty() && level[level.size()-1]=='+') {
- for (int i = LevelTraits::level(level.substr(0,level.size()-1));
- i < LevelTraits::COUNT;
- ++i)
- enable(Level(i), pattern);
- }
- else {
- enable(LevelTraits::level(level), pattern);
- }
-}
-
-Selector::Selector(const Options& opt){
- for_each(opt.selectors.begin(), opt.selectors.end(),
- boost::bind(&Selector::enable, this, _1));
-}
-
-bool Selector::isEnabled(Level level, const std::string& function) {
- for (std::vector<std::string>::iterator i=substrings[level].begin();
- i != substrings[level].end();
- ++i)
- {
- if (function.find(*i) != std::string::npos)
- return true;
- }
- return false;
-}
-
-}} // namespace qpid::log
diff --git a/qpid/cpp/src/qpid/log/Selector.h b/qpid/cpp/src/qpid/log/Selector.h
deleted file mode 100644
index 7c98bc6f8f..0000000000
--- a/qpid/cpp/src/qpid/log/Selector.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef SELECTOR_H
-#define SELECTOR_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Statement.h"
-#include <vector>
-
-namespace qpid {
-namespace log {
-class Options;
-
-/**
- * A selector identifies the set of log messages to enable.
- *
- * Thread object unsafe, pass-by-value type.
- */
-class Selector {
- public:
- /** Empty selector selects nothing */
- Selector() {}
-
- /** Set selector from Options */
- Selector(const Options&);
-
- /** Equavlient to: Selector s; s.enable(l, s) */
- Selector(Level l, const std::string& s=std::string()) {
- enable(l,s);
- }
-
- Selector(const std::string& enableStr) { enable(enableStr); }
- /**
- * Enable messages with level in levels where the file
- * name contains substring. Empty string matches all.
- */
- void enable(Level level, const std::string& substring=std::string()) {
- substrings[level].push_back(substring);
- }
-
- /** Enable based on a 'level[+]:file' string */
- void enable(const std::string& enableStr);
-
- /** True if level is enabld for file. */
- bool isEnabled(Level level, const std::string& function);
-
- private:
- std::vector<std::string> substrings[LevelTraits::COUNT];
-};
-
-
-}} // namespace qpid::log
-
-
-#endif /*!SELECTOR_H*/
diff --git a/qpid/cpp/src/qpid/log/Statement.cpp b/qpid/cpp/src/qpid/log/Statement.cpp
deleted file mode 100644
index 9b6fb7feaf..0000000000
--- a/qpid/cpp/src/qpid/log/Statement.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Statement.h"
-#include "Logger.h"
-#include <boost/bind.hpp>
-#include <stdexcept>
-#include <algorithm>
-#include <syslog.h>
-#include <ctype.h>
-
-namespace qpid {
-namespace log {
-
-namespace {
-using namespace std;
-
-struct NonPrint { bool operator()(unsigned char c) { return !isprint(c); } };
-
-char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-
-std::string quote(const std::string& str) {
- NonPrint nonPrint;
- size_t n = std::count_if(str.begin(), str.end(), nonPrint);
- if (n==0) return str;
- std::string ret;
- ret.reserve(str.size()+2*n); // Avoid extra allocations.
- for (string::const_iterator i = str.begin(); i != str.end(); ++i) {
- if (nonPrint(*i)) {
- ret.push_back('\\');
- ret.push_back(hex[((*i) >> 4)&0xf]);
- ret.push_back(hex[(*i) & 0xf]);
- }
- else ret.push_back(*i);
- }
- return ret;
-}
-
-}
-
-void Statement::log(const std::string& message) {
- Logger::instance().log(*this, quote(message));
-}
-
-Statement::Initializer::Initializer(Statement& s) : statement(s) {
- Logger::instance().add(s);
-}
-
-namespace {
-const char* names[LevelTraits::COUNT] = {
- "trace", "debug", "info", "notice", "warning", "error", "critical"
-};
-
-int priorities[LevelTraits::COUNT] = {
- LOG_DEBUG, LOG_DEBUG, LOG_INFO, LOG_NOTICE,
- LOG_WARNING, LOG_ERR, LOG_CRIT
-};
-
-} // namespace
-
-Level LevelTraits::level(const char* name) {
- for (int i =0; i < LevelTraits::COUNT; ++i) {
- if (strcmp(names[i], name)==0)
- return Level(i);
- }
- throw std::runtime_error(std::string("Invalid log level name: ")+name);
-}
-
-const char* LevelTraits::name(Level l) {
- return names[l];
-}
-
-int LevelTraits::priority(Level l) {
- return priorities[l];
-}
-
-}} // namespace qpid::log
diff --git a/qpid/cpp/src/qpid/log/Statement.h b/qpid/cpp/src/qpid/log/Statement.h
deleted file mode 100644
index 18162971b0..0000000000
--- a/qpid/cpp/src/qpid/log/Statement.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#ifndef STATEMENT_H
-#define STATEMENT_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/Msg.h"
-
-#include <boost/current_function.hpp>
-
-namespace qpid {
-namespace log {
-
-/** Debugging severity levels
- * - trace: High-volume debugging messages.
- * - debug: Debugging messages.
- * - info: Informational messages.
- * - notice: Normal but significant condition.
- * - warning: Warn of a possible problem.
- * - error: A definite error has occured.
- * - critical: System in danger of severe failure.
- */
-enum Level { trace, debug, info, notice, warning, error, critical };
-struct LevelTraits {
- static const int COUNT=critical+1;
-
- /** Get level from string name.
- *@exception if name invalid.
- */
- static Level level(const char* name);
-
- /** Get level from string name.
- *@exception if name invalid.
- */
- static Level level(const std::string& name) {
- return level(name.c_str());
- }
-
- /** String name of level */
- static const char* name(Level);
-
- /** Syslog priority of level */
- static int priority(Level);
-};
-
-/** POD struct representing a logging statement in source code. */
-struct Statement {
- bool enabled;
- const char* file;
- int line;
- const char* function;
- Level level;
-
- void log(const std::string& message);
-
- struct Initializer {
- Initializer(Statement& s);
- Statement& statement;
- };
-};
-
-///@internal static initializer for a Statement.
-#define QPID_LOG_STATEMENT_INIT(level) \
- { 0, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (::qpid::log::level) }
-
-/**
- * Macro for log statements. Example of use:
- * @code
- * QPID_LOG(debug, "There are " << foocount << " foos in the bar.");
- * QPID_LOG(error, boost::format("Dohickey %s exploded") % dohicky.name());
- * @endcode
- *
- * All code with logging statements should be built with
- * -DQPID_COMPONENT=<component name>
- * where component name is the name of the component this file belongs to.
- *
- * You can subscribe to log messages by level, by component, by filename
- * or a combination @see Configuration.
-
- *@param LEVEL severity Level for message, should be one of:
- * debug, info, notice, warning, error, critical. NB no qpid::log:: prefix.
- *@param MESSAGE any object with an @eostream operator<<, or a sequence
- * like of ostreamable objects separated by @e<<.
- */
-#define QPID_LOG(level, message) \
- do { \
- static ::qpid::log::Statement stmt_= QPID_LOG_STATEMENT_INIT(level); \
- static ::qpid::log::Statement::Initializer init_(stmt_); \
- if (stmt_.enabled) \
- stmt_.log(::qpid::Msg() << message); \
- } while(0)
-
-}} // namespace qpid::log
-
-
-
-
-#endif /*!STATEMENT_H*/
-
diff --git a/qpid/cpp/src/qpid/management/Args.h b/qpid/cpp/src/qpid/management/Args.h
deleted file mode 100644
index da1fb033b9..0000000000
--- a/qpid/cpp/src/qpid/management/Args.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _Args_
-#define _Args_
-
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-
-namespace qpid {
-namespace management {
-
-class Args
-{
- public:
-
- virtual ~Args (void) = 0;
-
-};
-
-inline Args::~Args (void) {}
-
-class ArgsNone : public Args
-{
-};
-
-}}
-
-
-#endif /*!_Args_*/
diff --git a/qpid/cpp/src/qpid/management/Manageable.cpp b/qpid/cpp/src/qpid/management/Manageable.cpp
deleted file mode 100644
index c5adb22694..0000000000
--- a/qpid/cpp/src/qpid/management/Manageable.cpp
+++ /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.
-//
-
-#include "Manageable.h"
-
-using namespace qpid::management;
-
-std::string Manageable::StatusText (status_t status)
-{
- switch (status)
- {
- case STATUS_OK : return "OK";
- case STATUS_UNKNOWN_OBJECT : return "UnknownObject";
- case STATUS_UNKNOWN_METHOD : return "UnknownMethod";
- case STATUS_NOT_IMPLEMENTED : return "NotImplemented";
- }
-
- return "??";
-}
-
diff --git a/qpid/cpp/src/qpid/management/Manageable.h b/qpid/cpp/src/qpid/management/Manageable.h
deleted file mode 100644
index 155b71da54..0000000000
--- a/qpid/cpp/src/qpid/management/Manageable.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef _Manageable_
-#define _Manageable_
-
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-#include "ManagementObject.h"
-#include "Args.h"
-#include <string>
-
-namespace qpid {
-namespace management {
-
-class Manageable
-{
- public:
-
- virtual ~Manageable (void) = 0;
-
- // status_t is a type used to pass completion status from the method handler.
- //
- typedef uint32_t status_t;
- static std::string StatusText (status_t status);
-
- static const status_t STATUS_OK = 0;
- static const status_t STATUS_UNKNOWN_OBJECT = 1;
- static const status_t STATUS_UNKNOWN_METHOD = 2;
- static const status_t STATUS_NOT_IMPLEMENTED = 3;
-
- // Every "Manageable" object must hold a reference to exactly one
- // management object. This object is always of a class derived from
- // the pure-virtual "ManagementObject".
- //
- // This accessor function returns a shared_ptr to the management object.
- //
- virtual ManagementObject::shared_ptr GetManagementObject (void) const = 0;
-
- // Every "Manageable" object must implement ManagementMethod. This
- // function is called when a remote management client invokes a method
- // on this object. The input and output arguments are specific to the
- // method being called and must be down-cast to the appropriate sub class
- // before use.
- virtual status_t ManagementMethod (uint32_t methodId, Args& args) = 0;
-};
-
-inline Manageable::~Manageable (void) {}
-
-}}
-
-#endif /*!_Manageable_*/
diff --git a/qpid/cpp/src/qpid/management/ManagementAgent.cpp b/qpid/cpp/src/qpid/management/ManagementAgent.cpp
deleted file mode 100644
index 709f2a0ecd..0000000000
--- a/qpid/cpp/src/qpid/management/ManagementAgent.cpp
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "ManagementAgent.h"
-#include "qpid/broker/DeliverableMessage.h"
-#include "qpid/log/Statement.h"
-#include <qpid/broker/Message.h>
-#include <qpid/broker/MessageDelivery.h>
-#include <qpid/framing/AMQFrame.h>
-#include <list>
-
-using namespace qpid::framing;
-using namespace qpid::management;
-using namespace qpid::broker;
-using namespace qpid::sys;
-
-ManagementAgent::shared_ptr ManagementAgent::agent;
-bool ManagementAgent::enabled = 0;
-
-ManagementAgent::ManagementAgent (uint16_t _interval) : interval (_interval)
-{
- timer.add (intrusive_ptr<TimerTask> (new Periodic(*this, interval)));
- nextObjectId = uint64_t (qpid::sys::Duration (qpid::sys::now ()));
-}
-
-ManagementAgent::~ManagementAgent () {}
-
-void ManagementAgent::enableManagement (void)
-{
- enabled = 1;
-}
-
-ManagementAgent::shared_ptr ManagementAgent::getAgent (void)
-{
- if (enabled && agent.get () == 0)
- agent = shared_ptr (new ManagementAgent (10));
-
- return agent;
-}
-
-void ManagementAgent::shutdown (void)
-{
- if (agent.get () != 0)
- {
- agent->mExchange.reset ();
- agent->dExchange.reset ();
- agent.reset ();
- }
-}
-
-void ManagementAgent::setExchange (broker::Exchange::shared_ptr _mexchange,
- broker::Exchange::shared_ptr _dexchange)
-{
- mExchange = _mexchange;
- dExchange = _dexchange;
-}
-
-void ManagementAgent::addObject (ManagementObject::shared_ptr object,
- uint64_t /*persistenceId*/,
- uint64_t /*idOffset*/)
-{
- RWlock::ScopedWlock writeLock (userLock);
- uint64_t objectId;
-
-// if (persistenceId == 0)
- objectId = nextObjectId++;
-// else
-// objectId = 0x8000000000000000ULL | (persistenceId + idOffset);
-
- object->setObjectId (objectId);
- managementObjects[objectId] = object;
-}
-
-ManagementAgent::Periodic::Periodic (ManagementAgent& _agent, uint32_t _seconds)
- : TimerTask (qpid::sys::Duration (_seconds * qpid::sys::TIME_SEC)), agent(_agent) {}
-
-ManagementAgent::Periodic::~Periodic () {}
-
-void ManagementAgent::Periodic::fire ()
-{
- agent.timer.add (intrusive_ptr<TimerTask> (new Periodic (agent, agent.interval)));
- agent.PeriodicProcessing ();
-}
-
-void ManagementAgent::clientAdded (void)
-{
- RWlock::ScopedRlock readLock (userLock);
-
- for (ManagementObjectMap::iterator iter = managementObjects.begin ();
- iter != managementObjects.end ();
- iter++)
- {
- ManagementObject::shared_ptr object = iter->second;
- object->setAllChanged ();
- object->setSchemaNeeded ();
- }
-}
-
-void ManagementAgent::EncodeHeader (Buffer& buf, uint8_t opcode, uint8_t cls)
-{
- buf.putOctet ('A');
- buf.putOctet ('M');
- buf.putOctet ('0');
- buf.putOctet ('1');
- buf.putOctet (opcode);
- buf.putOctet (cls);
-}
-
-bool ManagementAgent::CheckHeader (Buffer& buf, uint8_t *opcode, uint8_t *cls)
-{
- uint8_t h1 = buf.getOctet ();
- uint8_t h2 = buf.getOctet ();
- uint8_t h3 = buf.getOctet ();
- uint8_t h4 = buf.getOctet ();
-
- *opcode = buf.getOctet ();
- *cls = buf.getOctet ();
-
- return h1 == 'A' && h2 == 'M' && h3 == '0' && h4 == '1';
-}
-
-void ManagementAgent::SendBuffer (Buffer& buf,
- uint32_t length,
- broker::Exchange::shared_ptr exchange,
- string routingKey)
-{
- intrusive_ptr<Message> msg (new Message ());
- AMQFrame method (in_place<MessageTransferBody>(
- ProtocolVersion(), 0, exchange->getName (), 0, 0));
- AMQFrame header (in_place<AMQHeaderBody>());
- AMQFrame content(in_place<AMQContentBody>());
-
- content.castBody<AMQContentBody>()->decode(buf, length);
-
- method.setEof (false);
- header.setBof (false);
- header.setEof (false);
- content.setBof (false);
-
- msg->getFrames().append(method);
- msg->getFrames().append(header);
-
- MessageProperties* props =
- msg->getFrames().getHeaders()->get<MessageProperties>(true);
- props->setContentLength(length);
- msg->getFrames().append(content);
-
- DeliverableMessage deliverable (msg);
- exchange->route (deliverable, routingKey, 0);
-}
-
-void ManagementAgent::PeriodicProcessing (void)
-{
-#define BUFSIZE 65536
-#define THRESHOLD 16384
- RWlock::ScopedWlock writeLock (userLock);
- char msgChars[BUFSIZE];
- uint32_t contentSize;
- string routingKey;
- std::list<uint64_t> deleteList;
-
- if (managementObjects.empty ())
- return;
-
- for (ManagementObjectMap::iterator iter = managementObjects.begin ();
- iter != managementObjects.end ();
- iter++)
- {
- ManagementObject::shared_ptr object = iter->second;
-
- if (object->getSchemaNeeded ())
- {
- Buffer msgBuffer (msgChars, BUFSIZE);
- EncodeHeader (msgBuffer, 'S');
- object->writeSchema (msgBuffer);
-
- contentSize = BUFSIZE - msgBuffer.available ();
- msgBuffer.reset ();
- routingKey = "mgmt.schema." + object->getClassName ();
- SendBuffer (msgBuffer, contentSize, mExchange, routingKey);
- }
-
- if (object->getConfigChanged () || object->isDeleted ())
- {
- Buffer msgBuffer (msgChars, BUFSIZE);
- EncodeHeader (msgBuffer, 'C', 'C');
- object->writeConfig (msgBuffer);
-
- contentSize = BUFSIZE - msgBuffer.available ();
- msgBuffer.reset ();
- routingKey = "mgmt.config." + object->getClassName ();
- SendBuffer (msgBuffer, contentSize, mExchange, routingKey);
- }
-
- if (object->getInstChanged ())
- {
- Buffer msgBuffer (msgChars, BUFSIZE);
- EncodeHeader (msgBuffer, 'C', 'I');
- object->writeInstrumentation (msgBuffer);
-
- contentSize = BUFSIZE - msgBuffer.available ();
- msgBuffer.reset ();
- routingKey = "mgmt.inst." + object->getClassName ();
- SendBuffer (msgBuffer, contentSize, mExchange, routingKey);
- }
-
- if (object->isDeleted ())
- deleteList.push_back (iter->first);
- }
-
- // Delete flagged objects
- for (std::list<uint64_t>::reverse_iterator iter = deleteList.rbegin ();
- iter != deleteList.rend ();
- iter++)
- managementObjects.erase (*iter);
-
- deleteList.clear ();
-}
-
-void ManagementAgent::dispatchCommand (Deliverable& deliverable,
- const string& routingKey,
- const FieldTable* /*args*/)
-{
- size_t pos, start;
- Message& msg = ((DeliverableMessage&) deliverable).getMessage ();
- uint32_t contentSize;
-
- if (routingKey.compare (0, 7, "method.") != 0)
- {
- QPID_LOG (debug, "Illegal routing key for dispatch: " << routingKey);
- return;
- }
-
- start = 7;
- if (routingKey.length () == start)
- {
- QPID_LOG (debug, "Missing package-name in routing key: " << routingKey);
- return;
- }
-
- pos = routingKey.find ('.', start);
- if (pos == string::npos || routingKey.length () == pos + 1)
- {
- QPID_LOG (debug, "Missing class-name in routing key: " << routingKey);
- return;
- }
-
- string packageName = routingKey.substr (start, pos - start);
-
- start = pos + 1;
- pos = routingKey.find ('.', start);
- if (pos == string::npos || routingKey.length () == pos + 1)
- {
- QPID_LOG (debug, "Missing method-name in routing key: " << routingKey);
- return;
- }
-
- string className = routingKey.substr (start, pos - start);
-
- start = pos + 1;
- string methodName = routingKey.substr (start, routingKey.length () - start);
-
- contentSize = msg.encodedContentSize ();
- if (contentSize < 8 || contentSize > 65536)
- return;
-
- char *inMem = new char[contentSize];
- char outMem[4096]; // TODO Fix This
- Buffer inBuffer (inMem, contentSize);
- Buffer outBuffer (outMem, 4096);
- uint32_t outLen;
- uint8_t opcode, unused;
-
- msg.encodeContent (inBuffer);
- inBuffer.reset ();
-
- if (!CheckHeader (inBuffer, &opcode, &unused))
- {
- QPID_LOG (debug, " Invalid content header");
- return;
- }
-
- if (opcode != 'M')
- {
- QPID_LOG (debug, " Unexpected opcode " << opcode);
- return;
- }
-
- uint32_t methodId = inBuffer.getLong ();
- uint64_t objId = inBuffer.getLongLong ();
- string replyToKey;
-
- const framing::MessageProperties* p =
- msg.getFrames().getHeaders()->get<framing::MessageProperties>();
- if (p && p->hasReplyTo())
- {
- const framing::ReplyTo& rt = p->getReplyTo ();
- replyToKey = rt.getRoutingKey ();
- }
- else
- {
- QPID_LOG (debug, " Reply-to missing");
- return;
- }
-
- EncodeHeader (outBuffer, 'R');
- outBuffer.putLong (methodId);
-
- ManagementObjectMap::iterator iter = managementObjects.find (objId);
- if (iter == managementObjects.end ())
- {
- outBuffer.putLong (Manageable::STATUS_UNKNOWN_OBJECT);
- outBuffer.putShortString (Manageable::StatusText (Manageable::STATUS_UNKNOWN_OBJECT));
- }
- else
- {
- iter->second->doMethod (methodName, inBuffer, outBuffer);
- }
-
- outLen = 4096 - outBuffer.available ();
- outBuffer.reset ();
- SendBuffer (outBuffer, outLen, dExchange, replyToKey);
- free (inMem);
-}
-
diff --git a/qpid/cpp/src/qpid/management/ManagementAgent.h b/qpid/cpp/src/qpid/management/ManagementAgent.h
deleted file mode 100644
index 30b8857c27..0000000000
--- a/qpid/cpp/src/qpid/management/ManagementAgent.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef _ManagementAgent_
-#define _ManagementAgent_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Options.h"
-#include "qpid/broker/Exchange.h"
-#include "qpid/broker/Timer.h"
-#include "qpid/sys/Mutex.h"
-#include "ManagementObject.h"
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace management {
-
-class ManagementAgent
-{
- private:
-
- ManagementAgent (uint16_t interval);
-
- public:
-
- virtual ~ManagementAgent ();
-
- typedef boost::shared_ptr<ManagementAgent> shared_ptr;
-
- static void enableManagement (void);
- static shared_ptr getAgent (void);
- static void shutdown (void);
-
- void setInterval (uint16_t _interval) { interval = _interval; }
- void setExchange (broker::Exchange::shared_ptr mgmtExchange,
- broker::Exchange::shared_ptr directExchange);
- void addObject (ManagementObject::shared_ptr object,
- uint64_t persistenceId = 0,
- uint64_t idOffset = 10);
- void clientAdded (void);
- void dispatchCommand (broker::Deliverable& msg,
- const std::string& routingKey,
- const qpid::framing::FieldTable* args);
-
- private:
-
- struct Periodic : public broker::TimerTask
- {
- ManagementAgent& agent;
-
- Periodic (ManagementAgent& agent, uint32_t seconds);
- virtual ~Periodic ();
- void fire ();
- };
-
- static shared_ptr agent;
- static bool enabled;
-
- qpid::sys::RWlock userLock;
- ManagementObjectMap managementObjects;
- broker::Timer timer;
- broker::Exchange::shared_ptr mExchange;
- broker::Exchange::shared_ptr dExchange;
- uint16_t interval;
- uint64_t nextObjectId;
-
- void PeriodicProcessing (void);
- void EncodeHeader (qpid::framing::Buffer& buf, uint8_t opcode, uint8_t cls = 0);
- bool CheckHeader (qpid::framing::Buffer& buf, uint8_t *opcode, uint8_t *cls);
- void SendBuffer (qpid::framing::Buffer& buf,
- uint32_t length,
- broker::Exchange::shared_ptr exchange,
- std::string routingKey);
-};
-
-}}
-
-
-
-#endif /*!_ManagementAgent_*/
diff --git a/qpid/cpp/src/qpid/management/ManagementExchange.cpp b/qpid/cpp/src/qpid/management/ManagementExchange.cpp
deleted file mode 100644
index ee18f026e7..0000000000
--- a/qpid/cpp/src/qpid/management/ManagementExchange.cpp
+++ /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.
- *
- */
-
-#include "ManagementExchange.h"
-#include "qpid/log/Statement.h"
-
-using namespace qpid::management;
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-ManagementExchange::ManagementExchange (const string& _name, Manageable* _parent) :
- Exchange (_name, _parent), TopicExchange(_name, _parent) {}
-ManagementExchange::ManagementExchange (const std::string& _name,
- bool _durable,
- const FieldTable& _args,
- Manageable* _parent) :
- Exchange (_name, _durable, _args, _parent),
- TopicExchange(_name, _durable, _args, _parent) {}
-
-
-bool ManagementExchange::bind (Queue::shared_ptr queue,
- const string& routingKey,
- const FieldTable* args)
-{
- bool result = TopicExchange::bind (queue, routingKey, args);
-
- // Notify the management agent that a new management client has bound to the
- // exchange.
- if (result)
- managementAgent->clientAdded ();
-
- return result;
-}
-
-void ManagementExchange::route (Deliverable& msg,
- const string& routingKey,
- const FieldTable* args)
-{
- // Intercept management commands
- if (routingKey.length () > 7 &&
- routingKey.substr (0, 7).compare ("method.") == 0)
- {
- managementAgent->dispatchCommand (msg, routingKey, args);
- return;
- }
-
- TopicExchange::route (msg, routingKey, args);
-}
-
-void ManagementExchange::setManagmentAgent (ManagementAgent::shared_ptr agent)
-{
- managementAgent = agent;
-}
-
-
-ManagementExchange::~ManagementExchange() {}
-
-const std::string ManagementExchange::typeName("management");
-
diff --git a/qpid/cpp/src/qpid/management/ManagementExchange.h b/qpid/cpp/src/qpid/management/ManagementExchange.h
deleted file mode 100644
index 1a79482c9d..0000000000
--- a/qpid/cpp/src/qpid/management/ManagementExchange.h
+++ /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.
- *
- */
-#ifndef _ManagementExchange_
-#define _ManagementExchange_
-
-#include "qpid/broker/TopicExchange.h"
-#include "ManagementAgent.h"
-
-namespace qpid {
-namespace broker {
-
-class ManagementExchange : public virtual TopicExchange
-{
- private:
- management::ManagementAgent::shared_ptr managementAgent;
-
- public:
- static const std::string typeName;
-
- ManagementExchange (const string& name, Manageable* _parent = 0);
- ManagementExchange (const string& _name, bool _durable,
- const qpid::framing::FieldTable& _args,
- Manageable* _parent = 0);
-
- virtual std::string getType() const { return typeName; }
-
- virtual bool bind (Queue::shared_ptr queue,
- const string& routingKey,
- const qpid::framing::FieldTable* args);
-
- virtual void route (Deliverable& msg,
- const string& routingKey,
- const qpid::framing::FieldTable* args);
-
- void setManagmentAgent (management::ManagementAgent::shared_ptr agent);
-
- virtual ~ManagementExchange();
-};
-
-
-}
-}
-
-#endif
diff --git a/qpid/cpp/src/qpid/management/ManagementObject.cpp b/qpid/cpp/src/qpid/management/ManagementObject.cpp
deleted file mode 100644
index c2d1f56be0..0000000000
--- a/qpid/cpp/src/qpid/management/ManagementObject.cpp
+++ /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.
- *
- */
-
-#include "Manageable.h"
-#include "ManagementObject.h"
-#include "qpid/framing/FieldTable.h"
-
-using namespace qpid::framing;
-using namespace qpid::management;
-using namespace qpid::sys;
-
-void ManagementObject::writeTimestamps (Buffer& buf)
-{
- buf.putShortString (className);
- buf.putLongLong (uint64_t (Duration (now ())));
- buf.putLongLong (createTime);
- buf.putLongLong (destroyTime);
- buf.putLongLong (objectId);
-}
diff --git a/qpid/cpp/src/qpid/management/ManagementObject.h b/qpid/cpp/src/qpid/management/ManagementObject.h
deleted file mode 100644
index a32055721d..0000000000
--- a/qpid/cpp/src/qpid/management/ManagementObject.h
+++ /dev/null
@@ -1,117 +0,0 @@
-#ifndef _ManagementObject_
-#define _ManagementObject_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Manageable.h"
-#include "qpid/sys/Time.h"
-#include <qpid/framing/Buffer.h>
-#include <boost/shared_ptr.hpp>
-#include <map>
-
-namespace qpid {
-namespace management {
-
-class Manageable;
-
-class ManagementObject
-{
- protected:
-
- uint64_t createTime;
- uint64_t destroyTime;
- uint64_t objectId;
- bool configChanged;
- bool instChanged;
- bool deleted;
- Manageable* coreObject;
- std::string className;
-
- static const uint8_t TYPE_U8 = 1;
- static const uint8_t TYPE_U16 = 2;
- static const uint8_t TYPE_U32 = 3;
- static const uint8_t TYPE_U64 = 4;
- static const uint8_t TYPE_SSTR = 6;
- static const uint8_t TYPE_LSTR = 7;
- static const uint8_t TYPE_ABSTIME = 8;
- static const uint8_t TYPE_DELTATIME = 9;
- static const uint8_t TYPE_REF = 10;
- static const uint8_t TYPE_BOOL = 11;
-
- static const uint8_t ACCESS_RC = 1;
- static const uint8_t ACCESS_RW = 2;
- static const uint8_t ACCESS_RO = 3;
-
- static const uint8_t DIR_I = 1;
- static const uint8_t DIR_O = 2;
- static const uint8_t DIR_IO = 3;
-
- static const uint8_t FLAG_CONFIG = 0x01;
- static const uint8_t FLAG_INDEX = 0x02;
- static const uint8_t FLAG_END = 0x80;
-
- void writeTimestamps (qpid::framing::Buffer& buf);
-
- public:
- typedef boost::shared_ptr<ManagementObject> shared_ptr;
-
- ManagementObject (Manageable* _core, std::string _name) :
- destroyTime(0), objectId (0), configChanged(true),
- instChanged(true), deleted(false), coreObject(_core), className(_name)
- { createTime = uint64_t (qpid::sys::Duration (qpid::sys::now ())); }
- virtual ~ManagementObject () {}
-
- virtual void writeSchema (qpid::framing::Buffer& buf) = 0;
- virtual void writeConfig (qpid::framing::Buffer& buf) = 0;
- virtual void writeInstrumentation (qpid::framing::Buffer& buf) = 0;
- virtual bool getSchemaNeeded (void) = 0;
- virtual void setSchemaNeeded (void) = 0;
- virtual void doMethod (std::string methodName,
- qpid::framing::Buffer& inBuf,
- qpid::framing::Buffer& outBuf) = 0;
-
- std::string getClassName (void) { return className; }
- void setObjectId (uint64_t oid) { objectId = oid; }
- uint64_t getObjectId (void) { return objectId; }
- inline bool getConfigChanged (void) { return configChanged; }
- virtual bool getInstChanged (void) { return instChanged; }
- inline void setAllChanged (void)
- {
- configChanged = true;
- instChanged = true;
- }
-
- inline void resourceDestroy (void) {
- destroyTime = uint64_t (qpid::sys::Duration (qpid::sys::now ()));
- deleted = true;
- }
- bool isDeleted (void) { return deleted; }
-
-};
-
- typedef std::map<uint64_t,ManagementObject::shared_ptr> ManagementObjectMap;
-
-}}
-
-
-
-#endif /*!_ManagementObject_*/
diff --git a/qpid/cpp/src/qpid/memory.h b/qpid/cpp/src/qpid/memory.h
deleted file mode 100644
index 99d7a71e7b..0000000000
--- a/qpid/cpp/src/qpid/memory.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef QPID_AUTO_PTR_H
-#define QPID_AUTO_PTR_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <memory>
-namespace qpid {
-/** Convenient template for creating auto_ptr in-place in an argument list. */
-template <class T>
-std::auto_ptr<T> make_auto_ptr(T* ptr) { return std::auto_ptr<T>(ptr); }
-
-} // namespace qpid
-
-
-
-#endif /*!QPID_AUTO_PTR_H*/
diff --git a/qpid/cpp/src/qpid/pointer_to_other.h b/qpid/cpp/src/qpid/pointer_to_other.h
deleted file mode 100644
index a99dc89658..0000000000
--- a/qpid/cpp/src/qpid/pointer_to_other.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef QPID_POINTERTOOTHER_H
-#define QPID_POINTERTOOTHER_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-namespace qpid {
-
-// Defines the same pointer type (raw or smart) to another pointee type
-
-template<class T, class U>
-struct pointer_to_other;
-
-template<class T, class U,
- template<class> class Sp>
-struct pointer_to_other< Sp<T>, U >
- {
- typedef Sp<U> type;
- };
-
-template<class T, class T2, class U,
- template<class, class> class Sp>
-struct pointer_to_other< Sp<T, T2>, U >
- {
- typedef Sp<U, T2> type;
- };
-
-template<class T, class T2, class T3, class U,
- template<class, class, class> class Sp>
-struct pointer_to_other< Sp<T, T2, T3>, U >
- {
- typedef Sp<U, T2, T3> type;
- };
-
-template<class T, class U>
-struct pointer_to_other< T*, U >
-{
- typedef U* type;
-};
-
-} // namespace qpid
-
-
-
-#endif /*!QPID_POINTERTOOTHER_H*/
diff --git a/qpid/cpp/src/qpid/ptr_map.h b/qpid/cpp/src/qpid/ptr_map.h
deleted file mode 100644
index c33f63767d..0000000000
--- a/qpid/cpp/src/qpid/ptr_map.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef QPID_PTR_MAP
-#define QPID_PTR_MAP
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/ptr_container/ptr_map.hpp>
-#include <boost/version.hpp>
-
-namespace qpid {
-namespace ptr_map {
-
-/** @file
- * Workaround for API change between boost 1.33 and 1.34.
- *
- * To be portable across these versions, code using boost::ptr_map
- * iterators should use get_pointer(i) to get the pointer from
- * a boost::ptr_map iterator.
- *
- * Can be removed when we no longer support platforms on 1.33.
- *
- * @see http://www.boost.org/libs/ptr_container/doc/ptr_container.html#upgrading-from-boost-v-1-33
- */
-#if (BOOST_VERSION < 103400)
-
-template <class PtrMapIter>
-typename PtrMapIter::pointer get_pointer(const PtrMapIter& i)
-{ return &*i; }
-
-#else
-
-template <class PtrMapIter>
-typename PtrMapIter::value_type::second_type get_pointer(const PtrMapIter& i)
-{ return i->second; }
-
-#endif
-
-}} // namespace qpid::ptr_map
-
-#endif /*!QPID_PTR_MAP*/
-#ifndef QPID_PTR_MAP
-#define QPID_PTR_MAP
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/ptr_container/ptr_map.hpp>
-#include <boost/version.hpp>
-
-namespace qpid {
-namespace ptr_map {
-
-/** @file
- * Workaround for API change between boost 1.33 and 1.34.
- *
- * To be portable across these versions, code using boost::ptr_map
- * iterators should use get_pointer(i) to get the pointer from
- * a boost::ptr_map iterator.
- *
- * Can be removed when we no longer support platforms on 1.33.
- *
- * @see http://www.boost.org/libs/ptr_container/doc/ptr_container.html#upgrading-from-boost-v-1-33
- */
-#if (BOOST_VERSION < 103400)
-
-template <class PtrMapIter>
-typename PtrMapIter::pointer get_pointer(const PtrMapIter& i)
-{ return &*i; }
-
-#else
-
-template <class PtrMapIter>
-typename PtrMapIter::value_type::second_type get_pointer(const PtrMapIter& i)
-{ return i->second; }
-
-#endif
-
-}} // namespace qpid::ptr_map
-
-#endif /*!QPID_PTR_MAP*/
diff --git a/qpid/cpp/src/qpid/shared_ptr.h b/qpid/cpp/src/qpid/shared_ptr.h
deleted file mode 100644
index 0c933ea6a6..0000000000
--- a/qpid/cpp/src/qpid/shared_ptr.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _common_shared_ptr_h
-#define _common_shared_ptr_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <boost/shared_ptr.hpp>
-#include <boost/cast.hpp>
-
-namespace qpid {
-
-// Import shared_ptr definitions into qpid namespace and define some
-// useful shared_ptr templates for convenience.
-
-using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
-using boost::static_pointer_cast;
-using boost::const_pointer_cast;
-using boost::shared_polymorphic_downcast;
-
-template <class T> shared_ptr<T> make_shared_ptr(T* ptr) {
- return shared_ptr<T>(ptr);
-}
-
-template <class T, class D>
-shared_ptr<T> make_shared_ptr(T* ptr, D deleter) {
- return shared_ptr<T>(ptr, deleter);
-}
-
-inline void nullDeleter(void const *) {}
-
-} // namespace qpid
-
-
-
-#endif /*!_common_shared_ptr_h*/
diff --git a/qpid/cpp/src/qpid/sys/Acceptor.h b/qpid/cpp/src/qpid/sys/Acceptor.h
deleted file mode 100644
index 5eb1f1a500..0000000000
--- a/qpid/cpp/src/qpid/sys/Acceptor.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef _sys_Acceptor_h
-#define _sys_Acceptor_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <stdint.h>
-#include "qpid/SharedObject.h"
-
-namespace qpid {
-namespace sys {
-
-class ConnectionInputHandlerFactory;
-class ConnectionInputHandler;
-
-class Acceptor : public qpid::SharedObject<Acceptor>
-{
- public:
- static Acceptor::shared_ptr create(int16_t port, int backlog, int threads);
- virtual ~Acceptor() = 0;
- virtual uint16_t getPort() const = 0;
- virtual std::string getHost() const = 0;
- virtual void run(ConnectionInputHandlerFactory* factory) = 0;
- virtual ConnectionInputHandler* connect(
- const std::string& host, int16_t port,
- ConnectionInputHandlerFactory* factory) = 0;
-
- /** Note: this function is async-signal safe */
- virtual void shutdown() = 0;
-};
-
-inline Acceptor::~Acceptor() {}
-
-}}
-
-
-
-#endif /*!_sys_Acceptor_h*/
diff --git a/qpid/cpp/src/qpid/sys/AggregateOutput.cpp b/qpid/cpp/src/qpid/sys/AggregateOutput.cpp
deleted file mode 100644
index 74eea5ed08..0000000000
--- a/qpid/cpp/src/qpid/sys/AggregateOutput.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/AggregateOutput.h"
-#include "qpid/log/Statement.h"
-
-namespace qpid {
-namespace sys {
-
-void AggregateOutput::activateOutput()
-{
- control.activateOutput();
-}
-
-bool AggregateOutput::doOutput()
-{
- bool result = false;
- if (!tasks.empty()) {
- if (next >= tasks.size()) next = next % tasks.size();
-
- size_t start = next;
- //loop until a task generated some output
- while (!result) {
- result = tasks[next++]->doOutput();
- if (next >= tasks.size()) next = next % tasks.size();
- if (start == next) break;
- }
- }
- return result;
-}
-
-void AggregateOutput::addOutputTask(OutputTask* t)
-{
- tasks.push_back(t);
-}
-
-void AggregateOutput::removeOutputTask(OutputTask* t)
-{
- TaskList::iterator i = find(tasks.begin(), tasks.end(), t);
- if (i != tasks.end()) tasks.erase(i);
-}
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/AggregateOutput.h b/qpid/cpp/src/qpid/sys/AggregateOutput.h
deleted file mode 100644
index a870fcb95a..0000000000
--- a/qpid/cpp/src/qpid/sys/AggregateOutput.h
+++ /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.
- *
- */
-#ifndef _AggregateOutput_
-#define _AggregateOutput_
-
-#include <vector>
-#include "Mutex.h"
-#include "OutputControl.h"
-#include "OutputTask.h"
-
-namespace qpid {
-namespace sys {
-
- class AggregateOutput : public OutputTask, public OutputControl
- {
- typedef std::vector<OutputTask*> TaskList;
-
- TaskList tasks;
- size_t next;
- OutputControl& control;
-
- public:
- AggregateOutput(OutputControl& c) : next(0), control(c) {};
- //this may be called on any thread
- void activateOutput();
- //all the following will be called on the same thread
- bool doOutput();
- void addOutputTask(OutputTask* t);
- void removeOutputTask(OutputTask* t);
- };
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/AsynchIO.h b/qpid/cpp/src/qpid/sys/AsynchIO.h
deleted file mode 100644
index ca34d82741..0000000000
--- a/qpid/cpp/src/qpid/sys/AsynchIO.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef _sys_AsynchIO
-#define _sys_AsynchIO
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Dispatcher.h"
-
-#include <boost/function.hpp>
-#include <deque>
-
-namespace qpid {
-namespace sys {
-
-/*
- * Asynchronous acceptor: accepts connections then does a callback with the
- * accepted fd
- */
-class AsynchAcceptor {
-public:
- typedef boost::function1<void, const Socket&> Callback;
-
-private:
- Callback acceptedCallback;
- DispatchHandle handle;
-
-public:
- AsynchAcceptor(const Socket& s, Callback callback);
- void start(Poller::shared_ptr poller);
-
-private:
- void readable(DispatchHandle& handle);
-};
-
-/*
- * Asycnchronous reader/writer:
- * Reader accepts buffers to read into; reads into the provided buffers
- * and then does a callback with the buffer and amount read. Optionally it can callback
- * when there is something to read but no buffer to read it into.
- *
- * Writer accepts a buffer and queues it for writing; can also be given
- * a callback for when writing is "idle" (ie fd is writable, but nothing to write)
- *
- * The class is implemented in terms of DispatchHandle to allow it to be deleted by deleting
- * the contained DispatchHandle
- */
-class AsynchIO : private DispatchHandle {
-public:
- struct BufferBase {
- char* const bytes;
- const int32_t byteCount;
- int32_t dataStart;
- int32_t dataCount;
-
- BufferBase(char* const b, const int32_t s) :
- bytes(b),
- byteCount(s),
- dataStart(0),
- dataCount(0)
- {}
-
- virtual ~BufferBase()
- {}
- };
-
- typedef boost::function2<void, AsynchIO&, BufferBase*> ReadCallback;
- typedef boost::function1<void, AsynchIO&> EofCallback;
- typedef boost::function1<void, AsynchIO&> DisconnectCallback;
- typedef boost::function2<void, AsynchIO&, const Socket&> ClosedCallback;
- typedef boost::function1<void, AsynchIO&> BuffersEmptyCallback;
- typedef boost::function1<void, AsynchIO&> IdleCallback;
-
-private:
- ReadCallback readCallback;
- EofCallback eofCallback;
- DisconnectCallback disCallback;
- ClosedCallback closedCallback;
- BuffersEmptyCallback emptyCallback;
- IdleCallback idleCallback;
- std::deque<BufferBase*> bufferQueue;
- std::deque<BufferBase*> writeQueue;
- bool queuedClose;
- /**
- * This flag is used to detect and handle concurrency between
- * calls to notifyPendingWrite() (which can be made from any thread) and
- * the execution of the writeable() method (which is always on the
- * thread processing this handle.
- */
- volatile bool writePending;
-
-public:
- AsynchIO(const Socket& s,
- ReadCallback rCb, EofCallback eofCb, DisconnectCallback disCb,
- ClosedCallback cCb = 0, BuffersEmptyCallback eCb = 0, IdleCallback iCb = 0);
- void queueForDeletion();
-
- void start(Poller::shared_ptr poller);
- void queueReadBuffer(BufferBase* buff);
- void unread(BufferBase* buff);
- void queueWrite(BufferBase* buff);
- void notifyPendingWrite();
- void queueWriteClose();
- bool writeQueueEmpty() { return writeQueue.empty(); }
- BufferBase* getQueuedBuffer();
- const Socket& getSocket() const { return DispatchHandle::getSocket(); }
-
-private:
- ~AsynchIO();
- void readable(DispatchHandle& handle);
- void writeable(DispatchHandle& handle);
- void disconnected(DispatchHandle& handle);
- void close(DispatchHandle& handle);
-};
-
-}}
-
-#endif // _sys_AsynchIO
diff --git a/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp b/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp
deleted file mode 100644
index 0586eb9d36..0000000000
--- a/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Acceptor.h"
-
-#include "Socket.h"
-#include "AsynchIO.h"
-#include "Mutex.h"
-#include "Thread.h"
-
-#include "qpid/sys/ConnectionOutputHandler.h"
-#include "qpid/sys/ConnectionInputHandler.h"
-#include "qpid/sys/ConnectionInputHandlerFactory.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid/framing/AMQDataBlock.h"
-#include "qpid/framing/Buffer.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/log/Statement.h"
-
-#include <boost/bind.hpp>
-#include <boost/assert.hpp>
-#include <queue>
-#include <vector>
-#include <memory>
-
-namespace qpid {
-namespace sys {
-
-class AsynchIOAcceptor : public Acceptor {
- Poller::shared_ptr poller;
- Socket listener;
- int numIOThreads;
- const uint16_t listeningPort;
-
- public:
- AsynchIOAcceptor(int16_t port, int backlog, int threads);
- ~AsynchIOAcceptor() {}
- void run(ConnectionInputHandlerFactory* factory);
- ConnectionInputHandler* connect(
- const std::string& host, int16_t port,
- ConnectionInputHandlerFactory* factory);
-
- void shutdown();
-
- uint16_t getPort() const;
- std::string getHost() const;
-
- private:
- void accepted(Poller::shared_ptr, const Socket&, ConnectionInputHandlerFactory*);
-};
-
-Acceptor::shared_ptr Acceptor::create(int16_t port, int backlog, int threads)
-{
- return
- Acceptor::shared_ptr(new AsynchIOAcceptor(port, backlog, threads));
-}
-
-AsynchIOAcceptor::AsynchIOAcceptor(int16_t port, int backlog, int threads) :
- poller(new Poller),
- numIOThreads(threads),
- listeningPort(listener.listen(port, backlog))
-{}
-
-// Buffer definition
-struct Buff : public AsynchIO::BufferBase {
- Buff() :
- AsynchIO::BufferBase(new char[65536], 65536)
- {}
- ~Buff()
- { delete [] bytes;}
-};
-
-class AsynchIOHandler : public qpid::sys::ConnectionOutputHandler {
- AsynchIO* aio;
- ConnectionInputHandler* inputHandler;
- std::queue<framing::AMQFrame> frameQueue;
- Mutex frameQueueLock;
- bool frameQueueClosed;
- bool initiated;
- bool readError;
- std::string identifier;
- bool isClient;
-
- void write(const framing::AMQDataBlock&);
-
- public:
- AsynchIOHandler() :
- inputHandler(0),
- frameQueueClosed(false),
- initiated(false),
- readError(false),
- isClient(false)
- {}
-
- ~AsynchIOHandler() {
- if (inputHandler)
- inputHandler->closed();
- delete inputHandler;
- }
-
- void setClient() { isClient = true; }
-
- void init(AsynchIO* a, ConnectionInputHandler* h) {
- aio = a;
- inputHandler = h;
- identifier = aio->getSocket().getPeerAddress();
- }
-
- // Output side
- void send(framing::AMQFrame&);
- void close();
- void activateOutput();
-
- // Input side
- void readbuff(AsynchIO& aio, AsynchIO::BufferBase* buff);
- void eof(AsynchIO& aio);
- void disconnect(AsynchIO& aio);
-
- // Notifications
- void nobuffs(AsynchIO& aio);
- void idle(AsynchIO& aio);
- void closedSocket(AsynchIO& aio, const Socket& s);
-};
-
-void AsynchIOAcceptor::accepted(Poller::shared_ptr poller, const Socket& s, ConnectionInputHandlerFactory* f) {
-
- AsynchIOHandler* async = new AsynchIOHandler;
- ConnectionInputHandler* handler = f->create(async, s.getPeerAddress());
- AsynchIO* aio = new AsynchIO(s,
- boost::bind(&AsynchIOHandler::readbuff, async, _1, _2),
- boost::bind(&AsynchIOHandler::eof, async, _1),
- boost::bind(&AsynchIOHandler::disconnect, async, _1),
- boost::bind(&AsynchIOHandler::closedSocket, async, _1, _2),
- boost::bind(&AsynchIOHandler::nobuffs, async, _1),
- boost::bind(&AsynchIOHandler::idle, async, _1));
- async->init(aio, handler);
-
- // Give connection some buffers to use
- for (int i = 0; i < 4; i++) {
- aio->queueReadBuffer(new Buff);
- }
- aio->start(poller);
-}
-
-
-uint16_t AsynchIOAcceptor::getPort() const {
- return listeningPort; // Immutable no need for lock.
-}
-
-std::string AsynchIOAcceptor::getHost() const {
- return listener.getSockname();
-}
-
-void AsynchIOAcceptor::run(ConnectionInputHandlerFactory* fact) {
- Dispatcher d(poller);
- AsynchAcceptor
- acceptor(listener,
- boost::bind(&AsynchIOAcceptor::accepted, this, poller, _1, fact));
- acceptor.start(poller);
-
- std::vector<Thread> t(numIOThreads-1);
-
- // Run n-1 io threads
- for (int i=0; i<numIOThreads-1; ++i)
- t[i] = Thread(d);
-
- // Run final thread
- d.run();
-
- // Now wait for n-1 io threads to exit
- for (int i=0; i<numIOThreads-1; ++i) {
- t[i].join();
- }
-}
-
-ConnectionInputHandler* AsynchIOAcceptor::connect(const std::string& host, int16_t port, ConnectionInputHandlerFactory* f)
-{
- Socket* socket = new Socket();//Should be deleted by handle when socket closes
- socket->connect(host, port);
- AsynchIOHandler* async = new AsynchIOHandler;
- async->setClient();
- ConnectionInputHandler* handler = f->create(async, socket->getPeerAddress());
- AsynchIO* aio = new AsynchIO(*socket,
- boost::bind(&AsynchIOHandler::readbuff, async, _1, _2),
- boost::bind(&AsynchIOHandler::eof, async, _1),
- boost::bind(&AsynchIOHandler::disconnect, async, _1),
- boost::bind(&AsynchIOHandler::closedSocket, async, _1, _2),
- boost::bind(&AsynchIOHandler::nobuffs, async, _1),
- boost::bind(&AsynchIOHandler::idle, async, _1));
- async->init(aio, handler);
-
- // Give connection some buffers to use
- for (int i = 0; i < 4; i++) {
- aio->queueReadBuffer(new Buff);
- }
- aio->start(poller);
- return handler;
-}
-
-
-void AsynchIOAcceptor::shutdown() {
- // NB: this function must be async-signal safe, it must not
- // call any function that is not async-signal safe.
- poller->shutdown();
-}
-
-
-void AsynchIOHandler::write(const framing::AMQDataBlock& data)
-{
- AsynchIO::BufferBase* buff = aio->getQueuedBuffer();
- if (!buff)
- buff = new Buff;
- framing::Buffer out(buff->bytes, buff->byteCount);
- data.encode(out);
- buff->dataCount = data.size();
- aio->queueWrite(buff);
-}
-
-// Output side
-void AsynchIOHandler::send(framing::AMQFrame& frame) {
- // TODO: Need to find out if we are in the callback context,
- // in the callback thread if so we can go further than just queuing the frame
- // to be handled later
- {
- ScopedLock<Mutex> l(frameQueueLock);
- // Ignore anything seen after closing
- if (!frameQueueClosed)
- frameQueue.push(frame);
- }
-
- // Activate aio for writing here
- aio->notifyPendingWrite();
-}
-
-void AsynchIOHandler::close() {
- ScopedLock<Mutex> l(frameQueueLock);
- frameQueueClosed = true;
-}
-
-void AsynchIOHandler::activateOutput() {
- aio->notifyPendingWrite();
-}
-
-// Input side
-void AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) {
- if (readError) {
- return;
- }
- framing::Buffer in(buff->bytes+buff->dataStart, buff->dataCount);
- if(initiated){
- framing::AMQFrame frame;
- try{
- while(frame.decode(in)) {
- QPID_LOG(trace, "RECV [" << identifier << "]: " << frame);
- inputHandler->received(frame);
- }
- }catch(const std::exception& e){
- QPID_LOG(error, e.what());
- readError = true;
- aio->queueWriteClose();
- }
- }else{
- framing::ProtocolInitiation protocolInit;
- if(protocolInit.decode(in)){
- QPID_LOG(debug, "INIT [" << identifier << "]");
- inputHandler->initiated(protocolInit);
- initiated = true;
- }
- }
- // TODO: unreading needs to go away, and when we can cope
- // with multiple sub-buffers in the general buffer scheme, it will
- if (in.available() != 0) {
- // Adjust buffer for used bytes and then "unread them"
- buff->dataStart += buff->dataCount-in.available();
- buff->dataCount = in.available();
- aio->unread(buff);
- } else {
- // Give whole buffer back to aio subsystem
- aio->queueReadBuffer(buff);
- }
-}
-
-void AsynchIOHandler::eof(AsynchIO&) {
- QPID_LOG(debug, "DISCONNECTED [" << identifier << "]");
- inputHandler->closed();
- aio->queueWriteClose();
-}
-
-void AsynchIOHandler::closedSocket(AsynchIO&, const Socket& s) {
- // If we closed with data still to send log a warning
- if (!aio->writeQueueEmpty()) {
- QPID_LOG(warning, "CLOSING [" << identifier << "] unsent data (probably due to client disconnect)");
- }
- delete &s;
- aio->queueForDeletion();
- delete this;
-}
-
-void AsynchIOHandler::disconnect(AsynchIO& a) {
- // treat the same as eof
- eof(a);
-}
-
-// Notifications
-void AsynchIOHandler::nobuffs(AsynchIO&) {
-}
-
-void AsynchIOHandler::idle(AsynchIO&){
- if (isClient && !initiated) {
- //get & write protocol header from upper layers
- write(inputHandler->getInitiation());
- initiated = true;
- return;
- }
- ScopedLock<Mutex> l(frameQueueLock);
-
- if (frameQueue.empty()) {
- // At this point we know that we're write idling the connection
- // so tell the input handler to queue any available output:
- inputHandler->doOutput();
- //if still no frames, theres nothing to do:
- if (frameQueue.empty()) return;
- }
-
- do {
- // Try and get a queued buffer if not then construct new one
- AsynchIO::BufferBase* buff = aio->getQueuedBuffer();
- if (!buff)
- buff = new Buff;
- framing::Buffer out(buff->bytes, buff->byteCount);
- int buffUsed = 0;
-
- framing::AMQFrame frame = frameQueue.front();
- int frameSize = frame.size();
- int framesEncoded=0;
- while (frameSize <= int(out.available())) {
- frameQueue.pop();
-
- // Encode output frame
- frame.encode(out);
- ++framesEncoded;
- buffUsed += frameSize;
- QPID_LOG(trace, "SENT [" << identifier << "]: " << frame);
-
- if (frameQueue.empty()) {
- //if we have run out of frames, allow upper layers to
- //generate more
- if (!frameQueueClosed) {
- inputHandler->doOutput();
- }
- if (frameQueue.empty()) {
- //if there are still no frames, we have no more to
- //do
- break;
- }
- }
- frame = frameQueue.front();
- frameSize = frame.size();
- }
- QPID_LOG(trace, "Writing buffer: " << buffUsed << " bytes " << framesEncoded << " frames ");
-
- // If frame was egregiously large complain
- if (frameSize > buff->byteCount)
- throw framing::ContentTooLargeException(QPID_MSG("Could not write frame, too large for buffer."));
-
- buff->dataCount = buffUsed;
- aio->queueWrite(buff);
- } while (!frameQueue.empty());
-
- if (frameQueueClosed) {
- aio->queueWriteClose();
- }
-}
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/AtomicCount.h b/qpid/cpp/src/qpid/sys/AtomicCount.h
deleted file mode 100644
index b542e37039..0000000000
--- a/qpid/cpp/src/qpid/sys/AtomicCount.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef _posix_AtomicCount_h
-#define _posix_AtomicCount_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <boost/detail/atomic_count.hpp>
-#include "ScopedIncrement.h"
-
-namespace qpid {
-namespace sys {
-
-/**
- * Atomic counter.
- */
-class AtomicCount {
- public:
- typedef ScopedDecrement<AtomicCount> ScopedDecrement;
- typedef ScopedIncrement<AtomicCount> ScopedIncrement;
-
- AtomicCount(long value = 0) : count(value) {}
-
- void operator++() { ++count ; }
-
- long operator--() { return --count; }
-
- operator long() const { return count; }
-
-
- private:
- boost::detail::atomic_count count;
-};
-
-
-}}
-
-
-#endif // _posix_AtomicCount_h
diff --git a/qpid/cpp/src/qpid/sys/BlockingQueue.h b/qpid/cpp/src/qpid/sys/BlockingQueue.h
deleted file mode 100644
index dd709c6bff..0000000000
--- a/qpid/cpp/src/qpid/sys/BlockingQueue.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifndef QPID_SYS_BLOCKINGQUEUE_H
-#define QPID_SYS_BLOCKINGQUEUE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Waitable.h"
-
-#include <queue>
-
-namespace qpid {
-namespace sys {
-
-/**
- * A simple blocking queue template
- */
-template <class T>
-class BlockingQueue
-{
- mutable sys::Waitable lock;
- std::queue<T> queue;
- bool closed;
-
-public:
- BlockingQueue() : closed(false) {}
- ~BlockingQueue() { close(); }
-
- /** Block until there is a value to pop */
- T pop()
- {
- Waitable::ScopedLock l(lock);
- if (!queueWait()) throw ClosedException();
- return popInternal();
- }
-
- /** Non-blocking pop. If there is a value set outValue and return
- * true, else return false;
- */
- bool tryPop(T& outValue) {
- Waitable::ScopedLock l(lock);
- if (queue.empty()) return false;
- outValue = popInternal();
- return true;
- }
-
- /** Non-blocking pop. If there is a value return it, else return
- * valueIfEmpty.
- */
- T tryPop(const T& valueIfEmpty=T()) {
- T result=valueIfEmpty;
- tryPop(result);
- return result;
- }
-
- /** Push a value onto the queue */
- void push(const T& t)
- {
- Waitable::ScopedLock l(lock);
- queue.push(t);
- queueNotify(0);
- }
-
- /**
- * Close the queue. Throws ClosedException in threads waiting in pop().
- * Blocks till all waiting threads have been notified.
- */
- void close()
- {
- Waitable::ScopedLock l(lock);
- if (!closed) {
- closed = true;
- lock.notifyAll();
- lock.waitWaiters(); // Ensure no threads are still waiting.
- }
- }
-
- /** Open a closed queue. */
- void open() {
- Waitable::ScopedLock l(lock);
- closed=false;
- }
-
- bool isClosed() const {
- Waitable::ScopedLock l(lock);
- return closed;
- }
-
- bool empty() const {
- Waitable::ScopedLock l(lock);
- return queue.empty();
- }
- size_t size() const {
- Waitable::ScopedLock l(lock);
- return queue.size();
- }
-
- private:
-
- void queueNotify(size_t ignore) {
- if (!queue.empty() && lock.hasWaiters()>ignore)
- lock.notify(); // Notify another waiter.
- }
-
- bool queueWait() {
- Waitable::ScopedWait w(lock);
- while (!closed && queue.empty())
- lock.wait();
- return !queue.empty();
- }
-
- T popInternal() {
- T t=queue.front();
- queue.pop();
- queueNotify(1);
- return t;
- }
-
-};
-
-}}
-
-
-
-#endif /*!QPID_SYS_BLOCKINGQUEUE_H*/
diff --git a/qpid/cpp/src/qpid/sys/Condition.h b/qpid/cpp/src/qpid/sys/Condition.h
deleted file mode 100644
index 961c15e1ee..0000000000
--- a/qpid/cpp/src/qpid/sys/Condition.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef _sys_Condition_h
-#define _sys_Condition_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#ifdef USE_APR_PLATFORM
-#include "apr/Condition.h"
-#else
-#include "posix/Condition.h"
-#endif
-
-#endif /*!_sys_Condition_h*/
diff --git a/qpid/cpp/src/qpid/sys/ConnectionInputHandler.h b/qpid/cpp/src/qpid/sys/ConnectionInputHandler.h
deleted file mode 100644
index 1936b5ec50..0000000000
--- a/qpid/cpp/src/qpid/sys/ConnectionInputHandler.h
+++ /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.
- *
- */
-#ifndef _ConnectionInputHandler_
-#define _ConnectionInputHandler_
-
-#include "qpid/framing/InputHandler.h"
-#include "qpid/framing/InitiationHandler.h"
-#include "qpid/framing/ProtocolInitiation.h"
-#include "OutputTask.h"
-#include "TimeoutHandler.h"
-
-namespace qpid {
-namespace sys {
-
- class ConnectionInputHandler :
- public qpid::framing::InitiationHandler,
- public qpid::framing::InputHandler,
- public TimeoutHandler, public OutputTask
- {
- public:
- virtual qpid::framing::ProtocolInitiation getInitiation() = 0;
- virtual void closed() = 0;
- };
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h b/qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h
deleted file mode 100644
index 2b309b5758..0000000000
--- a/qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _ConnectionInputHandlerFactory_
-#define _ConnectionInputHandlerFactory_
-
-#include <boost/noncopyable.hpp>
-#include <string>
-
-namespace qpid {
-namespace sys {
-
-class ConnectionOutputHandler;
-class ConnectionInputHandler;
-
-/**
- * Callback interface used by the Acceptor to
- * create a ConnectionInputHandler for each new connection.
- */
-class ConnectionInputHandlerFactory : private boost::noncopyable
-{
- public:
- /**
- *@param out handler for connection output.
- *@param id identify the connection for management purposes.
- */
- virtual ConnectionInputHandler* create(ConnectionOutputHandler* out,
- const std::string& id) = 0;
-
- virtual ~ConnectionInputHandlerFactory(){}
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/ConnectionOutputHandler.h b/qpid/cpp/src/qpid/sys/ConnectionOutputHandler.h
deleted file mode 100644
index 5a60ae4998..0000000000
--- a/qpid/cpp/src/qpid/sys/ConnectionOutputHandler.h
+++ /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.
- *
- */
-#ifndef _ConnectionOutputHandler_
-#define _ConnectionOutputHandler_
-
-#include "qpid/framing/OutputHandler.h"
-#include "OutputControl.h"
-
-namespace qpid {
-namespace sys {
-
-/**
- * Provides the output handler associated with a connection.
- */
-class ConnectionOutputHandler : public virtual qpid::framing::OutputHandler, public OutputControl
-{
- public:
- virtual void close() = 0;
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/DeletionManager.h b/qpid/cpp/src/qpid/sys/DeletionManager.h
deleted file mode 100644
index 43154eb98e..0000000000
--- a/qpid/cpp/src/qpid/sys/DeletionManager.h
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifndef _sys_DeletionManager_h
-#define _sys_DeletionManager_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <vector>
-#include <algorithm>
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace sys {
-
-struct deleter
-{
- template <typename T>
- void operator()(T* ptr){ delete ptr;}
-};
-
-/**
- * DeletionManager keeps track of handles that need to be deleted but may still be
- * in use by one of the threads concurrently.
- *
- * The mode of operation is like this:
- * - When we want to delete but we might still be using the handle we
- * * Transfer ownership of the handle to this class
- * * Mark the handle as (potentially) in use by every thread
- * - Then subsequently at points where the thread code knows it isn't
- * using any handles it declares that it is using no handles
- * - When the last thread declares no use of a handle it automatically
- * gets deleted by the shared_ptr implementation
- *
- * The class only has static members and data and so can only be used once for
- * any particular handle type
- */
-template <typename H>
-class DeletionManager
-{
-public:
- // Mark every thread as using the handle - it will be deleted
- // below after every thread marks the handle as unused
- static void markForDeletion(H* handle) {
- allThreadsStatuses.addHandle(shared_ptr(handle));
- }
-
- // Mark this thread is not using any handle -
- // handles get deleted here when no one else
- // is using them either
- static void markAllUnusedInThisThread() {
- static __thread ThreadStatus* threadStatus = 0;
-
- // Thread local vars can't be dynamically constructed so we need
- // to check whether we've made it yet and construct it if not
- // (no locking necessary for the check as it's thread local!)
- if (!threadStatus) {
- threadStatus = new ThreadStatus;
- allThreadsStatuses.addThreadStatus(threadStatus);
- }
-
- ScopedLock<Mutex> l(threadStatus->lock);
-
- // The actual deletions will happen here when all the shared_ptr
- // ref counts hit 0 (that is when every thread marks the handle unused)
- threadStatus->handles.clear();
- }
-
-private:
- typedef boost::shared_ptr<H> shared_ptr;
-
- // In theory we know that we never need more handles than the number of
- // threads runnning so we could use a fixed size array. However at this point
- // in the code we don't have easy access to this information.
- struct ThreadStatus
- {
- Mutex lock;
- std::vector<shared_ptr> handles;
- };
-
- class AllThreadsStatuses
- {
- Mutex lock;
- std::vector<ThreadStatus*> statuses;
-
- struct handleAdder
- {
- shared_ptr handle;
-
- handleAdder(shared_ptr h): handle(h) {}
-
- void operator()(ThreadStatus* ptr) {
- ScopedLock<Mutex> l(ptr->lock);
- ptr->handles.push_back(handle);
- }
- };
-
- public:
- // Need this to be able to do static initialisation
- explicit AllThreadsStatuses(int) {}
-
- ~AllThreadsStatuses() {
- ScopedLock<Mutex> l(lock);
- std::for_each(statuses.begin(), statuses.end(), deleter());
- }
-
- void addThreadStatus(ThreadStatus* t) {
- ScopedLock<Mutex> l(lock);
- statuses.push_back(t);
- }
-
- void addHandle(shared_ptr h) {
- ScopedLock<Mutex> l(lock);
- std::for_each(statuses.begin(), statuses.end(), handleAdder(h));
- }
- };
-
- static AllThreadsStatuses allThreadsStatuses;
-};
-
-}}
-#endif // _sys_DeletionManager_h
diff --git a/qpid/cpp/src/qpid/sys/Dispatcher.cpp b/qpid/cpp/src/qpid/sys/Dispatcher.cpp
deleted file mode 100644
index c55f808b42..0000000000
--- a/qpid/cpp/src/qpid/sys/Dispatcher.cpp
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Dispatcher.h"
-
-#include <boost/cast.hpp>
-
-#include <assert.h>
-
-namespace qpid {
-namespace sys {
-
-Dispatcher::Dispatcher(Poller::shared_ptr poller0) :
- poller(poller0) {
-}
-
-Dispatcher::~Dispatcher() {
-}
-
-void Dispatcher::run() {
- do {
- Poller::Event event = poller->wait();
- DispatchHandle* h =
- boost::polymorphic_downcast<DispatchHandle*>(event.handle);
-
- // If can read/write then dispatch appropriate callbacks
- if (h) {
- h->dispatchCallbacks(event.type);
- } else {
- // Handle shutdown
- switch (event.type) {
- case Poller::SHUTDOWN:
- goto dispatcher_shutdown;
- default:
- // This should be impossible
- assert(false);
- }
- }
- } while (true);
-
-dispatcher_shutdown:
- ;
-}
-
-DispatchHandle::~DispatchHandle() {
- stopWatch();
-}
-
-void DispatchHandle::startWatch(Poller::shared_ptr poller0) {
- bool r = readableCallback;
- bool w = writableCallback;
-
- ScopedLock<Mutex> lock(stateLock);
- assert(state == IDLE);
-
- // If no callbacks set then do nothing (that is what we were asked to do!)
- // TODO: Maybe this should be an assert instead
- if (!r && !w) {
- state = INACTIVE;
- return;
- }
-
- Poller::Direction d = r ?
- (w ? Poller::INOUT : Poller::IN) :
- Poller::OUT;
-
- poller = poller0;
- poller->addFd(*this, d);
-
- state = r ?
- (w ? ACTIVE_RW : ACTIVE_R) :
- ACTIVE_W;
-}
-
-void DispatchHandle::rewatch() {
- bool r = readableCallback;
- bool w = writableCallback;
-
- ScopedLock<Mutex> lock(stateLock);
- switch(state) {
- case IDLE:
- case DELAYED_IDLE:
- break;
- case DELAYED_R:
- case DELAYED_W:
- case DELAYED_INACTIVE:
- state = r ?
- (w ? DELAYED_RW : DELAYED_R) :
- DELAYED_W;
- break;
- case DELAYED_DELETE:
- break;
- case INACTIVE:
- case ACTIVE_R:
- case ACTIVE_W: {
- assert(poller);
- Poller::Direction d = r ?
- (w ? Poller::INOUT : Poller::IN) :
- Poller::OUT;
- poller->modFd(*this, d);
- state = r ?
- (w ? ACTIVE_RW : ACTIVE_R) :
- ACTIVE_W;
- break;
- }
- case DELAYED_RW:
- case ACTIVE_RW:
- // Don't need to do anything already waiting for readable/writable
- break;
- }
-}
-
-void DispatchHandle::rewatchRead() {
- if (!readableCallback) {
- return;
- }
-
- ScopedLock<Mutex> lock(stateLock);
- switch(state) {
- case IDLE:
- case DELAYED_IDLE:
- break;
- case DELAYED_R:
- case DELAYED_RW:
- case DELAYED_DELETE:
- break;
- case DELAYED_W:
- state = DELAYED_RW;
- break;
- case DELAYED_INACTIVE:
- state = DELAYED_R;
- break;
- case ACTIVE_R:
- case ACTIVE_RW:
- // Nothing to do: already waiting for readable
- break;
- case INACTIVE:
- assert(poller);
- poller->modFd(*this, Poller::IN);
- state = ACTIVE_R;
- break;
- case ACTIVE_W:
- assert(poller);
- poller->modFd(*this, Poller::INOUT);
- state = ACTIVE_RW;
- break;
- }
-}
-
-void DispatchHandle::rewatchWrite() {
- if (!writableCallback) {
- return;
- }
-
- ScopedLock<Mutex> lock(stateLock);
- switch(state) {
- case IDLE:
- case DELAYED_IDLE:
- break;
- case DELAYED_W:
- case DELAYED_RW:
- case DELAYED_DELETE:
- break;
- case DELAYED_R:
- state = DELAYED_RW;
- break;
- case DELAYED_INACTIVE:
- state = DELAYED_W;
- break;
- case INACTIVE:
- assert(poller);
- poller->modFd(*this, Poller::OUT);
- state = ACTIVE_W;
- break;
- case ACTIVE_R:
- assert(poller);
- poller->modFd(*this, Poller::INOUT);
- state = ACTIVE_RW;
- break;
- case ACTIVE_W:
- case ACTIVE_RW:
- // Nothing to do: already waiting for writable
- break;
- }
-}
-
-void DispatchHandle::unwatchRead() {
- if (!readableCallback) {
- return;
- }
-
- ScopedLock<Mutex> lock(stateLock);
- switch(state) {
- case IDLE:
- case DELAYED_IDLE:
- break;
- case DELAYED_R:
- state = DELAYED_INACTIVE;
- break;
- case DELAYED_RW:
- state = DELAYED_W;
- break;
- case DELAYED_W:
- case DELAYED_INACTIVE:
- case DELAYED_DELETE:
- break;
- case ACTIVE_R:
- assert(poller);
- poller->modFd(*this, Poller::NONE);
- state = INACTIVE;
- break;
- case ACTIVE_RW:
- assert(poller);
- poller->modFd(*this, Poller::OUT);
- state = ACTIVE_W;
- break;
- case ACTIVE_W:
- case INACTIVE:
- break;
- }
-}
-
-void DispatchHandle::unwatchWrite() {
- if (!writableCallback) {
- return;
- }
-
- ScopedLock<Mutex> lock(stateLock);
- switch(state) {
- case IDLE:
- case DELAYED_IDLE:
- break;
- case DELAYED_W:
- state = DELAYED_INACTIVE;
- break;
- case DELAYED_RW:
- state = DELAYED_R;
- break;
- case DELAYED_R:
- case DELAYED_INACTIVE:
- case DELAYED_DELETE:
- break;
- case ACTIVE_W:
- assert(poller);
- poller->modFd(*this, Poller::NONE);
- state = INACTIVE;
- break;
- case ACTIVE_RW:
- assert(poller);
- poller->modFd(*this, Poller::IN);
- state = ACTIVE_R;
- break;
- case ACTIVE_R:
- case INACTIVE:
- break;
- }
-}
-
-void DispatchHandle::unwatch() {
- ScopedLock<Mutex> lock(stateLock);
- switch (state) {
- case IDLE:
- case DELAYED_IDLE:
- break;
- case DELAYED_R:
- case DELAYED_W:
- case DELAYED_RW:
- case DELAYED_INACTIVE:
- state = DELAYED_INACTIVE;
- break;
- case DELAYED_DELETE:
- break;
- default:
- assert(poller);
- poller->modFd(*this, Poller::NONE);
- state = INACTIVE;
- break;
- }
-}
-
-void DispatchHandle::stopWatch() {
- ScopedLock<Mutex> lock(stateLock);
- switch (state) {
- case IDLE:
- case DELAYED_IDLE:
- case DELAYED_DELETE:
- return;
- case DELAYED_R:
- case DELAYED_W:
- case DELAYED_RW:
- case DELAYED_INACTIVE:
- state = DELAYED_IDLE;
- break;
- default:
- state = IDLE;
- break;
- }
- assert(poller);
- poller->delFd(*this);
- poller.reset();
-}
-
-// The slightly strange switch structure
-// is to ensure that the lock is released before
-// we do the delete
-void DispatchHandle::doDelete() {
- // Ensure that we're no longer watching anything
- stopWatch();
-
- // If we're in the middle of a callback defer the delete
- {
- ScopedLock<Mutex> lock(stateLock);
- switch (state) {
- case DELAYED_IDLE:
- case DELAYED_DELETE:
- state = DELAYED_DELETE;
- return;
- case IDLE:
- break;
- default:
- // Can only get out of stopWatch() in DELAYED_IDLE/DELAYED_DELETE/IDLE states
- assert(false);
- }
- }
- // If we're not then do it right away
- deferDelete();
-}
-
-void DispatchHandle::dispatchCallbacks(Poller::EventType type) {
- // Note that we are now doing the callbacks
- {
- ScopedLock<Mutex> lock(stateLock);
-
- // Set up to wait for same events next time unless reset
- switch(state) {
- case ACTIVE_R:
- state = DELAYED_R;
- break;
- case ACTIVE_W:
- state = DELAYED_W;
- break;
- case ACTIVE_RW:
- state = DELAYED_RW;
- break;
- // Can only get here in a DELAYED_* state in the rare case
- // that we're already here for reading and we get activated for
- // writing and we can write (it might be possible the other way
- // round too). In this case we're already processing the handle
- // in a different thread in this function so return right away
- case DELAYED_R:
- case DELAYED_W:
- case DELAYED_RW:
- case DELAYED_INACTIVE:
- case DELAYED_IDLE:
- case DELAYED_DELETE:
- return;
- default:
- assert(false);
- }
- }
-
- // Do callbacks - whilst we are doing the callbacks we are prevented from processing
- // the same handle until we re-enable it. To avoid rentering the callbacks for a single
- // handle re-enabling in the callbacks is actually deferred until they are complete.
- switch (type) {
- case Poller::READABLE:
- readableCallback(*this);
- break;
- case Poller::WRITABLE:
- writableCallback(*this);
- break;
- case Poller::READ_WRITABLE:
- readableCallback(*this);
- writableCallback(*this);
- break;
- case Poller::DISCONNECTED:
- {
- ScopedLock<Mutex> lock(stateLock);
- state = DELAYED_INACTIVE;
- }
- if (disconnectedCallback) {
- disconnectedCallback(*this);
- }
- break;
- default:
- assert(false);
- }
-
- // If any of the callbacks re-enabled reading/writing then actually
- // do it now
- {
- ScopedLock<Mutex> lock(stateLock);
- switch (state) {
- case DELAYED_R:
- poller->modFd(*this, Poller::IN);
- state = ACTIVE_R;
- return;
- case DELAYED_W:
- poller->modFd(*this, Poller::OUT);
- state = ACTIVE_W;
- return;
- case DELAYED_RW:
- poller->modFd(*this, Poller::INOUT);
- state = ACTIVE_RW;
- return;
- case DELAYED_INACTIVE:
- state = INACTIVE;
- return;
- case DELAYED_IDLE:
- state = IDLE;
- return;
- default:
- // This should be impossible
- assert(false);
- return;
- case DELAYED_DELETE:
- break;
- }
- }
- deferDelete();
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/sys/Dispatcher.h b/qpid/cpp/src/qpid/sys/Dispatcher.h
deleted file mode 100644
index 7cc4873068..0000000000
--- a/qpid/cpp/src/qpid/sys/Dispatcher.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef _sys_Dispatcher_h
-#define _sys_Dispatcher_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Poller.h"
-#include "Runnable.h"
-#include "Mutex.h"
-
-#include <memory>
-#include <queue>
-#include <boost/function.hpp>
-
-#include <assert.h>
-
-
-namespace qpid {
-namespace sys {
-
-class Dispatcher;
-class DispatchHandle : public PollerHandle {
- friend class Dispatcher;
-public:
- typedef boost::function1<void, DispatchHandle&> Callback;
-
-private:
- Callback readableCallback;
- Callback writableCallback;
- Callback disconnectedCallback;
- Poller::shared_ptr poller;
- Mutex stateLock;
- enum {
- IDLE, INACTIVE, ACTIVE_R, ACTIVE_W, ACTIVE_RW,
- DELAYED_IDLE, DELAYED_INACTIVE, DELAYED_R, DELAYED_W, DELAYED_RW,
- DELAYED_DELETE
- } state;
-
-public:
- DispatchHandle(const Socket& s, Callback rCb, Callback wCb, Callback dCb) :
- PollerHandle(s),
- readableCallback(rCb),
- writableCallback(wCb),
- disconnectedCallback(dCb),
- state(IDLE)
- {}
-
- ~DispatchHandle();
-
- void startWatch(Poller::shared_ptr poller);
- void rewatch();
- void rewatchRead();
- void rewatchWrite();
- void unwatch();
- void unwatchRead();
- void unwatchWrite();
- void stopWatch();
-
-protected:
- void doDelete();
-
-private:
- void dispatchCallbacks(Poller::EventType dir);
-};
-
-class Dispatcher : public Runnable {
- const Poller::shared_ptr poller;
-
-public:
- Dispatcher(Poller::shared_ptr poller);
- ~Dispatcher();
-
- void run();
-};
-
-}}
-
-#endif // _sys_Dispatcher_h
diff --git a/qpid/cpp/src/qpid/sys/Module.h b/qpid/cpp/src/qpid/sys/Module.h
deleted file mode 100644
index 79793ed0ca..0000000000
--- a/qpid/cpp/src/qpid/sys/Module.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef QPID_SYS_MODULE_H
-#define QPID_SYS_MODULE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/Shlib.h"
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
-namespace sys {
-
-template <class T> class Module : public AutoShlib, private boost::noncopyable
-{
- public:
- Module(const std::string& name) :
- AutoShlib(name),
- ptr(getSymbol<T*(*)()>("create")()) {}
-
- T* get() { return ptr; }
- T* operator->() { return ptr; }
- ~Module() throw() {
- getSymbol<void (*)(T*)>("destroy")(ptr);
- }
-
- private:
- T* ptr;
-};
-
-}}
-
-#endif /*!QPID_SYS_MODULE_H*/
diff --git a/qpid/cpp/src/qpid/sys/Monitor.h b/qpid/cpp/src/qpid/sys/Monitor.h
deleted file mode 100644
index 1d9835675c..0000000000
--- a/qpid/cpp/src/qpid/sys/Monitor.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _sys_Monitor_h
-#define _sys_Monitor_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <sys/errno.h>
-#include "Condition.h"
-
-namespace qpid {
-namespace sys {
-
-/**
- * A monitor is a condition variable and a mutex
- */
-class Monitor : public Mutex, public Condition {
- public:
- using Condition::wait;
- inline void wait();
- inline bool wait(const AbsTime& absoluteTime);
-};
-
-
-void Monitor::wait() {
- Condition::wait(*this);
-}
-
-bool Monitor::wait(const AbsTime& absoluteTime) {
- return Condition::wait(*this, absoluteTime);
-}
-
-}}
-#endif /*!_sys_Monitor_h*/
diff --git a/qpid/cpp/src/qpid/sys/Mutex.h b/qpid/cpp/src/qpid/sys/Mutex.h
deleted file mode 100644
index b4bd3a9b4a..0000000000
--- a/qpid/cpp/src/qpid/sys/Mutex.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef _sys_Mutex_h
-#define _sys_Mutex_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace qpid {
-namespace sys {
-
-/**
- * Scoped lock template: calls lock() in ctor, unlock() in dtor.
- * L can be any class with lock() and unlock() functions.
- */
-template <class L>
-class ScopedLock
-{
- public:
- ScopedLock(L& l) : mutex(l) { l.lock(); }
- ~ScopedLock() { mutex.unlock(); }
- private:
- L& mutex;
-};
-
-template <class L>
-class ScopedUnlock
-{
- public:
- ScopedUnlock(L& l) : mutex(l) { l.unlock(); }
- ~ScopedUnlock() { mutex.lock(); }
- private:
- L& mutex;
-};
-
-template <class L>
-class ScopedRlock
-{
- public:
- ScopedRlock(L& l) : mutex(l) { l.rlock(); }
- ~ScopedRlock() { mutex.unlock(); }
- private:
- L& mutex;
-};
-
-template <class L>
-class ScopedWlock
-{
- public:
- ScopedWlock(L& l) : mutex(l) { l.wlock(); }
- ~ScopedWlock() { mutex.unlock(); }
- private:
- L& mutex;
-};
-
-template <class L>
-class ConditionalScopedLock
-{
- public:
- ConditionalScopedLock(L& l) : mutex(l) { acquired = l.trylock(); }
- ~ConditionalScopedLock() { if (acquired) mutex.unlock(); }
- bool lockAcquired() { return acquired; }
- private:
- L& mutex;
- bool acquired;
-};
-
-}}
-
-#ifdef USE_APR_PLATFORM
-#include "apr/Mutex.h"
-#else
-#include "posix/Mutex.h"
-#endif
-
-#endif /*!_sys_Mutex_h*/
diff --git a/qpid/cpp/src/qpid/sys/OutputControl.h b/qpid/cpp/src/qpid/sys/OutputControl.h
deleted file mode 100644
index d922a0d85c..0000000000
--- a/qpid/cpp/src/qpid/sys/OutputControl.h
+++ /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.
- *
- */
-#ifndef _OutputControl_
-#define _OutputControl_
-
-namespace qpid {
-namespace sys {
-
- class OutputControl
- {
- public:
- virtual ~OutputControl() {}
- virtual void activateOutput() = 0;
- };
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/OutputTask.h b/qpid/cpp/src/qpid/sys/OutputTask.h
deleted file mode 100644
index 109765b8c3..0000000000
--- a/qpid/cpp/src/qpid/sys/OutputTask.h
+++ /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.
- *
- */
-#ifndef _OutputTask_
-#define _OutputTask_
-
-namespace qpid {
-namespace sys {
-
- class OutputTask
- {
- public:
- virtual ~OutputTask() {}
- virtual bool doOutput() = 0;
- };
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/Poller.h b/qpid/cpp/src/qpid/sys/Poller.h
deleted file mode 100644
index 0d6b4f9308..0000000000
--- a/qpid/cpp/src/qpid/sys/Poller.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef _sys_Poller_h
-#define _sys_Poller_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Time.h"
-#include "Socket.h"
-
-#include <stdint.h>
-
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace sys {
-
-/**
- * Handle class to use for polling
- */
-class Poller;
-class PollerHandlePrivate;
-class PollerHandle {
- friend class Poller;
-
- PollerHandlePrivate* const impl;
- const Socket& socket;
-
-public:
- PollerHandle(const Socket& s);
-
- // Usual way to delete (will defer deletion until we
- // can't be returned from a Poller::wait any more)
- void deferDelete();
-
- // Class clients shouldn't ever use this
- virtual ~PollerHandle();
-
- const Socket& getSocket() const {return socket;}
-};
-
-/**
- * Poller: abstract class to encapsulate a file descriptor poll to be used
- * by a reactor
- */
-class PollerPrivate;
-class Poller {
- PollerPrivate* const impl;
-
-public:
- typedef boost::shared_ptr<Poller> shared_ptr;
-
- enum Direction {
- NONE = 0,
- IN,
- OUT,
- INOUT
- };
-
- enum EventType {
- INVALID = 0,
- READABLE,
- WRITABLE,
- READ_WRITABLE,
- DISCONNECTED,
- SHUTDOWN,
- TIMEOUT
- };
-
- struct Event {
- PollerHandle* handle;
- EventType type;
-
- Event(PollerHandle* handle0, EventType type0) :
- handle(handle0),
- type(type0) {
- }
- };
-
- Poller();
- ~Poller();
- /** Note: this function is async-signal safe */
- void shutdown();
-
- void addFd(PollerHandle& handle, Direction dir);
- void delFd(PollerHandle& handle);
- void modFd(PollerHandle& handle, Direction dir);
- void rearmFd(PollerHandle& handle);
- Event wait(Duration timeout = TIME_INFINITE);
-};
-
-}}
-#endif // _sys_Poller_h
diff --git a/qpid/cpp/src/qpid/sys/RefCountedMap.h b/qpid/cpp/src/qpid/sys/RefCountedMap.h
deleted file mode 100644
index 7db1d34953..0000000000
--- a/qpid/cpp/src/qpid/sys/RefCountedMap.h
+++ /dev/null
@@ -1,163 +0,0 @@
-#ifndef QPID_SYS_REFCOUNTEDMAP_H
-#define QPID_SYS_REFCOUNTEDMAP_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/Mutex.h"
-#include "qpid/RefCounted.h"
-#include <boost/type_traits/remove_pointer.hpp>
-#include <boost/bind.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/cast.hpp>
-#include <vector>
-#include <map>
-#include <algorithm>
-
-namespace qpid {
-namespace sys {
-
-template <class, class, class> class RefCountedMap;
-
-template <class Key, class Data, class Base=RefCounted,
- class Impl=std::map<Key, Data*> >
-class RefCountedMapData : public Base {
- public:
- typedef RefCountedMap<Key, Data, Impl> Map;
-
- bool attached() {
- assert(map || self->second == this);
- return map;
- }
- const Key& getKey() const { assert(attached()); return self->first; }
- void released() const { if (map) map->lockedDetach(self); delete this; }
-
- private:
- friend class RefCountedMap<Key, Data, Impl>;
- intrusive_ptr<Map> map;
- typename Impl::iterator self;
-
- public:
-};
-
-/**
- * A thread-safe, reference-counted, weak map of reference-counted values.
- *
- * The map does not hold a reference to its members, they must have
- * external references to exist. When last external reference is
- * released, the value is atomically erased from the map and deleted.
- *
- * The map itself is a member of a ref-counted holder class, the
- * map ensures its holder is not deleted till the map is empty.
- */
-template <class Key, class Data, class Impl=std::map<Key, Data*> >
-class RefCountedMap : public RefCountedChild {
- template <class, class, class, class> friend class RefCountedMapData;
- typedef typename Impl::iterator iterator;
- typedef typename Impl::value_type value_type;
-
- mutable sys::Mutex lock;
- Impl map;
-
- // Acquire the lock and ensure map is not deleted before unlock.
- class Lock {
- intrusive_ptr<const RefCountedMap> map;
- sys::Mutex::ScopedLock lock;
- public:
- Lock(const RefCountedMap* m) : map(m), lock(m->lock) {}
- };
-
- // Called from Data::released.
- void lockedDetach(iterator i) { Lock l(this); detach(i); }
-
- void detach(iterator i) {
- // Must be called with lock held.
- assert(i->second->map == this);
- map.erase(i);
- i->second->map = 0; // May call this->release()
- }
-
- public:
- RefCountedMap(RefCounted& container) : RefCountedChild(container) {}
- ~RefCountedMap() {}
-
- /** Return 0 if not found */
- intrusive_ptr<Data> find(const Key& k) {
- Lock l(this);
- iterator i = map.find(k);
- return (i == map.end()) ? 0 : i->second;
- }
-
- bool insert(const Key& k, intrusive_ptr<Data> d) {
- Lock l(this);
- iterator i;
- bool inserted;
- boost::tuples::tie(i, inserted) =
- map.insert(std::make_pair(k, d.get()));
- if (inserted) {
- assert(!d->map);
- d->map=boost::polymorphic_downcast<RefCountedMap*>(this);
- d->self=i;
- }
- return inserted;
- }
-
- size_t size() { Lock l(this); return map.size(); }
-
- bool empty() { Lock l(this); return map.empty(); }
-
- void erase(const Key& k) { Lock l(this); detach(map.find(k)); }
-
- void clear() { Lock l(this); while (!map.empty()) detach(map.begin()); }
-
- /** Clear the map, apply functor to each entry before erasing */
- template <class F> void clear(F functor) {
- Lock l(this);
- while (!map.empty()) {
- intrusive_ptr<Data> ptr;
- if (map.empty()) return;
- ptr = map.begin()->second;
- detach(map.begin());
- sys::Mutex::ScopedUnlock u(lock);
- functor(ptr);
- }
- }
-
- /** Apply functor to each map entry. */
- template <class F> void apply(F functor) {
- std::vector<intrusive_ptr<Data> > snapshot;
- {
- // Take a snapshot referencing all values in map.
- Lock l(this);
- snapshot.resize(map.size());
- typedef value_type value_type;
- std::transform(map.begin(), map.end(), snapshot.begin(),
- boost::bind(&value_type::second, _1));
- }
- // Drop the lock to call functor.
- std::for_each(snapshot.begin(), snapshot.end(), functor);
- }
-};
-
-
-}} // namespace qpid::sys
-
-#endif /*!QPID_SYS_REFCOUNTEDMAP_H*/
diff --git a/qpid/cpp/src/qpid/sys/Runnable.cpp b/qpid/cpp/src/qpid/sys/Runnable.cpp
deleted file mode 100644
index 30122c682f..0000000000
--- a/qpid/cpp/src/qpid/sys/Runnable.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Runnable.h"
-#include <boost/bind.hpp>
-
-namespace qpid {
-namespace sys {
-
-Runnable::~Runnable() {}
-
-Runnable::Functor Runnable::functor()
-{
- return boost::bind(&Runnable::run, this);
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/sys/Runnable.h b/qpid/cpp/src/qpid/sys/Runnable.h
deleted file mode 100644
index fb3927c612..0000000000
--- a/qpid/cpp/src/qpid/sys/Runnable.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef _Runnable_
-#define _Runnable_
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/function.hpp>
-
-namespace qpid {
-namespace sys {
-
-/**
- * Interface for objects that can be run, e.g. in a thread.
- */
-class Runnable
-{
- public:
- /** Type to represent a runnable as a Functor */
- typedef boost::function0<void> Functor;
-
- virtual ~Runnable();
-
- /** Derived classes override run(). */
- virtual void run() = 0;
-
- /** Create a functor object that will call this->run(). */
- Functor functor();
-};
-
-}}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/ScopedIncrement.h b/qpid/cpp/src/qpid/sys/ScopedIncrement.h
deleted file mode 100644
index 8645ab2484..0000000000
--- a/qpid/cpp/src/qpid/sys/ScopedIncrement.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef _posix_ScopedIncrement_h
-#define _posix_ScopedIncrement_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <boost/noncopyable.hpp>
-#include <boost/function.hpp>
-
-namespace qpid {
-namespace sys {
-
-/**
- * Increment counter in constructor and decrement in destructor.
- * Optionally call a function if the decremented counter value is 0.
- * Note the function must not throw, it is called in the destructor.
- */
-template <class T, class F=boost::function<void()> >
-class ScopedIncrement : boost::noncopyable
-{
- public:
- ScopedIncrement(T& c, F f=0)
- : count(c), callback(f) { ++count; }
- ~ScopedIncrement() { if (--count == 0 && callback) callback(); }
-
- private:
- T& count;
- F callback;
-};
-
-
-/** Decrement counter in constructor and increment in destructor. */
-template <class T>
-class ScopedDecrement : boost::noncopyable
-{
- public:
- ScopedDecrement(T& c) : count(c) { value = --count; }
- ~ScopedDecrement() { ++count; }
-
- /** Return the value after the decrement. */
- operator long() { return value; }
-
- private:
- T& count;
- long value;
-};
-
-
-}}
-
-
-#endif // _posix_ScopedIncrement_h
diff --git a/qpid/cpp/src/qpid/sys/Semaphore.h b/qpid/cpp/src/qpid/sys/Semaphore.h
deleted file mode 100644
index 3efb7ce2df..0000000000
--- a/qpid/cpp/src/qpid/sys/Semaphore.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef _sys_Semaphore_h
-#define _sys_Semaphore_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Monitor.h"
-
-namespace qpid {
-namespace sys {
-
-class Semaphore
-{
-public:
- Semaphore(uint c = 1) : count(c) {}
-
- void lock() { acquire(); }
- void unlock() { release(); }
- bool trylock() { return tryAcquire(); }
-
- bool tryAcquire()
- {
- Monitor::ScopedLock l(monitor);
- if (count) {
- count--;
- return true;
- } else {
- return false;
- }
- }
-
- void acquire()
- {
- Monitor::ScopedLock l(monitor);
- while (count == 0) monitor.wait();
- count--;
- }
-
- void release()
- {
- Monitor::ScopedLock l(monitor);
- if (!count++) monitor.notifyAll();
- }
-
-private:
- Monitor monitor;
- uint count;
-};
-
-}}
-
-#endif /*!_sys_Semaphore_h*/
diff --git a/qpid/cpp/src/qpid/sys/Serializer.cpp b/qpid/cpp/src/qpid/sys/Serializer.cpp
deleted file mode 100644
index 86f901aa78..0000000000
--- a/qpid/cpp/src/qpid/sys/Serializer.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/Serializer.h"
-#include "qpid/log/Statement.h"
-
-#include <boost/bind.hpp>
-
-#include <assert.h>
-
-namespace qpid {
-namespace sys {
-
-SerializerBase::SerializerBase(bool allowImmediate)
- : state(IDLE), immediate(allowImmediate) {}
-
-void SerializerBase::shutdown() {
- {
- Mutex::ScopedLock l(lock);
- if (state == SHUTDOWN) return;
- state = SHUTDOWN;
- lock.notify();
- }
- if (worker.id() != 0)
- worker.join();
-}
-
-void SerializerBase::notifyWorker() {
- // Call with lock held.
- if (!worker.id())
- worker = Thread(*this);
- else
- lock.notify();
-}
-
-bool SerializerBase::running() {
- Mutex::ScopedLock l(lock);
- return state != SHUTDOWN;
-}
-
-void SerializerBase::wait() {
- Mutex::ScopedLock l(lock);
- if (state == IDLE) lock.wait();
-}
-
-void SerializerBase::run() {
- while (running()) {
- dispatch();
- wait();
- }
-}
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/Serializer.h b/qpid/cpp/src/qpid/sys/Serializer.h
deleted file mode 100644
index fe4afc85cb..0000000000
--- a/qpid/cpp/src/qpid/sys/Serializer.h
+++ /dev/null
@@ -1,181 +0,0 @@
-#ifndef SERIALIZER_H
-#define SERIALIZER_H
-
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid/sys/Thread.h"
-
-#include <boost/function.hpp>
-#include <boost/noncopyable.hpp>
-
-#include <deque>
-
-namespace qpid {
-namespace sys {
-
-/** Abstract base class for Serializer below. */
-class SerializerBase : private boost::noncopyable, private Runnable
-{
- public:
- typedef boost::function<void()> VoidFn0;
- struct ShutdownException : public Exception {};
-
- /** @see Serializer::Serializer */
- SerializerBase(bool immediate=true);
-
- virtual ~SerializerBase() { shutdown(); }
-
- virtual void dispatch() = 0;
- protected:
- enum State {
- IDLE, ///< No threads are active.
- EXECUTING, ///< execute() is executing a single task.
- DISPATCHING, ///< dispatch() is draining the queue.
- SHUTDOWN ///< SerailizerBase is being destroyed.
- };
-
- void shutdown();
- void notifyWorker();
- void run();
- virtual bool empty() = 0;
- bool running();
- void wait();
-
- Monitor lock;
- State state;
- bool immediate;
- Thread worker;
-};
-
-
-/**
- * Execute tasks sequentially, queuing tasks when necessary to
- * ensure only one thread at a time executes a task and tasks
- * are executed in order.
- *
- * Task is a void returning 0-arg functor. It must not throw exceptions.
- *
- * Note we deliberately do not use boost::function as the task type
- * because copying a boost::functor allocates the target object on the
- * heap.
- */
-template <class Task>
-class Serializer : public SerializerBase {
-
- std::deque<Task> queue;
-
- bool empty() { return queue.empty(); }
- void dispatch(Task& task);
-
- public:
- /** Start a serializer.
- *
- * @param immediate Allow execute() to execute a task immediatly
- * in the current thread.
- */
- Serializer(bool immediate=true)
- : SerializerBase(immediate) {}
-
- ~Serializer() { shutdown(); }
- /**
- * Task may be executed immediately in the calling thread if there
- * are no other tasks pending or executing and the "immediate"
- * paramater to the constructor was true. Otherwise task will be
- * enqueued for execution by a dispatch thread.
- */
- void execute(Task& task);
-
-
- /** Execute pending tasks sequentially in calling thread.
- * Drains the task queue and returns, does not block for more tasks.
- *
- * @exception ShutdownException if the serializer is being destroyed.
- */
- void dispatch();
- };
-
-
-template <class Task>
-void Serializer<Task>::execute(Task& task) {
- Mutex::ScopedLock l(lock);
- assert(state != SHUTDOWN);
- if (immediate && state == IDLE) {
- state = EXECUTING;
- dispatch(task);
- if (state != SHUTDOWN) {
- assert(state == EXECUTING);
- state = IDLE;
- }
- }
- else
- queue.push_back(task);
- if (!queue.empty() && state == IDLE) {
- state = DISPATCHING;
- notifyWorker();
- }
-}
-
-template <class Task>
-void Serializer<Task>::dispatch() {
- Mutex::ScopedLock l(lock);
- // TODO aconway 2007-07-16: This loop could be unbounded
- // if other threads add work while we're in dispatch(Task&).
- // If we need to bound it we could dispatch just the elements
- // that were enqueued when dispatch() was first called - save
- // begin() iterator and pop only up to that.
- while (!queue.empty() && state != SHUTDOWN) {
- assert(state == DISPATCHING);
- dispatch(queue.front());
- queue.pop_front();
- }
- if (state != SHUTDOWN) {
- assert(state == DISPATCHING);
- state = IDLE;
- }
-}
-
-template <class Task>
-void Serializer<Task>::dispatch(Task& task) {
- // Preconditions: lock is held, state is EXECUTING or DISPATCHING
- assert(state != IDLE);
- assert(state != SHUTDOWN);
- assert(state == EXECUTING || state == DISPATCHING);
- Mutex::ScopedUnlock u(lock);
- // No exceptions allowed in task.
- notifyWorker();
- try { task(); } catch (...) { assert(0); }
-}
-
-
-
-
-}} // namespace qpid::sys
-
-
-
-
-
-#endif /*!SERIALIZER_H*/
diff --git a/qpid/cpp/src/qpid/sys/Shlib.cpp b/qpid/cpp/src/qpid/sys/Shlib.cpp
deleted file mode 100644
index 8fd3f42cc6..0000000000
--- a/qpid/cpp/src/qpid/sys/Shlib.cpp
+++ /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.
- *
- */
-
-#include "Shlib.h"
-
-#include "qpid/log/Statement.h"
-
-namespace qpid {
-namespace sys {
-
-AutoShlib::~AutoShlib() throw() {
- try {
- unload();
- } catch(const std::exception& e) {
- QPID_LOG(error, "Unloading shared library: " << e.what());
- }
-}
-
-// Note: Other functions are defined in apr/Shlib.cpp or posix/Shlib.cpp.
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/Shlib.h b/qpid/cpp/src/qpid/sys/Shlib.h
deleted file mode 100644
index debf231125..0000000000
--- a/qpid/cpp/src/qpid/sys/Shlib.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef QPID_SYS_SHLIB_H
-#define QPID_SYS_SHLIB_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/noncopyable.hpp>
-#include <iostream>
-#include <dlfcn.h>
-
-namespace qpid {
-namespace sys {
-
-/** Encapsulates a shared library handle.
- *@see AutoShlib
- */
-class Shlib {
- public:
- /** Load a shared library */
- Shlib(const char* libname) { load(libname); }
-
- /** Load a shared library */
- Shlib(const std::string& libname) { load(libname.c_str()); }
-
- /** Unload shared library. */
- void unload();
-
- /** Look up symbol. */
- void* getSymbol(const char* symbol);
-
- /** Look up symbol in shared library, cast it to the desired
- * pointer type, void* by default.
- */
- template <class T>
- T getSymbol(const char* symbol) {
- // Double cast avoids warning about casting object to function pointer
- return reinterpret_cast<T>(reinterpret_cast<intptr_t>(
- this->getSymbol(symbol)));
- }
-
- /** Look up symbol in shared library. */
- template <class T*>
- void* getSymbol(const std::string& symbol) {
- return getSymbol<T>(symbol.c_str());
- }
-
- private:
- void* handle;
- void load(const char* libname);
-};
-
-/** A shared library handle that unloads the shlib in it's dtor */
-class AutoShlib : public Shlib {
- public:
- /** Load shared library */
- AutoShlib(const std::string& libname) : Shlib(libname) {}
- /** Calls unload() */
- ~AutoShlib() throw();
-};
-
-
-}} // namespace qpid::sys
-
-#endif /*!QPID_SYS_SHLIB_H*/
diff --git a/qpid/cpp/src/qpid/sys/ShutdownHandler.h b/qpid/cpp/src/qpid/sys/ShutdownHandler.h
deleted file mode 100644
index 88baecb5b6..0000000000
--- a/qpid/cpp/src/qpid/sys/ShutdownHandler.h
+++ /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.
- *
- */
-#ifndef _ShutdownHandler_
-#define _ShutdownHandler_
-
-namespace qpid {
-namespace sys {
-
- class ShutdownHandler
- {
- public:
- virtual void shutdown() = 0;
- virtual ~ShutdownHandler(){}
- };
-
-}
-}
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/Socket.h b/qpid/cpp/src/qpid/sys/Socket.h
deleted file mode 100644
index 1594e89aac..0000000000
--- a/qpid/cpp/src/qpid/sys/Socket.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef _sys_Socket_h
-#define _sys_Socket_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <string>
-#include "qpid/sys/Time.h"
-
-struct sockaddr;
-
-namespace qpid {
-namespace sys {
-
-class SocketPrivate;
-class Socket
-{
- friend class Poller;
-
- SocketPrivate* const impl;
-
-public:
- /** Create a socket wrapper for descriptor. */
- Socket();
- ~Socket();
-
- /** Create an initialized TCP socket */
- void createTcp() const;
-
- /** Set timeout for read and write */
- void setTimeout(const Duration& interval) const;
-
- /** Set socket non blocking */
- void setNonblocking() const;
-
- void connect(const std::string& host, int port) const;
-
- void close() const;
-
- enum { SOCKET_TIMEOUT=-2, SOCKET_EOF=-3 } ErrorCode;
-
- /** Returns bytes sent or an ErrorCode value < 0. */
- ssize_t send(const void* data, size_t size) const;
-
- /**
- * Returns bytes received, an ErrorCode value < 0 or 0
- * if the connection closed in an orderly manner.
- */
- ssize_t recv(void* data, size_t size) const;
-
- /** Bind to a port and start listening.
- *@param port 0 means choose an available port.
- *@param backlog maximum number of pending connections.
- *@return The bound port.
- */
- int listen(int port = 0, int backlog = 10) const;
-
- /** Returns the "socket name" ie the address bound to
- * the near end of the socket
- */
- std::string getSockname() const;
-
- /** Returns the "peer name" ie the address bound to
- * the remote end of the socket
- */
- std::string getPeername() const;
-
- /**
- * Returns an address (host and port) for the remote end of the
- * socket
- */
- std::string getPeerAddress() const;
- /**
- * Returns an address (host and port) for the local end of the
- * socket
- */
- std::string getLocalAddress() const;
-
- uint getLocalPort() const;
- uint getRemotePort() const;
-
-
- /** Accept a connection from a socket that is already listening
- * and has an incoming connection
- */
- Socket* accept(struct sockaddr *addr, socklen_t *addrlen) const;
-
- // TODO The following are raw operations, maybe they need better wrapping?
- int read(void *buf, size_t count) const;
- int write(const void *buf, size_t count) const;
-
- int toFd() const;
-
-private:
- Socket(SocketPrivate*);
-};
-
-}}
-#endif /*!_sys_Socket_h*/
diff --git a/qpid/cpp/src/qpid/sys/StateMonitor.h b/qpid/cpp/src/qpid/sys/StateMonitor.h
deleted file mode 100644
index 5a92756f3a..0000000000
--- a/qpid/cpp/src/qpid/sys/StateMonitor.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef QPID_SYS_STATEMONITOR_H
-#define QPID_SYS_STATEMONITOR_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/sys/Waitable.h"
-
-#include <bitset>
-
-namespace qpid {
-namespace sys {
-
-/**
- * A monitor with an enum state value.
- *
- *@param Enum: enum type to use for states.
- *@param EnumMax: Highest enum value.
- */
-template <class Enum, size_t MaxEnum>
-class StateMonitor : public Waitable
-{
- public:
- struct Set : public std::bitset<MaxEnum + 1> {
- Set() {}
- Set(Enum s) { set(s); }
- Set(Enum s, Enum t) { set(s).set(t); }
- Set(Enum s, Enum t, Enum u) { set(s).set(t).set(u); }
- Set(Enum s, Enum t, Enum u, Enum v) { set(s).set(t).set(u).set(v); }
- };
-
-
- StateMonitor(Enum initial) { state=initial; }
-
- /** @pre Caller holds a ScopedLock. */
- void set(Enum s) { state=s; notifyAll(); }
- /** @pre Caller holds a ScopedLock. */
- StateMonitor& operator=(Enum s) { set(s); return *this; }
-
- /** @pre Caller holds a ScopedLock. */
- Enum get() const { return state; }
- /** @pre Caller holds a ScopedLock. */
- operator Enum() const { return state; }
-
- /** @pre Caller holds a ScopedLock */
- void waitFor(Enum s) { ScopedWait(*this); while (s != state) wait(); }
- /** @pre Caller holds a ScopedLock */
- void waitFor(Set s) { ScopedWait(*this); while (!s.test(state)) wait(); }
- /** @pre Caller holds a ScopedLock */
- void waitNot(Enum s) { ScopedWait(*this); while (s == state) wait(); }
- /** @pre Caller holds a ScopedLock */
- void waitNot(Set s) { ScopedWait(*this); while (s.test(state)) wait(); }
-
- private:
- Enum state;
-};
-
-}}
-
-
-#endif /*!QPID_SYS_STATEMONITOR_H*/
diff --git a/qpid/cpp/src/qpid/sys/SystemInfo.cpp b/qpid/cpp/src/qpid/sys/SystemInfo.cpp
deleted file mode 100644
index dcc7ad9985..0000000000
--- a/qpid/cpp/src/qpid/sys/SystemInfo.cpp
+++ /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.
- *
- */
-
-#include "SystemInfo.h"
-#include <unistd.h>
-
-namespace qpid {
-namespace sys {
-
-long SystemInfo::concurrency() {
-#ifdef _SC_NPROCESSORS_ONLN // Linux specific.
- return sysconf(_SC_NPROCESSORS_ONLN);
-#else
- return -1;
-#endif
-}
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/SystemInfo.h b/qpid/cpp/src/qpid/sys/SystemInfo.h
deleted file mode 100644
index 73c3ca3c17..0000000000
--- a/qpid/cpp/src/qpid/sys/SystemInfo.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef QPID_SYS_SYSTEMINFO_H
-#define QPID_SYS_SYSTEMINFO_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-namespace qpid {
-namespace sys {
-
-/**
- * Retrieve information about the system we are running on.
- * Results may be dependent on OS/hardware.
- */
-class SystemInfo
-{
- public:
- /** Estimate available concurrency, e.g. number of CPU cores.
- * -1 means estimate not available on this platform.
- */
- static long concurrency();
-};
-
-}} // namespace qpid::sys
-
-
-
-#endif /*!QPID_SYS_SYSTEMINFO_H*/
diff --git a/qpid/cpp/src/qpid/sys/Thread.h b/qpid/cpp/src/qpid/sys/Thread.h
deleted file mode 100644
index fd9be5617e..0000000000
--- a/qpid/cpp/src/qpid/sys/Thread.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef _sys_Thread_h
-#define _sys_Thread_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#ifdef USE_APR_PLATFORM
-#include "apr/Thread.h"
-#else
-#include "posix/Thread.h"
-#endif
-
-#endif /*!_sys_Thread_h*/
diff --git a/qpid/cpp/src/qpid/sys/Time.h b/qpid/cpp/src/qpid/sys/Time.h
deleted file mode 100644
index c87bd6f05b..0000000000
--- a/qpid/cpp/src/qpid/sys/Time.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifndef _sys_Time_h
-#define _sys_Time_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <stdint.h>
-#include <limits>
-
-namespace qpid {
-namespace sys {
-
-class Duration;
-
-/** Times in nanoseconds */
-class AbsTime {
- static int64_t max() { return std::numeric_limits<int64_t>::max(); }
- int64_t time_ns;
-
- friend class Duration;
-
- public:
- inline AbsTime() {}
- inline AbsTime(const AbsTime& time0, const Duration& duration);
- // Default asignment operation fine
- // Default copy constructor fine
- inline void reset(const AbsTime& time0, const Duration& duration);
-
- static AbsTime now();
- inline static AbsTime FarFuture();
- int64_t timeValue() const { return time_ns; }
- bool operator==(const AbsTime& t) const { return t.time_ns == time_ns; }
- template <class S> void serialize(S& s) { s(time_ns); }
-
- friend bool operator<(const AbsTime& a, const AbsTime& b);
- friend bool operator>(const AbsTime& a, const AbsTime& b);
-};
-
-class Duration {
- static int64_t max() { return std::numeric_limits<int64_t>::max(); }
- int64_t nanosecs;
-
- friend class AbsTime;
-
- public:
- inline Duration(int64_t time0);
- inline explicit Duration(const AbsTime& time0);
- inline explicit Duration(const AbsTime& start, const AbsTime& finish);
- inline operator int64_t() const;
-};
-
-
-AbsTime::AbsTime(const AbsTime& t, const Duration& d) :
- time_ns(d == Duration::max() ? max() : t.time_ns+d.nanosecs)
-{}
-
-void AbsTime::reset(const AbsTime& t, const Duration& d)
-{
- time_ns = d == Duration::max() ? max() : t.time_ns+d.nanosecs;
-}
-
-AbsTime AbsTime::FarFuture() { AbsTime ff; ff.time_ns = max(); return ff;}
-
-inline AbsTime now() { return AbsTime::now(); }
-
-inline bool operator<(const AbsTime& a, const AbsTime& b) { return a.time_ns < b.time_ns; }
-inline bool operator>(const AbsTime& a, const AbsTime& b) { return a.time_ns > b.time_ns; }
-
-Duration::Duration(int64_t time0) :
- nanosecs(time0)
-{}
-
-Duration::Duration(const AbsTime& time0) :
- nanosecs(time0.time_ns)
-{}
-
-Duration::Duration(const AbsTime& start, const AbsTime& finish) :
- nanosecs(finish.time_ns - start.time_ns)
-{}
-
-Duration::operator int64_t() const
-{ return nanosecs; }
-
-/** Nanoseconds per second. */
-const Duration TIME_SEC = 1000*1000*1000;
-/** Nanoseconds per millisecond */
-const Duration TIME_MSEC = 1000*1000;
-/** Nanoseconds per microseconds. */
-const Duration TIME_USEC = 1000;
-/** Nanoseconds per nanosecond. */
-const Duration TIME_NSEC = 1;
-
-/** Value to represent an infinite timeout */
-const Duration TIME_INFINITE = std::numeric_limits<int64_t>::max();
-
-/** Time greater than any other time */
-const AbsTime FAR_FUTURE = AbsTime::FarFuture();
-
-}}
-
-#endif /*!_sys_Time_h*/
diff --git a/qpid/cpp/src/qpid/sys/TimeoutHandler.h b/qpid/cpp/src/qpid/sys/TimeoutHandler.h
deleted file mode 100644
index 0c10709bbf..0000000000
--- a/qpid/cpp/src/qpid/sys/TimeoutHandler.h
+++ /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.
- *
- */
-#ifndef _TimeoutHandler_
-#define _TimeoutHandler_
-
-namespace qpid {
-namespace sys {
-
- class TimeoutHandler
- {
- public:
- virtual void idleOut() = 0;
- virtual void idleIn() = 0;
- virtual ~TimeoutHandler(){}
- };
-
-}
-}
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/Waitable.h b/qpid/cpp/src/qpid/sys/Waitable.h
deleted file mode 100644
index 37392ed761..0000000000
--- a/qpid/cpp/src/qpid/sys/Waitable.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef QPID_SYS_WAITABLE_H
-#define QPID_SYS_WAITABLE_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "Monitor.h"
-
-#include <assert.h>
-
-namespace qpid {
-namespace sys {
-
-/**
- * A monitor that keeps track of waiting threads. Threads declare a
- * ScopedWait around wait() inside a ScopedLock to be considered
- * waiters.
- */
-class Waitable : public Monitor {
- public:
- Waitable() : waiters(0) {}
-
- /** Use this inside a scoped lock around the
- * call to Monitor::wait to be counted as a waiter
- */
- struct ScopedWait {
- Waitable& w;
- ScopedWait(Waitable& w_) : w(w_) { ++w.waiters; }
- ~ScopedWait() { if (--w.waiters==0) w.notifyAll(); }
- };
-
- /** Block till there are no more ScopedWaits.
- *@pre Must be called inside a ScopedLock but NOT a ScopedWait.
- */
- void waitWaiters() {
- while (waiters != 0)
- wait();
- }
-
- /** Returns the number of outstanding ScopedWaits.
- * Must be called with the lock held.
- */
- size_t hasWaiters() { return waiters; }
-
- private:
- friend struct ScopedWait;
- size_t waiters;
-};
-
-}} // namespace qpid::sys
-
-
-
-#endif /*!QPID_SYS_WAITABLE_H*/
diff --git a/qpid/cpp/src/qpid/sys/apr/APRBase.cpp b/qpid/cpp/src/qpid/sys/apr/APRBase.cpp
deleted file mode 100644
index 724c489303..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/APRBase.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <iostream>
-#include "qpid/log/Statement.h"
-#include "APRBase.h"
-
-using namespace qpid::sys;
-
-APRBase* APRBase::instance = 0;
-
-APRBase* APRBase::getInstance(){
- if(instance == 0){
- instance = new APRBase();
- }
- return instance;
-}
-
-
-APRBase::APRBase() : count(0){
- apr_initialize();
- CHECK_APR_SUCCESS(apr_pool_create(&pool, 0));
- CHECK_APR_SUCCESS(apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_NESTED, pool));
-}
-
-APRBase::~APRBase(){
- CHECK_APR_SUCCESS(apr_thread_mutex_destroy(mutex));
- apr_pool_destroy(pool);
- apr_terminate();
-}
-
-bool APRBase::_increment(){
- bool deleted(false);
- CHECK_APR_SUCCESS(apr_thread_mutex_lock(mutex));
- if(this == instance){
- count++;
- }else{
- deleted = true;
- }
- CHECK_APR_SUCCESS(apr_thread_mutex_unlock(mutex));
- return !deleted;
-}
-
-void APRBase::_decrement(){
- APRBase* copy = 0;
- CHECK_APR_SUCCESS(apr_thread_mutex_lock(mutex));
- if(--count == 0){
- copy = instance;
- instance = 0;
- }
- CHECK_APR_SUCCESS(apr_thread_mutex_unlock(mutex));
- if(copy != 0){
- delete copy;
- }
-}
-
-void APRBase::increment(){
- int count = 0;
- while(count++ < 2 && !getInstance()->_increment())
- QPID_LOG(warning, "APR initialization triggered concurrently with termination.");
-}
-
-void APRBase::decrement(){
- getInstance()->_decrement();
-}
-
-std::string qpid::sys::get_desc(apr_status_t status){
- const int size = 50;
- char tmp[size];
- return std::string(apr_strerror(status, tmp, size));
-}
-
diff --git a/qpid/cpp/src/qpid/sys/apr/APRBase.h b/qpid/cpp/src/qpid/sys/apr/APRBase.h
deleted file mode 100644
index 7b5644a129..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/APRBase.h
+++ /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.
- *
- */
-#ifndef _APRBase_
-#define _APRBase_
-
-#include <string>
-#include <apr_thread_mutex.h>
-#include <apr_errno.h>
-
-namespace qpid {
-namespace sys {
-
- /**
- * Use of APR libraries necessitates explicit init and terminate
- * calls. Any class using APR libs should obtain the reference to
- * this singleton and increment on construction, decrement on
- * destruction. This class can then correctly initialise apr
- * before the first use and terminate after the last use.
- */
- class APRBase{
- static APRBase* instance;
- apr_pool_t* pool;
- apr_thread_mutex_t* mutex;
- int count;
-
- APRBase();
- ~APRBase();
- static APRBase* getInstance();
- bool _increment();
- void _decrement();
- public:
- static void increment();
- static void decrement();
- };
-
- //this is also a convenient place for a helper function for error checking:
- void check(apr_status_t status, const char* file, const int line);
- std::string get_desc(apr_status_t status);
-
-#define CHECK_APR_SUCCESS(A) qpid::sys::check(A, __FILE__, __LINE__);
-
-}
-}
-
-// Inlined as it is called *a lot*
-void inline qpid::sys::check(apr_status_t status, const char* file, const int line){
- if (status != APR_SUCCESS){
- char tmp[256];
- throw Exception(QPID_MSG(apr_strerror(status, tmp, size)))
- }
-}
-
-
-
-
-#endif
diff --git a/qpid/cpp/src/qpid/sys/apr/APRPool.cpp b/qpid/cpp/src/qpid/sys/apr/APRPool.cpp
deleted file mode 100644
index e8b71f6e8a..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/APRPool.cpp
+++ /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.
- *
- */
-
-#include "APRPool.h"
-#include "APRBase.h"
-#include <boost/pool/detail/singleton.hpp>
-
-using namespace qpid::sys;
-
-APRPool::APRPool(){
- APRBase::increment();
- CHECK_APR_SUCCESS(apr_pool_create(&pool, NULL));
-}
-
-APRPool::~APRPool(){
- apr_pool_destroy(pool);
- APRBase::decrement();
-}
-
-apr_pool_t* APRPool::get() {
- return boost::details::pool::singleton_default<APRPool>::instance().pool;
-}
-
diff --git a/qpid/cpp/src/qpid/sys/apr/APRPool.h b/qpid/cpp/src/qpid/sys/apr/APRPool.h
deleted file mode 100644
index da7661fcfa..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/APRPool.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef _APRPool_
-#define _APRPool_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <boost/noncopyable.hpp>
-#include <apr_pools.h>
-
-namespace qpid {
-namespace sys {
-/**
- * Singleton APR memory pool.
- */
-class APRPool : private boost::noncopyable {
- public:
- APRPool();
- ~APRPool();
-
- /** Get singleton instance */
- static apr_pool_t* get();
-
- private:
- apr_pool_t* pool;
-};
-
-}}
-
-
-
-
-
-#endif /*!_APRPool_*/
diff --git a/qpid/cpp/src/qpid/sys/apr/Condition.h b/qpid/cpp/src/qpid/sys/apr/Condition.h
deleted file mode 100644
index 5e544219ab..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/Condition.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef _sys_apr_Condition_h
-#define _sys_apr_Condition_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "APRPool.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/Time.h"
-
-#include <sys/errno.h>
-#include <boost/noncopyable.hpp>
-#include <apr_thread_cond.h>
-
-namespace qpid {
-namespace sys {
-
-/**
- * A condition variable for thread synchronization.
- */
-class Condition
-{
- public:
- inline Condition();
- inline ~Condition();
- inline void wait(Mutex&);
- inline bool wait(Mutex&, const AbsTime& absoluteTime);
- inline void notify();
- inline void notifyAll();
-
- private:
- apr_thread_cond_t* condition;
-};
-
-
-Condition::Condition() {
- CHECK_APR_SUCCESS(apr_thread_cond_create(&condition, APRPool::get()));
-}
-
-Condition::~Condition() {
- CHECK_APR_SUCCESS(apr_thread_cond_destroy(condition));
-}
-
-void Condition::wait(Mutex& mutex) {
- CHECK_APR_SUCCESS(apr_thread_cond_wait(condition, mutex.mutex));
-}
-
-bool Condition::wait(Mutex& mutex, const AbsTime& absoluteTime){
- // APR uses microseconds.
- apr_status_t status =
- apr_thread_cond_timedwait(
- condition, mutex.mutex, Duration(now(), absoluteTime)/TIME_USEC);
- if(status != APR_TIMEUP) CHECK_APR_SUCCESS(status);
- return status == 0;
-}
-
-void Condition::notify(){
- CHECK_APR_SUCCESS(apr_thread_cond_signal(condition));
-}
-
-void Condition::notifyAll(){
- CHECK_APR_SUCCESS(apr_thread_cond_broadcast(condition));
-}
-
-}}
-#endif /*!_sys_apr_Condition_h*/
diff --git a/qpid/cpp/src/qpid/sys/apr/Mutex.h b/qpid/cpp/src/qpid/sys/apr/Mutex.h
deleted file mode 100644
index 51089c98ff..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/Mutex.h
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef _sys_apr_Mutex_h
-#define _sys_apr_Mutex_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "APRBase.h"
-#include "APRPool.h"
-
-#include <boost/noncopyable.hpp>
-#include <apr_thread_mutex.h>
-
-namespace qpid {
-namespace sys {
-
-class Condition;
-
-/**
- * Mutex lock.
- */
-class Mutex : private boost::noncopyable {
- public:
- typedef ScopedLock<Mutex> ScopedLock;
- typedef ScopedUnlock<Mutex> ScopedUnlock;
-
- inline Mutex();
- inline ~Mutex();
- inline void lock();
- inline void unlock();
- inline bool trylock();
-
- protected:
- apr_thread_mutex_t* mutex;
- friend class Condition;
-};
-
-Mutex::Mutex() {
- CHECK_APR_SUCCESS(apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_NESTED, APRPool::get()));
-}
-
-Mutex::~Mutex(){
- CHECK_APR_SUCCESS(apr_thread_mutex_destroy(mutex));
-}
-
-void Mutex::lock() {
- CHECK_APR_SUCCESS(apr_thread_mutex_lock(mutex));
-}
-void Mutex::unlock() {
- CHECK_APR_SUCCESS(apr_thread_mutex_unlock(mutex));
-}
-
-bool Mutex::trylock() {
- return apr_thread_mutex_trylock(mutex) == 0;
-}
-
-
-/**
- * RW lock.
- */
-class RWlock : private boost::noncopyable {
- friend class Condition;
-
-public:
- typedef ScopedRlock<RWlock> ScopedRlock;
- typedef ScopedWlock<RWlock> ScopedWlock;
-
- inline RWlock();
- inline ~RWlock();
- inline void wlock(); // will write-lock
- inline void rlock(); // will read-lock
- inline void unlock();
- inline bool trywlock(); // will write-try
- inline bool tryrlock(); // will read-try
-
- protected:
- apr_thread_mutex_t* mutex;
-};
-
-RWlock::RWlock() {
- CHECK_APR_SUCCESS(apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_NESTED, APRPool::get()));
-}
-
-RWlock::~RWlock(){
- CHECK_APR_SUCCESS(apr_thread_mutex_destroy(mutex));
-}
-
-void RWlock::wlock() {
- CHECK_APR_SUCCESS(apr_thread_mutex_lock(mutex));
-}
-
-void RWlock::rlock() {
- CHECK_APR_SUCCESS(apr_thread_mutex_lock(mutex));
-}
-
-void RWlock::unlock() {
- CHECK_APR_SUCCESS(apr_thread_mutex_unlock(mutex));
-}
-
-bool RWlock::trywlock() {
- return apr_thread_mutex_trylock(mutex) == 0;
-}
-
-bool RWlock::tryrlock() {
- return apr_thread_mutex_trylock(mutex) == 0;
-}
-
-
-}}
-#endif /*!_sys_apr_Mutex_h*/
diff --git a/qpid/cpp/src/qpid/sys/apr/Shlib.cpp b/qpid/cpp/src/qpid/sys/apr/Shlib.cpp
deleted file mode 100644
index b0ba706713..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/Shlib.cpp
+++ /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.
- *
- */
-
-#include "qpid/sys/Shlib.h"
-#include "APRBase.h"
-#include "APRPool.h"
-#include <apr_dso.h>
-
-namespace qpid {
-namespace sys {
-
-void Shlib::load(const char* libname) {
- apr_dso_handle_t* aprHandle;
- CHECK_APR_SUCCESS(
- apr_dso_load(&aprHandle, libname, APRPool::get()));
- handle=aprHandle;
-}
-
-void Shlib::unload() {
- CHECK_APR_SUCCESS(
- apr_dso_unload(static_cast<apr_dso_handle_t*>(handle)));
-}
-
-void* Shlib::getSymbol(const char* name) {
- apr_dso_handle_sym_t symbol;
- CHECK_APR_SUCCESS(apr_dso_sym(&symbol,
- static_cast<apr_dso_handle_t*>(handle),
- name));
- return (void*) symbol;
-}
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/apr/Socket.cpp b/qpid/cpp/src/qpid/sys/apr/Socket.cpp
deleted file mode 100644
index 577268844a..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/Socket.cpp
+++ /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.
- *
- */
-
-
-#include "qpid/sys/Socket.h"
-
-#include "APRBase.h"
-#include "APRPool.h"
-
-#include <apr_network_io.h>
-
-namespace qpid {
-namespace sys {
-
-class SocketPrivate {
-public:
- SocketPrivate(apr_socket_t* s = 0) :
- socket(s)
- {}
-
- apr_socket_t* socket;
-};
-
-Socket::Socket() :
- impl(new SocketPrivate)
-{
- createTcp();
-}
-
-Socket::Socket(SocketPrivate* sp) :
- impl(sp)
-{}
-
-Socket::~Socket() {
- delete impl;
-}
-
-void Socket::createTcp() const {
- apr_socket_t*& socket = impl->socket;
- apr_socket_t* s;
- CHECK_APR_SUCCESS(
- apr_socket_create(
- &s, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
- APRPool::get()));
- socket = s;
-}
-
-void Socket::setTimeout(const Duration& interval) const {
- apr_socket_t*& socket = impl->socket;
- apr_socket_timeout_set(socket, interval/TIME_USEC);
-}
-
-void Socket::connect(const std::string& host, int port) const {
- apr_socket_t*& socket = impl->socket;
- apr_sockaddr_t* address;
- CHECK_APR_SUCCESS(
- apr_sockaddr_info_get(
- &address, host.c_str(), APR_UNSPEC, port, APR_IPV4_ADDR_OK,
- APRPool::get()));
- CHECK_APR_SUCCESS(apr_socket_connect(socket, address));
-}
-
-void Socket::close() const {
- apr_socket_t*& socket = impl->socket;
- if (socket == 0) return;
- CHECK_APR_SUCCESS(apr_socket_close(socket));
- socket = 0;
-}
-
-ssize_t Socket::send(const void* data, size_t size) const
-{
- apr_socket_t*& socket = impl->socket;
- apr_size_t sent = size;
- apr_status_t status =
- apr_socket_send(socket, reinterpret_cast<const char*>(data), &sent);
- if (APR_STATUS_IS_TIMEUP(status)) return SOCKET_TIMEOUT;
- if (APR_STATUS_IS_EOF(status)) return SOCKET_EOF;
- CHECK_APR_SUCCESS(status);
- return sent;
-}
-
-ssize_t Socket::recv(void* data, size_t size) const
-{
- apr_socket_t*& socket = impl->socket;
- apr_size_t received = size;
- apr_status_t status =
- apr_socket_recv(socket, reinterpret_cast<char*>(data), &received);
- if (APR_STATUS_IS_TIMEUP(status))
- return SOCKET_TIMEOUT;
- if (APR_STATUS_IS_EOF(status))
- return SOCKET_EOF;
- CHECK_APR_SUCCESS(status);
- return received;
-}
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/apr/Thread.cpp b/qpid/cpp/src/qpid/sys/apr/Thread.cpp
deleted file mode 100644
index 3369ef7eb1..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/Thread.cpp
+++ /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.
- *
- */
-
-#include "Thread.h"
-#include "qpid/sys/Runnable.h"
-
-using namespace qpid::sys;
-using qpid::sys::Runnable;
-
-void* APR_THREAD_FUNC Thread::runRunnable(apr_thread_t* thread, void *data) {
- reinterpret_cast<Runnable*>(data)->run();
- CHECK_APR_SUCCESS(apr_thread_exit(thread, APR_SUCCESS));
- return NULL;
-}
-
-
diff --git a/qpid/cpp/src/qpid/sys/apr/Thread.h b/qpid/cpp/src/qpid/sys/apr/Thread.h
deleted file mode 100644
index 8cbbc0456e..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/Thread.h
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef _sys_apr_Thread_h
-#define _sys_apr_Thread_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "APRPool.h"
-#include "APRBase.h"
-
-#include <apr_thread_proc.h>
-#include <apr_portable.h>
-
-namespace qpid {
-namespace sys {
-
-class Runnable;
-
-class Thread
-{
- public:
- inline static Thread current();
-
- /** ID of current thread for logging.
- * Workaround for broken Thread::current() in APR
- */
- inline static long logId();
-
- inline static void yield();
-
- inline Thread();
- inline explicit Thread(qpid::sys::Runnable*);
- inline explicit Thread(qpid::sys::Runnable&);
-
- inline void join();
-
- inline long id();
-
- private:
- static void* APR_THREAD_FUNC runRunnable(apr_thread_t* thread, void *data);
- inline Thread(apr_thread_t* t);
- apr_thread_t* thread;
-};
-
-Thread::Thread() : thread(0) {}
-
-Thread::Thread(Runnable* runnable) {
- CHECK_APR_SUCCESS(
- apr_thread_create(&thread, 0, runRunnable, runnable, APRPool::get()));
-}
-
-Thread::Thread(Runnable& runnable) {
- CHECK_APR_SUCCESS(
- apr_thread_create(&thread, 0, runRunnable, &runnable, APRPool::get()));
-}
-
-void Thread::join(){
- apr_status_t status;
- if (thread != 0)
- CHECK_APR_SUCCESS(apr_thread_join(&status, thread));
-}
-
-long Thread::id() {
- return long(thread);
-}
-
-/** ID of current thread for logging.
- * Workaround for broken Thread::current() in APR
- */
-long Thread::logId() {
- return static_cast<long>(apr_os_thread_current());
-}
-
-Thread::Thread(apr_thread_t* t) : thread(t) {}
-
-Thread Thread::current(){
- apr_thread_t* thr;
- apr_os_thread_t osthr = apr_os_thread_current();
- CHECK_APR_SUCCESS(apr_os_thread_put(&thr, &osthr, APRPool::get()));
- return Thread(thr);
-}
-
-void Thread::yield()
-{
- apr_thread_yield();
-}
-
-}}
-#endif /*!_sys_apr_Thread_h*/
diff --git a/qpid/cpp/src/qpid/sys/apr/Time.cpp b/qpid/cpp/src/qpid/sys/apr/Time.cpp
deleted file mode 100644
index 34e740b144..0000000000
--- a/qpid/cpp/src/qpid/sys/apr/Time.cpp
+++ /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.
- *
- */
-
-#include "qpid/sys/Time.h"
-
-#include <apr_time.h>
-
-namespace qpid {
-namespace sys {
-
-AbsTime AbsTime::now() {
- AbsTime time_now;
- time_now.time_ns = apr_time_now() * TIME_USEC;
- return time_now;
-}
-
-}}
-
diff --git a/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp b/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp
deleted file mode 100644
index 67783fc8c8..0000000000
--- a/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/Poller.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/DeletionManager.h"
-#include "qpid/sys/posix/check.h"
-#include "qpid/sys/posix/PrivatePosix.h"
-
-#include <sys/epoll.h>
-#include <errno.h>
-
-#include <assert.h>
-#include <vector>
-#include <exception>
-
-namespace qpid {
-namespace sys {
-
-// Deletion manager to handle deferring deletion of PollerHandles to when they definitely aren't being used
-DeletionManager<PollerHandle> PollerHandleDeletionManager;
-
-// Instantiate (and define) class static for DeletionManager
-template <>
-DeletionManager<PollerHandle>::AllThreadsStatuses DeletionManager<PollerHandle>::allThreadsStatuses(0);
-
-class PollerHandlePrivate {
- friend class Poller;
- friend class PollerHandle;
-
- enum FDStat {
- ABSENT,
- MONITORED,
- INACTIVE,
- HUNGUP,
- MONITORED_HUNGUP
- };
-
- ::__uint32_t events;
- FDStat stat;
- Mutex lock;
-
- PollerHandlePrivate() :
- events(0),
- stat(ABSENT) {
- }
-
- bool isActive() const {
- return stat == MONITORED || stat == MONITORED_HUNGUP;
- }
-
- void setActive() {
- stat = (stat == HUNGUP) ? MONITORED_HUNGUP : MONITORED;
- }
-
- bool isInactive() const {
- return stat == INACTIVE || stat == HUNGUP;
- }
-
- void setInactive() {
- stat = INACTIVE;
- }
-
- bool isIdle() const {
- return stat == ABSENT;
- }
-
- void setIdle() {
- stat = ABSENT;
- }
-
- bool isHungup() const {
- return stat == MONITORED_HUNGUP || stat == HUNGUP;
- }
-
- void setHungup() {
- assert(stat == MONITORED);
- stat = HUNGUP;
- }
-};
-
-PollerHandle::PollerHandle(const Socket& s) :
- impl(new PollerHandlePrivate),
- socket(s)
-{}
-
-PollerHandle::~PollerHandle() {
- delete impl;
-}
-
-void PollerHandle::deferDelete() {
- PollerHandleDeletionManager.markForDeletion(this);
-}
-
-/**
- * Concrete implementation of Poller to use the Linux specific epoll
- * interface
- */
-class PollerPrivate {
- friend class Poller;
-
- static const int DefaultFds = 256;
-
- struct ReadablePipe {
- int fds[2];
-
- /**
- * This encapsulates an always readable pipe which we can add
- * to the epoll set to force epoll_wait to return
- */
- ReadablePipe() {
- QPID_POSIX_CHECK(::pipe(fds));
- // Just write the pipe's fds to the pipe
- QPID_POSIX_CHECK(::write(fds[1], fds, 2));
- }
-
- ~ReadablePipe() {
- ::close(fds[0]);
- ::close(fds[1]);
- }
-
- int getFD() {
- return fds[0];
- }
- };
-
- static ReadablePipe alwaysReadable;
-
- const int epollFd;
- bool isShutdown;
-
- static ::__uint32_t directionToEpollEvent(Poller::Direction dir) {
- switch (dir) {
- case Poller::IN: return ::EPOLLIN;
- case Poller::OUT: return ::EPOLLOUT;
- case Poller::INOUT: return ::EPOLLIN | ::EPOLLOUT;
- default: return 0;
- }
- }
-
- static Poller::EventType epollToDirection(::__uint32_t events) {
- // POLLOUT & POLLHUP are mutually exclusive really, but at least socketpairs
- // can give you both!
- events = (events & ::EPOLLHUP) ? events & ~::EPOLLOUT : events;
- ::__uint32_t e = events & (::EPOLLIN | ::EPOLLOUT);
- switch (e) {
- case ::EPOLLIN: return Poller::READABLE;
- case ::EPOLLOUT: return Poller::WRITABLE;
- case ::EPOLLIN | ::EPOLLOUT: return Poller::READ_WRITABLE;
- default:
- return (events & ::EPOLLHUP | ::EPOLLERR) ?
- Poller::DISCONNECTED : Poller::INVALID;
- }
- }
-
- PollerPrivate() :
- epollFd(::epoll_create(DefaultFds)),
- isShutdown(false) {
- QPID_POSIX_CHECK(epollFd);
- }
-
- ~PollerPrivate() {
- // It's probably okay to ignore any errors here as there can't be data loss
- ::close(epollFd);
- }
-};
-
-PollerPrivate::ReadablePipe PollerPrivate::alwaysReadable;
-
-void Poller::addFd(PollerHandle& handle, Direction dir) {
- PollerHandlePrivate& eh = *handle.impl;
- ScopedLock<Mutex> l(eh.lock);
- ::epoll_event epe;
- int op;
-
- if (eh.isIdle()) {
- op = EPOLL_CTL_ADD;
- epe.events = PollerPrivate::directionToEpollEvent(dir) | ::EPOLLONESHOT;
- } else {
- assert(eh.isActive());
- op = EPOLL_CTL_MOD;
- epe.events = eh.events | PollerPrivate::directionToEpollEvent(dir);
- }
- epe.data.ptr = &handle;
-
- QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, op, toFd(handle.socket.impl), &epe));
-
- // Record monitoring state of this fd
- eh.events = epe.events;
- eh.setActive();
-}
-
-void Poller::delFd(PollerHandle& handle) {
- PollerHandlePrivate& eh = *handle.impl;
- ScopedLock<Mutex> l(eh.lock);
- assert(!eh.isIdle());
- int rc = ::epoll_ctl(impl->epollFd, EPOLL_CTL_DEL, toFd(handle.socket.impl), 0);
- // Ignore EBADF since deleting a nonexistent fd has the overall required result!
- // And allows the case where a sloppy program closes the fd and then does the delFd()
- if (rc == -1 && errno != EBADF) {
- QPID_POSIX_CHECK(rc);
- }
- eh.setIdle();
-}
-
-// modFd is equivalent to delFd followed by addFd
-void Poller::modFd(PollerHandle& handle, Direction dir) {
- PollerHandlePrivate& eh = *handle.impl;
- ScopedLock<Mutex> l(eh.lock);
- assert(!eh.isIdle());
-
- ::epoll_event epe;
- epe.events = PollerPrivate::directionToEpollEvent(dir) | ::EPOLLONESHOT;
- epe.data.ptr = &handle;
-
- QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, EPOLL_CTL_MOD, toFd(handle.socket.impl), &epe));
-
- // Record monitoring state of this fd
- eh.events = epe.events;
- eh.setActive();
-}
-
-void Poller::rearmFd(PollerHandle& handle) {
- PollerHandlePrivate& eh = *handle.impl;
- ScopedLock<Mutex> l(eh.lock);
- assert(eh.isInactive());
-
- ::epoll_event epe;
- epe.events = eh.events;
- epe.data.ptr = &handle;
-
- QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, EPOLL_CTL_MOD, toFd(handle.socket.impl), &epe));
-
- eh.setActive();
-}
-
-void Poller::shutdown() {
- // NB: this function must be async-signal safe, it must not
- // call any function that is not async-signal safe.
-
- // Allow sloppy code to shut us down more than once
- if (impl->isShutdown)
- return;
-
- // Don't use any locking here - isshutdown will be visible to all
- // after the epoll_ctl() anyway (it's a memory barrier)
- impl->isShutdown = true;
-
- // Add always readable fd to epoll (not EPOLLONESHOT)
- int fd = impl->alwaysReadable.getFD();
- ::epoll_event epe;
- epe.events = ::EPOLLIN;
- epe.data.ptr = 0;
- QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, EPOLL_CTL_ADD, fd, &epe));
-}
-
-Poller::Event Poller::wait(Duration timeout) {
- epoll_event epe;
- int timeoutMs = (timeout == TIME_INFINITE) ? -1 : timeout / TIME_MSEC;
-
- // Repeat until we weren't interupted
- do {
- PollerHandleDeletionManager.markAllUnusedInThisThread();
- int rc = ::epoll_wait(impl->epollFd, &epe, 1, timeoutMs);
-
- if (impl->isShutdown) {
- return Event(0, SHUTDOWN);
- }
-
- if (rc ==-1 && errno != EINTR) {
- QPID_POSIX_CHECK(rc);
- } else if (rc > 0) {
- assert(rc == 1);
- PollerHandle* handle = static_cast<PollerHandle*>(epe.data.ptr);
- PollerHandlePrivate& eh = *handle->impl;
-
- ScopedLock<Mutex> l(eh.lock);
-
- // the handle could have gone inactive since we left the epoll_wait
- if (eh.isActive()) {
- // If the connection has been hungup we could still be readable
- // (just not writable), allow us to readable until we get here again
- if (epe.events & ::EPOLLHUP) {
- if (eh.isHungup()) {
- return Event(handle, DISCONNECTED);
- }
- eh.setHungup();
- } else {
- eh.setInactive();
- }
- return Event(handle, PollerPrivate::epollToDirection(epe.events));
- }
- }
- // We only get here if one of the following:
- // * epoll_wait was interrupted by a signal
- // * epoll_wait timed out
- // * the state of the handle changed after being returned by epoll_wait
- //
- // The only things we can do here are return a timeout or wait more.
- // Obviously if we timed out we return timeout; if the wait was meant to
- // be indefinite then we should never return with a time out so we go again.
- // If the wait wasn't indefinite, but we were interrupted then we have to return
- // with a timeout as we don't know how long we've waited so far and so we can't
- // continue the wait.
- if (rc == 0 || timeoutMs != -1) {
- return Event(0, TIMEOUT);
- }
- } while (true);
-}
-
-// Concrete constructors
-Poller::Poller() :
- impl(new PollerPrivate())
-{}
-
-Poller::~Poller() {
- delete impl;
-}
-
-}}
diff --git a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp b/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
deleted file mode 100644
index 94c68bd5d0..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/AsynchIO.h"
-#include "qpid/sys/Time.h"
-
-#include "check.h"
-
-// TODO The basic algorithm here is not really POSIX specific and with a bit more abstraction
-// could (should) be promoted to be platform portable
-#include <unistd.h>
-#include <sys/socket.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <boost/bind.hpp>
-
-using namespace qpid::sys;
-
-namespace {
-
-/*
- * Make *process* not generate SIGPIPE when writing to closed
- * pipe/socket (necessary as default action is to terminate process)
- */
-void ignoreSigpipe() {
- ::signal(SIGPIPE, SIG_IGN);
-}
-
-/*
- * We keep per thread state to avoid locking overhead. The assumption is that
- * on average all the connections are serviced by all the threads so the state
- * recorded in each thread is about the same. If this turns out not to be the
- * case we could rebalance the info occasionally.
- */
-__thread int threadReadTotal = 0;
-__thread int threadMaxRead = 0;
-__thread int threadReadCount = 0;
-__thread int threadWriteTotal = 0;
-__thread int threadWriteCount = 0;
-__thread int64_t threadMaxReadTimeNs = 2 * 1000000; // start at 2ms
-}
-
-/*
- * Asynch Acceptor
- */
-
-AsynchAcceptor::AsynchAcceptor(const Socket& s, Callback callback) :
- acceptedCallback(callback),
- handle(s, boost::bind(&AsynchAcceptor::readable, this, _1), 0, 0) {
-
- s.setNonblocking();
- ignoreSigpipe();
-}
-
-void AsynchAcceptor::start(Poller::shared_ptr poller) {
- handle.startWatch(poller);
-}
-
-/*
- * We keep on accepting as long as there is something to accept
- */
-void AsynchAcceptor::readable(DispatchHandle& h) {
- Socket* s;
- do {
- errno = 0;
- // TODO: Currently we ignore the peers address, perhaps we should
- // log it or use it for connection acceptance.
- s = h.getSocket().accept(0, 0);
- if (s) {
- acceptedCallback(*s);
- } else {
- break;
- }
- } while (true);
-
- h.rewatch();
-}
-
-/*
- * Asynch reader/writer
- */
-AsynchIO::AsynchIO(const Socket& s,
- ReadCallback rCb, EofCallback eofCb, DisconnectCallback disCb,
- ClosedCallback cCb, BuffersEmptyCallback eCb, IdleCallback iCb) :
-
- DispatchHandle(s,
- boost::bind(&AsynchIO::readable, this, _1),
- boost::bind(&AsynchIO::writeable, this, _1),
- boost::bind(&AsynchIO::disconnected, this, _1)),
- readCallback(rCb),
- eofCallback(eofCb),
- disCallback(disCb),
- closedCallback(cCb),
- emptyCallback(eCb),
- idleCallback(iCb),
- queuedClose(false),
- writePending(false) {
-
- s.setNonblocking();
-}
-
-struct deleter
-{
- template <typename T>
- void operator()(T *ptr){ delete ptr;}
-};
-
-AsynchIO::~AsynchIO() {
- std::for_each( bufferQueue.begin(), bufferQueue.end(), deleter());
- std::for_each( writeQueue.begin(), writeQueue.end(), deleter());
-}
-
-void AsynchIO::queueForDeletion() {
- DispatchHandle::doDelete();
-}
-
-void AsynchIO::start(Poller::shared_ptr poller) {
- DispatchHandle::startWatch(poller);
-}
-
-void AsynchIO::queueReadBuffer(BufferBase* buff) {
- assert(buff);
- buff->dataStart = 0;
- buff->dataCount = 0;
- bufferQueue.push_back(buff);
- DispatchHandle::rewatchRead();
-}
-
-void AsynchIO::unread(BufferBase* buff) {
- assert(buff);
- if (buff->dataStart != 0) {
- memmove(buff->bytes, buff->bytes+buff->dataStart, buff->dataCount);
- buff->dataStart = 0;
- }
- bufferQueue.push_front(buff);
- DispatchHandle::rewatchRead();
-}
-
-void AsynchIO::queueWrite(BufferBase* buff) {
- assert(buff);
- // If we've already closed the socket then throw the write away
- if (queuedClose) {
- bufferQueue.push_front(buff);
- return;
- } else {
- writeQueue.push_front(buff);
- }
- writePending = false;
- DispatchHandle::rewatchWrite();
-}
-
-void AsynchIO::notifyPendingWrite() {
- writePending = true;
- DispatchHandle::rewatchWrite();
-}
-
-void AsynchIO::queueWriteClose() {
- queuedClose = true;
- DispatchHandle::rewatchWrite();
-}
-
-/** Return a queued buffer if there are enough
- * to spare
- */
-AsynchIO::BufferBase* AsynchIO::getQueuedBuffer() {
- // Always keep at least one buffer (it might have data that was "unread" in it)
- if (bufferQueue.size()<=1)
- return 0;
- BufferBase* buff = bufferQueue.back();
- assert(buff);
- buff->dataStart = 0;
- buff->dataCount = 0;
- bufferQueue.pop_back();
- return buff;
-}
-
-/*
- * We keep on reading as long as we have something to read and a buffer to put
- * it in
- */
-void AsynchIO::readable(DispatchHandle& h) {
- int readTotal = 0;
- AbsTime readStartTime = AbsTime::now();
- do {
- // (Try to) get a buffer
- if (!bufferQueue.empty()) {
- // Read into buffer
- BufferBase* buff = bufferQueue.front();
- assert(buff);
- bufferQueue.pop_front();
- errno = 0;
- int readCount = buff->byteCount-buff->dataCount;
- int rc = h.getSocket().read(buff->bytes + buff->dataCount, readCount);
- if (rc > 0) {
- buff->dataCount += rc;
- threadReadTotal += rc;
- readTotal += rc;
-
- readCallback(*this, buff);
- if (rc != readCount) {
- // If we didn't fill the read buffer then time to stop reading
- break;
- }
-
- // Stop reading if we've overrun our timeslot
- if (Duration(readStartTime, AbsTime::now()) > threadMaxReadTimeNs) {
- break;
- }
-
- } else {
- // Put buffer back (at front so it doesn't interfere with unread buffers)
- bufferQueue.push_front(buff);
- assert(buff);
-
- // Eof or other side has gone away
- if (rc == 0 || errno == ECONNRESET) {
- eofCallback(*this);
- h.unwatchRead();
- break;
- } else if (errno == EAGAIN) {
- // We have just put a buffer back so we know
- // we can carry on watching for reads
- break;
- } else {
- QPID_POSIX_CHECK(rc);
- }
- }
- } else {
- // Something to read but no buffer
- if (emptyCallback) {
- emptyCallback(*this);
- }
- // If we still have no buffers we can't do anything more
- if (bufferQueue.empty()) {
- h.unwatchRead();
- break;
- }
-
- }
- } while (true);
-
- ++threadReadCount;
- threadMaxRead = std::max(threadMaxRead, readTotal);
- return;
-}
-
-/*
- * We carry on writing whilst we have data to write and we can write
- */
-void AsynchIO::writeable(DispatchHandle& h) {
- int writeTotal = 0;
- do {
- // See if we've got something to write
- if (!writeQueue.empty()) {
- // Write buffer
- BufferBase* buff = writeQueue.back();
- writeQueue.pop_back();
- errno = 0;
- assert(buff->dataStart+buff->dataCount <= buff->byteCount);
- int rc = h.getSocket().write(buff->bytes+buff->dataStart, buff->dataCount);
- if (rc >= 0) {
- threadWriteTotal += rc;
- writeTotal += rc;
-
- // If we didn't write full buffer put rest back
- if (rc != buff->dataCount) {
- buff->dataStart += rc;
- buff->dataCount -= rc;
- writeQueue.push_back(buff);
- break;
- }
-
- // Recycle the buffer
- queueReadBuffer(buff);
-
- // If we've already written more than the max for reading then stop
- // (this is to stop writes dominating reads)
- if (writeTotal > threadMaxRead)
- break;
- } else {
- // Put buffer back
- writeQueue.push_back(buff);
- if (errno == ECONNRESET || errno == EPIPE) {
- // Just stop watching for write here - we'll get a
- // disconnect callback soon enough
- h.unwatchWrite();
- break;
- } else if (errno == EAGAIN) {
- // We have just put a buffer back so we know
- // we can carry on watching for writes
- break;
- } else {
- QPID_POSIX_CHECK(rc);
- }
- }
- } else {
- // If we're waiting to close the socket then can do it now as there is nothing to write
- if (queuedClose) {
- close(h);
- break;
- }
- // Fd is writable, but nothing to write
- if (idleCallback) {
- writePending = false;
- idleCallback(*this);
- }
- // If we still have no buffers to write we can't do anything more
- if (writeQueue.empty() && !writePending && !queuedClose) {
- h.unwatchWrite();
- // The following handles the case where writePending is
- // set to true after the test above; in this case its
- // possible that the unwatchWrite overwrites the
- // desired rewatchWrite so we correct that here
- if (writePending)
- h.rewatchWrite();
- break;
- }
- }
- } while (true);
-
- ++threadWriteCount;
- return;
-}
-
-void AsynchIO::disconnected(DispatchHandle& h) {
- // If we've already queued close do it instead of disconnected callback
- if (queuedClose) {
- close(h);
- } else if (disCallback) {
- disCallback(*this);
- h.unwatch();
- }
-}
-
-/*
- * Close the socket and callback to say we've done it
- */
-void AsynchIO::close(DispatchHandle& h) {
- h.stopWatch();
- h.getSocket().close();
- if (closedCallback) {
- closedCallback(*this, getSocket());
- }
-}
-
diff --git a/qpid/cpp/src/qpid/sys/posix/Condition.h b/qpid/cpp/src/qpid/sys/posix/Condition.h
deleted file mode 100644
index 86d6500ee9..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/Condition.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef _sys_posix_Condition_h
-#define _sys_posix_Condition_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "PrivatePosix.h"
-
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/Time.h"
-
-#include <time.h>
-#include <sys/errno.h>
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
-namespace sys {
-
-/**
- * A condition variable for thread synchronization.
- */
-class Condition
-{
- public:
- inline Condition();
- inline ~Condition();
- inline void wait(Mutex&);
- inline bool wait(Mutex&, const AbsTime& absoluteTime);
- inline void notify();
- inline void notifyAll();
-
- private:
- pthread_cond_t condition;
-};
-
-Condition::Condition() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_cond_init(&condition, 0));
-}
-
-Condition::~Condition() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_cond_destroy(&condition));
-}
-
-void Condition::wait(Mutex& mutex) {
- QPID_POSIX_ASSERT_THROW_IF(pthread_cond_wait(&condition, &mutex.mutex));
-}
-
-bool Condition::wait(Mutex& mutex, const AbsTime& absoluteTime){
- struct timespec ts;
- toTimespec(ts, Duration(absoluteTime));
- int status = pthread_cond_timedwait(&condition, &mutex.mutex, &ts);
- if (status != 0) {
- if (status == ETIMEDOUT) return false;
- throw QPID_POSIX_ERROR(status);
- }
- return true;
-}
-
-void Condition::notify(){
- QPID_POSIX_ASSERT_THROW_IF(pthread_cond_signal(&condition));
-}
-
-void Condition::notifyAll(){
- QPID_POSIX_ASSERT_THROW_IF(pthread_cond_broadcast(&condition));
-}
-
-}}
-#endif /*!_sys_posix_Condition_h*/
diff --git a/qpid/cpp/src/qpid/sys/posix/Mutex.h b/qpid/cpp/src/qpid/sys/posix/Mutex.h
deleted file mode 100644
index 590fd14bd0..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/Mutex.h
+++ /dev/null
@@ -1,201 +0,0 @@
-#ifndef _sys_posix_Mutex_h
-#define _sys_posix_Mutex_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "check.h"
-
-#include <pthread.h>
-#include <boost/noncopyable.hpp>
-
-namespace qpid {
-namespace sys {
-
-class Condition;
-
-/**
- * Mutex lock.
- */
-class Mutex : private boost::noncopyable {
- friend class Condition;
-
-public:
- typedef ScopedLock<Mutex> ScopedLock;
- typedef ScopedUnlock<Mutex> ScopedUnlock;
-
- inline Mutex();
- inline ~Mutex();
- inline void lock();
- inline void unlock();
- inline bool trylock();
-
-
-protected:
- pthread_mutex_t mutex;
-};
-
-/**
- * RW lock.
- */
-class RWlock : private boost::noncopyable {
- friend class Condition;
-
-public:
- typedef ScopedRlock<RWlock> ScopedRlock;
- typedef ScopedWlock<RWlock> ScopedWlock;
-
- inline RWlock();
- inline ~RWlock();
- inline void wlock(); // will write-lock
- inline void rlock(); // will read-lock
- inline void unlock();
- inline void trywlock(); // will write-try
- inline void tryrlock(); // will read-try
-
-protected:
- pthread_rwlock_t rwlock;
-};
-
-
-/**
- * Initialise a recursive mutex attr for use in creating mutexes later
- * (we use pthread_once to make sure it is initialised exactly once)
- */
-namespace {
- pthread_once_t onceControl = PTHREAD_ONCE_INIT;
- pthread_rwlockattr_t rwlockattr;
- pthread_mutexattr_t mutexattr;
-
- void initMutexattr() {
- pthread_mutexattr_init(&mutexattr);
- pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE);
- }
-
- void initRWlockattr() {
- pthread_rwlockattr_init(&rwlockattr);
- }
-
- struct RecursiveMutexattr {
- RecursiveMutexattr() {
- pthread_once(&onceControl, initMutexattr);
- }
-
- operator const pthread_mutexattr_t*() const {
- return &mutexattr;
- }
- };
- struct RecursiveRWlockattr {
- RecursiveRWlockattr() {
- pthread_once(&onceControl, initRWlockattr);
- }
-
- operator const pthread_rwlockattr_t*() const {
- return &rwlockattr;
- }
- };
-
- RecursiveMutexattr recursiveMutexattr;
- RecursiveRWlockattr recursiveRWlockattr;
-
-
-
-}
-
-/**
- * PODMutex is a POD, can be static-initialized with
- * PODMutex m = QPID_PODMUTEX_INITIALIZER
- */
-struct PODMutex
-{
- typedef ScopedLock<PODMutex> ScopedLock;
-
- inline void lock();
- inline void unlock();
- inline bool trylock();
-
- // Must be public to be a POD:
- pthread_mutex_t mutex;
-};
-
-#define QPID_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
-
-void PODMutex::lock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_lock(&mutex));
-}
-
-void PODMutex::unlock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_unlock(&mutex));
-}
-
-bool PODMutex::trylock() {
- return pthread_mutex_trylock(&mutex) == 0;
-}
-
-Mutex::Mutex() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_init(&mutex, recursiveMutexattr));
-}
-
-Mutex::~Mutex(){
- QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_destroy(&mutex));
-}
-
-void Mutex::lock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_lock(&mutex));
-}
-
-void Mutex::unlock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_unlock(&mutex));
-}
-
-bool Mutex::trylock() {
- return pthread_mutex_trylock(&mutex) == 0;
-}
-
-
-RWlock::RWlock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_init(&rwlock, recursiveRWlockattr));
-}
-
-RWlock::~RWlock(){
- QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_destroy(&rwlock));
-}
-
-void RWlock::wlock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_wrlock(&rwlock));
-}
-
-void RWlock::rlock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_rdlock(&rwlock));
-}
-
-void RWlock::unlock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_unlock(&rwlock));
-}
-
-void RWlock::trywlock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_trywrlock(&rwlock));
-}
-
-void RWlock::tryrlock() {
- QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_tryrdlock(&rwlock));
-}
-
-
-}}
-#endif /*!_sys_posix_Mutex_h*/
diff --git a/qpid/cpp/src/qpid/sys/posix/PrivatePosix.h b/qpid/cpp/src/qpid/sys/posix/PrivatePosix.h
deleted file mode 100644
index 9ec9770cab..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/PrivatePosix.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _sys_posix_PrivatePosix_h
-#define _sys_posix_PrivatePosix_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/Time.h"
-
-struct timespec;
-struct timeval;
-
-namespace qpid {
-namespace sys {
-
-// Private Time related implementation details
-struct timespec& toTimespec(struct timespec& ts, const Duration& t);
-struct timeval& toTimeval(struct timeval& tv, const Duration& t);
-Duration toTime(const struct timespec& ts);
-
-// Private socket related implementation details
-class SocketPrivate;
-int toFd(const SocketPrivate* s);
-
-}}
-
-#endif /*!_sys_posix_PrivatePosix_h*/
diff --git a/qpid/cpp/src/qpid/sys/posix/Shlib.cpp b/qpid/cpp/src/qpid/sys/posix/Shlib.cpp
deleted file mode 100644
index 1552aa06b5..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/Shlib.cpp
+++ /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.
- *
- */
-
-#include "qpid/sys/Shlib.h"
-#include "qpid/Exception.h"
-#include <dlfcn.h>
-
-
-namespace qpid {
-namespace sys {
-
-void Shlib::load(const char* name) {
- dlerror();
- handle = ::dlopen(name, RTLD_NOW);
- const char* error = ::dlerror();
- if (error) {
- throw Exception(QPID_MSG(error));
- }
-}
-
-void Shlib::unload() {
- if (handle) {
- ::dlerror();
- ::dlclose(handle);
- const char* error = ::dlerror();
- if (error) {
- throw Exception(QPID_MSG(error));
- }
- handle = 0;
- }
-}
-
-void* Shlib::getSymbol(const char* name) {
- ::dlerror();
- void* sym = ::dlsym(handle, name);
- const char* error = ::dlerror();
- if (error)
- throw Exception(QPID_MSG(error));
- return sym;
-}
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/posix/Socket.cpp b/qpid/cpp/src/qpid/sys/posix/Socket.cpp
deleted file mode 100644
index 028b45d03d..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/Socket.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/Socket.h"
-
-#include "check.h"
-#include "PrivatePosix.h"
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <cstdlib>
-
-#include <boost/format.hpp>
-
-namespace qpid {
-namespace sys {
-
-class SocketPrivate {
-public:
- SocketPrivate(int f = -1) :
- fd(f)
- {}
-
- int fd;
-
- std::string getName(bool local, bool includeService = false) const;
- std::string getService(bool local) const;
-};
-
-std::string SocketPrivate::getName(bool local, bool includeService) const
-{
- ::sockaddr_storage name; // big enough for any socket address
- ::socklen_t namelen = sizeof(name);
-
- int result = -1;
- if (local) {
- result = ::getsockname(fd, (::sockaddr*)&name, &namelen);
- } else {
- result = ::getpeername(fd, (::sockaddr*)&name, &namelen);
- }
-
- QPID_POSIX_CHECK(result);
-
- char servName[NI_MAXSERV];
- char dispName[NI_MAXHOST];
- if (includeService) {
- if (int rc=::getnameinfo((::sockaddr*)&name, namelen, dispName, sizeof(dispName),
- servName, sizeof(servName),
- NI_NUMERICHOST | NI_NUMERICSERV) != 0)
- throw QPID_POSIX_ERROR(rc);
- return std::string(dispName) + ":" + std::string(servName);
-
- } else {
- if (int rc=::getnameinfo((::sockaddr*)&name, namelen, dispName, sizeof(dispName), 0, 0, NI_NUMERICHOST) != 0)
- throw QPID_POSIX_ERROR(rc);
- return dispName;
- }
-}
-
-std::string SocketPrivate::getService(bool local) const
-{
- ::sockaddr_storage name; // big enough for any socket address
- ::socklen_t namelen = sizeof(name);
-
- int result = -1;
- if (local) {
- result = ::getsockname(fd, (::sockaddr*)&name, &namelen);
- } else {
- result = ::getpeername(fd, (::sockaddr*)&name, &namelen);
- }
-
- QPID_POSIX_CHECK(result);
-
- char servName[NI_MAXSERV];
- if (int rc=::getnameinfo((::sockaddr*)&name, namelen, 0, 0,
- servName, sizeof(servName),
- NI_NUMERICHOST | NI_NUMERICSERV) != 0)
- throw QPID_POSIX_ERROR(rc);
- return servName;
-}
-
-Socket::Socket() :
- impl(new SocketPrivate)
-{
- createTcp();
-}
-
-Socket::Socket(SocketPrivate* sp) :
- impl(sp)
-{}
-
-Socket::~Socket() {
- delete impl;
-}
-
-void Socket::createTcp() const
-{
- int& socket = impl->fd;
- if (socket != -1) Socket::close();
- int s = ::socket (PF_INET, SOCK_STREAM, 0);
- if (s < 0) throw QPID_POSIX_ERROR(errno);
- socket = s;
-}
-
-void Socket::setTimeout(const Duration& interval) const
-{
- const int& socket = impl->fd;
- struct timeval tv;
- toTimeval(tv, interval);
- setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
- setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
-}
-
-void Socket::setNonblocking() const {
- QPID_POSIX_CHECK(::fcntl(impl->fd, F_SETFL, O_NONBLOCK));
-}
-
-namespace {
-const char* h_errstr(int e) {
- switch (e) {
- case HOST_NOT_FOUND: return "Host not found";
- case NO_ADDRESS: return "Name does not have an IP address";
- case TRY_AGAIN: return "A temporary error occurred on an authoritative name server.";
- case NO_RECOVERY: return "Non-recoverable name server error";
- default: return "Unknown error";
- }
-}
-}
-
-void Socket::connect(const std::string& host, int port) const
-{
- const int& socket = impl->fd;
- struct sockaddr_in name;
- name.sin_family = AF_INET;
- name.sin_port = htons(port);
- // TODO: Be good to make this work for IPv6 as well as IPv4
- // Use more modern lookup functions
- struct hostent* hp = gethostbyname ( host.c_str() );
- if (hp == 0)
- throw Exception(QPID_MSG("Cannot resolve " << host << ": " << h_errstr(h_errno)));
- memcpy(&name.sin_addr.s_addr, hp->h_addr_list[0], hp->h_length);
- if (::connect(socket, (struct sockaddr*)(&name), sizeof(name)) < 0)
- throw qpid::Exception(QPID_MSG(strError(errno) << ": " << host << ":" << port));
-}
-
-void
-Socket::close() const
-{
- int& socket = impl->fd;
- if (socket == -1) return;
- if (::close(socket) < 0) throw QPID_POSIX_ERROR(errno);
- socket = -1;
-}
-
-ssize_t
-Socket::send(const void* data, size_t size) const
-{
- const int& socket = impl->fd;
- ssize_t sent = ::send(socket, data, size, 0);
- if (sent < 0) {
- if (errno == ECONNRESET) return SOCKET_EOF;
- if (errno == ETIMEDOUT) return SOCKET_TIMEOUT;
- throw QPID_POSIX_ERROR(errno);
- }
- return sent;
-}
-
-ssize_t
-Socket::recv(void* data, size_t size) const
-{
- const int& socket = impl->fd;
- ssize_t received = ::recv(socket, data, size, 0);
- if (received < 0) {
- if (errno == ETIMEDOUT) return SOCKET_TIMEOUT;
- throw QPID_POSIX_ERROR(errno);
- }
- return received;
-}
-
-int Socket::listen(int port, int backlog) const
-{
- const int& socket = impl->fd;
- int yes=1;
- QPID_POSIX_CHECK(setsockopt(socket,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(yes)));
- struct sockaddr_in name;
- name.sin_family = AF_INET;
- name.sin_port = htons(port);
- name.sin_addr.s_addr = 0;
- if (::bind(socket, (struct sockaddr*)&name, sizeof(name)) < 0)
- throw QPID_POSIX_ERROR(errno);
- if (::listen(socket, backlog) < 0)
- throw QPID_POSIX_ERROR(errno);
-
- socklen_t namelen = sizeof(name);
- if (::getsockname(socket, (struct sockaddr*)&name, &namelen) < 0)
- throw QPID_POSIX_ERROR(errno);
-
- return ntohs(name.sin_port);
-}
-
-Socket* Socket::accept(struct sockaddr *addr, socklen_t *addrlen) const
-{
- int afd = ::accept(impl->fd, addr, addrlen);
- if ( afd >= 0)
- return new Socket(new SocketPrivate(afd));
- else if (errno == EAGAIN)
- return 0;
- else throw QPID_POSIX_ERROR(errno);
-}
-
-int Socket::read(void *buf, size_t count) const
-{
- return ::read(impl->fd, buf, count);
-}
-
-int Socket::write(const void *buf, size_t count) const
-{
- return ::write(impl->fd, buf, count);
-}
-
-std::string Socket::getSockname() const
-{
- return impl->getName(true);
-}
-
-std::string Socket::getPeername() const
-{
- return impl->getName(false);
-}
-
-std::string Socket::getPeerAddress() const
-{
- return impl->getName(false, true);
-}
-
-std::string Socket::getLocalAddress() const
-{
- return impl->getName(true, true);
-}
-
-uint Socket::getLocalPort() const
-{
- return atoi(impl->getService(true).c_str());
-}
-
-uint Socket::getRemotePort() const
-{
- return atoi(impl->getService(true).c_str());
-}
-
-int Socket::toFd() const {
- return impl->fd;
-}
-
-int toFd(const SocketPrivate* s)
-{
- return s->fd;
-}
-
-}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/posix/Thread.cpp b/qpid/cpp/src/qpid/sys/posix/Thread.cpp
deleted file mode 100644
index dc9b21448f..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/Thread.cpp
+++ /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.
- *
- */
-
-#include "Thread.h"
-#include "qpid/sys/Runnable.h"
-
-void* qpid::sys::Thread::runRunnable(void* p)
-{
- static_cast<Runnable*>(p)->run();
- return 0;
-}
diff --git a/qpid/cpp/src/qpid/sys/posix/Thread.h b/qpid/cpp/src/qpid/sys/posix/Thread.h
deleted file mode 100644
index e199c0eef6..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/Thread.h
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef _sys_posix_Thread_h
-#define _sys_posix_Thread_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "check.h"
-#include <pthread.h>
-
-namespace qpid {
-namespace sys {
-
-class Runnable;
-
-class Thread
-{
- public:
- inline static Thread current();
-
- /** ID of current thread for logging.
- * Workaround for broken Thread::current() in APR
- */
- static long logId() { return current().id(); }
-
- inline static void yield();
-
- inline Thread();
- inline explicit Thread(qpid::sys::Runnable*);
- inline explicit Thread(qpid::sys::Runnable&);
-
- inline void join();
-
- inline long id();
-
- private:
- static void* runRunnable(void* runnable);
- inline Thread(pthread_t);
- pthread_t thread;
-};
-
-
-Thread::Thread() : thread(0) {}
-
-Thread::Thread(Runnable* runnable) {
- QPID_POSIX_ASSERT_THROW_IF(pthread_create(&thread, NULL, runRunnable, runnable));
-}
-
-Thread::Thread(Runnable& runnable) {
- QPID_POSIX_ASSERT_THROW_IF(pthread_create(&thread, NULL, runRunnable, &runnable));
-}
-
-void Thread::join(){
- if (thread != 0)
- QPID_POSIX_ASSERT_THROW_IF(pthread_join(thread, 0));
-}
-
-long Thread::id() {
- return long(thread);
-}
-
-Thread::Thread(pthread_t thr) : thread(thr) {}
-
-Thread Thread::current() {
- return Thread(pthread_self());
-}
-
-void Thread::yield()
-{
- QPID_POSIX_ASSERT_THROW_IF(pthread_yield());
-}
-
-
-}}
-#endif /*!_sys_posix_Thread_h*/
diff --git a/qpid/cpp/src/qpid/sys/posix/Time.cpp b/qpid/cpp/src/qpid/sys/posix/Time.cpp
deleted file mode 100644
index ac63a3d038..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/Time.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "PrivatePosix.h"
-
-#include "qpid/sys/Time.h"
-
-#include <time.h>
-#include <sys/time.h>
-
-namespace qpid {
-namespace sys {
-
-AbsTime AbsTime::now() {
- struct timespec ts;
- ::clock_gettime(CLOCK_REALTIME, &ts);
- AbsTime time_now;
- time_now.time_ns = toTime(ts).nanosecs;
- return time_now;
-}
-
-struct timespec& toTimespec(struct timespec& ts, const Duration& t) {
- ts.tv_sec = t / TIME_SEC;
- ts.tv_nsec = t % TIME_SEC;
- return ts;
-}
-
-struct timeval& toTimeval(struct timeval& tv, const Duration& t) {
- tv.tv_sec = t/TIME_SEC;
- tv.tv_usec = (t%TIME_SEC)/TIME_USEC;
- return tv;
-}
-
-Duration toTime(const struct timespec& ts) {
- return ts.tv_sec*TIME_SEC + ts.tv_nsec;
-}
-
-}}
-
diff --git a/qpid/cpp/src/qpid/sys/posix/check.h b/qpid/cpp/src/qpid/sys/posix/check.h
deleted file mode 100644
index aa93c37205..0000000000
--- a/qpid/cpp/src/qpid/sys/posix/check.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef _posix_check_h
-#define _posix_check_h
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include <cerrno>
-#include <assert.h>
-
-#define QPID_POSIX_ERROR(ERRNO) qpid::Exception(QPID_MSG(qpid::strError(ERRNO)))
-
-/** THROW QPID_POSIX_ERROR(errno) if RESULT is less than zero */
-#define QPID_POSIX_CHECK(RESULT) \
- if ((RESULT) < 0) throw QPID_POSIX_ERROR((errno))
-
-/** Throw a posix error if ERRNO is non-zero */
-#define QPID_POSIX_THROW_IF(ERRNO) \
- do { int e=(ERRNO); if (e) throw QPID_POSIX_ERROR(e); } while(0)
-
-/** Same as _THROW_IF in a release build, but abort a debug build */
-#ifdef NDEBUG
-#define QPID_POSIX_ASSERT_THROW_IF(ERRNO) QPID_POSIX_THROW_IF(ERRNO)
-#else
-#define QPID_POSIX_ASSERT_THROW_IF(ERRNO) \
- do { int e=(ERRNO); if (e) { errno=e; perror(0); assert(0); } } while(0)
-#endif
-
-#endif /*!_posix_check_h*/
diff --git a/qpid/cpp/src/qpidd.cpp b/qpid/cpp/src/qpidd.cpp
deleted file mode 100644
index 08b907cbe2..0000000000
--- a/qpid/cpp/src/qpidd.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/broker/Broker.h"
-#include "qpid/sys/posix/check.h"
-#include "qpid/broker/Daemon.h"
-#include "qpid/log/Statement.h"
-#include "qpid/log/Options.h"
-#include "qpid/log/Logger.h"
-#include "qpid/Plugin.h"
-#include "qpid/sys/Shlib.h"
-#include "config.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <iostream>
-#include <fstream>
-#include <signal.h>
-#include <unistd.h>
-
-using namespace qpid;
-using namespace qpid::broker;
-using namespace qpid::sys;
-using namespace qpid::log;
-using namespace std;
-namespace fs=boost::filesystem;
-
-struct ModuleOptions : public qpid::Options {
- string loadDir;
- vector<string> load;
- bool noLoad;
- ModuleOptions() : qpid::Options("Module options"), loadDir("/usr/lib/qpidd"), noLoad(false)
- {
- addOptions()
- ("module-dir", optValue(loadDir, "DIR"), "Load all .so modules in this directory")
- ("load-module", optValue(load, "FILE"), "Specifies additional module(s) to be loaded")
- ("no-module-dir", optValue(noLoad), "Don't load modules from module directory");
- }
-};
-
-
-struct DaemonOptions : public qpid::Options {
- bool daemon;
- bool quit;
- bool check;
- int wait;
-
- DaemonOptions() : qpid::Options("Daemon options"), daemon(false), quit(false), check(false), wait(10)
- {
- addOptions()
- ("daemon,d", optValue(daemon), "Run as a daemon.")
- ("wait,w", optValue(wait, "SECONDS"), "Sets the maximum wait time to initialize the daemon. If the daemon fails to initialize, prints an error and returns 1")
- ("check,c", optValue(check), "Prints the daemon's process ID to stdout and returns 0 if the daemon is running, otherwise returns 1")
- ("quit,q", optValue(quit), "Tells the daemon to shut down");
- }
-};
-
-
-struct QpiddOptions : public qpid::Options {
- CommonOptions common;
- ModuleOptions module;
- Broker::Options broker;
- DaemonOptions daemon;
- qpid::log::Options log;
-
- QpiddOptions() : qpid::Options("Options"), common("", "/etc/qpidd.conf") {
- add(common);
- add(module);
- add(broker);
- add(daemon);
- add(log);
- const Plugin::Plugins& plugins=
- Plugin::getPlugins();
- for (Plugin::Plugins::const_iterator i = plugins.begin();
- i != plugins.end();
- ++i)
- if ((*i)->getOptions() != 0)
- add(*(*i)->getOptions());
- }
-
- void usage() const {
- cout << "Usage: qpidd [OPTIONS]" << endl << endl << *this << endl;
- };
-};
-
-// BootstrapOptions is a minimal subset of options used for a pre-parse
-// of the command line to discover which plugin modules need to be loaded.
-// The pre-parse is necessary because plugin modules may supply their own
-// set of options. CommonOptions is needed to properly support loading
-// from a configuration file.
-struct BootstrapOptions : public qpid::Options {
- CommonOptions common;
- ModuleOptions module;
- qpid::log::Options log;
-
- BootstrapOptions() : qpid::Options("Options"), common("", "/etc/qpidd.conf") {
- add(common);
- add(module);
- add(log);
- }
-};
-
-// Globals
-shared_ptr<Broker> brokerPtr;
-auto_ptr<QpiddOptions> options;
-
-void shutdownHandler(int /*signal*/){
- // Note: do not call any async-signal unsafe functions here.
- // Do any extra shutdown actions in main() after broker->run()
- brokerPtr->shutdown();
-}
-
-struct QpiddDaemon : public Daemon {
- /** Code for parent process */
- void parent() {
- uint16_t port = wait(options->daemon.wait);
- if (options->broker.port == 0)
- cout << port << endl;
- }
-
- /** Code for forked child process */
- void child() {
- brokerPtr.reset(new Broker(options->broker));
- uint16_t port=brokerPtr->getPort();
- ready(port); // Notify parent.
- brokerPtr->run();
- brokerPtr.reset();
- }
-};
-
-void tryShlib(const char* libname, bool noThrow) {
- try {
- Shlib shlib(libname);
- QPID_LOG (info, "Loaded Module: " << libname);
- }
- catch (const exception& e) {
- if (!noThrow)
- throw;
- }
-}
-
-void loadModuleDir (string dirname, bool isDefault)
-{
- fs::path dirPath (dirname, fs::native);
-
- if (!fs::exists (dirPath))
- {
- if (isDefault)
- return;
- throw Exception ("Directory not found: " + dirname);
- }
-
- fs::directory_iterator endItr;
- for (fs::directory_iterator itr (dirPath); itr != endItr; ++itr)
- {
- if (!fs::is_directory(*itr) &&
- itr->string().find (".so") == itr->string().length() - 3)
- tryShlib (itr->string().data(), true);
- }
-}
-
-
-int main(int argc, char* argv[])
-{
- try
- {
- {
- BootstrapOptions bootOptions;
- string defaultPath (bootOptions.module.loadDir);
-
- // Parse only the common, load, and log options to see which modules need
- // to be loaded. Once the modules are loaded, the command line will
- // be re-parsed with all of the module-supplied options.
- bootOptions.parse (argc, argv, bootOptions.common.config, true);
- qpid::log::Logger::instance().configure(bootOptions.log, argv[0]);
-
- for (vector<string>::iterator iter = bootOptions.module.load.begin();
- iter != bootOptions.module.load.end();
- iter++)
- tryShlib (iter->data(), false);
-
- if (!bootOptions.module.noLoad) {
- bool isDefault = defaultPath == bootOptions.module.loadDir;
- loadModuleDir (bootOptions.module.loadDir, isDefault);
- }
- }
-
- // Parse options
- options.reset(new QpiddOptions());
- options->parse(argc, argv, options->common.config);
-
- // Options that just print information.
- if(options->common.help || options->common.version) {
- if (options->common.version)
- cout << "qpidd (" << PACKAGE_NAME << ") version "
- << PACKAGE_VERSION << endl;
- else if (options->common.help)
- options->usage();
- return 0;
- }
-
- // Options that affect a running daemon.
- if (options->daemon.check || options->daemon.quit) {
- pid_t pid = Daemon::getPid(options->broker.port);
- if (pid < 0)
- return 1;
- if (options->daemon.check)
- cout << pid << endl;
- if (options->daemon.quit && kill(pid, SIGINT) < 0)
- throw Exception("Failed to stop daemon: " + strError(errno));
- return 0;
- }
-
- // Starting the broker.
-
- // Signal handling
- signal(SIGINT,shutdownHandler);
- signal(SIGTERM,shutdownHandler);
- signal(SIGHUP,SIG_IGN); // TODO aconway 2007-07-18: reload config.
-
- signal(SIGCHLD,SIG_IGN);
- signal(SIGTSTP,SIG_IGN);
- signal(SIGTTOU,SIG_IGN);
- signal(SIGTTIN,SIG_IGN);
-
- if (options->daemon.daemon) {
- // Fork the daemon
- QpiddDaemon d;
- d.fork();
- }
- else { // Non-daemon broker.
- brokerPtr.reset(new Broker(options->broker));
- if (options->broker.port == 0)
- cout << uint16_t(brokerPtr->getPort()) << endl;
- brokerPtr->run();
- QPID_LOG(notice, "Shutting down.");
- }
- return 0;
- }
- catch(const exception& e) {
- cerr << e.what() << endl;
- }
- return 1;
-}
diff --git a/qpid/cpp/src/tests/.valgrind.supp b/qpid/cpp/src/tests/.valgrind.supp
deleted file mode 100644
index e0abf0dd43..0000000000
--- a/qpid/cpp/src/tests/.valgrind.supp
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- Benign error in libcpg.
- Memcheck:Param
- socketcall.sendmsg(msg.msg_iov[i])
- obj:*/libpthread-2.5.so
- obj:*/libcpg.so.2.0.0
-}
-
-{
- Uninitialised value problem in _dl_relocate (F7, F8)
- Memcheck:Cond
- fun:_dl_relocate_object
- fun:*dl_*
-}
-
-{
- False "possibly leaked" in boost program_options - global std::string var.
- Memcheck:Leak
- fun:_Znwj
- fun:_ZNSs4_Rep9_S_createEjjRKSaIcE
- obj:/usr/lib/libstdc++.so.6.0.8
- fun:_ZNSsC1EPKcRKSaIcE
- obj:/usr/lib/libboost_program_options.so.1.33.1
-}
-
-{
- Bogus epoll_ctl error on i386
- Memcheck:Param
- epoll_ctl(event)
- fun:epoll_ctl
-}
-
diff --git a/qpid/cpp/src/tests/.valgrindrc b/qpid/cpp/src/tests/.valgrindrc
deleted file mode 100644
index 4aba7661de..0000000000
--- a/qpid/cpp/src/tests/.valgrindrc
+++ /dev/null
@@ -1,7 +0,0 @@
---gen-suppressions=all
---leak-check=full
---demangle=yes
---suppressions=.valgrind.supp
---num-callers=25
---trace-children=yes
-
diff --git a/qpid/cpp/src/tests/AccumulatedAckTest.cpp b/qpid/cpp/src/tests/AccumulatedAckTest.cpp
deleted file mode 100644
index cbe44e6814..0000000000
--- a/qpid/cpp/src/tests/AccumulatedAckTest.cpp
+++ /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.
- *
- */
-#include "qpid/framing/AccumulatedAck.h"
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include <list>
-
-using std::list;
-using namespace qpid::framing;
-
-class AccumulatedAckTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(AccumulatedAckTest);
- CPPUNIT_TEST(testGeneral);
- CPPUNIT_TEST(testCovers);
- CPPUNIT_TEST(testUpdateFromCompletionData);
- CPPUNIT_TEST(testCase1);
- CPPUNIT_TEST(testCase2);
- CPPUNIT_TEST(testCase3);
- CPPUNIT_TEST(testCase4);
- CPPUNIT_TEST(testConsolidation1);
- CPPUNIT_TEST(testConsolidation2);
- CPPUNIT_TEST(testConsolidation3);
- CPPUNIT_TEST(testConsolidation4);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- bool covers(const AccumulatedAck& ack, int i)
- {
- return ack.covers(SequenceNumber(i));
- }
-
- void update(AccumulatedAck& ack, int start, int end)
- {
- ack.update(SequenceNumber(start), SequenceNumber(end));
- }
-
- void testGeneral()
- {
- AccumulatedAck ack(0);
- ack.clear();
- update(ack, 3,3);
- update(ack, 7,7);
- update(ack, 9,9);
- update(ack, 1,2);
- update(ack, 4,5);
- update(ack, 6,6);
-
- for(int i = 1; i <= 7; i++) CPPUNIT_ASSERT(covers(ack, i));
- CPPUNIT_ASSERT(covers(ack, 9));
-
- CPPUNIT_ASSERT(!covers(ack, 8));
- CPPUNIT_ASSERT(!covers(ack, 10));
-
- ack.consolidate();
-
- for(int i = 1; i <= 7; i++) CPPUNIT_ASSERT(covers(ack, i));
- CPPUNIT_ASSERT(covers(ack, 9));
-
- CPPUNIT_ASSERT(!covers(ack, 8));
- CPPUNIT_ASSERT(!covers(ack, 10));
- }
-
- void testCovers()
- {
- AccumulatedAck ack(5);
- update(ack, 7, 7);
- update(ack, 9, 9);
-
- CPPUNIT_ASSERT(covers(ack, 1));
- CPPUNIT_ASSERT(covers(ack, 2));
- CPPUNIT_ASSERT(covers(ack, 3));
- CPPUNIT_ASSERT(covers(ack, 4));
- CPPUNIT_ASSERT(covers(ack, 5));
- CPPUNIT_ASSERT(covers(ack, 7));
- CPPUNIT_ASSERT(covers(ack, 9));
-
- CPPUNIT_ASSERT(!covers(ack, 6));
- CPPUNIT_ASSERT(!covers(ack, 8));
- CPPUNIT_ASSERT(!covers(ack, 10));
- }
-
- void testUpdateFromCompletionData()
- {
- AccumulatedAck ack(0);
- SequenceNumber mark(2);
- SequenceNumberSet ranges;
- ranges.addRange(SequenceNumber(5), SequenceNumber(8));
- ranges.addRange(SequenceNumber(10), SequenceNumber(15));
- ranges.addRange(SequenceNumber(9), SequenceNumber(9));
- ranges.addRange(SequenceNumber(3), SequenceNumber(4));
-
- ack.update(mark, ranges);
-
- for(int i = 0; i <= 15; i++) {
- CPPUNIT_ASSERT(covers(ack, i));
- }
- CPPUNIT_ASSERT(!covers(ack, 16));
- CPPUNIT_ASSERT_EQUAL((uint32_t) 15, ack.mark.getValue());
- }
-
- void testCase1()
- {
- AccumulatedAck ack(3);
- update(ack, 1,2);
- for(int i = 1; i <= 3; i++) CPPUNIT_ASSERT(covers(ack, i));
- CPPUNIT_ASSERT(!covers(ack, 4));
- }
-
- void testCase2()
- {
- AccumulatedAck ack(3);
- update(ack, 3,6);
- for(int i = 1; i <= 6; i++) CPPUNIT_ASSERT(covers(ack, i));
- CPPUNIT_ASSERT(!covers(ack, 7));
- }
-
- void testCase3()
- {
- AccumulatedAck ack(3);
- update(ack, 4,6);
- for(int i = 1; i <= 6; i++) {
- CPPUNIT_ASSERT(covers(ack, i));
- }
- CPPUNIT_ASSERT(!covers(ack, 7));
- }
-
- void testCase4()
- {
- AccumulatedAck ack(3);
- update(ack, 5,6);
- for(int i = 1; i <= 6; i++) {
- if (i == 4) CPPUNIT_ASSERT(!covers(ack, i));
- else CPPUNIT_ASSERT(covers(ack, i));
- }
- CPPUNIT_ASSERT(!covers(ack, 7));
- }
-
- void testConsolidation1()
- {
- AccumulatedAck ack(3);
- update(ack, 7,7);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 3, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 1, ack.ranges.size());
-
- update(ack, 8,9);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 3, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 1, ack.ranges.size());
-
- update(ack, 1,2);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 3, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 1, ack.ranges.size());
-
- update(ack, 4,5);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 5, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 1, ack.ranges.size());
-
- update(ack, 6,6);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 9, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 0, ack.ranges.size());
-
- for(int i = 1; i <= 9; i++) CPPUNIT_ASSERT(covers(ack, i));
- CPPUNIT_ASSERT(!covers(ack, 10));
- }
-
- void testConsolidation2()
- {
- AccumulatedAck ack(0);
- update(ack, 10,12);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 0, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 1, ack.ranges.size());
-
- update(ack, 7,9);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 0, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 1, ack.ranges.size());
- CPPUNIT_ASSERT_EQUAL((uint32_t) 7, ack.ranges.front().start.getValue());
- CPPUNIT_ASSERT_EQUAL((uint32_t) 12, ack.ranges.front().end.getValue());
-
- update(ack, 5,7);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 0, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 1, ack.ranges.size());
- CPPUNIT_ASSERT_EQUAL((uint32_t) 5, ack.ranges.front().start.getValue());
- CPPUNIT_ASSERT_EQUAL((uint32_t) 12, ack.ranges.front().end.getValue());
-
- update(ack, 3,4);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 0, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 1, ack.ranges.size());
- CPPUNIT_ASSERT_EQUAL((uint32_t) 3, ack.ranges.front().start.getValue());
- CPPUNIT_ASSERT_EQUAL((uint32_t) 12, ack.ranges.front().end.getValue());
-
- update(ack, 1,2);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 12, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 0, ack.ranges.size());
-
- for(int i = 1; i <= 12; i++) CPPUNIT_ASSERT(covers(ack, i));
- CPPUNIT_ASSERT(!covers(ack, 13));
- }
-
- void testConsolidation3()
- {
- AccumulatedAck ack(0);
- update(ack, 10,12);
- update(ack, 6,7);
- update(ack, 3,4);
- update(ack, 1,15);
- CPPUNIT_ASSERT_EQUAL((uint32_t) 15, ack.mark.getValue());
- CPPUNIT_ASSERT_EQUAL((size_t) 0, ack.ranges.size());
- }
-
- void testConsolidation4()
- {
- AccumulatedAck ack(0);
- ack.update(SequenceNumber(0), SequenceNumber(2));
- ack.update(SequenceNumber(5), SequenceNumber(8));
- ack.update(SequenceNumber(10), SequenceNumber(15));
- ack.update(SequenceNumber(9), SequenceNumber(9));
- ack.update(SequenceNumber(3), SequenceNumber(4));
-
- for(int i = 0; i <= 15; i++) {
- CPPUNIT_ASSERT(covers(ack, i));
- }
- CPPUNIT_ASSERT(!covers(ack, 16));
- CPPUNIT_ASSERT_EQUAL((uint32_t) 15, ack.mark.getValue());
- }
-
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(AccumulatedAckTest);
-
diff --git a/qpid/cpp/src/tests/Array.cpp b/qpid/cpp/src/tests/Array.cpp
deleted file mode 100644
index 336e57b485..0000000000
--- a/qpid/cpp/src/tests/Array.cpp
+++ /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.
- *
- */
-#include <iostream>
-#include <sstream>
-#include "qpid/framing/Array.h"
-#include "qpid/framing/FieldValue.h"
-
-#include "unit_test.h"
-
-QPID_AUTO_TEST_SUITE(ArrayTestSuite)
-
-using namespace qpid::framing;
-
-void populate(std::vector<std::string>& data, int count = 10)
-{
- for (int i = 0; i < count; i++) {
- std::stringstream out;
- out << "item-" << i;
- data.push_back(out.str());
- }
-}
-
-BOOST_AUTO_TEST_CASE(testEncodeDecode)
-{
- std::vector<std::string> data;
- populate(data);
-
- Array a(data);
-
- char buff[200];
- Buffer wbuffer(buff, 200);
- a.encode(wbuffer);
-
- Array b;
- Buffer rbuffer(buff, 200);
- b.decode(rbuffer);
- BOOST_CHECK_EQUAL(a, b);
-
- std::vector<std::string> data2;
- b.collect(data2);
- //BOOST_CHECK_EQUAL(data, data2);
- BOOST_CHECK(data == data2);
-}
-
-BOOST_AUTO_TEST_CASE(testAssignment)
-{
- std::vector<std::string> data;
- populate(data);
- Array b;
- {
- Array a(data);
- b = a;
- BOOST_CHECK_EQUAL(a, b);
- }
- std::vector<std::string> data2;
- b.collect(data2);
- //BOOST_CHECK_EQUAL(data, data2);
- BOOST_CHECK(data == data2);
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/BasicP2PTest.cpp b/qpid/cpp/src/tests/BasicP2PTest.cpp
deleted file mode 100644
index b202f88ca6..0000000000
--- a/qpid/cpp/src/tests/BasicP2PTest.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "BasicP2PTest.h"
-
-using namespace qpid;
-using namespace qpid::client;
-
-class BasicP2PTest::Receiver : public Worker, public MessageListener
-{
- const std::string queue;
- std::string tag;
-public:
- Receiver(TestOptions& options, const std::string& _queue, const int _messages)
- : Worker(options, _messages), queue(_queue){}
- void init()
- {
- Queue q(queue, true);
- channel.declareQueue(q);
- framing::FieldTable args;
- channel.bind(Exchange::STANDARD_DIRECT_EXCHANGE, q, queue, args);
- channel.consume(q, tag, this);
- channel.start();
- }
-
- void start()
- {
- }
-
- void received(Message&)
- {
- count++;
- }
-};
-
-void BasicP2PTest::assign(const std::string& role, framing::FieldTable& params, TestOptions& options)
-{
- std::string queue = params.getString("P2P_QUEUE_AND_KEY_NAME");
- int messages = params.getInt("P2P_NUM_MESSAGES");
- if (role == "SENDER") {
- worker = std::auto_ptr<Worker>(new Sender(options, Exchange::STANDARD_DIRECT_EXCHANGE, queue, messages));
- } else if(role == "RECEIVER"){
- worker = std::auto_ptr<Worker>(new Receiver(options, queue, messages));
- } else {
- throw Exception("unrecognised role");
- }
- worker->init();
-}
diff --git a/qpid/cpp/src/tests/BasicP2PTest.h b/qpid/cpp/src/tests/BasicP2PTest.h
deleted file mode 100644
index 3f0a3704f5..0000000000
--- a/qpid/cpp/src/tests/BasicP2PTest.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef _BasicP2PTest_
-#define _BasicP2PTest_
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <memory>
-#include <sstream>
-
-#include "qpid/Exception.h"
-#include "qpid/client/Channel.h"
-#include "qpid/client/Message.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/MessageListener.h"
-#include "SimpleTestCaseBase.h"
-
-
-namespace qpid {
-
-class BasicP2PTest : public SimpleTestCaseBase
-{
- class Receiver;
-public:
- void assign(const std::string& role, framing::FieldTable& params, TestOptions& options);
-};
-
-}
-
-#endif
diff --git a/qpid/cpp/src/tests/BasicPubSubTest.cpp b/qpid/cpp/src/tests/BasicPubSubTest.cpp
deleted file mode 100644
index 623194d331..0000000000
--- a/qpid/cpp/src/tests/BasicPubSubTest.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "BasicPubSubTest.h"
-
-using namespace qpid;
-
-class BasicPubSubTest::Receiver : public Worker, public MessageListener
-{
- const Exchange& exchange;
- const std::string queue;
- const std::string key;
- std::string tag;
-public:
- Receiver(TestOptions& options, const Exchange& _exchange, const std::string& _queue, const std::string& _key, const int _messages)
- : Worker(options, _messages), exchange(_exchange), queue(_queue), key(_key){}
-
- void init()
- {
- Queue q(queue, true);
- channel.declareQueue(q);
- framing::FieldTable args;
- channel.bind(exchange, q, key, args);
- channel.consume(q, tag, this);
- channel.start();
- }
-
- void start(){
- }
-
- void received(Message&)
- {
- count++;
- }
-};
-
-class BasicPubSubTest::MultiReceiver : public Worker, public MessageListener
-{
- typedef boost::ptr_vector<Receiver> ReceiverList;
- ReceiverList receivers;
-
-public:
- MultiReceiver(TestOptions& options, const Exchange& exchange, const std::string& key, const int _messages, int receiverCount)
- : Worker(options, _messages)
- {
- for (int i = 0; i != receiverCount; i++) {
- std::string queue = (boost::format("%1%_%2%") % options.clientid % i).str();
- receivers.push_back(new Receiver(options, exchange, queue, key, _messages));
- }
- }
-
- void init()
- {
- for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
- receivers[i].init();
- }
- }
-
- void start()
- {
- for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
- receivers[i].start();
- }
- }
-
- void received(Message& msg)
- {
- for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
- receivers[i].received(msg);
- }
- }
-
- virtual int getCount()
- {
- count = 0;
- for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
- count += receivers[i].getCount();
- }
- return count;
- }
- virtual void stop()
- {
- for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
- receivers[i].stop();
- }
- }
-};
-
-void BasicPubSubTest::assign(const std::string& role, framing::FieldTable& params, TestOptions& options)
-{
- std::string key = params.getString("PUBSUB_KEY");
- int messages = params.getInt("PUBSUB_NUM_MESSAGES");
- int receivers = params.getInt("PUBSUB_NUM_RECEIVERS");
- if (role == "SENDER") {
- worker = std::auto_ptr<Worker>(new Sender(options, Exchange::STANDARD_TOPIC_EXCHANGE, key, messages));
- } else if(role == "RECEIVER"){
- worker = std::auto_ptr<Worker>(new MultiReceiver(options, Exchange::STANDARD_TOPIC_EXCHANGE, key, messages, receivers));
- } else {
- throw Exception("unrecognised role");
- }
- worker->init();
-}
-
diff --git a/qpid/cpp/src/tests/BasicPubSubTest.h b/qpid/cpp/src/tests/BasicPubSubTest.h
deleted file mode 100644
index c3f8020b3a..0000000000
--- a/qpid/cpp/src/tests/BasicPubSubTest.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _BasicPubSubTest_
-#define _BasicPubSubTest_
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <memory>
-#include <sstream>
-
-#include "qpid/Exception.h"
-#include "qpid/client/Channel.h"
-#include "qpid/client/Message.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/MessageListener.h"
-#include "SimpleTestCaseBase.h"
-#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/format.hpp>
-
-
-namespace qpid {
-
-using namespace qpid::client;
-
-class BasicPubSubTest : public SimpleTestCaseBase
-{
- class Receiver;
- class MultiReceiver;
-public:
- void assign(const std::string& role, framing::FieldTable& params, TestOptions& options);
-};
-
-}
-
-#endif
diff --git a/qpid/cpp/src/tests/Blob.cpp b/qpid/cpp/src/tests/Blob.cpp
deleted file mode 100644
index d27c0bbd85..0000000000
--- a/qpid/cpp/src/tests/Blob.cpp
+++ /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.
- */
-#include "qpid/framing/Blob.h"
-
-#include "unit_test.h"
-
-QPID_AUTO_TEST_SUITE(BlobTestSuite)
-
-using namespace std;
-using namespace qpid::framing;
-
-struct Base {
- int id;
- int magic;
-
- Base(int n) : id(n), magic(42) {}
- Base(const Base& c) : id(c.id), magic(42) {}
- ~Base() { BOOST_CHECK_EQUAL(42, magic); } // Detect random data.
-};
-
-template <class T> struct Count : public Base {
- static int instances;
- bool destroyed;
-
- Count(int n) : Base(n), destroyed(false) { ++instances; }
- Count(const Count& c) : Base(c), destroyed(false) { ++instances; }
- ~Count() {
- BOOST_CHECK(!destroyed); // Detect double-destructor
- destroyed=true;
- BOOST_CHECK(--instances >= 0);
- }
-};
-
-template <class T> int Count<T>::instances = 0;
-
-struct Foo : public Count<Foo> { Foo(int n) : Count<Foo>(n) {}; };
-struct Bar : public Count<Bar> { Bar(int n) : Count<Bar>(n) {}; };
-
-typedef Blob<sizeof(Foo), Base> TestBlob ;
-
-BOOST_AUTO_TEST_CASE(testCtor) {
- {
- TestBlob empty;
- BOOST_CHECK(empty.empty());
- BOOST_CHECK(empty.get() == 0);
-
- TestBlob empty2(empty);
- BOOST_CHECK(empty2.empty());
-
- TestBlob foo(in_place<Foo>(1));
- BOOST_CHECK(!foo.empty());
- BOOST_CHECK_EQUAL(1, foo.get()->id);
- BOOST_CHECK_EQUAL(1, Foo::instances);
-
- TestBlob foo2(foo);
- BOOST_CHECK(!foo2.empty());
- BOOST_CHECK_EQUAL(1, foo2.get()->id);
- BOOST_CHECK_EQUAL(2, Foo::instances);
- }
-
- BOOST_CHECK_EQUAL(0, Foo::instances);
- BOOST_CHECK_EQUAL(0, Bar::instances);
-}
-
-
-BOOST_AUTO_TEST_CASE(testAssign) {
- {
- TestBlob b;
- b = Foo(2);
- BOOST_CHECK_EQUAL(2, b.get()->id);
- BOOST_CHECK_EQUAL(1, Foo::instances);
-
- TestBlob b2(b);
- BOOST_CHECK_EQUAL(2, b.get()->id);
- BOOST_CHECK_EQUAL(2, Foo::instances);
-
- b2 = Bar(3);
- BOOST_CHECK_EQUAL(3, b2.get()->id);
- BOOST_CHECK_EQUAL(1, Foo::instances);
- BOOST_CHECK_EQUAL(1, Bar::instances);
-
- b2 = in_place<Foo>(4);
- BOOST_CHECK_EQUAL(4, b2.get()->id);
- BOOST_CHECK_EQUAL(2, Foo::instances);
- BOOST_CHECK_EQUAL(0, Bar::instances);
-
- b2.clear();
- BOOST_CHECK(b2.empty());
- BOOST_CHECK_EQUAL(1, Foo::instances);
- }
- BOOST_CHECK_EQUAL(0, Foo::instances);
- BOOST_CHECK_EQUAL(0, Bar::instances);
-}
-
-
-BOOST_AUTO_TEST_CASE(testClear) {
- TestBlob b(in_place<Foo>(5));
- TestBlob c(b);
- BOOST_CHECK(!c.empty());
- BOOST_CHECK(!b.empty());
- BOOST_CHECK_EQUAL(2, Foo::instances);
-
- c.clear();
- BOOST_CHECK(c.empty());
- BOOST_CHECK_EQUAL(1, Foo::instances);
-
- b.clear();
- BOOST_CHECK(b.empty());
- BOOST_CHECK_EQUAL(0, Foo::instances);
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/BrokerFixture.h b/qpid/cpp/src/tests/BrokerFixture.h
deleted file mode 100644
index fd350b77fe..0000000000
--- a/qpid/cpp/src/tests/BrokerFixture.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifndef TESTS_BROKERFIXTURE_H
-#define TESTS_BROKERFIXTURE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "SocketProxy.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/broker/Broker.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/ConnectionImpl.h"
-#include "qpid/client/Session.h"
-#include "qpid/client/SubscriptionManager.h"
-
-/**
- * A fixture with an in-process broker.
- */
-struct BrokerFixture {
- typedef qpid::broker::Broker Broker;
- typedef boost::shared_ptr<Broker> BrokerPtr;
-
- BrokerPtr broker;
- qpid::sys::Thread brokerThread;
-
- BrokerFixture() {
- Broker::Options opts;
- opts.port=0;
- // Management doesn't play well with multiple in-process brokers.
- opts.enableMgmt=false;
- opts.workerThreads=1;
- opts.dataDir="";
- broker = Broker::create(opts);
- // TODO aconway 2007-12-05: At one point BrokerFixture
- // tests could hang in Connection ctor if the following
- // line is removed. This may not be an issue anymore.
- broker->getPort();
- brokerThread = qpid::sys::Thread(*broker);
- };
-
- ~BrokerFixture() {
- broker->shutdown();
- brokerThread.join();
- }
-
- /** Open a connection to the broker. */
- void open(qpid::client::Connection& c) {
- c.open("localhost", broker->getPort());
- }
-};
-
-struct LocalConnection : public qpid::client::Connection {
- LocalConnection(uint16_t port) { open("localhost", port); }
-};
-
-/** A local client connection via a socket proxy. */
-struct ProxyConnection : public qpid::client::Connection {
- SocketProxy proxy;
- ProxyConnection(int brokerPort) : proxy(brokerPort) {
- open("localhost", proxy.getPort());
- }
- ~ProxyConnection() { close(); }
-};
-
-/**
- * A BrokerFixture with open Connection, Session and
- * SubscriptionManager and LocalQueue for convenience.
- */
-template <class ConnectionType>
-struct SessionFixtureT : BrokerFixture {
- ConnectionType connection;
- qpid::client::Session session;
- qpid::client::SubscriptionManager subs;
- qpid::client::LocalQueue lq;
-
- SessionFixtureT() : connection(broker->getPort()),
- session(connection.newSession(qpid::client::ASYNC)),
- subs(session)
- {}
-
- ~SessionFixtureT() {
- connection.close();
- }
-};
-
-typedef SessionFixtureT<LocalConnection> SessionFixture;
-typedef SessionFixtureT<ProxyConnection> ProxySessionFixture;
-
-
-#endif /*!TESTS_BROKERFIXTURE_H*/
diff --git a/qpid/cpp/src/tests/ClientChannelTest.cpp b/qpid/cpp/src/tests/ClientChannelTest.cpp
deleted file mode 100644
index 605d5e4885..0000000000
--- a/qpid/cpp/src/tests/ClientChannelTest.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <vector>
-#include "qpid_test_plugin.h"
-#include "BrokerFixture.h"
-#include "qpid/client/Channel.h"
-#include "qpid/client/Message.h"
-#include "qpid/client/Queue.h"
-#include "qpid/client/Exchange.h"
-#include "qpid/client/MessageListener.h"
-#include "qpid/client/BasicMessageChannel.h"
-#include "qpid/client/MessageMessageChannel.h"
-
-using namespace std;
-using namespace boost;
-using namespace qpid::client;
-using namespace qpid::sys;
-using namespace qpid::framing;
-
-/// Small frame size so we can create fragmented messages.
-const size_t FRAME_MAX = 256;
-
-
-/**
- * Test base for client API using an in-process broker.
- * The test base defines the tests methods, derived classes
- * instantiate the channel in Basic or Message mode.
- */
-class ChannelTestBase : public CppUnit::TestCase, public SessionFixture
-{
- struct Listener: public qpid::client::MessageListener {
- vector<Message> messages;
- Monitor monitor;
- void received(Message& msg) {
- Mutex::ScopedLock l(monitor);
- messages.push_back(msg);
- monitor.notifyAll();
- }
- };
-
- const std::string qname;
- const std::string data;
- Queue queue;
- Exchange exchange;
- Listener listener;
-
- protected:
- boost::scoped_ptr<Channel> channel;
-
- public:
-
- ChannelTestBase()
- : qname("testq"), data("hello"),
- queue(qname, true), exchange("", Exchange::DIRECT_EXCHANGE)
- {}
-
- void setUp() {
- CPPUNIT_ASSERT(channel);
- connection.openChannel(*channel);
- CPPUNIT_ASSERT(channel->getId() != 0);
- channel->declareQueue(queue);
- }
-
- void testPublishGet() {
- Message pubMsg(data);
- pubMsg.getHeaders().setString("hello", "world");
- channel->publish(pubMsg, exchange, qname);
- Message getMsg;
- CPPUNIT_ASSERT(channel->get(getMsg, queue));
- CPPUNIT_ASSERT_EQUAL(data, getMsg.getData());
- CPPUNIT_ASSERT_EQUAL(string("world"),
- getMsg.getHeaders().getString("hello"));
- CPPUNIT_ASSERT(!channel->get(getMsg, queue)); // Empty queue
- }
-
- void testGetNoContent() {
- Message pubMsg;
- pubMsg.getHeaders().setString("hello", "world");
- channel->publish(pubMsg, exchange, qname);
- Message getMsg;
- CPPUNIT_ASSERT(channel->get(getMsg, queue));
- CPPUNIT_ASSERT(getMsg.getData().empty());
- CPPUNIT_ASSERT_EQUAL(string("world"),
- getMsg.getHeaders().getString("hello"));
- }
-
- void testConsumeCancel() {
- string tag; // Broker assigned
- channel->consume(queue, tag, &listener);
- channel->start();
- CPPUNIT_ASSERT_EQUAL(size_t(0), listener.messages.size());
- channel->publish(Message("a"), exchange, qname);
- {
- Mutex::ScopedLock l(listener.monitor);
- Time deadline(now() + 1*TIME_SEC);
- while (listener.messages.size() != 1) {
- CPPUNIT_ASSERT(listener.monitor.wait(deadline));
- }
- }
- CPPUNIT_ASSERT_EQUAL(size_t(1), listener.messages.size());
- CPPUNIT_ASSERT_EQUAL(string("a"), listener.messages[0].getData());
-
- channel->publish(Message("b"), exchange, qname);
- channel->publish(Message("c"), exchange, qname);
- {
- Mutex::ScopedLock l(listener.monitor);
- while (listener.messages.size() != 3) {
- CPPUNIT_ASSERT(listener.monitor.wait(1*TIME_SEC));
- }
- }
- CPPUNIT_ASSERT_EQUAL(size_t(3), listener.messages.size());
- CPPUNIT_ASSERT_EQUAL(string("b"), listener.messages[1].getData());
- CPPUNIT_ASSERT_EQUAL(string("c"), listener.messages[2].getData());
-
- channel->cancel(tag);
- channel->publish(Message("d"), exchange, qname);
- CPPUNIT_ASSERT_EQUAL(size_t(3), listener.messages.size());
- {
- Mutex::ScopedLock l(listener.monitor);
- CPPUNIT_ASSERT(!listener.monitor.wait(TIME_SEC/2));
- }
- Message msg;
- CPPUNIT_ASSERT(channel->get(msg, queue));
- CPPUNIT_ASSERT_EQUAL(string("d"), msg.getData());
- }
-
- // Consume already-published messages
- void testConsumePublished() {
- Message pubMsg("x");
- pubMsg.getHeaders().setString("y", "z");
- channel->publish(pubMsg, exchange, qname);
- string tag;
- channel->consume(queue, tag, &listener);
- CPPUNIT_ASSERT_EQUAL(size_t(0), listener.messages.size());
- channel->start();
- {
- Mutex::ScopedLock l(listener.monitor);
- while (listener.messages.size() != 1)
- CPPUNIT_ASSERT(listener.monitor.wait(1*TIME_SEC));
- }
- CPPUNIT_ASSERT_EQUAL(string("x"), listener.messages[0].getData());
- CPPUNIT_ASSERT_EQUAL(string("z"),
- listener.messages[0].getHeaders().getString("y"));
- }
-
- void testGetFragmentedMessage() {
- string longStr(FRAME_MAX*2, 'x'); // Longer than max frame size.
- channel->publish(Message(longStr), exchange, qname);
- Message getMsg;
- CPPUNIT_ASSERT(channel->get(getMsg, queue));
- }
-
- void testConsumeFragmentedMessage() {
- string xx(FRAME_MAX*2, 'x');
- channel->publish(Message(xx), exchange, qname);
- channel->start();
- string tag;
- channel->consume(queue, tag, &listener);
- string yy(FRAME_MAX*2, 'y');
- channel->publish(Message(yy), exchange, qname);
- {
- Mutex::ScopedLock l(listener.monitor);
- while (listener.messages.size() != 2)
- CPPUNIT_ASSERT(listener.monitor.wait(1*TIME_SEC));
- }
- CPPUNIT_ASSERT_EQUAL(xx, listener.messages[0].getData());
- CPPUNIT_ASSERT_EQUAL(yy, listener.messages[1].getData());
- }
-};
-
-class BasicChannelTest : public ChannelTestBase {
- CPPUNIT_TEST_SUITE(BasicChannelTest);
- CPPUNIT_TEST(testPublishGet);
- CPPUNIT_TEST(testGetNoContent);
- CPPUNIT_TEST(testConsumeCancel);
- CPPUNIT_TEST(testConsumePublished);
- CPPUNIT_TEST(testGetFragmentedMessage);
- CPPUNIT_TEST(testConsumeFragmentedMessage);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- BasicChannelTest(){
- channel.reset(new Channel(false, 500, Channel::AMQP_08));
- }
-};
-
-class MessageChannelTest : public ChannelTestBase {
- CPPUNIT_TEST_SUITE(MessageChannelTest);
- CPPUNIT_TEST(testPublishGet);
- CPPUNIT_TEST(testGetNoContent);
- CPPUNIT_TEST(testGetFragmentedMessage);
- CPPUNIT_TEST_SUITE_END();
- public:
- MessageChannelTest() {
- channel.reset(new Channel(false, 500, Channel::AMQP_09));
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(BasicChannelTest);
-CPPUNIT_TEST_SUITE_REGISTRATION(MessageChannelTest);
diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp
deleted file mode 100644
index 7a997db327..0000000000
--- a/qpid/cpp/src/tests/ClientSessionTest.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "unit_test.h"
-#include "BrokerFixture.h"
-#include "qpid/client/Dispatcher.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/client/Session.h"
-#include "qpid/framing/TransferContent.h"
-#include "qpid/framing/reply_exceptions.h"
-
-#include <boost/optional.hpp>
-#include <boost/lexical_cast.hpp>
-
-#include <vector>
-
-QPID_AUTO_TEST_SUITE(ClientSessionTest)
-
-using namespace qpid::client;
-using namespace qpid::client::arg;
-using namespace qpid::framing;
-using namespace qpid;
-using qpid::sys::Monitor;
-using std::string;
-using std::cout;
-using std::endl;
-using namespace boost;
-
-
-struct DummyListener : public sys::Runnable, public MessageListener {
- std::vector<Message> messages;
- string name;
- uint expected;
- Dispatcher dispatcher;
-
- DummyListener(Session& session, const string& n, uint ex) :
- name(n), expected(ex), dispatcher(session) {}
-
- void run()
- {
- dispatcher.listen(name, this);
- dispatcher.run();
- }
-
- void received(Message& msg)
- {
- messages.push_back(msg);
- if (--expected == 0)
- dispatcher.stop();
- }
-};
-
-struct SimpleListener : public MessageListener
-{
- Monitor lock;
- std::vector<Message> messages;
-
- void received(Message& msg)
- {
- Monitor::ScopedLock l(lock);
- messages.push_back(msg);
- lock.notifyAll();
- }
-
- void waitFor(const uint n)
- {
- Monitor::ScopedLock l(lock);
- while (messages.size() < n) {
- lock.wait();
- }
- }
-};
-
-struct ClientSessionFixture : public ProxySessionFixture
-{
- void declareSubscribe(const string& q="my-queue",
- const string& dest="my-dest")
- {
- session.queueDeclare(queue=q);
- session.messageSubscribe(queue=q, destination=dest, acquireMode=1);
- session.messageFlow(destination=dest, unit=0, value=0xFFFFFFFF);//messages
- session.messageFlow(destination=dest, unit=1, value=0xFFFFFFFF);//bytes
- }
-};
-
-BOOST_FIXTURE_TEST_CASE(testQueueQuery, ClientSessionFixture) {
- session =connection.newSession(ASYNC);
- session.queueDeclare(queue="my-queue", alternateExchange="amq.fanout", exclusive=true, autoDelete=true);
- TypedResult<QueueQueryResult> result = session.queueQuery(string("my-queue"));
- BOOST_CHECK_EQUAL(false, result.get().getDurable());
- BOOST_CHECK_EQUAL(true, result.get().getExclusive());
- BOOST_CHECK_EQUAL(string("amq.fanout"),
- result.get().getAlternateExchange());
-}
-
-BOOST_FIXTURE_TEST_CASE(testTransfer, ClientSessionFixture)
-{
- session=connection.newSession(ASYNC);
- declareSubscribe();
- session.messageTransfer(content=TransferContent("my-message", "my-queue"));
- //get & test the message:
- FrameSet::shared_ptr msg = session.get();
- BOOST_CHECK(msg->isA<MessageTransferBody>());
- BOOST_CHECK_EQUAL(string("my-message"), msg->getContent());
- //confirm receipt:
- session.getExecution().completed(msg->getId(), true, true);
-}
-
-BOOST_FIXTURE_TEST_CASE(testDispatcher, ClientSessionFixture)
-{
- session =connection.newSession(ASYNC);
- declareSubscribe();
- size_t count = 100;
- for (size_t i = 0; i < count; ++i)
- session.messageTransfer(content=TransferContent(lexical_cast<string>(i), "my-queue"));
- DummyListener listener(session, "my-dest", count);
- listener.run();
- BOOST_REQUIRE_EQUAL(count, listener.messages.size());
- for (size_t i = 0; i < count; ++i)
- BOOST_CHECK_EQUAL(lexical_cast<string>(i), listener.messages[i].getData());
-}
-
-/* FIXME aconway 2008-01-28: hangs
-BOOST_FIXTURE_TEST_CASE(testDispatcherThread, ClientSessionFixture)
-{
- session =connection.newSession(ASYNC);
- declareSubscribe();
- size_t count = 10000;
- DummyListener listener(session, "my-dest", count);
- sys::Thread t(listener);
- for (size_t i = 0; i < count; ++i) {
- session.messageTransfer(content=TransferContent(lexical_cast<string>(i), "my-queue"));
- if (i%100 == 0) cout << "T" << i << std::flush;
- }
- t.join();
- BOOST_REQUIRE_EQUAL(count, listener.messages.size());
- for (size_t i = 0; i < count; ++i)
- BOOST_CHECK_EQUAL(lexical_cast<string>(i), listener.messages[i].getData());
-}
-*/
-
-BOOST_FIXTURE_TEST_CASE(_FIXTURE, ClientSessionFixture)
-{
- session =connection.newSession(ASYNC, 0);
- session.suspend(); // session has 0 timeout.
- try {
- connection.resume(session);
- BOOST_FAIL("Expected InvalidArgumentException.");
- } catch(const InternalErrorException&) {}
-}
-
-BOOST_FIXTURE_TEST_CASE(testUseSuspendedError, ClientSessionFixture)
-{
- session =connection.newSession(ASYNC, 60);
- session.suspend();
- try {
- session.exchangeQuery(name="amq.fanout");
- BOOST_FAIL("Expected session suspended exception");
- } catch(const CommandInvalidException&) {}
-}
-
-BOOST_FIXTURE_TEST_CASE(testSuspendResume, ClientSessionFixture)
-{
- session =connection.newSession(ASYNC, 60);
- declareSubscribe();
- session.suspend();
- // Make sure we are still subscribed after resume.
- connection.resume(session);
- session.messageTransfer(content=TransferContent("my-message", "my-queue"));
- FrameSet::shared_ptr msg = session.get();
- BOOST_CHECK_EQUAL(string("my-message"), msg->getContent());
-}
-
-/**
- * Currently broken due to a deadlock in SessionCore
- *
-BOOST_FIXTURE_TEST_CASE(testSendToSelf, SessionFixture) {
- // Deadlock if SubscriptionManager run() concurrent with session ack.
- SimpleListener mylistener;
- session.queueDeclare(queue="myq", exclusive=true, autoDelete=true);
- subs.subscribe(mylistener, "myq", "myq");
- sys::Thread runner(subs);//start dispatcher thread
- string data("msg");
- Message msg(data, "myq");
- const uint count=10000;
- for (uint i = 0; i < count; ++i) {
- session.messageTransfer(content=msg);
- }
- mylistener.waitFor(count);
- subs.cancel("myq");
- subs.stop();
- session.close();
- BOOST_CHECK_EQUAL(mylistener.messages.size(), count);
- for (uint j = 0; j < count; ++j) {
- BOOST_CHECK_EQUAL(mylistener.messages[j].getData(), data);
- }
-}
-*/
-
-QPID_AUTO_TEST_SUITE_END()
-
diff --git a/qpid/cpp/src/tests/ConcurrentQueue.cpp b/qpid/cpp/src/tests/ConcurrentQueue.cpp
deleted file mode 100644
index c6ca40e897..0000000000
--- a/qpid/cpp/src/tests/ConcurrentQueue.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/**@file
- * Compare alternative implementations for BlockingQueue.
- */
-
-#include "qpid/sys/BlockingQueue.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Time.h"
-
-#include <boost/test/test_tools.hpp>
-#include <boost/bind.hpp>
-
-#include <deque>
-#include <vector>
-#include <iostream>
-
-#include "time.h"
-
-using namespace qpid::sys;
-using namespace std;
-
-template <class T> class DualVectorDualLockQueue {
- public:
- /** Optionally specify initial capacity of the queue to minimize
- * re-allocation.
- */
- DualVectorDualLockQueue(size_t capacity=16) {
- pushVec.reserve(capacity);
- popVec.reserve(capacity);
- popIter = popVec.end();
- }
-
- /** Push a data item onto the back of the queue */
- void push(const T& data) {
- Mutex::ScopedLock l(pushLock);
- pushVec.push_back(data);
- }
-
- /** If the queue is non-empty, pop the front item into data and
- * return true. If the queue is empty, return false
- */
- bool tryPop(T& data) {
- Mutex::ScopedLock l(popLock);
- if (popIter == popVec.end()) {
- popVec.clear();
- Mutex::ScopedLock l(pushLock);
- pushVec.swap(popVec);
- popIter = popVec.begin();
- }
- if (popIter == popVec.end())
- return false;
- else {
- data = *popIter++;
- return true;
- }
- }
-
- private:
- Mutex pushLock, popLock;
- std::vector<T> pushVec, popVec;
- typename std::vector<T>::iterator popIter;
-};
-
-template <class T> struct LockedDequeQueue : public BlockingQueue<T> {
- /** size_t ignored, can't pre-allocate space in a dequeue */
- LockedDequeQueue(size_t=0) {};
-};
-
-// ================ Test code.
-
-/** Pause by sleeping */
-void nsleep(const Duration& delay) {
- static Monitor m;
- AbsTime stop(now(), delay);
- while (now() < stop)
- m.wait(stop);
-}
-
-/** Pause by spinning */
-void nspin(const Duration& delay) {
- AbsTime stop(now(), delay);
- while (now() < stop)
- ;
-}
-
-/** Unlocked fake queue for comparison */
-struct NullQueue {
- NullQueue(int items=0) : npush(items), npop(items) {}
- void push(int) { --npush; }
- bool tryPop(int& n) {
- if (npop == 0)
- return false;
- else {
- n=npop--;
- return true;
- }
- }
- volatile int npush, npop;
-};
-
-
-// Global test parameters.
-int items;
-Duration delay(0);
-boost::function<void()> npause;
-
-template <class Q>
-struct Pusher : public Runnable {
- Pusher(Q& q) : queue(q) {}
- void run() {
- for (int i=items; i > 0; i--) {
- queue.push(i);
- npause();
- }
- }
- Q& queue;
-};
-
-template <class Q>
-struct Popper : public Runnable {
- Popper(Q& q) : queue(q) {}
- void run() {
- for (int i=items; i > 0; i--) {
- int n;
- if (queue.tryPop(n))
- BOOST_REQUIRE_EQUAL(i,n);
- npause();
- }
- }
- Q& queue;
-};
-
-ostream& operator<<(ostream& out, const Duration& d) {
- return out << double(d)/TIME_MSEC << " msecs";
-}
-
-void report(const char* s, const Duration &d) {
- cout << s << ": " << d
- << " (" << (double(items)*TIME_SEC)/d << " push-pops/sec" << ")"
- << endl;
-}
-
-template <class Q, class PusherT=Pusher<Q>, class PopperT=Popper<Q> >
-struct Timer {
- static Duration time() {
- cout << endl << "==" << typeid(Q).name() << endl;
-
- Q queue(items);
- PusherT pusher(queue);
- PopperT popper(queue);
-
- // Serial
- AbsTime start=now();
- pusher.run();
- popper.run();
- Duration serial(start,now());
- report ("Serial", serial);
-
- // Concurrent
- start=now();
- Thread pushThread(pusher);
- Thread popThread(popper);
- pushThread.join();
- popThread.join();
- Duration concurrent(start,now());
- report ("Concurrent", concurrent);
-
- cout << "Serial/concurrent: " << double(serial)/concurrent << endl;
- return concurrent;
- }
-};
-
-int test_main(int argc, char** argv) {
- items = (argc > 1) ? atoi(argv[1]) : 250*1000;
- delay = (argc > 2) ? atoi(argv[2]) : 4*1000;
- npause=boost::bind(nspin, delay);
-
- cout << "Push/pop " << items << " items, delay=" << delay << endl;
- Timer<NullQueue>::time();
- Duration dv = Timer<DualVectorDualLockQueue<int> >::time();
- Duration d = Timer<LockedDequeQueue<int> >::time();
- cout << endl;
- cout << "Ratio deque/dual vector=" << double(d)/dv << endl;
- return 0;
-}
-// namespace
diff --git a/qpid/cpp/src/tests/Cpg.cpp b/qpid/cpp/src/tests/Cpg.cpp
deleted file mode 100644
index e8339bf773..0000000000
--- a/qpid/cpp/src/tests/Cpg.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-#include "test_tools.h"
-#include "qpid/cluster/Cpg.h"
-#include "qpid/framing/AMQBody.h"
-
-#include <boost/bind.hpp>
-#include "unit_test.h"
-
-#include <string>
-#include <iostream>
-#include <iterator>
-#include <vector>
-#include <algorithm>
-
-QPID_AUTO_TEST_SUITE(CpgTestSuite)
-
-
-using namespace std;
-using namespace qpid::cluster;
-using namespace qpid::framing;
-
-// For debugging: op << for CPG types.
-
-ostream& operator<<(ostream& o, const cpg_name* n) {
- return o << qpid::cluster::Cpg::str(*n);
-}
-
-ostream& operator<<(ostream& o, const cpg_address& a) {
- return o << "(" << a.nodeid <<","<<a.pid<<","<<a.reason<<")";
-}
-
-template <class T>
-ostream& operator<<(ostream& o, const pair<T*, int>& array) {
- o << "{ ";
- ostream_iterator<cpg_address> i(o, " ");
- copy(array.first, array.first+array.second, i);
- o << "}";
- return o;
-}
-
-struct Callback : public Cpg::Handler {
- Callback(const string group_) : group(group_) {}
- string group;
- vector<string> delivered;
- vector<int> configChanges;
-
- void deliver (
- cpg_handle_t /*handle*/,
- struct cpg_name *grp,
- uint32_t /*nodeid*/,
- uint32_t /*pid*/,
- void* msg,
- int msg_len)
- {
- BOOST_CHECK_EQUAL(group, Cpg::str(*grp));
- delivered.push_back(string((char*)msg,msg_len));
- }
-
- void configChange(
- cpg_handle_t /*handle*/,
- struct cpg_name *grp,
- struct cpg_address */*members*/, int nMembers,
- struct cpg_address */*left*/, int nLeft,
- struct cpg_address */*joined*/, int nJoined
- )
- {
- BOOST_CHECK_EQUAL(group, Cpg::str(*grp));
- configChanges.push_back(nMembers);
- BOOST_MESSAGE("configChange: "<<
- nLeft<<" left "<<
- nJoined<<" joined "<<
- nMembers<<" members.");
- }
-};
-
-BOOST_AUTO_TEST_CASE(CpgBasic) {
- // Verify basic functionality of cpg. This will catch any
- // openais configuration or permission errors.
- //
- Cpg::Name group("CpgBasic");
- Callback cb(group.str());
- Cpg cpg(cb);
- cpg.join(group);
- iovec iov = { (void*)"Hello!", 6 };
- cpg.mcast(group, &iov, 1);
- cpg.leave(group);
- cpg.dispatchSome();
-
- BOOST_REQUIRE_EQUAL(1u, cb.delivered.size());
- BOOST_CHECK_EQUAL("Hello!", cb.delivered.front());
- BOOST_REQUIRE_EQUAL(2u, cb.configChanges.size());
- BOOST_CHECK_EQUAL(1, cb.configChanges[0]);
- BOOST_CHECK_EQUAL(0, cb.configChanges[1]);
-}
-
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/DeliveryRecordTest.cpp b/qpid/cpp/src/tests/DeliveryRecordTest.cpp
deleted file mode 100644
index 9487f743d6..0000000000
--- a/qpid/cpp/src/tests/DeliveryRecordTest.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/broker/DeliveryRecord.h"
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include <memory>
-#include <boost/format.hpp>
-
-using namespace qpid::broker;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using boost::dynamic_pointer_cast;
-using std::list;
-
-class DeliveryRecordTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(DeliveryRecordTest);
- CPPUNIT_TEST(testSort);
- CPPUNIT_TEST_SUITE_END();
-
-public:
-
- void testSort()
- {
- list<SequenceNumber> ids;
- ids.push_back(SequenceNumber(6));
- ids.push_back(SequenceNumber(2));
- ids.push_back(SequenceNumber(4));
- ids.push_back(SequenceNumber(5));
- ids.push_back(SequenceNumber(1));
- ids.push_back(SequenceNumber(3));
-
- list<DeliveryRecord> records;
- for (list<SequenceNumber>::iterator i = ids.begin(); i != ids.end(); i++) {
- records.push_back(DeliveryRecord(QueuedMessage(0), Queue::shared_ptr(), "tag", DeliveryToken::shared_ptr(), *i, false, false));
- }
- records.sort();
-
- SequenceNumber expected(0);
- for (list<DeliveryRecord>::iterator i = records.begin(); i != records.end(); i++) {
- CPPUNIT_ASSERT(i->matches(++expected));
- }
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(DeliveryRecordTest);
-
diff --git a/qpid/cpp/src/tests/DispatcherTest.cpp b/qpid/cpp/src/tests/DispatcherTest.cpp
deleted file mode 100644
index 7631956acc..0000000000
--- a/qpid/cpp/src/tests/DispatcherTest.cpp
+++ /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.
- *
- */
-
-#include "qpid/sys/Poller.h"
-#include "qpid/sys/Dispatcher.h"
-#include "qpid/sys/Thread.h"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <iostream>
-#include <boost/bind.hpp>
-
-using namespace std;
-using namespace qpid::sys;
-
-int writeALot(int fd, const string& s) {
- int bytesWritten = 0;
- do {
- errno = 0;
- int lastWrite = ::write(fd, s.c_str(), s.size());
- if ( lastWrite >= 0) {
- bytesWritten += lastWrite;
- }
- } while (errno != EAGAIN);
- return bytesWritten;
-}
-
-int readALot(int fd) {
- int bytesRead = 0;
- char buf[10240];
-
- do {
- errno = 0;
- int lastRead = ::read(fd, buf, sizeof(buf));
- if ( lastRead >= 0) {
- bytesRead += lastRead;
- }
- } while (errno != EAGAIN);
- return bytesRead;
-}
-
-int64_t writtenBytes = 0;
-int64_t readBytes = 0;
-
-void writer(DispatchHandle& h, int fd, const string& s) {
- writtenBytes += writeALot(fd, s);
- h.rewatch();
-}
-
-void reader(DispatchHandle& h, int fd) {
- readBytes += readALot(fd);
- h.rewatch();
-}
-
-int main(int argc, char** argv)
-{
- // Create poller
- Poller::shared_ptr poller(new Poller);
-
- // Create dispatcher thread
- Dispatcher d(poller);
- Dispatcher d1(poller);
- //Dispatcher d2(poller);
- //Dispatcher d3(poller);
- Thread dt(d);
- Thread dt1(d1);
- //Thread dt2(d2);
- //Thread dt3(d3);
-
- // Setup sender and receiver
- int sv[2];
- int rc = ::socketpair(AF_LOCAL, SOCK_STREAM, 0, sv);
- assert(rc >= 0);
-
- // Set non-blocking
- rc = ::fcntl(sv[0], F_SETFL, O_NONBLOCK);
- assert(rc >= 0);
-
- rc = ::fcntl(sv[1], F_SETFL, O_NONBLOCK);
- assert(rc >= 0);
-
- // Make up a large string
- string testString = "This is only a test ... 1,2,3,4,5,6,7,8,9,10;";
- for (int i = 0; i < 8; i++)
- testString += testString;
-
- DispatchHandle rh(sv[0], boost::bind(reader, _1, sv[0]), 0);
- DispatchHandle wh(sv[1], 0, boost::bind(writer, _1, sv[1], testString));
-
- rh.watch(poller);
- wh.watch(poller);
-
- // wait 2 minutes then shutdown
- sleep(60);
-
- poller->shutdown();
- dt.join();
- dt1.join();
- //dt2.join();
- //dt3.join();
-
- cout << "Wrote: " << writtenBytes << "\n";
- cout << "Read: " << readBytes << "\n";
-
- return 0;
-}
diff --git a/qpid/cpp/src/tests/DtxWorkRecordTest.cpp b/qpid/cpp/src/tests/DtxWorkRecordTest.cpp
deleted file mode 100644
index d7d151f8d6..0000000000
--- a/qpid/cpp/src/tests/DtxWorkRecordTest.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/broker/DtxWorkRecord.h"
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include <vector>
-#include "TxMocks.h"
-
-using namespace qpid::broker;
-using boost::static_pointer_cast;
-
-class DtxWorkRecordTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(DtxWorkRecordTest);
- CPPUNIT_TEST(testOnePhaseCommit);
- CPPUNIT_TEST(testFailOnOnePhaseCommit);
- CPPUNIT_TEST(testTwoPhaseCommit);
- CPPUNIT_TEST(testFailOnTwoPhaseCommit);
- CPPUNIT_TEST(testRollback);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testOnePhaseCommit(){
- MockTransactionalStore store;
- store.expectBegin().expectCommit();
-
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare().expectCommit();
- MockTxOp::shared_ptr opB(new MockTxOp());
- opB->expectPrepare().expectCommit();
-
- DtxBuffer::shared_ptr bufferA(new DtxBuffer());
- bufferA->enlist(static_pointer_cast<TxOp>(opA));
- bufferA->markEnded();
- DtxBuffer::shared_ptr bufferB(new DtxBuffer());
- bufferB->enlist(static_pointer_cast<TxOp>(opB));
- bufferB->markEnded();
-
- DtxWorkRecord work("my-xid", &store);
- work.add(bufferA);
- work.add(bufferB);
-
- work.commit(true);
-
- store.check();
- CPPUNIT_ASSERT(store.isCommitted());
- opA->check();
- opB->check();
- }
-
- void testFailOnOnePhaseCommit(){
- MockTransactionalStore store;
- store.expectBegin().expectAbort();
-
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare().expectRollback();
- MockTxOp::shared_ptr opB(new MockTxOp(true));
- opB->expectPrepare().expectRollback();
- MockTxOp::shared_ptr opC(new MockTxOp());
- opC->expectRollback();
-
- DtxBuffer::shared_ptr bufferA(new DtxBuffer());
- bufferA->enlist(static_pointer_cast<TxOp>(opA));
- bufferA->markEnded();
- DtxBuffer::shared_ptr bufferB(new DtxBuffer());
- bufferB->enlist(static_pointer_cast<TxOp>(opB));
- bufferB->markEnded();
- DtxBuffer::shared_ptr bufferC(new DtxBuffer());
- bufferC->enlist(static_pointer_cast<TxOp>(opC));
- bufferC->markEnded();
-
- DtxWorkRecord work("my-xid", &store);
- work.add(bufferA);
- work.add(bufferB);
- work.add(bufferC);
-
- work.commit(true);
-
- CPPUNIT_ASSERT(store.isAborted());
- store.check();
-
- opA->check();
- opB->check();
- opC->check();
- }
-
- void testTwoPhaseCommit(){
- MockTransactionalStore store;
- store.expectBegin2PC().expectPrepare().expectCommit();
-
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare().expectCommit();
- MockTxOp::shared_ptr opB(new MockTxOp());
- opB->expectPrepare().expectCommit();
-
- DtxBuffer::shared_ptr bufferA(new DtxBuffer());
- bufferA->enlist(static_pointer_cast<TxOp>(opA));
- bufferA->markEnded();
- DtxBuffer::shared_ptr bufferB(new DtxBuffer());
- bufferB->enlist(static_pointer_cast<TxOp>(opB));
- bufferB->markEnded();
-
- DtxWorkRecord work("my-xid", &store);
- work.add(bufferA);
- work.add(bufferB);
-
- CPPUNIT_ASSERT(work.prepare());
- CPPUNIT_ASSERT(store.isPrepared());
- work.commit(false);
- store.check();
- CPPUNIT_ASSERT(store.isCommitted());
- opA->check();
- opB->check();
- }
-
- void testFailOnTwoPhaseCommit(){
- MockTransactionalStore store;
- store.expectBegin2PC().expectAbort();
-
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare().expectRollback();
- MockTxOp::shared_ptr opB(new MockTxOp(true));
- opB->expectPrepare().expectRollback();
- MockTxOp::shared_ptr opC(new MockTxOp());
- opC->expectRollback();
-
- DtxBuffer::shared_ptr bufferA(new DtxBuffer());
- bufferA->enlist(static_pointer_cast<TxOp>(opA));
- bufferA->markEnded();
- DtxBuffer::shared_ptr bufferB(new DtxBuffer());
- bufferB->enlist(static_pointer_cast<TxOp>(opB));
- bufferB->markEnded();
- DtxBuffer::shared_ptr bufferC(new DtxBuffer());
- bufferC->enlist(static_pointer_cast<TxOp>(opC));
- bufferC->markEnded();
-
- DtxWorkRecord work("my-xid", &store);
- work.add(bufferA);
- work.add(bufferB);
- work.add(bufferC);
-
- CPPUNIT_ASSERT(!work.prepare());
- CPPUNIT_ASSERT(store.isAborted());
- store.check();
- opA->check();
- opB->check();
- opC->check();
- }
-
- void testRollback(){
- MockTransactionalStore store;
- store.expectBegin2PC().expectPrepare().expectAbort();
-
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare().expectRollback();
- MockTxOp::shared_ptr opB(new MockTxOp());
- opB->expectPrepare().expectRollback();
-
- DtxBuffer::shared_ptr bufferA(new DtxBuffer());
- bufferA->enlist(static_pointer_cast<TxOp>(opA));
- bufferA->markEnded();
- DtxBuffer::shared_ptr bufferB(new DtxBuffer());
- bufferB->enlist(static_pointer_cast<TxOp>(opB));
- bufferB->markEnded();
-
- DtxWorkRecord work("my-xid", &store);
- work.add(bufferA);
- work.add(bufferB);
-
- CPPUNIT_ASSERT(work.prepare());
- CPPUNIT_ASSERT(store.isPrepared());
- work.rollback();
- store.check();
- CPPUNIT_ASSERT(store.isAborted());
- opA->check();
- opB->check();
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(DtxWorkRecordTest);
-
diff --git a/qpid/cpp/src/tests/EventChannelTest.cpp b/qpid/cpp/src/tests/EventChannelTest.cpp
deleted file mode 100644
index 6d8d64e165..0000000000
--- a/qpid/cpp/src/tests/EventChannelTest.cpp
+++ /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.
- *
- */
-#include "qpid/sys/posix/EventChannel.h"
-#include "qpid/sys/posix/check.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Socket.h"
-#include "qpid/sys/Thread.h"
-#include "qpid_test_plugin.h"
-
-#include <sys/socket.h>
-#include <signal.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <iostream>
-
-using namespace qpid::sys;
-
-
-const char hello[] = "hello";
-const size_t size = sizeof(hello);
-
-struct RunMe : public Runnable
-{
- bool ran;
- RunMe() : ran(false) {}
- void run() { ran = true; }
-};
-
-class EventChannelTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(EventChannelTest);
- CPPUNIT_TEST(testEvent);
- CPPUNIT_TEST(testRead);
- CPPUNIT_TEST(testFailedRead);
- CPPUNIT_TEST(testWrite);
- CPPUNIT_TEST(testFailedWrite);
- CPPUNIT_TEST(testReadWrite);
- CPPUNIT_TEST(testAccept);
- CPPUNIT_TEST_SUITE_END();
-
- private:
- EventChannel::shared_ptr ec;
- int pipe[2];
- char readBuf[size];
-
- public:
-
- void setUp()
- {
- memset(readBuf, size, 0);
- ec = EventChannel::create();
- if (::pipe(pipe) != 0) throw QPID_POSIX_ERROR(errno);
- // Ignore SIGPIPE, otherwise we will crash writing to broken pipe.
- signal(SIGPIPE, SIG_IGN);
- }
-
- // Verify that calling getEvent returns event.
- template <class T> bool isNextEvent(T& event)
- {
- return &event == dynamic_cast<T*>(ec->getEvent());
- }
-
- template <class T> bool isNextEventOk(T& event)
- {
- Event* next = ec->getEvent();
- if (next) next->throwIfError();
- return &event == next;
- }
-
- void testEvent()
- {
- RunMe runMe;
- CPPUNIT_ASSERT(!runMe.ran);
- // Instances of Event just pass thru the channel immediately.
- Event e(runMe.functor());
- ec->postEvent(e);
- CPPUNIT_ASSERT(isNextEventOk(e));
- e.dispatch();
- CPPUNIT_ASSERT(runMe.ran);
- }
-
- void testRead() {
- ReadEvent re(pipe[0], readBuf, size);
- ec->postEvent(re);
- CPPUNIT_ASSERT_EQUAL(ssize_t(size), ::write(pipe[1], hello, size));
- CPPUNIT_ASSERT(isNextEventOk(re));
- CPPUNIT_ASSERT_EQUAL(size, re.getSize());
- CPPUNIT_ASSERT_EQUAL(std::string(hello), std::string(readBuf));
- }
-
- void testFailedRead()
- {
- ReadEvent re(pipe[0], readBuf, size);
- ec->postEvent(re);
-
- // EOF before all data read.
- ::close(pipe[1]);
- CPPUNIT_ASSERT(isNextEvent(re));
- CPPUNIT_ASSERT(re.hasError());
- try {
- re.throwIfError();
- CPPUNIT_FAIL("Expected Exception.");
- }
- catch (const qpid::Exception&) { }
-
- // Bad file descriptor. Note in this case we fail
- // in postEvent and throw immediately.
- try {
- ReadEvent bad;
- ec->postEvent(bad);
- CPPUNIT_FAIL("Expected Exception.");
- }
- catch (const qpid::Exception&) { }
- }
-
- void testWrite() {
- WriteEvent wr(pipe[1], hello, size);
- ec->postEvent(wr);
- CPPUNIT_ASSERT(isNextEventOk(wr));
- CPPUNIT_ASSERT_EQUAL(ssize_t(size), ::read(pipe[0], readBuf, size));;
- CPPUNIT_ASSERT_EQUAL(std::string(hello), std::string(readBuf));
- }
-
- void testFailedWrite() {
- WriteEvent wr(pipe[1], hello, size);
- ::close(pipe[0]);
- ec->postEvent(wr);
- CPPUNIT_ASSERT(isNextEvent(wr));
- CPPUNIT_ASSERT(wr.hasError());
- }
-
- void testReadWrite()
- {
- ReadEvent re(pipe[0], readBuf, size);
- WriteEvent wr(pipe[1], hello, size);
- ec->postEvent(re);
- ec->postEvent(wr);
- ec->getEvent();
- ec->getEvent();
- CPPUNIT_ASSERT_EQUAL(std::string(hello), std::string(readBuf));
- }
-
- void testAccept() {
- Socket s = Socket::createTcp();
- int port = s.listen(0, 10);
- CPPUNIT_ASSERT(port != 0);
-
- AcceptEvent ae(s.fd());
- ec->postEvent(ae);
- Socket client = Socket::createTcp();
- client.connect("localhost", port);
- CPPUNIT_ASSERT(isNextEvent(ae));
- ae.dispatch();
-
- // Verify client writes are read by the accepted descriptor.
- char readBuf[size];
- ReadEvent re(ae.getAcceptedDesscriptor(), readBuf, size);
- ec->postEvent(re);
- CPPUNIT_ASSERT_EQUAL(ssize_t(size), client.send(hello, sizeof(hello)));
- CPPUNIT_ASSERT(isNextEvent(re));
- re.dispatch();
- CPPUNIT_ASSERT_EQUAL(std::string(hello), std::string(readBuf));
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(EventChannelTest);
-
diff --git a/qpid/cpp/src/tests/EventChannelThreadsTest.cpp b/qpid/cpp/src/tests/EventChannelThreadsTest.cpp
deleted file mode 100644
index 22ea57d675..0000000000
--- a/qpid/cpp/src/tests/EventChannelThreadsTest.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <iostream>
-#include <boost/bind.hpp>
-
-#include "qpid/sys/Socket.h"
-#include "qpid/sys/posix/EventChannelThreads.h"
-#include "qpid_test_plugin.h"
-
-
-using namespace std;
-
-using namespace qpid::sys;
-
-const int nConnections = 5;
-const int nMessages = 10; // Messages read/written per connection.
-
-
-// Accepts + reads + writes.
-const int totalEvents = nConnections+2*nConnections*nMessages;
-
-/**
- * Messages are numbered 0..nMessages.
- * We count the total number of events, and the
- * number of reads and writes for each message number.
- */
-class TestResults : public Monitor {
- public:
- TestResults() : isShutdown(false), nEventsRemaining(totalEvents) {}
-
- void countEvent() {
- if (--nEventsRemaining == 0)
- shutdown();
- }
-
- void countRead(int messageNo) {
- ++reads[messageNo];
- countEvent();
- }
-
- void countWrite(int messageNo) {
- ++writes[messageNo];
- countEvent();
- }
-
- void shutdown(const std::string& exceptionMsg = std::string()) {
- ScopedLock lock(*this);
- exception = exceptionMsg;
- isShutdown = true;
- notifyAll();
- }
-
- void wait() {
- ScopedLock lock(*this);
- Time deadline = now() + 10*TIME_SEC;
- while (!isShutdown) {
- CPPUNIT_ASSERT(Monitor::wait(deadline));
- }
- }
-
- bool isShutdown;
- std::string exception;
- AtomicCount reads[nMessages];
- AtomicCount writes[nMessages];
- AtomicCount nEventsRemaining;
-};
-
-TestResults results;
-
-EventChannelThreads::shared_ptr threads;
-
-// Functor to wrap callbacks in try/catch.
-class SafeCallback {
- public:
- SafeCallback(Runnable& r) : callback(r.functor()) {}
- SafeCallback(Event::Callback cb) : callback(cb) {}
-
- void operator()() {
- std::string exception;
- try {
- callback();
- return;
- }
- catch (const std::exception& e) {
- exception = e.what();
- }
- catch (...) {
- exception = "Unknown exception.";
- }
- results.shutdown(exception);
- }
-
- private:
- Event::Callback callback;
-};
-
-/** Repost an event N times. */
-class Repost {
- public:
- Repost(int n) : count (n) {}
- virtual ~Repost() {}
-
- void repost(Event* event) {
- if (--count==0) {
- delete event;
- } else {
- threads->postEvent(event);
- }
- }
- private:
- int count;
-};
-
-
-
-/** Repeating read event. */
-class TestReadEvent : public ReadEvent, public Runnable, private Repost {
- public:
- explicit TestReadEvent(int fd=-1) :
- ReadEvent(fd, &value, sizeof(value), SafeCallback(*this)),
- Repost(nMessages)
- {}
-
- void run() {
- CPPUNIT_ASSERT_EQUAL(sizeof(value), getSize());
- CPPUNIT_ASSERT(0 <= value);
- CPPUNIT_ASSERT(value < nMessages);
- results.countRead(value);
- repost(this);
- }
-
- private:
- int value;
- ReadEvent original;
-};
-
-
-/** Fire and forget write event */
-class TestWriteEvent : public WriteEvent, public Runnable, private Repost {
- public:
- TestWriteEvent(int fd=-1) :
- WriteEvent(fd, &value, sizeof(value), SafeCallback(*this)),
- Repost(nMessages),
- value(0)
- {}
-
- void run() {
- CPPUNIT_ASSERT_EQUAL(sizeof(int), getSize());
- results.countWrite(value++);
- repost(this);
- }
-
- private:
- int value;
-};
-
-/** Fire-and-forget Accept event, posts reads on the accepted connection. */
-class TestAcceptEvent : public AcceptEvent, public Runnable, private Repost {
- public:
- TestAcceptEvent(int fd=-1) :
- AcceptEvent(fd, SafeCallback(*this)),
- Repost(nConnections)
- {}
-
- void run() {
- threads->postEvent(new TestReadEvent(getAcceptedDesscriptor()));
- results.countEvent();
- repost(this);
- }
-};
-
-class EventChannelThreadsTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(EventChannelThreadsTest);
- CPPUNIT_TEST(testThreads);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void setUp() {
- threads = EventChannelThreads::create(EventChannel::create());
- }
-
- void tearDown() {
- threads.reset();
- }
-
- void testThreads()
- {
- Socket listener = Socket::createTcp();
- int port = listener.listen();
-
- // Post looping accept events, will repost nConnections times.
- // The accept event will automatically post read events.
- threads->postEvent(new TestAcceptEvent(listener.fd()));
-
- // Make connections.
- Socket connections[nConnections];
- for (int i = 0; i < nConnections; ++i) {
- connections[i] = Socket::createTcp();
- connections[i].connect("localhost", port);
- }
-
- // Post looping write events.
- for (int i = 0; i < nConnections; ++i) {
- threads->postEvent(new TestWriteEvent(connections[i].fd()));
- }
-
- // Wait for all events to be dispatched.
- results.wait();
-
- if (!results.exception.empty()) CPPUNIT_FAIL(results.exception);
- CPPUNIT_ASSERT_EQUAL(0, int(results.nEventsRemaining));
-
- // Expect a read and write for each messageNo from each connection.
- for (int messageNo = 0; messageNo < nMessages; ++messageNo) {
- CPPUNIT_ASSERT_EQUAL(nConnections, int(results.reads[messageNo]));
- CPPUNIT_ASSERT_EQUAL(nConnections, int(results.writes[messageNo]));
- }
-
- threads->shutdown();
- threads->join();
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(EventChannelThreadsTest);
-
diff --git a/qpid/cpp/src/tests/ExchangeTest.cpp b/qpid/cpp/src/tests/ExchangeTest.cpp
deleted file mode 100644
index d1eca203c6..0000000000
--- a/qpid/cpp/src/tests/ExchangeTest.cpp
+++ /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.
- *
- */
-
-#include "qpid/Exception.h"
-#include "qpid/broker/Exchange.h"
-#include "qpid/broker/Queue.h"
-#include "qpid/broker/DeliverableMessage.h"
-#include "qpid/broker/DirectExchange.h"
-#include "qpid/broker/ExchangeRegistry.h"
-#include "qpid/broker/FanOutExchange.h"
-#include "qpid/broker/HeadersExchange.h"
-#include "qpid/broker/TopicExchange.h"
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include "qpid/framing/BasicGetBody.h"
-#include "MessageUtils.h"
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-using namespace qpid;
-
-class ExchangeTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(ExchangeTest);
- CPPUNIT_TEST(testMe);
- CPPUNIT_TEST(testIsBound);
- CPPUNIT_TEST(testDeleteGetAndRedeclare);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testMe()
- {
- Queue::shared_ptr queue(new Queue("queue", true));
- Queue::shared_ptr queue2(new Queue("queue2", true));
-
- TopicExchange topic("topic");
- topic.bind(queue, "abc", 0);
- topic.bind(queue2, "abc", 0);
-
- DirectExchange direct("direct");
- direct.bind(queue, "abc", 0);
- direct.bind(queue2, "abc", 0);
-
- queue.reset();
- queue2.reset();
-
- intrusive_ptr<Message> msgPtr(MessageUtils::createMessage("exchange", "key", "id"));
- DeliverableMessage msg(msgPtr);
- topic.route(msg, "abc", 0);
- direct.route(msg, "abc", 0);
-
- }
-
- void testIsBound()
- {
- Queue::shared_ptr a(new Queue("a", true));
- Queue::shared_ptr b(new Queue("b", true));
- Queue::shared_ptr c(new Queue("c", true));
- Queue::shared_ptr d(new Queue("d", true));
-
- string k1("abc");
- string k2("def");
- string k3("xyz");
-
- FanOutExchange fanout("fanout");
- fanout.bind(a, "", 0);
- fanout.bind(b, "", 0);
- fanout.bind(c, "", 0);
-
- CPPUNIT_ASSERT(fanout.isBound(a, 0, 0));
- CPPUNIT_ASSERT(fanout.isBound(b, 0, 0));
- CPPUNIT_ASSERT(fanout.isBound(c, 0, 0));
- CPPUNIT_ASSERT(!fanout.isBound(d, 0, 0));
-
- DirectExchange direct("direct");
- direct.bind(a, k1, 0);
- direct.bind(a, k3, 0);
- direct.bind(b, k2, 0);
- direct.bind(c, k1, 0);
-
- CPPUNIT_ASSERT(direct.isBound(a, 0, 0));
- CPPUNIT_ASSERT(direct.isBound(a, &k1, 0));
- CPPUNIT_ASSERT(direct.isBound(a, &k3, 0));
- CPPUNIT_ASSERT(!direct.isBound(a, &k2, 0));
- CPPUNIT_ASSERT(direct.isBound(b, 0, 0));
- CPPUNIT_ASSERT(direct.isBound(b, &k2, 0));
- CPPUNIT_ASSERT(direct.isBound(c, &k1, 0));
- CPPUNIT_ASSERT(!direct.isBound(d, 0, 0));
- CPPUNIT_ASSERT(!direct.isBound(d, &k1, 0));
- CPPUNIT_ASSERT(!direct.isBound(d, &k2, 0));
- CPPUNIT_ASSERT(!direct.isBound(d, &k3, 0));
-
- TopicExchange topic("topic");
- topic.bind(a, k1, 0);
- topic.bind(a, k3, 0);
- topic.bind(b, k2, 0);
- topic.bind(c, k1, 0);
-
- CPPUNIT_ASSERT(topic.isBound(a, 0, 0));
- CPPUNIT_ASSERT(topic.isBound(a, &k1, 0));
- CPPUNIT_ASSERT(topic.isBound(a, &k3, 0));
- CPPUNIT_ASSERT(!topic.isBound(a, &k2, 0));
- CPPUNIT_ASSERT(topic.isBound(b, 0, 0));
- CPPUNIT_ASSERT(topic.isBound(b, &k2, 0));
- CPPUNIT_ASSERT(topic.isBound(c, &k1, 0));
- CPPUNIT_ASSERT(!topic.isBound(d, 0, 0));
- CPPUNIT_ASSERT(!topic.isBound(d, &k1, 0));
- CPPUNIT_ASSERT(!topic.isBound(d, &k2, 0));
- CPPUNIT_ASSERT(!topic.isBound(d, &k3, 0));
-
- HeadersExchange headers("headers");
- FieldTable args1;
- args1.setString("x-match", "all");
- args1.setString("a", "A");
- args1.setInt("b", 1);
- FieldTable args2;
- args2.setString("x-match", "any");
- args2.setString("a", "A");
- args2.setInt("b", 1);
- FieldTable args3;
- args3.setString("x-match", "any");
- args3.setString("c", "C");
- args3.setInt("b", 6);
-
- headers.bind(a, "", &args1);
- headers.bind(a, "", &args3);
- headers.bind(b, "", &args2);
- headers.bind(c, "", &args1);
-
- CPPUNIT_ASSERT(headers.isBound(a, 0, 0));
- CPPUNIT_ASSERT(headers.isBound(a, 0, &args1));
- CPPUNIT_ASSERT(headers.isBound(a, 0, &args3));
- CPPUNIT_ASSERT(!headers.isBound(a, 0, &args2));
- CPPUNIT_ASSERT(headers.isBound(b, 0, 0));
- CPPUNIT_ASSERT(headers.isBound(b, 0, &args2));
- CPPUNIT_ASSERT(headers.isBound(c, 0, &args1));
- CPPUNIT_ASSERT(!headers.isBound(d, 0, 0));
- CPPUNIT_ASSERT(!headers.isBound(d, 0, &args1));
- CPPUNIT_ASSERT(!headers.isBound(d, 0, &args2));
- CPPUNIT_ASSERT(!headers.isBound(d, 0, &args3));
- }
-
- void testDeleteGetAndRedeclare() {
- ExchangeRegistry exchanges;
- exchanges.declare("my-exchange", "direct", false, FieldTable());
- exchanges.destroy("my-exchange");
- try {
- exchanges.get("my-exchange");
- } catch (const ChannelException&) {}
- std::pair<Exchange::shared_ptr, bool> response = exchanges.declare("my-exchange", "direct", false, FieldTable());
- CPPUNIT_ASSERT_EQUAL(string("direct"), response.first->getType());
-
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(ExchangeTest);
diff --git a/qpid/cpp/src/tests/FieldTable.cpp b/qpid/cpp/src/tests/FieldTable.cpp
deleted file mode 100644
index db4c4906fa..0000000000
--- a/qpid/cpp/src/tests/FieldTable.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <iostream>
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/FieldValue.h"
-
-#include "unit_test.h"
-
-using namespace qpid::framing;
-
-QPID_AUTO_TEST_SUITE(FieldTableTestSuite)
-
-BOOST_AUTO_TEST_CASE(testMe)
-{
- FieldTable ft;
- ft.setString("A", "BCDE");
- BOOST_CHECK(StringValue("BCDE") == *ft.get("A"));
-
- char buff[100];
- Buffer wbuffer(buff, 100);
- wbuffer.put(ft);
-
- Buffer rbuffer(buff, 100);
- FieldTable ft2;
- rbuffer.get(ft2);
- BOOST_CHECK(StringValue("BCDE") == *ft2.get("A"));
-
-}
-
-BOOST_AUTO_TEST_CASE(testAssignment)
-{
- FieldTable a;
- FieldTable b;
-
- a.setString("A", "BBBB");
- a.setInt("B", 1234);
- b = a;
- a.setString("A", "CCCC");
-
- BOOST_CHECK(StringValue("CCCC") == *a.get("A"));
- BOOST_CHECK(StringValue("BBBB") == *b.get("A"));
- BOOST_CHECK_EQUAL(1234, a.getInt("B"));
- BOOST_CHECK_EQUAL(1234, b.getInt("B"));
- BOOST_CHECK(IntegerValue(1234) == *a.get("B"));
- BOOST_CHECK(IntegerValue(1234) == *b.get("B"));
-
- FieldTable d;
- {
- FieldTable c;
- c = a;
-
- char* buff = static_cast<char*>(::alloca(c.size()));
- Buffer wbuffer(buff, c.size());
- wbuffer.put(c);
-
- Buffer rbuffer(buff, c.size());
- rbuffer.get(d);
- BOOST_CHECK_EQUAL(c, d);
- BOOST_CHECK(StringValue("CCCC") == *c.get("A"));
- BOOST_CHECK(IntegerValue(1234) == *c.get("B"));
- }
- BOOST_CHECK(StringValue("CCCC") == *d.get("A"));
- BOOST_CHECK(IntegerValue(1234) == *d.get("B"));
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/FieldValue.cpp b/qpid/cpp/src/tests/FieldValue.cpp
deleted file mode 100644
index a820ae57bd..0000000000
--- a/qpid/cpp/src/tests/FieldValue.cpp
+++ /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.
- */
-#include "qpid/framing/FieldValue.h"
-
-#include "unit_test.h"
-
-QPID_AUTO_TEST_SUITE(FieldValueTestSuite)
-
-using namespace qpid::framing;
-
-StringValue s("abc");
-IntegerValue i(42);
-//DecimalValue d(1234,2);
-//FieldTableValue ft;
-//EmptyValue e;
-
-BOOST_AUTO_TEST_CASE(testStringValueEquals)
-{
-
- BOOST_CHECK(StringValue("abc") == s);
- BOOST_CHECK(StringValue("foo") != s);
- BOOST_CHECK(s != i);
- BOOST_CHECK(s.convertsTo<std::string>() == true);
- BOOST_CHECK(s.convertsTo<int>() == false);
- BOOST_CHECK(s.get<std::string>() == "abc");
- BOOST_CHECK_THROW(s.get<int>(), InvalidConversionException);
-// BOOST_CHECK(s != ft);
-
-}
-
-BOOST_AUTO_TEST_CASE(testIntegerValueEquals)
-{
- BOOST_CHECK(IntegerValue(42) == i);
- BOOST_CHECK(IntegerValue(5) != i);
- BOOST_CHECK(i != s);
- BOOST_CHECK(i.convertsTo<std::string>() == false);
- BOOST_CHECK(i.convertsTo<int>() == true);
- BOOST_CHECK_THROW(i.get<std::string>(), InvalidConversionException);
- BOOST_CHECK(i.get<int>() == 42);
-// BOOST_CHECK(i != ft);
-}
-
-#if 0
-BOOST_AUTO_TEST_CASE(testDecimalValueEquals)
-{
- BOOST_CHECK(DecimalValue(1234, 2) == d);
- BOOST_CHECK(DecimalValue(12345, 2) != d);
- BOOST_CHECK(DecimalValue(1234, 3) != d);
- BOOST_CHECK(d != s);
-}
-
-BOOST_AUTO_TEST_CASE(testFieldTableValueEquals)
-{
- ft.getValue().setString("foo", "FOO");
- ft.getValue().setInt("magic", 7);
-
- BOOST_CHECK_EQUAL(std::string("FOO"),
- ft.getValue().getString("foo"));
- BOOST_CHECK_EQUAL(7, ft.getValue().getInt("magic"));
-
- FieldTableValue f2;
- BOOST_CHECK(ft != f2);
- f2.getValue().setString("foo", "FOO");
- BOOST_CHECK(ft != f2);
- f2.getValue().setInt("magic", 7);
- BOOST_CHECK_EQUAL(ft,f2);
- BOOST_CHECK(ft == f2);
- f2.getValue().setString("foo", "BAR");
- BOOST_CHECK(ft != f2);
- BOOST_CHECK(ft != i);
-}
-#endif
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/Frame.cpp b/qpid/cpp/src/tests/Frame.cpp
deleted file mode 100644
index 0484dc4b2a..0000000000
--- a/qpid/cpp/src/tests/Frame.cpp
+++ /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.
- *
- */
-#include "qpid/framing/Frame.h"
-
-#include <boost/lexical_cast.hpp>
-#include "unit_test.h"
-
-QPID_AUTO_TEST_SUITE(FrameTestSuite)
-
-using namespace std;
-using namespace qpid::framing;
-using namespace boost;
-
-BOOST_AUTO_TEST_CASE(testContentBody) {
- Frame f(42, AMQContentBody("foobar"));
- AMQBody* body=f.getBody();
- BOOST_CHECK(dynamic_cast<AMQContentBody*>(body));
- Buffer b(f.size());
- f.encode(b);
- b.flip();
- Frame g;
- g.decode(b);
- AMQContentBody* content=dynamic_cast<AMQContentBody*>(g.getBody());
- BOOST_REQUIRE(content);
- BOOST_CHECK_EQUAL(content->getData(), "foobar");
-}
-
-BOOST_AUTO_TEST_CASE(testMethodBody) {
- FieldTable args;
- args.setString("foo", "bar");
- Frame f(
- 42, QueueDeclareBody(ProtocolVersion(), 1, "q", "altex",
- true, false, true, false, true, args));
- BOOST_CHECK_EQUAL(f.getChannel(), 42);
- Buffer b(f.size());
- f.encode(b);
- b.flip();
- Frame g;
- g.decode(b);
- BOOST_CHECK_EQUAL(f.getChannel(), g.getChannel());
- QueueDeclareBody* declare=dynamic_cast<QueueDeclareBody*>(g.getBody());
- BOOST_REQUIRE(declare);
- BOOST_CHECK_EQUAL(declare->getAlternateExchange(), "altex");
- BOOST_CHECK_EQUAL(lexical_cast<string>(*f.getBody()), lexical_cast<string>(*g.getBody()));
-}
-
-BOOST_AUTO_TEST_CASE(testLoop) {
- // Run in a loop so heap profiler can spot any allocations.
- Buffer b(1024);
- for (int i = 0; i < 100; ++i) {
- Frame ctor(2, AccessRequestOkBody(ProtocolVersion(), 42));
- Frame assign(3);
- assign.body = AccessRequestOkBody(ProtocolVersion(), 42);
- assign.encode(b);
- b.flip();
- Frame g;
- g.decode(b);
- BOOST_REQUIRE(dynamic_cast<AccessRequestOkBody*>(g.getBody())->getTicket() == 42);
- }
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/FramingTest.cpp b/qpid/cpp/src/tests/FramingTest.cpp
deleted file mode 100644
index 0c7adb2af8..0000000000
--- a/qpid/cpp/src/tests/FramingTest.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/client/Exchange.h"
-#include "qpid/client/Queue.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/Connector.h"
-#include "qpid/framing/AMQP_HighestVersion.h"
-#include "qpid/framing/BasicGetOkBody.h"
-#include "qpid/framing/ConnectionRedirectBody.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/framing/all_method_bodies.h"
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/reply_exceptions.h"
-#include "qpid_test_plugin.h"
-
-#include <boost/bind.hpp>
-#include <boost/lexical_cast.hpp>
-#include <iostream>
-
-#include <memory>
-#include <sstream>
-#include <typeinfo>
-
-using namespace qpid;
-using namespace qpid::framing;
-using namespace std;
-
-template <class T>
-std::string tostring(const T& x)
-{
- std::ostringstream out;
- out << x;
- return out.str();
-}
-
-class FramingTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(FramingTest);
- CPPUNIT_TEST(testBasicQosBody);
- CPPUNIT_TEST(testConnectionSecureBody);
- CPPUNIT_TEST(testConnectionRedirectBody);
- CPPUNIT_TEST(testAccessRequestBody);
- CPPUNIT_TEST(testBasicConsumeBody);
- CPPUNIT_TEST(testConnectionRedirectBodyFrame);
- CPPUNIT_TEST(testBasicConsumeOkBodyFrame);
- CPPUNIT_TEST(testInlineContent);
- CPPUNIT_TEST(testContentReference);
- CPPUNIT_TEST(testContentValidation);
- CPPUNIT_TEST_SUITE_END();
-
- private:
- char buffer[1024];
- ProtocolVersion version;
-
- public:
-
- FramingTest() : version(highestProtocolVersion) {}
-
- void testBasicQosBody()
- {
- Buffer wbuff(buffer, sizeof(buffer));
- BasicQosBody in(version, 0xCAFEBABE, 0xABBA, true);
- in.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- BasicQosBody out(version);
- out.decode(rbuff);
- CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
- }
-
- void testConnectionSecureBody()
- {
- Buffer wbuff(buffer, sizeof(buffer));
- std::string s = "security credential";
- ConnectionSecureBody in(version, s);
- in.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- ConnectionSecureBody out(version);
- out.decode(rbuff);
- CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
- }
-
- void testConnectionRedirectBody()
- {
- Buffer wbuff(buffer, sizeof(buffer));
- std::string a = "hostA";
- std::string b = "hostB";
- ConnectionRedirectBody in(version, a, b);
- in.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- ConnectionRedirectBody out(version);
- out.decode(rbuff);
- CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
- }
-
- void testAccessRequestBody()
- {
- Buffer wbuff(buffer, sizeof(buffer));
- std::string s = "text";
- AccessRequestBody in(version, s, true, false, true, false, true);
- in.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- AccessRequestBody out(version);
- out.decode(rbuff);
- CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
- }
-
- void testBasicConsumeBody()
- {
- Buffer wbuff(buffer, sizeof(buffer));
- std::string q = "queue";
- std::string t = "tag";
- BasicConsumeBody in(version, 0, q, t, false, true, false, false,
- FieldTable());
- in.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- BasicConsumeBody out(version);
- out.decode(rbuff);
- CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
- }
-
-
- void testConnectionRedirectBodyFrame()
- {
- Buffer wbuff(buffer, sizeof(buffer));
- std::string a = "hostA";
- std::string b = "hostB";
- AMQFrame in(in_place<ConnectionRedirectBody>(version, a, b));
- in.setChannel(999);
- in.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- AMQFrame out;
- out.decode(rbuff);
- CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
- }
-
- void testBasicConsumeOkBodyFrame()
- {
- Buffer wbuff(buffer, sizeof(buffer));
- std::string s = "hostA";
- AMQFrame in(in_place<BasicConsumeOkBody>(version, s));
- in.setChannel(999);
- in.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- AMQFrame out;
- out.decode(rbuff);
- CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out));
- }
-
- void testInlineContent() {
- Buffer wbuff(buffer, sizeof(buffer));
- Content content(INLINE, "MyData");
- CPPUNIT_ASSERT(content.isInline());
- content.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- Content recovered;
- recovered.decode(rbuff);
- CPPUNIT_ASSERT(recovered.isInline());
- CPPUNIT_ASSERT_EQUAL(content.getValue(), recovered.getValue());
- }
-
- void testContentReference() {
- Buffer wbuff(buffer, sizeof(buffer));
- Content content(REFERENCE, "MyRef");
- CPPUNIT_ASSERT(content.isReference());
- content.encode(wbuff);
-
- Buffer rbuff(buffer, sizeof(buffer));
- Content recovered;
- recovered.decode(rbuff);
- CPPUNIT_ASSERT(recovered.isReference());
- CPPUNIT_ASSERT_EQUAL(content.getValue(), recovered.getValue());
- }
-
- void testContentValidation() {
- try {
- Content content(REFERENCE, "");
- CPPUNIT_ASSERT(false);//fail, expected exception
- } catch (const InvalidArgumentException& e) {}
-
- try {
- Content content(2, "Blah");
- CPPUNIT_ASSERT(false);//fail, expected exception
- } catch (const SyntaxErrorException& e) {}
-
- try {
- Buffer wbuff(buffer, sizeof(buffer));
- wbuff.putOctet(2);
- wbuff.putLongString("blah, blah");
-
- Buffer rbuff(buffer, sizeof(buffer));
- Content content;
- content.decode(rbuff);
- CPPUNIT_FAIL("Expected exception");
- } catch (Exception& e) {}
-
- }
-
- };
-
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(FramingTest);
-
-
-
diff --git a/qpid/cpp/src/tests/HeaderTest.cpp b/qpid/cpp/src/tests/HeaderTest.cpp
deleted file mode 100644
index 9e2bddb4de..0000000000
--- a/qpid/cpp/src/tests/HeaderTest.cpp
+++ /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.
- *
- */
-#include <iostream>
-#include "qpid/framing/amqp_framing.h"
-#include "qpid/framing/FieldValue.h"
-#include "qpid_test_plugin.h"
-
-using namespace qpid::framing;
-using namespace std;
-
-class HeaderTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(HeaderTest);
- CPPUNIT_TEST(testGenericProperties);
- CPPUNIT_TEST(testMessageProperties);
- CPPUNIT_TEST(testDeliveryProperies);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testGenericProperties()
- {
- AMQHeaderBody body;
- body.get<MessageProperties>(true)->getApplicationHeaders().setString(
- "A", "BCDE");
- char buff[100];
- Buffer wbuffer(buff, 100);
- body.encode(wbuffer);
-
- Buffer rbuffer(buff, 100);
- AMQHeaderBody body2;
- body2.decode(rbuffer, body.size());
- MessageProperties* props =
- body2.get<MessageProperties>(true);
- CPPUNIT_ASSERT_EQUAL(
- string("BCDE"),
- props->getApplicationHeaders().get("A")->get<string>());
- }
-
- void testMessageProperties() {
- AMQFrame out(in_place<AMQHeaderBody>());
- MessageProperties* props1 =
- out.castBody<AMQHeaderBody>()->get<MessageProperties>(true);
-
- props1->setContentLength(42);
- props1->setMessageId("messageId");
- props1->setCorrelationId("correlationId");
- props1->setReplyTo(ReplyTo("ex","key"));
- props1->setContentType("contentType");
- props1->setContentEncoding("contentEncoding");
- props1->setType("type");
- props1->setUserId("userId");
- props1->setAppId("appId");
- props1->setTransactionId("transactionId");
- props1->setSecurityToken("securityToken");
-
- char buff[10000];
- Buffer wbuffer(buff, 10000);
- out.encode(wbuffer);
-
- Buffer rbuffer(buff, 10000);
- AMQFrame in;
- in.decode(rbuffer);
- MessageProperties* props2 =
- in.castBody<AMQHeaderBody>()->get<MessageProperties>(true);
-
- CPPUNIT_ASSERT_EQUAL(props1->getContentLength(), props2->getContentLength());
- CPPUNIT_ASSERT_EQUAL(props1->getMessageId(), props2->getMessageId());
- CPPUNIT_ASSERT_EQUAL(props1->getCorrelationId(), props2->getCorrelationId());
- CPPUNIT_ASSERT_EQUAL(props1->getContentType(), props2->getContentType());
- CPPUNIT_ASSERT_EQUAL(props1->getContentEncoding(), props2->getContentEncoding());
- CPPUNIT_ASSERT_EQUAL(props1->getType(), props2->getType());
- CPPUNIT_ASSERT_EQUAL(props1->getUserId(), props2->getUserId());
- CPPUNIT_ASSERT_EQUAL(props1->getAppId(), props2->getAppId());
- CPPUNIT_ASSERT_EQUAL(props1->getTransactionId(), props2->getTransactionId());
- CPPUNIT_ASSERT_EQUAL(props1->getSecurityToken(), props2->getSecurityToken());
-
- }
-
- void testDeliveryProperies() {
- AMQFrame out(in_place<AMQHeaderBody>());
- DeliveryProperties* props1 =
- out.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true);
-
- props1->setDiscardUnroutable(true);
- props1->setExchange("foo");
-
- char buff[10000];
- Buffer wbuffer(buff, 10000);
- out.encode(wbuffer);
-
- Buffer rbuffer(buff, 10000);
- AMQFrame in;
- in.decode(rbuffer);
- DeliveryProperties* props2 =
- in.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true);
-
- CPPUNIT_ASSERT(props2->getDiscardUnroutable());
- CPPUNIT_ASSERT_EQUAL(string("foo"), props2->getExchange());
- CPPUNIT_ASSERT(!props2->hasTimestamp());
- }
-
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(HeaderTest);
-
diff --git a/qpid/cpp/src/tests/HeadersExchangeTest.cpp b/qpid/cpp/src/tests/HeadersExchangeTest.cpp
deleted file mode 100644
index f07f238ee4..0000000000
--- a/qpid/cpp/src/tests/HeadersExchangeTest.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include "qpid/broker/HeadersExchange.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/FieldValue.h"
-#include "qpid_test_plugin.h"
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-class HeadersExchangeTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(HeadersExchangeTest);
- CPPUNIT_TEST(testMatchAll);
- CPPUNIT_TEST(testMatchAny);
- CPPUNIT_TEST(testMatchEmptyValue);
- CPPUNIT_TEST(testMatchEmptyArgs);
- CPPUNIT_TEST(testMatchNoXMatch);
- CPPUNIT_TEST(testBindNoXMatch);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testMatchAll()
- {
- FieldTable b, m, n;
- b.setString("x-match", "all");
- b.setString("foo", "FOO");
- b.setInt("n", 42);
- m.setString("foo", "FOO");
- m.setInt("n", 42);
- CPPUNIT_ASSERT(HeadersExchange::match(b, m));
-
- // Ignore extras.
- m.setString("extra", "x");
- CPPUNIT_ASSERT(HeadersExchange::match(b, m));
-
- // Fail mismatch, wrong value.
- m.setString("foo", "NotFoo");
- CPPUNIT_ASSERT(!HeadersExchange::match(b, m));
-
- // Fail mismatch, missing value
- n.setInt("n", 42);
- n.setString("extra", "x");
- CPPUNIT_ASSERT(!HeadersExchange::match(b, n));
- }
-
- void testMatchAny()
- {
- FieldTable b, m, n;
- b.setString("x-match", "any");
- b.setString("foo", "FOO");
- b.setInt("n", 42);
- m.setString("foo", "FOO");
- CPPUNIT_ASSERT(!HeadersExchange::match(b, n));
- CPPUNIT_ASSERT(HeadersExchange::match(b, m));
- m.setInt("n", 42);
- CPPUNIT_ASSERT(HeadersExchange::match(b, m));
- }
-
- void testMatchEmptyValue()
- {
- FieldTable b, m;
- b.setString("x-match", "all");
- b.set("foo", FieldTable::ValuePtr());
- b.set("n", FieldTable::ValuePtr());
- CPPUNIT_ASSERT(!HeadersExchange::match(b, m));
- m.setString("foo", "blah");
- m.setInt("n", 123);
- }
-
- void testMatchEmptyArgs()
- {
- FieldTable b, m;
- m.setString("foo", "FOO");
-
- b.setString("x-match", "all");
- CPPUNIT_ASSERT(HeadersExchange::match(b, m));
- b.setString("x-match", "any");
- CPPUNIT_ASSERT(!HeadersExchange::match(b, m));
- }
-
-
- void testMatchNoXMatch()
- {
- FieldTable b, m;
- b.setString("foo", "FOO");
- m.setString("foo", "FOO");
- CPPUNIT_ASSERT(!HeadersExchange::match(b, m));
- }
-
- void testBindNoXMatch()
- {
- HeadersExchange exchange("test");
- Queue::shared_ptr queue;
- std::string key;
- FieldTable args;
- try {
- //just checking this doesn't cause assertion etc
- exchange.bind(queue, key, &args);
- } catch(qpid::Exception&) {
- //expected
- }
- }
-
-
-};
-
-// make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(HeadersExchangeTest);
diff --git a/qpid/cpp/src/tests/IList.cpp b/qpid/cpp/src/tests/IList.cpp
deleted file mode 100644
index 2e872d0e05..0000000000
--- a/qpid/cpp/src/tests/IList.cpp
+++ /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.
- *
- */
-#include "qpid/IList.h"
-#include "unit_test.h"
-#include "test_tools.h"
-#include <boost/assign/list_of.hpp>
-#include <vector>
-
-QPID_AUTO_TEST_SUITE(IListTestSuite)
-
-using namespace qpid;
-using namespace std;
-using boost::assign::list_of;
-
-// Comparison, op== and << for ILists in qpid namespace for template lookup.
-
-template <class T, class S> bool operator==(const IList<T>& a, const S& b) { return seqEqual(a, b); }
-template <class T> ostream& operator<<(std::ostream& o, const IList<T>& l) { return seqPrint(o, l); }
-template <class T>
-ostream& operator<<(ostream& o, typename IList<T>::iterator i) {
- return i? o << "(nil)" : o << *i;
-}
-
-struct IListFixture {
- struct Node : public IListNode<Node*> {
- char value;
- Node(char c) { value=c; }
- bool operator==(const Node& n) const { return value == n.value; }
- };
- typedef IList<Node> List;
- Node a, b, c, d, e;
- IListFixture() :a('a'),b('b'),c('c'),d('d'),e('e') {}
-};
-
-ostream& operator<<(ostream& o, const IListFixture::Node& n) { return o << n.value; }
-
-BOOST_FIXTURE_TEST_CASE(IList_default_ctor, IListFixture) {
- List l;
- BOOST_CHECK(l.empty());
- BOOST_CHECK(l.begin() == l.end());
- BOOST_CHECK_EQUAL(0u, l.size());
-}
-
-BOOST_FIXTURE_TEST_CASE(IList_push_front, IListFixture) {
- List l;
- l.push_front(&a);
- BOOST_CHECK_EQUAL(1u, l.size());
- BOOST_CHECK_EQUAL(l, list_of(a));
- l.push_front(&b);
- BOOST_CHECK_EQUAL(2u, l.size());
- BOOST_CHECK_EQUAL(l, list_of(b)(a));
-}
-
-BOOST_FIXTURE_TEST_CASE(IList_push_back, IListFixture) {
- List l;
- l.push_back(&a);
- BOOST_CHECK_EQUAL(1u, l.size());
- BOOST_CHECK_EQUAL(l, list_of(a));
- l.push_back(&b);
- BOOST_CHECK_EQUAL(2u, l.size());
- BOOST_CHECK_EQUAL(l, list_of(a)(b));
-}
-
-BOOST_FIXTURE_TEST_CASE(IList_insert, IListFixture) {
- List l;
- List::iterator i(l.begin());
- i = l.insert(i, &a);
- BOOST_CHECK_EQUAL(l, list_of(a));
- BOOST_CHECK(i == l.begin());
-
- i = l.insert(i, &b);
- BOOST_CHECK_EQUAL(l, list_of(b)(a));
- BOOST_CHECK(i == l.begin());
-
- i++;
- BOOST_CHECK_EQUAL(*i, a);
- i = l.insert(i, &c);
- BOOST_CHECK_EQUAL(l, list_of(b)(c)(a));
- BOOST_CHECK_EQUAL(*i, c);
-
- i = l.insert(i, &d);
- BOOST_CHECK_EQUAL(l, list_of(b)(d)(c)(a));
- BOOST_CHECK_EQUAL(*i, d);
-}
-
-BOOST_FIXTURE_TEST_CASE(IList_iterator_test, IListFixture) {
- List l;
- l.push_back(&a);
- l.push_back(&b);
-
- List::iterator i = l.begin();
- BOOST_CHECK_EQUAL(*i, a);
- BOOST_CHECK_EQUAL(static_cast<Node*>(i), &a);
- List::const_iterator ci = i;
- BOOST_CHECK_EQUAL(static_cast<const Node*>(ci), &a);
-
- i++;
- BOOST_CHECK_EQUAL(*i, b);
- BOOST_CHECK_EQUAL(static_cast<Node*>(i), &b);
- i++;
- BOOST_CHECK(i == l.end());
-}
-
-BOOST_FIXTURE_TEST_CASE(IList_pop_front, IListFixture) {
- List l;
- l.push_back(&a);
- l.push_back(&b);
- BOOST_CHECK_EQUAL(l, list_of(a)(b));
- l.pop_front();
- BOOST_CHECK_EQUAL(l, list_of(b));
- l.pop_front();
- BOOST_CHECK(l.empty());
-}
-
-BOOST_FIXTURE_TEST_CASE(IList_pop_back, IListFixture) {
- List l;
- l.push_back(&a);
- l.push_back(&b);
- l.pop_back();
- BOOST_CHECK_EQUAL(l, list_of(a));
- l.pop_back();
- BOOST_CHECK(l.empty());
-}
-
-BOOST_FIXTURE_TEST_CASE(IList_erase, IListFixture) {
- List l;
- l.push_back(&a);
- l.push_back(&b);
- l.push_back(&c);
-
- List::iterator i=l.begin();
- i++;
- l.erase(i);
- BOOST_CHECK_EQUAL(l, list_of(a)(c));
-
- i=l.begin();
- i++;
- l.erase(i);
- BOOST_CHECK_EQUAL(l, list_of(a));
-
- l.erase(l.begin());
- BOOST_CHECK(l.empty());
-}
-
-QPID_AUTO_TEST_SUITE_END()
-
diff --git a/qpid/cpp/src/tests/ISList.cpp b/qpid/cpp/src/tests/ISList.cpp
deleted file mode 100644
index de06f130ff..0000000000
--- a/qpid/cpp/src/tests/ISList.cpp
+++ /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.
- *
- */
-#include "qpid/ISList.h"
-#include "qpid/RefCounted.h"
-#include "unit_test.h"
-#include "test_tools.h"
-#include <boost/assign/list_of.hpp>
-#include <boost/shared_ptr.hpp>
-#include <vector>
-
-QPID_AUTO_TEST_SUITE(ISListTestSuite)
-
-using namespace qpid;
-using namespace std;
-using boost::assign::list_of;
-
-// Comparison, op== and << for ILists in qpid namespace for template lookup.
-
-template <class T, class S> bool operator==(const ISList<T>& a, const S& b) { return seqEqual(a, b); }
-template <class T> ostream& operator<<(std::ostream& o, const ISList<T>& l) { return seqPrint(o, l); }
-template <class T>
-ostream& operator<<(ostream& o, typename ISList<T>::iterator i) {
- return i? o << "(nil)" : o << *i;
-}
-
-struct NodeBase {
- static int instances;
- char value;
-
- NodeBase(char c) { value=c; ++instances; }
- NodeBase(const NodeBase& n) { value=n.value; ++instances; }
- ~NodeBase() { --instances; }
- bool operator==(const NodeBase& n) const { return value == n.value; }
-};
-
-int NodeBase::instances = 0;
-
-ostream& operator<<(ostream& o, const NodeBase& n) { return o << n.value; }
-
-struct Fixture {
- struct Node : public NodeBase, public ISListNode<Node*> {
- Node(char c) : NodeBase(c) {}
- };
- typedef ISList<Node> List;
- Node a, b, c, d, e;
- List l;
- Fixture() :a('a'),b('b'),c('c'),d('d'),e('e') {}
-};
-
-BOOST_FIXTURE_TEST_CASE(default_ctor, Fixture) {
- BOOST_CHECK(l.empty());
- BOOST_CHECK(l.begin() == l.end());
- BOOST_CHECK_EQUAL(0u, l.size());
-}
-
-BOOST_FIXTURE_TEST_CASE(push_front, Fixture) {
- l.push_front(&a);
- BOOST_CHECK_EQUAL(1u, l.size());
- BOOST_CHECK_EQUAL(l, list_of(a));
- l.push_front(&b);
- BOOST_CHECK_EQUAL(2u, l.size());
- BOOST_CHECK_EQUAL(l, list_of(b)(a));
-}
-
-BOOST_FIXTURE_TEST_CASE(push_back, Fixture) {
- l.push_back(&a);
- BOOST_CHECK_EQUAL(1u, l.size());
- BOOST_CHECK_EQUAL(l, list_of(a));
- l.push_back(&b);
- BOOST_CHECK_EQUAL(2u, l.size());
- BOOST_CHECK_EQUAL(l, list_of(a)(b));
-}
-
-BOOST_FIXTURE_TEST_CASE(insert, Fixture) {
- List::iterator i(l.begin());
- i = l.insert(i, &a);
- BOOST_CHECK_EQUAL(l, list_of(a));
- BOOST_CHECK(i == l.begin());
-
- i = l.insert(i, &b);
- BOOST_CHECK_EQUAL(l, list_of(b)(a));
- BOOST_CHECK(i == l.begin());
-
- i++;
- BOOST_CHECK_EQUAL(*i, a);
- i = l.insert(i, &c);
- BOOST_CHECK_EQUAL(l, list_of(b)(c)(a));
- BOOST_CHECK_EQUAL(*i, c);
-
- i = l.insert(i, &d);
- BOOST_CHECK_EQUAL(l, list_of(b)(d)(c)(a));
- BOOST_CHECK_EQUAL(*i, d);
-}
-
-BOOST_FIXTURE_TEST_CASE(iterator_test, Fixture) {
- l.push_back(&a);
- l.push_back(&b);
-
- List::iterator i = l.begin();
- BOOST_CHECK_EQUAL(*i, a);
- BOOST_CHECK_EQUAL(static_cast<Node*>(i), &a);
- List::const_iterator ci = i;
- BOOST_CHECK_EQUAL(static_cast<const Node*>(ci), &a);
-
- i++;
- BOOST_CHECK_EQUAL(*i, b);
- BOOST_CHECK_EQUAL(static_cast<Node*>(i), &b);
- i++;
- BOOST_CHECK(i == l.end());
-}
-
-BOOST_FIXTURE_TEST_CASE(pop_front, Fixture) {
- l.push_back(&a);
- l.push_back(&b);
- l.pop_front();
- BOOST_CHECK_EQUAL(l, list_of(b));
- l.pop_front();
- BOOST_CHECK(l.empty());
-}
-
-BOOST_FIXTURE_TEST_CASE(erase, Fixture) {
- l.push_back(&a);
- l.push_back(&b);
- l.push_back(&c);
-
- List::iterator i=l.begin();
- i++;
- l.erase(i);
- BOOST_CHECK_EQUAL(l, list_of(a)(c));
-
- i=l.begin();
- i++;
- l.erase(i);
- BOOST_CHECK_EQUAL(l, list_of(a));
-
- l.erase(l.begin());
- BOOST_CHECK(l.empty());
-}
-
-
-// ================ Test smart pointer types.
-
-template <class Node> void smart_pointer_test() {
- typedef typename Node::pointer pointer;
- typedef ISList<Node> List;
- List l;
-
- BOOST_CHECK_EQUAL(0, NodeBase::instances);
- l.push_back(pointer(new Node()));
- l.push_back(pointer(new Node()));
- BOOST_CHECK_EQUAL(2, NodeBase::instances); // maintains a reference.
-
- pointer p = l.begin();
- l.pop_front();
- BOOST_CHECK_EQUAL(2, NodeBase::instances); // transfers ownership.
- p = pointer();
- BOOST_CHECK_EQUAL(1, NodeBase::instances);
-
- l.clear();
- BOOST_CHECK_EQUAL(0, NodeBase::instances);
- { // Dtor cleans up
- List ll;
- ll.push_back(pointer(new Node()));
- BOOST_CHECK_EQUAL(1, NodeBase::instances);
- }
- BOOST_CHECK_EQUAL(0, NodeBase::instances);
-}
-
-struct IntrusiveNode : public NodeBase, public RefCounted,
- public ISListNode<intrusive_ptr<IntrusiveNode> >
-{
- IntrusiveNode() : NodeBase(0) {}
-};
-
-
-BOOST_AUTO_TEST_CASE(intrusive_ptr_test) {
- smart_pointer_test<IntrusiveNode>();
-}
-
-
-struct SharedNode : public NodeBase, public ISListNode<boost::shared_ptr<SharedNode> > {
- SharedNode() : NodeBase(0) {}
-};
-
-BOOST_AUTO_TEST_CASE(shared_ptr_test) {
- smart_pointer_test<SharedNode>();
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/InlineVector.cpp b/qpid/cpp/src/tests/InlineVector.cpp
deleted file mode 100644
index d1b3ebf7de..0000000000
--- a/qpid/cpp/src/tests/InlineVector.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/InlineVector.h"
-#include "unit_test.h"
-
-QPID_AUTO_TEST_SUITE(InlineVectorTestSuite)
-
-using namespace qpid;
-using namespace std;
-
-typedef InlineVector<int, 3> Vec;
-
-bool isInline(const Vec& v) {
- return (char*)&v <= (char*)v.data() &&
- (char*)v.data() < (char*)&v+sizeof(v);
-}
-
-BOOST_AUTO_TEST_CASE(testCtor) {
- {
- Vec v;
- BOOST_CHECK(isInline(v));
- BOOST_CHECK(v.empty());
- }
- {
- Vec v(3, 42);
- BOOST_CHECK(isInline(v));
- BOOST_CHECK_EQUAL(3u, v.size());
- BOOST_CHECK_EQUAL(v[0], 42);
- BOOST_CHECK_EQUAL(v[2], 42);
-
- Vec u(v);
- BOOST_CHECK(isInline(u));
- BOOST_CHECK_EQUAL(3u, u.size());
- BOOST_CHECK_EQUAL(u[0], 42);
- BOOST_CHECK_EQUAL(u[2], 42);
- }
-
- {
- Vec v(4, 42);
-
- BOOST_CHECK_EQUAL(v.size(), 4u);
- BOOST_CHECK(!isInline(v));
- Vec u(v);
- BOOST_CHECK_EQUAL(u.size(), 4u);
- BOOST_CHECK(!isInline(u));
- }
-}
-
-BOOST_AUTO_TEST_CASE(testInsert) {
- Vec v;
- v.push_back(1);
- BOOST_CHECK_EQUAL(v.size(), 1u);
- BOOST_CHECK_EQUAL(v.back(), 1);
- BOOST_CHECK(isInline(v));
-
- v.insert(v.begin(), 2);
- BOOST_CHECK_EQUAL(v.size(), 2u);
- BOOST_CHECK_EQUAL(v.back(), 1);
- BOOST_CHECK(isInline(v));
-
- v.push_back(3);
- BOOST_CHECK(isInline(v));
-
- v.push_back(4);
- BOOST_CHECK_EQUAL(v.size(), 4u);
- BOOST_CHECK(!isInline(v));
-}
-
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/Makefile.am b/qpid/cpp/src/tests/Makefile.am
deleted file mode 100644
index 3ce86b9da1..0000000000
--- a/qpid/cpp/src/tests/Makefile.am
+++ /dev/null
@@ -1,176 +0,0 @@
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(APR_CXXFLAGS) -DBOOST_TEST_DYN_LINK
-INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../gen -I$(top_builddir)/src/gen
-
-abs_builddir=@abs_builddir@
-extra_libs = $(CPPUNIT_LIBS)
-lib_client = $(abs_builddir)/../libqpidclient.la
-lib_common = $(abs_builddir)/../libqpidcommon.la
-lib_broker = $(abs_builddir)/../libqpidbroker.la
-
-#
-# Initialize variables that are incremented with +=
-#
-check_PROGRAMS=
-check_LTLIBRARIES=
-TESTS=
-EXTRA_DIST=
-CLEANFILES=
-
-#
-# Unit test program
-#
-# Unit tests are built as a single program to reduce valgrind overhead
-# when running the tests. If you want to build a subset of the tests do
-# rm -f unit_test; make unit_test unit_test_OBJECTS="unit_test.o SelectedTest.o"
-#
-
-TESTS+=unit_test
-check_PROGRAMS+=unit_test
-unit_test_LDADD=-lboost_unit_test_framework -lboost_regex \
- $(lib_client) $(lib_broker)
-unit_test_SOURCES= unit_test.cpp unit_test.h \
- BrokerFixture.h SocketProxy.h \
- exception_test.cpp \
- RefCounted.cpp \
- SessionState.cpp Blob.cpp logging.cpp \
- Url.cpp Uuid.cpp \
- Shlib.cpp FieldValue.cpp FieldTable.cpp Array.cpp \
- InlineVector.cpp \
- ISList.cpp IList.cpp \
- ClientSessionTest.cpp \
- serialize.cpp
-# FIXME aconway 2008-02-20: removed RefCountedMap.cpp due to valgrind error.
-
-check_LTLIBRARIES += libshlibtest.la
-libshlibtest_la_LDFLAGS = -module -rpath $(abs_builddir)
-libshlibtest_la_SOURCES = shlibtest.cpp
-
-include cluster.mk
-
-#
-# Other test programs
-#
-check_PROGRAMS+=perftest
-perftest_SOURCES=perftest.cpp test_tools.h TestOptions.h
-perftest_LDADD=$(lib_client)
-
-check_PROGRAMS+=txtest
-txtest_SOURCES=txtest.cpp TestOptions.h
-txtest_LDADD=$(lib_client)
-
-check_PROGRAMS+=latencytest
-latencytest_SOURCES=latencytest.cpp TestOptions.h
-latencytest_LDADD=$(lib_client)
-
-# NB: CppUnit test libraries below will be migrated to boost test programs.
-#
-
-# cppunit tests
-broker_unit_tests = \
- AccumulatedAckTest \
- DtxWorkRecordTest \
- DeliveryRecordTest \
- ExchangeTest \
- HeadersExchangeTest \
- MessageTest \
- QueueRegistryTest \
- QueueTest \
- QueuePolicyTest \
- TimerTest \
- TopicExchangeTest \
- TxAckTest \
- TxBufferTest \
- TxPublishTest \
- MessageBuilderTest
-
-#client_unit_tests = \
-# ClientChannelTest
-
-framing_unit_tests = \
- FramingTest \
- HeaderTest \
- SequenceNumberTest
-
-posix_unit_tests = \
- EventChannelTest \
- EventChannelThreadsTest
-
-unit_tests = \
- $(broker_unit_tests) \
- $(client_unit_tests) \
- $(framing_unit_tests) \
- $(misc_unit_tests)
-
-# Executables for client tests
-
-testprogs= \
- client_test \
- topic_listener \
- topic_publisher
-# echo_service
-
-check_PROGRAMS += $(testprogs) interop_runner
-
-TESTS_ENVIRONMENT = VALGRIND=$(VALGRIND) srcdir=$(srcdir) QPID_DATA_DIR= $(srcdir)/run_test
-
-system_tests = client_test quick_perftest quick_topictest
-TESTS += run-unit-tests start_broker $(system_tests) python_tests stop_broker
-
-EXTRA_DIST += \
- run_test vg_check \
- run-unit-tests start_broker python_tests stop_broker \
- quick_topictest \
- quick_perftest \
- topictest \
- .valgrind.supp \
- .valgrindrc \
- MessageUtils.h \
- MockConnectionInputHandler.h \
- TxMocks.h \
- qpid_test_plugin.h
-
-include gen.mk
-
-check_LTLIBRARIES += libdlclose_noop.la
-libdlclose_noop_la_LDFLAGS = -module -rpath $(abs_builddir)
-libdlclose_noop_la_SOURCES = dlclose_noop.c
-
-gen.mk: Makefile.am
- ( \
- for i in $(testprogs); do \
- echo $${i}_SOURCES = $$i.cpp; \
- echo $${i}_LDADD = '$$(lib_client) $$(lib_common) $$(extra_libs)'; \
- done; \
- libs=; \
- for i in $(unit_tests); do \
- echo "check_LTLIBRARIES +=$${i}.la"; \
- echo $${i}_la_SOURCES = $$i.cpp; \
- echo $${i}_la_LIBADD = '$$(lib_common) $$(lib_client)'; \
- echo $${i}_la_LIBADD += '$$(lib_broker) $$(extra_libs)'; \
- echo $${i}_la_LDFLAGS = "-module -rpath `pwd`"; \
- done; \
- ) \
- > $@-t
- mv $@-t $@
-
-CLEANFILES+=valgrind.out *.log *.vglog dummy_test $(unit_wrappers)
-MAINTAINERCLEANFILES=gen.mk
-
-interop_runner_SOURCES = \
- interop_runner.cpp \
- SimpleTestCaseBase.cpp \
- BasicP2PTest.cpp \
- BasicPubSubTest.cpp \
- SimpleTestCaseBase.h \
- BasicP2PTest.h \
- BasicPubSubTest.h \
- TestCase.h \
- TestOptions.h
-interop_runner_LDADD = $(lib_client) $(lib_common) $(extra_libs)
-
-# Longer running stability tests, not run by default check: target.
-# Not run under valgrind, too slow
-LONG_TESTS=fanout_perftest shared_perftest multiq_perftest topic_perftest
-EXTRA_DIST+=$(LONG_TESTS) run_perftest
-check-long:
- $(MAKE) check TESTS="start_broker $(LONG_TESTS) stop_broker" VALGRIND=
diff --git a/qpid/cpp/src/tests/MessageBuilderTest.cpp b/qpid/cpp/src/tests/MessageBuilderTest.cpp
deleted file mode 100644
index 092e02cc2f..0000000000
--- a/qpid/cpp/src/tests/MessageBuilderTest.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/broker/Message.h"
-#include "qpid/broker/MessageBuilder.h"
-#include "qpid/broker/NullMessageStore.h"
-#include "qpid/framing/frame_functors.h"
-#include "qpid/framing/TypeFilter.h"
-#include "qpid_test_plugin.h"
-#include <list>
-
-using namespace boost;
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-class MessageBuilderTest : public CppUnit::TestCase
-{
- class MockMessageStore : public NullMessageStore
- {
- enum Op {STAGE=1, APPEND=2};
-
- uint64_t id;
- intrusive_ptr<PersistableMessage> expectedMsg;
- string expectedData;
- std::list<Op> ops;
-
- void checkExpectation(Op actual)
- {
- CPPUNIT_ASSERT_EQUAL(ops.front(), actual);
- ops.pop_front();
- }
-
- public:
- MockMessageStore() : id(0), expectedMsg(0) {}
-
- void expectStage(PersistableMessage& msg)
- {
- expectedMsg = &msg;
- ops.push_back(STAGE);
- }
-
- void expectAppendContent(PersistableMessage& msg, const string& data)
- {
- expectedMsg = &msg;
- expectedData = data;
- ops.push_back(APPEND);
- }
-
- void stage(intrusive_ptr<PersistableMessage>& msg)
- {
- checkExpectation(STAGE);
- CPPUNIT_ASSERT_EQUAL(expectedMsg, msg);
- msg->setPersistenceId(++id);
- }
-
- void appendContent(intrusive_ptr<const PersistableMessage>& msg, const string& data)
- {
- checkExpectation(APPEND);
- CPPUNIT_ASSERT_EQUAL(static_pointer_cast<const PersistableMessage>(expectedMsg), msg);
- CPPUNIT_ASSERT_EQUAL(expectedData, data);
- }
-
- bool expectationsMet()
- {
- return ops.empty();
- }
- };
-
- CPPUNIT_TEST_SUITE(MessageBuilderTest);
- CPPUNIT_TEST(testHeaderOnly);
- CPPUNIT_TEST(test1ContentFrame);
- CPPUNIT_TEST(test2ContentFrames);
- CPPUNIT_TEST(testStaging);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testHeaderOnly(){
- MessageBuilder builder(0, 0);
- builder.start(SequenceNumber());
-
- std::string exchange("builder-exchange");
- std::string key("builder-exchange");
-
- AMQFrame method(in_place<MessageTransferBody>(
- ProtocolVersion(), 0, exchange, 0, 0));
- AMQFrame header(in_place<AMQHeaderBody>());
-
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(0);
- header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
-
- builder.handle(method);
- builder.handle(header);
-
- CPPUNIT_ASSERT(builder.getMessage());
- CPPUNIT_ASSERT_EQUAL(exchange, builder.getMessage()->getExchangeName());
- CPPUNIT_ASSERT_EQUAL(key, builder.getMessage()->getRoutingKey());
- CPPUNIT_ASSERT(builder.getMessage()->getFrames().isComplete());
- }
-
- void test1ContentFrame(){
- MessageBuilder builder(0, 0);
- builder.start(SequenceNumber());
-
- std::string data("abcdefg");
- std::string exchange("builder-exchange");
- std::string key("builder-exchange");
-
- AMQFrame method(in_place<MessageTransferBody>(ProtocolVersion(), 0, exchange, 0, 0));
- AMQFrame header(in_place<AMQHeaderBody>());
- AMQFrame content(in_place<AMQContentBody>(data));
- method.setEof(false);
- header.setBof(false);
- header.setEof(false);
- content.setBof(false);
-
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data.size());
- header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
-
- builder.handle(method);
- CPPUNIT_ASSERT(builder.getMessage());
- CPPUNIT_ASSERT(!builder.getMessage()->getFrames().isComplete());
-
- builder.handle(header);
- CPPUNIT_ASSERT(builder.getMessage());
- CPPUNIT_ASSERT(!builder.getMessage()->getFrames().isComplete());
-
- builder.handle(content);
- CPPUNIT_ASSERT(builder.getMessage());
- CPPUNIT_ASSERT(builder.getMessage()->getFrames().isComplete());
- }
-
- void test2ContentFrames(){
- MessageBuilder builder(0, 0);
- builder.start(SequenceNumber());
-
- std::string data1("abcdefg");
- std::string data2("hijklmn");
- std::string exchange("builder-exchange");
- std::string key("builder-exchange");
-
- AMQFrame method(in_place<MessageTransferBody>(
- ProtocolVersion(), 0, exchange, 0, 0));
- AMQFrame header(in_place<AMQHeaderBody>());
- AMQFrame content1(in_place<AMQContentBody>(data1));
- AMQFrame content2(in_place<AMQContentBody>(data2));
- method.setEof(false);
- header.setBof(false);
- header.setEof(false);
- content1.setBof(false);
- content1.setEof(false);
- content2.setBof(false);
-
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data1.size() + data2.size());
- header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
-
- builder.handle(method);
- builder.handle(header);
- builder.handle(content1);
- CPPUNIT_ASSERT(builder.getMessage());
- CPPUNIT_ASSERT(!builder.getMessage()->getFrames().isComplete());
-
- builder.handle(content2);
- CPPUNIT_ASSERT(builder.getMessage());
- CPPUNIT_ASSERT(builder.getMessage()->getFrames().isComplete());
- }
-
- void testStaging(){
- MockMessageStore store;
- MessageBuilder builder(&store, 5);
- builder.start(SequenceNumber());
-
- std::string data1("abcdefg");
- std::string data2("hijklmn");
- std::string exchange("builder-exchange");
- std::string key("builder-exchange");
-
- AMQFrame method(in_place<MessageTransferBody>(
- ProtocolVersion(), 0, exchange, 0, 0));
- AMQFrame header(in_place<AMQHeaderBody>());
- AMQFrame content1(in_place<AMQContentBody>(data1));
- AMQFrame content2(in_place<AMQContentBody>(data2));
-
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data1.size() + data2.size());
- header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
-
- builder.handle(method);
- builder.handle(header);
-
- store.expectStage(*builder.getMessage());
- builder.handle(content1);
- CPPUNIT_ASSERT(store.expectationsMet());
- CPPUNIT_ASSERT_EQUAL((uint64_t) 1, builder.getMessage()->getPersistenceId());
-
- store.expectAppendContent(*builder.getMessage(), data2);
- builder.handle(content2);
- CPPUNIT_ASSERT(store.expectationsMet());
-
- //were the content frames dropped?
- CPPUNIT_ASSERT_EQUAL((uint64_t) 0, builder.getMessage()->contentSize());
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(MessageBuilderTest);
diff --git a/qpid/cpp/src/tests/MessageTest.cpp b/qpid/cpp/src/tests/MessageTest.cpp
deleted file mode 100644
index a19080e1ce..0000000000
--- a/qpid/cpp/src/tests/MessageTest.cpp
+++ /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.
- *
- */
-#include "qpid/broker/Message.h"
-#include "qpid/framing/AMQP_HighestVersion.h"
-#include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/FieldValue.h"
-
-#include "qpid_test_plugin.h"
-
-#include <iostream>
-
-using namespace boost;
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-
-class MessageTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(MessageTest);
- CPPUNIT_TEST(testEncodeDecode);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testEncodeDecode()
- {
- string exchange = "MyExchange";
- string routingKey = "MyRoutingKey";
- string messageId = "MyMessage";
- string data1("abcdefg");
- string data2("hijklmn");
-
- intrusive_ptr<Message> msg(new Message());
-
- AMQFrame method(in_place<MessageTransferBody>(
- ProtocolVersion(), 0, exchange, 0, 0));
- AMQFrame header(in_place<AMQHeaderBody>());
- AMQFrame content1(in_place<AMQContentBody>(data1));
- AMQFrame content2(in_place<AMQContentBody>(data2));
-
- msg->getFrames().append(method);
- msg->getFrames().append(header);
- msg->getFrames().append(content1);
- msg->getFrames().append(content2);
-
- MessageProperties* mProps = msg->getFrames().getHeaders()->get<MessageProperties>(true);
- mProps->setContentLength(data1.size() + data2.size());
- mProps->setMessageId(messageId);
- FieldTable applicationHeaders;
- applicationHeaders.setString("abc", "xyz");
- mProps->setApplicationHeaders(applicationHeaders);
- DeliveryProperties* dProps = msg->getFrames().getHeaders()->get<DeliveryProperties>(true);
- dProps->setRoutingKey(routingKey);
- dProps->setDeliveryMode(PERSISTENT);
- CPPUNIT_ASSERT(msg->isPersistent());
-
- char* buff = static_cast<char*>(::alloca(msg->encodedSize()));
- Buffer wbuffer(buff, msg->encodedSize());
- msg->encode(wbuffer);
-
- Buffer rbuffer(buff, msg->encodedSize());
- msg = new Message();
- msg->decodeHeader(rbuffer);
- msg->decodeContent(rbuffer);
- CPPUNIT_ASSERT_EQUAL(exchange, msg->getExchangeName());
- CPPUNIT_ASSERT_EQUAL(routingKey, msg->getRoutingKey());
- CPPUNIT_ASSERT_EQUAL((uint64_t) data1.size() + data2.size(), msg->contentSize());
- CPPUNIT_ASSERT_EQUAL((uint64_t) data1.size() + data2.size(), msg->getProperties<MessageProperties>()->getContentLength());
- CPPUNIT_ASSERT_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());
- CPPUNIT_ASSERT(StringValue("xyz") == *msg->getProperties<MessageProperties>()->getApplicationHeaders().get("abc"));
- CPPUNIT_ASSERT_EQUAL((uint8_t) PERSISTENT, msg->getProperties<DeliveryProperties>()->getDeliveryMode());
- CPPUNIT_ASSERT(msg->isPersistent());
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(MessageTest);
-
diff --git a/qpid/cpp/src/tests/MessageUtils.h b/qpid/cpp/src/tests/MessageUtils.h
deleted file mode 100644
index 117473bb5e..0000000000
--- a/qpid/cpp/src/tests/MessageUtils.h
+++ /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.
- *
- */
-
-#include "qpid/broker/Message.h"
-#include "qpid/broker/MessageDelivery.h"
-#include "qpid/framing/AMQFrame.h"
-
-using namespace qpid;
-using namespace broker;
-using namespace framing;
-
-struct MessageUtils
-{
- static intrusive_ptr<Message> createMessage(const string& exchange, const string& routingKey,
- const string& messageId, uint64_t contentSize = 0)
- {
- intrusive_ptr<Message> msg(new Message());
-
- AMQFrame method(in_place<MessageTransferBody>(ProtocolVersion(), 0, exchange, 0, 0));
- AMQFrame header(in_place<AMQHeaderBody>());
-
- msg->getFrames().append(method);
- msg->getFrames().append(header);
- MessageProperties* props = msg->getFrames().getHeaders()->get<MessageProperties>(true);
- props->setContentLength(contentSize);
- props->setMessageId(messageId);
- msg->getFrames().getHeaders()->get<DeliveryProperties>(true)->setRoutingKey(routingKey);
- return msg;
- }
-
- static void addContent(intrusive_ptr<Message> msg, const string& data)
- {
- AMQFrame content(in_place<AMQContentBody>(data));
- msg->getFrames().append(content);
- }
-};
diff --git a/qpid/cpp/src/tests/MockConnectionInputHandler.h b/qpid/cpp/src/tests/MockConnectionInputHandler.h
deleted file mode 100644
index d104e7d934..0000000000
--- a/qpid/cpp/src/tests/MockConnectionInputHandler.h
+++ /dev/null
@@ -1,113 +0,0 @@
-#ifndef _tests_MockConnectionInputHandler_h
-#define _tests_MockConnectionInputHandler_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/sys/ConnectionInputHandler.h"
-#include "qpid/sys/ConnectionInputHandlerFactory.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid/framing/ProtocolInitiation.h"
-
-struct MockConnectionInputHandler : public qpid::sys::ConnectionInputHandler {
-
- MockConnectionInputHandler() : state(START) {}
-
- ~MockConnectionInputHandler() {}
-
- void initiated(const qpid::framing::ProtocolInitiation& pi) {
- qpid::sys::Monitor::ScopedLock l(monitor);
- init = pi;
- setState(GOT_INIT);
- }
-
- void received(qpid::framing::AMQFrame* framep) {
- qpid::sys::Monitor::ScopedLock l(monitor);
- frame = *framep;
- setState(GOT_FRAME);
- }
-
- qpid::framing::ProtocolInitiation waitForProtocolInit() {
- waitFor(GOT_INIT);
- return init;
- }
-
- qpid::framing::AMQFrame waitForFrame() {
- waitFor(GOT_FRAME);
- return frame;
- }
-
- void waitForClosed() {
- waitFor(CLOSED);
- }
-
- void closed() {
- qpid::sys::Monitor::ScopedLock l(monitor);
- setState(CLOSED);
- }
-
- void idleOut() {}
- void idleIn() {}
-
- private:
- typedef enum { START, GOT_INIT, GOT_FRAME, CLOSED } State;
-
- void setState(State s) {
- state = s;
- monitor.notify();
- }
-
- void waitFor(State s) {
- qpid::sys::Monitor::ScopedLock l(monitor);
- qpid::sys::Time deadline = qpid::sys::now() + 10*qpid::sys::TIME_SEC;
- while (state != s)
- CPPUNIT_ASSERT(monitor.wait(deadline));
- }
-
- qpid::sys::Monitor monitor;
- State state;
- qpid::framing::ProtocolInitiation init;
- qpid::framing::AMQFrame frame;
-};
-
-
-struct MockConnectionInputHandlerFactory : public qpid::sys::ConnectionInputHandlerFactory {
- MockConnectionInputHandlerFactory() : handler(0) {}
-
- qpid::sys::ConnectionInputHandler* create(qpid::sys::ConnectionOutputHandler*) {
- qpid::sys::Monitor::ScopedLock lock(monitor);
- handler = new MockConnectionInputHandler();
- monitor.notifyAll();
- return handler;
- }
-
- void waitForHandler() {
- qpid::sys::Monitor::ScopedLock lock(monitor);
- qpid::sys::Time deadline =
- qpid::sys::now() + 500 * qpid::sys::TIME_SEC;
- while (handler == 0)
- CPPUNIT_ASSERT(monitor.wait(deadline));
- }
-
- MockConnectionInputHandler* handler;
- qpid::sys::Monitor monitor;
-};
-
-
-
-#endif /*!_tests_MockConnectionInputHandler_h*/
diff --git a/qpid/cpp/src/tests/PollerTest.cpp b/qpid/cpp/src/tests/PollerTest.cpp
deleted file mode 100644
index fcb1d0dadf..0000000000
--- a/qpid/cpp/src/tests/PollerTest.cpp
+++ /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.
- *
- */
-
-/**
- * Use socketpair to test the poller
- */
-
-#include "qpid/sys/Poller.h"
-
-#include <string>
-#include <iostream>
-#include <memory>
-#include <exception>
-
-#include <assert.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-using namespace std;
-using namespace qpid::sys;
-
-int writeALot(int fd, const string& s) {
- int bytesWritten = 0;
- do {
- errno = 0;
- int lastWrite = ::write(fd, s.c_str(), s.size());
- if ( lastWrite >= 0) {
- bytesWritten += lastWrite;
- }
- } while (errno != EAGAIN);
- return bytesWritten;
-}
-
-int readALot(int fd) {
- int bytesRead = 0;
- char buf[1024];
-
- do {
- errno = 0;
- int lastRead = ::read(fd, buf, sizeof(buf));
- if ( lastRead >= 0) {
- bytesRead += lastRead;
- }
- } while (errno != EAGAIN);
- return bytesRead;
-}
-
-int main(int argc, char** argv)
-{
- try
- {
- int sv[2];
- int rc = ::socketpair(AF_LOCAL, SOCK_STREAM, 0, sv);
- assert(rc >= 0);
-
- // Set non-blocking
- rc = ::fcntl(sv[0], F_SETFL, O_NONBLOCK);
- assert(rc >= 0);
-
- rc = ::fcntl(sv[1], F_SETFL, O_NONBLOCK);
- assert(rc >= 0);
-
- // Make up a large string
- string testString = "This is only a test ... 1,2,3,4,5,6,7,8,9,10;";
- for (int i = 0; i < 6; i++)
- testString += testString;
-
- // Read as much as we can from socket 0
- int bytesRead = readALot(sv[0]);
- assert(bytesRead == 0);
- cout << "Read(0): " << bytesRead << " bytes\n";
-
- // Write as much as we can to socket 0
- int bytesWritten = writeALot(sv[0], testString);
- cout << "Wrote(0): " << bytesWritten << " bytes\n";
-
- // Read as much as we can from socket 1
- bytesRead = readALot(sv[1]);
- assert(bytesRead == bytesWritten);
- cout << "Read(1): " << bytesRead << " bytes\n";
-
- auto_ptr<Poller> poller(new Poller);
-
- PollerHandle h0(sv[0]);
- PollerHandle h1(sv[1]);
-
- poller->addFd(h0, Poller::INOUT);
-
- // Wait for 500ms - h0 should be writable
- Poller::Event event = poller->wait();
- assert(event.handle == &h0);
- assert(event.dir == Poller::OUT);
-
- // Write as much as we can to socket 0
- bytesWritten = writeALot(sv[0], testString);
- cout << "Wrote(0): " << bytesWritten << " bytes\n";
-
- // Wait for 500ms - h0 no longer writable
- poller->rearmFd(h0);
- event = poller->wait(500000000);
- assert(event.handle == 0);
-
- // Test we can read it all now
- poller->addFd(h1, Poller::INOUT);
- event = poller->wait();
- assert(event.handle == &h1);
- assert(event.dir == Poller::INOUT);
-
- bytesRead = readALot(sv[1]);
- assert(bytesRead == bytesWritten);
- cout << "Read(1): " << bytesRead << " bytes\n";
-
- // At this point h1 should have been disabled from the poller
- // (as it was just returned) and h0 can write again
- event = poller->wait();
- assert(event.handle == &h0);
- assert(event.dir == Poller::OUT);
-
- // Now both the handles should be disabled
- event = poller->wait(500000000);
- assert(event.handle == 0);
-
- // Test shutdown
- poller->shutdown();
- event = poller->wait();
- assert(event.handle == 0);
- assert(event.dir == Poller::SHUTDOWN);
-
- event = poller->wait();
- assert(event.handle == 0);
- assert(event.dir == Poller::SHUTDOWN);
-
- poller->delFd(h1);
- poller->delFd(h0);
-
- return 0;
- } catch (exception& e) {
- cout << "Caught exception " << e.what() << "\n";
- }
-}
-
-
diff --git a/qpid/cpp/src/tests/QueuePolicyTest.cpp b/qpid/cpp/src/tests/QueuePolicyTest.cpp
deleted file mode 100644
index 467f43638f..0000000000
--- a/qpid/cpp/src/tests/QueuePolicyTest.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
- /*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/broker/QueuePolicy.h"
-#include "qpid_test_plugin.h"
-
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-class QueuePolicyTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(QueuePolicyTest);
- CPPUNIT_TEST(testCount);
- CPPUNIT_TEST(testSize);
- CPPUNIT_TEST(testBoth);
- CPPUNIT_TEST(testSettings);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void testCount(){
- QueuePolicy policy(5, 0);
- CPPUNIT_ASSERT(!policy.limitExceeded());
- for (int i = 0; i < 5; i++) policy.enqueued(10);
- CPPUNIT_ASSERT_EQUAL((uint64_t) 0, policy.getMaxSize());
- CPPUNIT_ASSERT_EQUAL((uint32_t) 5, policy.getMaxCount());
- CPPUNIT_ASSERT(!policy.limitExceeded());
- policy.enqueued(10);
- CPPUNIT_ASSERT(policy.limitExceeded());
- policy.dequeued(10);
- CPPUNIT_ASSERT(!policy.limitExceeded());
- policy.enqueued(10);
- CPPUNIT_ASSERT(policy.limitExceeded());
- }
-
- void testSize(){
- QueuePolicy policy(0, 50);
- for (int i = 0; i < 5; i++) policy.enqueued(10);
- CPPUNIT_ASSERT(!policy.limitExceeded());
- policy.enqueued(10);
- CPPUNIT_ASSERT(policy.limitExceeded());
- policy.dequeued(10);
- CPPUNIT_ASSERT(!policy.limitExceeded());
- policy.enqueued(10);
- CPPUNIT_ASSERT(policy.limitExceeded());
- }
-
- void testBoth(){
- QueuePolicy policy(5, 50);
- for (int i = 0; i < 5; i++) policy.enqueued(11);
- CPPUNIT_ASSERT(policy.limitExceeded());
- policy.dequeued(20);
- CPPUNIT_ASSERT(!policy.limitExceeded());//fails
- policy.enqueued(5);
- policy.enqueued(10);
- CPPUNIT_ASSERT(policy.limitExceeded());
- }
-
- void testSettings(){
- //test reading and writing the policy from/to field table
- FieldTable settings;
- QueuePolicy a(101, 303);
- a.update(settings);
- QueuePolicy b(settings);
- CPPUNIT_ASSERT_EQUAL(a.getMaxCount(), b.getMaxCount());
- CPPUNIT_ASSERT_EQUAL(a.getMaxSize(), b.getMaxSize());
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(QueuePolicyTest);
-
diff --git a/qpid/cpp/src/tests/QueueRegistryTest.cpp b/qpid/cpp/src/tests/QueueRegistryTest.cpp
deleted file mode 100644
index 5fd861d6be..0000000000
--- a/qpid/cpp/src/tests/QueueRegistryTest.cpp
+++ /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.
- */
-
-#include "qpid/broker/QueueRegistry.h"
-#include "qpid_test_plugin.h"
-#include <string>
-
-using namespace qpid::broker;
-
-class QueueRegistryTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(QueueRegistryTest);
- CPPUNIT_TEST(testDeclare);
- CPPUNIT_TEST(testDeclareTmp);
- CPPUNIT_TEST(testFind);
- CPPUNIT_TEST(testDestroy);
- CPPUNIT_TEST_SUITE_END();
-
- private:
- std::string foo, bar;
- QueueRegistry reg;
- std::pair<Queue::shared_ptr, bool> qc;
-
- public:
- void setUp() {
- foo = "foo";
- bar = "bar";
- }
-
- void testDeclare() {
- qc = reg.declare(foo, false, 0, 0);
- Queue::shared_ptr q = qc.first;
- CPPUNIT_ASSERT(q);
- CPPUNIT_ASSERT(qc.second); // New queue
- CPPUNIT_ASSERT_EQUAL(foo, q->getName());
-
- qc = reg.declare(foo, false, 0, 0);
- CPPUNIT_ASSERT_EQUAL(q, qc.first);
- CPPUNIT_ASSERT(!qc.second);
-
- qc = reg.declare(bar, false, 0, 0);
- q = qc.first;
- CPPUNIT_ASSERT(q);
- CPPUNIT_ASSERT_EQUAL(true, qc.second);
- CPPUNIT_ASSERT_EQUAL(bar, q->getName());
- }
-
- void testDeclareTmp()
- {
- qc = reg.declare(std::string(), false, 0, 0);
- CPPUNIT_ASSERT(qc.second);
- CPPUNIT_ASSERT_EQUAL(std::string("tmp_1"), qc.first->getName());
- }
-
- void testFind() {
- CPPUNIT_ASSERT(reg.find(foo) == 0);
-
- reg.declare(foo, false, 0, 0);
- reg.declare(bar, false, 0, 0);
- Queue::shared_ptr q = reg.find(bar);
- CPPUNIT_ASSERT(q);
- CPPUNIT_ASSERT_EQUAL(bar, q->getName());
- }
-
- void testDestroy() {
- qc = reg.declare(foo, false, 0, 0);
- reg.destroy(foo);
- // Queue is gone from the registry.
- CPPUNIT_ASSERT(reg.find(foo) == 0);
- // Queue is not actually destroyed till we drop our reference.
- CPPUNIT_ASSERT_EQUAL(foo, qc.first->getName());
- // We shoud be the only reference.
- CPPUNIT_ASSERT_EQUAL(1L, qc.first.use_count());
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(QueueRegistryTest);
diff --git a/qpid/cpp/src/tests/QueueTest.cpp b/qpid/cpp/src/tests/QueueTest.cpp
deleted file mode 100644
index fae0d88b7c..0000000000
--- a/qpid/cpp/src/tests/QueueTest.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
- /*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/Exception.h"
-#include "qpid/broker/Queue.h"
-#include "qpid/broker/Deliverable.h"
-#include "qpid/broker/ExchangeRegistry.h"
-#include "qpid/broker/QueueRegistry.h"
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include "boost/format.hpp"
-
-using namespace qpid;
-using namespace qpid::broker;
-using namespace qpid::framing;
-using namespace qpid::sys;
-
-
-class TestConsumer : public virtual Consumer{
-public:
- typedef shared_ptr<TestConsumer> shared_ptr;
-
- intrusive_ptr<Message> last;
- bool received;
- TestConsumer(): received(false) {};
-
- virtual bool deliver(QueuedMessage& msg){
- last = msg.payload;
- received = true;
- return true;
- };
- void notify() {}
-};
-
-class FailOnDeliver : public Deliverable
-{
-public:
- void deliverTo(Queue::shared_ptr& queue)
- {
- throw Exception(QPID_MSG("Invalid delivery to " << queue->getName()));
- }
-};
-
-class QueueTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(QueueTest);
- CPPUNIT_TEST(testConsumers);
- CPPUNIT_TEST(testRegistry);
- CPPUNIT_TEST(testDequeue);
- CPPUNIT_TEST(testBound);
- CPPUNIT_TEST(testAsyncMessage);
- CPPUNIT_TEST(testAsyncMessageCount);
- CPPUNIT_TEST_SUITE_END();
-
-
- public:
- intrusive_ptr<Message> message(std::string exchange, std::string routingKey) {
- intrusive_ptr<Message> msg(new Message());
- AMQFrame method(in_place<MessageTransferBody>(
- ProtocolVersion(), 0, exchange, 0, 0));
- AMQFrame header(in_place<AMQHeaderBody>());
- msg->getFrames().append(method);
- msg->getFrames().append(header);
- msg->getFrames().getHeaders()->get<DeliveryProperties>(true)->setRoutingKey(routingKey);
- return msg;
- }
-
-
- void testAsyncMessage(){
-
- Queue::shared_ptr queue(new Queue("my_test_queue", true));
- intrusive_ptr<Message> received;
-
- TestConsumer c1;
- queue->consume(c1);
-
-
- //Test basic delivery:
- intrusive_ptr<Message> msg1 = message("e", "A");
- msg1->enqueueAsync();//this is done on enqueue which is not called from process
- queue->process(msg1);
- sleep(2);
-
- CPPUNIT_ASSERT(!c1.received);
- msg1->enqueueComplete();
-
- received = queue->dequeue().payload;
- CPPUNIT_ASSERT_EQUAL(msg1.get(), received.get());
-
-
- }
-
-
- void testAsyncMessageCount(){
- Queue::shared_ptr queue(new Queue("my_test_queue", true));
- intrusive_ptr<Message> msg1 = message("e", "A");
- msg1->enqueueAsync();//this is done on enqueue which is not called from process
-
- queue->process(msg1);
- sleep(2);
- uint32_t compval=0;
- CPPUNIT_ASSERT_EQUAL(compval, queue->getMessageCount());
- msg1->enqueueComplete();
- compval=1;
- CPPUNIT_ASSERT_EQUAL(compval, queue->getMessageCount());
-
- }
-
- void testConsumers(){
- Queue::shared_ptr queue(new Queue("my_queue", true));
-
- //Test adding consumers:
- TestConsumer c1;
- TestConsumer c2;
- queue->consume(c1);
- queue->consume(c2);
-
- CPPUNIT_ASSERT_EQUAL(uint32_t(2), queue->getConsumerCount());
-
- //Test basic delivery:
- intrusive_ptr<Message> msg1 = message("e", "A");
- intrusive_ptr<Message> msg2 = message("e", "B");
- intrusive_ptr<Message> msg3 = message("e", "C");
-
- queue->deliver(msg1);
- CPPUNIT_ASSERT(queue->dispatch(c1));
- CPPUNIT_ASSERT_EQUAL(msg1.get(), c1.last.get());
-
- queue->deliver(msg2);
- CPPUNIT_ASSERT(queue->dispatch(c2));
- CPPUNIT_ASSERT_EQUAL(msg2.get(), c2.last.get());
-
- c1.received = false;
- queue->deliver(msg3);
- CPPUNIT_ASSERT(queue->dispatch(c1));
- CPPUNIT_ASSERT_EQUAL(msg3.get(), c1.last.get());
-
- //Test cancellation:
- queue->cancel(c1);
- CPPUNIT_ASSERT_EQUAL(uint32_t(1), queue->getConsumerCount());
- queue->cancel(c2);
- CPPUNIT_ASSERT_EQUAL(uint32_t(0), queue->getConsumerCount());
- }
-
- void testRegistry(){
- //Test use of queues in registry:
- QueueRegistry registry;
- registry.declare("queue1", true, true);
- registry.declare("queue2", true, true);
- registry.declare("queue3", true, true);
-
- CPPUNIT_ASSERT(registry.find("queue1"));
- CPPUNIT_ASSERT(registry.find("queue2"));
- CPPUNIT_ASSERT(registry.find("queue3"));
-
- registry.destroy("queue1");
- registry.destroy("queue2");
- registry.destroy("queue3");
-
- CPPUNIT_ASSERT(!registry.find("queue1"));
- CPPUNIT_ASSERT(!registry.find("queue2"));
- CPPUNIT_ASSERT(!registry.find("queue3"));
- }
-
- void testDequeue(){
- Queue::shared_ptr queue(new Queue("my_queue", true));
- intrusive_ptr<Message> msg1 = message("e", "A");
- intrusive_ptr<Message> msg2 = message("e", "B");
- intrusive_ptr<Message> msg3 = message("e", "C");
- intrusive_ptr<Message> received;
-
- queue->deliver(msg1);
- queue->deliver(msg2);
- queue->deliver(msg3);
-
- CPPUNIT_ASSERT_EQUAL(uint32_t(3), queue->getMessageCount());
-
- received = queue->dequeue().payload;
- CPPUNIT_ASSERT_EQUAL(msg1.get(), received.get());
- CPPUNIT_ASSERT_EQUAL(uint32_t(2), queue->getMessageCount());
-
- received = queue->dequeue().payload;
- CPPUNIT_ASSERT_EQUAL(msg2.get(), received.get());
- CPPUNIT_ASSERT_EQUAL(uint32_t(1), queue->getMessageCount());
-
- TestConsumer consumer;
- queue->consume(consumer);
- queue->dispatch(consumer);
- if (!consumer.received)
- sleep(2);
-
- CPPUNIT_ASSERT_EQUAL(msg3.get(), consumer.last.get());
- CPPUNIT_ASSERT_EQUAL(uint32_t(0), queue->getMessageCount());
-
- received = queue->dequeue().payload;
- CPPUNIT_ASSERT(!received);
- CPPUNIT_ASSERT_EQUAL(uint32_t(0), queue->getMessageCount());
-
- }
-
- void testBound()
- {
- //test the recording of bindings, and use of those to allow a queue to be unbound
- string key("my-key");
- FieldTable args;
-
- Queue::shared_ptr queue(new Queue("my-queue", true));
- ExchangeRegistry exchanges;
- //establish bindings from exchange->queue and notify the queue as it is bound:
- Exchange::shared_ptr exchange1 = exchanges.declare("my-exchange-1", "direct").first;
- exchange1->bind(queue, key, &args);
- queue->bound(exchange1->getName(), key, args);
-
- Exchange::shared_ptr exchange2 = exchanges.declare("my-exchange-2", "fanout").first;
- exchange2->bind(queue, key, &args);
- queue->bound(exchange2->getName(), key, args);
-
- Exchange::shared_ptr exchange3 = exchanges.declare("my-exchange-3", "topic").first;
- exchange3->bind(queue, key, &args);
- queue->bound(exchange3->getName(), key, args);
-
- //delete one of the exchanges:
- exchanges.destroy(exchange2->getName());
- exchange2.reset();
-
- //unbind the queue from all exchanges it knows it has been bound to:
- queue->unbind(exchanges, queue);
-
- //ensure the remaining exchanges don't still have the queue bound to them:
- FailOnDeliver deliverable;
- exchange1->route(deliverable, key, &args);
- exchange3->route(deliverable, key, &args);
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(QueueTest);
-
-
diff --git a/qpid/cpp/src/tests/README b/qpid/cpp/src/tests/README
deleted file mode 100644
index 3cf6fab2ad..0000000000
--- a/qpid/cpp/src/tests/README
+++ /dev/null
@@ -1,71 +0,0 @@
-= Running Qpid C++ tests =
-
-General philosophy is that "make check" run all tests by default, but
-developers can run tests selectively as explained below.
-
-== Valgrind ==
-
-By default we run tests under valgrind to detect memory errors if valgrind
-is present. ./configure --disable-valgrind will disable it.
-
-Default valgrind options are specified in .valgrindrc-default, which a
-checked-in file. The actual options used are in .valgrindrc which is a
-local file. Normally it is a copy of valgrindrc-default but you can
-modify at will.
-
-Supressed errors are listed in .valgrind.supp. If you want to change
-suppressions for local testing, just modify .valgrindrc to point to a
-different file. Do NOT add suppressions to .valgrindrc.supp unless
-they are known problems outside of Qpid that can't reasonably be
-worked around in Qpid.
-
-
-== Unit Tests ==
-
-Unit tests shared libraries containing CppUnit test plug-ins, run by
-the CppUnit DllPlugInTester program.
-
-run-unit-tests runs tests under valgrind, you can run it directly.
-Library names (without path or .so) and CppUnit test paths can be
-specified on the command line or in env var UNIT_TESTS. For example:
-
-Selected test classes:
-./run-unit-tests ValueTest ClientChannelTest
-
-Individual test method
-./run-unit-tests ValueTest :ValueTest::testStringValueEquals
-
-You can also Build and run selected tests via make:
-make check TESTS=run-unit-tests UNIT_TESTS=ClientChannelTest
-
-NOTE: If you use DllPlugInTester directly note that if foobar.so is in
-the current directory then this will fail with "can't load plugin":
- # DllPluginTester foobar.so
-
-Instead you need to say:
- # DllPluginTester ./foobar.so
-
-DllPluginTester uses dlopen() which only searches for shlibs
-in the standard places unless the filename contains a "/". In that
-case it just tries to open the filename.
-
-== System Tests ==
-
-System tests are self contained AMQP client executables or scripts.
-They are listed in the TESTS make variable, which can be over-ridden.
-
-The ./start_broker "test" launches the broker, ./stop_broker" stops it.
-Tests in between assume the broker is running.
-
-./python_tests: runs ../python/run_tests. This is the main set of
-system testss for the broker.
-
-Other C++ client test executables and scripts under client/test are
-system tests for the client.
-
-By setting TESTS in a make command you can run a different subset of tests
-against an already-running broker.
-
-
-
-
diff --git a/qpid/cpp/src/tests/RefCounted.cpp b/qpid/cpp/src/tests/RefCounted.cpp
deleted file mode 100644
index d111d58712..0000000000
--- a/qpid/cpp/src/tests/RefCounted.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/RefCounted.h"
-
-#include "unit_test.h"
-
-QPID_AUTO_TEST_SUITE(RefCountedTestSuiteTestSuite)
-
-using namespace std;
-using namespace qpid;
-
-struct DummyCounted : public AbstractRefCounted {
- DummyCounted() : count(0) {}
- mutable int count;
- virtual void addRef() const { count++; }
- virtual void release() const { count--; }
-};
-
-BOOST_AUTO_TEST_CASE(testIntrusivePtr) {
- DummyCounted dummy;
- BOOST_CHECK_EQUAL(0, dummy.count);
- {
- intrusive_ptr<DummyCounted> p(&dummy);
- BOOST_CHECK_EQUAL(1, dummy.count);
- {
- intrusive_ptr<DummyCounted> q(p);
- BOOST_CHECK_EQUAL(2, dummy.count);
- intrusive_ptr<DummyCounted> r;
- r=q;
- BOOST_CHECK_EQUAL(3, dummy.count);
- }
- BOOST_CHECK_EQUAL(1, dummy.count);
- }
- BOOST_CHECK_EQUAL(0, dummy.count);
-}
-
-struct CountMe : public RefCounted {
- static int instances;
- CountMe() { ++instances; }
- ~CountMe() { --instances; }
-};
-
-int CountMe::instances=0;
-
-BOOST_AUTO_TEST_CASE(testRefCounted) {
- BOOST_CHECK_EQUAL(0, CountMe::instances);
- intrusive_ptr<CountMe> p(new CountMe());
- BOOST_CHECK_EQUAL(1, CountMe::instances);
- intrusive_ptr<CountMe> q(p);
- BOOST_CHECK_EQUAL(1, CountMe::instances);
- q=0;
- BOOST_CHECK_EQUAL(1, CountMe::instances);
- p=0;
- BOOST_CHECK_EQUAL(0, CountMe::instances);
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/RefCountedMap.cpp b/qpid/cpp/src/tests/RefCountedMap.cpp
deleted file mode 100644
index 79a0d94eb7..0000000000
--- a/qpid/cpp/src/tests/RefCountedMap.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/sys/RefCountedMap.h"
-#include "unit_test.h"
-#include "test_tools.h"
-#include <boost/bind.hpp>
-#include <map>
-
-QPID_AUTO_TEST_SUITE(RefCountedMapTestSuite)
-
-using namespace std;
-using namespace qpid;
-using namespace qpid::sys;
-
-template <int Id> struct Counted {
- static int instances;
- Counted() { ++instances; }
- Counted(const Counted&) { ++instances; }
- ~Counted() { --instances; }
-};
-template <int Id>int Counted<Id>::instances=0;
-
-struct Data : public RefCountedMapData<int, Data>, public Counted<2> {
- Data(int i=0) : value(i) {}
- int value;
- void inc() { value++; }
-};
-
-struct Container : public RefCounted, public Counted<3> {
- Data::Map map;
- Container() : map(*this) {}
-};
-
-struct RefCountedMapFixture {
- intrusive_ptr<Container> cont;
- intrusive_ptr<Data> p, q;
- RefCountedMapFixture() :
- cont(new Container()), p(new Data(1)), q(new Data(2))
- {
- cont->map.insert(1,p);
- cont->map.insert(2,q);
- }
- ~RefCountedMapFixture() { if (cont) cont->map.clear(); }
-};
-
-BOOST_FIXTURE_TEST_CASE(testFixtureSetup, RefCountedMapFixture) {
- BOOST_CHECK_EQUAL(1, Container::instances);
- BOOST_CHECK_EQUAL(2, Data::instances);
- BOOST_CHECK_EQUAL(cont->map.size(), 2u);
- BOOST_CHECK_EQUAL(cont->map.find(1)->value, 1);
- BOOST_CHECK_EQUAL(cont->map.find(2)->value, 2);
-}
-
-BOOST_FIXTURE_TEST_CASE(testReleaseRemoves, RefCountedMapFixture)
-{
- // Release external ref, removes from map
- p = 0;
- BOOST_CHECK_EQUAL(Data::instances, 1);
- BOOST_CHECK_EQUAL(cont->map.size(), 1u);
- BOOST_CHECK(!cont->map.find(1));
- BOOST_CHECK_EQUAL(cont->map.find(2)->value, 2);
-
- q = 0;
- BOOST_CHECK(cont->map.empty());
-}
-
-// Functor that releases values as a side effect.
-struct Release {
- RefCountedMapFixture& f ;
- Release(RefCountedMapFixture& ff) : f(ff) {}
- void operator()(const intrusive_ptr<Data>& ptr) {
- BOOST_CHECK(ptr->value > 0); // Make sure ptr is not released.
- f.p = 0;
- f.q = 0;
- BOOST_CHECK(ptr->value > 0); // Make sure ptr is not released.
- }
-};
-
-
-BOOST_FIXTURE_TEST_CASE(testApply, RefCountedMapFixture) {
- cont->map.apply(boost::bind(&Data::inc, _1));
- BOOST_CHECK_EQUAL(2, p->value);
- BOOST_CHECK_EQUAL(3, q->value);
-
- // Allow functors to release valuse as side effects.
- cont->map.apply(Release(*this));
- BOOST_CHECK(cont->map.empty());
- BOOST_CHECK_EQUAL(Data::instances, 0);
-}
-
-BOOST_FIXTURE_TEST_CASE(testClearFunctor, RefCountedMapFixture) {
- cont->map.clear(boost::bind(&Data::inc, _1));
- BOOST_CHECK(cont->map.empty());
- BOOST_CHECK_EQUAL(2, p->value);
- BOOST_CHECK_EQUAL(3, q->value);
-}
-
-BOOST_FIXTURE_TEST_CASE(testReleaseEmptyMap, RefCountedMapFixture) {
- // Container must not be deleted till map is empty.
- cont = 0;
- BOOST_CHECK_EQUAL(1, Container::instances); // Not empty.
- p = 0;
- q = 0;
- BOOST_CHECK_EQUAL(0, Container::instances); // Deleted
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/SequenceNumberTest.cpp b/qpid/cpp/src/tests/SequenceNumberTest.cpp
deleted file mode 100644
index d227b78323..0000000000
--- a/qpid/cpp/src/tests/SequenceNumberTest.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include "qpid/framing/SequenceNumber.h"
-#include "qpid/framing/SequenceNumberSet.h"
-
-using namespace qpid::framing;
-
-class SequenceNumberTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(SequenceNumberTest);
- CPPUNIT_TEST(testIncrementPostfix);
- CPPUNIT_TEST(testIncrementPrefix);
- CPPUNIT_TEST(testWrapAround);
- CPPUNIT_TEST(testCondense);
- CPPUNIT_TEST(testCondenseSingleRange);
- CPPUNIT_TEST(testCondenseSingleItem);
- CPPUNIT_TEST(testDifference);
- CPPUNIT_TEST(testDifferenceWithWrapAround1);
- CPPUNIT_TEST(testDifferenceWithWrapAround2);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testIncrementPostfix()
- {
- SequenceNumber a;
- SequenceNumber b;
- CPPUNIT_ASSERT(!(a > b));
- CPPUNIT_ASSERT(!(b < a));
- CPPUNIT_ASSERT(a == b);
-
- SequenceNumber c = a++;
- CPPUNIT_ASSERT(a > b);
- CPPUNIT_ASSERT(b < a);
- CPPUNIT_ASSERT(a != b);
- CPPUNIT_ASSERT(c < a);
- CPPUNIT_ASSERT(a != c);
-
- b++;
- CPPUNIT_ASSERT(!(a > b));
- CPPUNIT_ASSERT(!(b < a));
- CPPUNIT_ASSERT(a == b);
- CPPUNIT_ASSERT(c < b);
- CPPUNIT_ASSERT(b != c);
- }
-
- void testIncrementPrefix()
- {
- SequenceNumber a;
- SequenceNumber b;
- CPPUNIT_ASSERT(!(a > b));
- CPPUNIT_ASSERT(!(b < a));
- CPPUNIT_ASSERT(a == b);
-
- SequenceNumber c = ++a;
- CPPUNIT_ASSERT(a > b);
- CPPUNIT_ASSERT(b < a);
- CPPUNIT_ASSERT(a != b);
- CPPUNIT_ASSERT(a == c);
-
- ++b;
- CPPUNIT_ASSERT(!(a > b));
- CPPUNIT_ASSERT(!(b < a));
- CPPUNIT_ASSERT(a == b);
- }
-
- void testWrapAround()
- {
- const uint32_t max = 0xFFFFFFFF;
- SequenceNumber a(max - 10);
- SequenceNumber b(max - 5);
- checkComparison(a, b, 5);
-
- const uint32_t max_signed = 0x7FFFFFFF;
- SequenceNumber c(max_signed - 10);
- SequenceNumber d(max_signed - 5);
- checkComparison(c, d, 5);
- }
-
- void checkComparison(SequenceNumber& a, SequenceNumber& b, int gap)
- {
- //increment until b wraps around
- for (int i = 0; i < (gap + 2); i++) {
- CPPUNIT_ASSERT(++a < ++b);//test prefix
- }
- //keep incrementing until a also wraps around
- for (int i = 0; i < (gap + 2); i++) {
- CPPUNIT_ASSERT(a++ < b++);//test postfix
- }
- //let a 'catch up'
- for (int i = 0; i < gap; i++) {
- a++;
- }
- CPPUNIT_ASSERT(a == b);
- CPPUNIT_ASSERT(++a > b);
- }
-
- void testCondense()
- {
- SequenceNumberSet set;
- for (uint i = 0; i < 6; i++) {
- set.push_back(SequenceNumber(i));
- }
- set.push_back(SequenceNumber(7));
- for (uint i = 9; i < 13; i++) {
- set.push_back(SequenceNumber(i));
- }
- set.push_back(SequenceNumber(13));
- SequenceNumberSet actual = set.condense();
-
- SequenceNumberSet expected;
- expected.addRange(SequenceNumber(0), SequenceNumber(5));
- expected.addRange(SequenceNumber(7), SequenceNumber(7));
- expected.addRange(SequenceNumber(9), SequenceNumber(13));
- CPPUNIT_ASSERT_EQUAL(expected, actual);
- }
-
- void testCondenseSingleRange()
- {
- SequenceNumberSet set;
- for (uint i = 0; i < 6; i++) {
- set.push_back(SequenceNumber(i));
- }
- SequenceNumberSet actual = set.condense();
-
- SequenceNumberSet expected;
- expected.addRange(SequenceNumber(0), SequenceNumber(5));
- CPPUNIT_ASSERT_EQUAL(expected, actual);
- }
-
- void testCondenseSingleItem()
- {
- SequenceNumberSet set;
- set.push_back(SequenceNumber(1));
- SequenceNumberSet actual = set.condense();
-
- SequenceNumberSet expected;
- expected.addRange(SequenceNumber(1), SequenceNumber(1));
- CPPUNIT_ASSERT_EQUAL(expected, actual);
- }
-
- void testDifference()
- {
- SequenceNumber a;
- SequenceNumber b;
-
- for (int i = 0; i < 10; i++, ++a) {
- CPPUNIT_ASSERT_EQUAL(i, a - b);
- CPPUNIT_ASSERT_EQUAL(-i, b - a);
- }
-
- b = a;
-
- for (int i = 0; i < 10; i++, ++b) {
- CPPUNIT_ASSERT_EQUAL(-i, a - b);
- CPPUNIT_ASSERT_EQUAL(i, b - a);
- }
- }
-
- void testDifferenceWithWrapAround1()
- {
- const uint32_t max = 0xFFFFFFFF;
- SequenceNumber a(max - 5);
- SequenceNumber b(max - 10);
- checkDifference(a, b, 5);
- }
-
- void testDifferenceWithWrapAround2()
- {
- const uint32_t max_signed = 0x7FFFFFFF;
- SequenceNumber c(max_signed - 5);
- SequenceNumber d(max_signed - 10);
- checkDifference(c, d, 5);
- }
-
- void checkDifference(SequenceNumber& a, SequenceNumber& b, int gap)
- {
- CPPUNIT_ASSERT_EQUAL(gap, a - b);
- CPPUNIT_ASSERT_EQUAL(-gap, b - a);
-
- //increment until b wraps around
- for (int i = 0; i < (gap + 2); i++, ++a, ++b) {
- CPPUNIT_ASSERT_EQUAL(gap, a - b);
- }
- //keep incrementing until a also wraps around
- for (int i = 0; i < (gap + 2); i++, ++a, ++b) {
- CPPUNIT_ASSERT_EQUAL(gap, a - b);
- }
- //let b catch up and overtake
- for (int i = 0; i < (gap*2); i++, ++b) {
- CPPUNIT_ASSERT_EQUAL(gap - i, a - b);
- CPPUNIT_ASSERT_EQUAL(i - gap, b - a);
- }
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(SequenceNumberTest);
diff --git a/qpid/cpp/src/tests/Serializer.cpp b/qpid/cpp/src/tests/Serializer.cpp
deleted file mode 100644
index 51b739218d..0000000000
--- a/qpid/cpp/src/tests/Serializer.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/sys/Serializer.h"
-
-#include <boost/bind.hpp>
-#include <boost/utility/value_init.hpp>
-#include "unit_test.h"
-
-#include <set>
-
-#include <unistd.h>
-
-QPID_AUTO_TEST_SUITE(SerializerTestSuite)
-
-
-using namespace qpid;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using namespace std;
-
-typedef Serializer<boost::function<void()> > BoostFunctionSerializer;
-
-/** Test for concurrent calls */
-struct Tester {
- Monitor lock;
- size_t count;
- size_t collisions;
- set<long> threads;
-
- Tester() : count(0), collisions(0) {}
-
- void test() {
- if (lock.trylock()) { // Check for concurrent calls.
- ++count;
- threads.insert(Thread::logId()); // Record thread.
- usleep(1000); // Encourage overlap.
- lock.notify();
- lock.unlock();
- }
- else
- ++collisions;
- }
-};
-
-void execute(BoostFunctionSerializer& s, boost::function<void()> t)
-{
- s.execute(t);
-}
-
-BOOST_AUTO_TEST_CASE(testSingleThread) {
- // Verify that we call in the same thread by default.
- Tester tester;
- BoostFunctionSerializer s;
- for (int i = 0; i < 100; ++i)
- execute(s, boost::bind(&Tester::test, &tester));
- // All should be executed in this thread.
- BOOST_CHECK_EQUAL(0u, tester.collisions);
- BOOST_CHECK_EQUAL(100u, tester.count);
- BOOST_REQUIRE_EQUAL(1u, tester.threads.size());
- BOOST_CHECK_EQUAL(Thread::logId(), *tester.threads.begin());
-}
-
-
-BOOST_AUTO_TEST_CASE(testSingleThreadNoImmediate) {
- // Verify that we call in different thread if immediate=false.
- Tester tester;
- BoostFunctionSerializer s(false);
- for (int i = 0; i < 100; ++i)
- execute(s, boost::bind(&Tester::test, &tester));
- {
- // Wait for dispatch thread to complete.
- Mutex::ScopedLock l(tester.lock);
- while (tester.count != 100)
- tester.lock.wait();
- }
- BOOST_CHECK_EQUAL(0u, tester.collisions);
- BOOST_CHECK_EQUAL(100u, tester.count);
- BOOST_REQUIRE_EQUAL(1u, tester.threads.size());
- BOOST_CHECK(Thread::logId() != *tester.threads.begin());
-}
-
-struct Caller : public Runnable, public Tester {
- Caller(BoostFunctionSerializer& s) : serializer(s) {}
- void run() { execute(serializer, boost::bind(&Tester::test, this)); }
- BoostFunctionSerializer& serializer;
-};
-
-BOOST_AUTO_TEST_CASE(testDispatchThread) {
- BoostFunctionSerializer s;
- Caller caller(s);
- Thread threads[100];
- // Concurrent calls.
- for (size_t i = 0; i < 100; ++i)
- threads[i] = Thread(caller);
- for (size_t i = 0; i < 100; ++i)
- threads[i].join();
-
- // At least one task should have been queued.
- BOOST_CHECK_EQUAL(0u, caller.collisions);
- BOOST_CHECK(caller.threads.size() > 2u);
- BOOST_CHECK(caller.threads.size() < 100u);
-}
-
-
-std::auto_ptr<BoostFunctionSerializer> serializer;
-
-struct CallDispatch : public Runnable {
- void run() {
- serializer->dispatch();
- }
-};
-
-void notifyDispatch() {
- static CallDispatch cd;
- Thread t(cd);
-}
-
-// Use externally created threads.
-BOOST_AUTO_TEST_CASE(testExternalDispatch) {
- serializer.reset(new BoostFunctionSerializer(false, &notifyDispatch));
- Tester tester;
- for (int i = 0; i < 100; ++i)
- execute(*serializer, boost::bind(&Tester::test, &tester));
- {
- // Wait for dispatch thread to complete.
- Mutex::ScopedLock l(tester.lock);
- while (tester.count != 100)
- tester.lock.wait();
- }
- BOOST_CHECK_EQUAL(0u, tester.collisions);
- BOOST_CHECK_EQUAL(100u, tester.count);
- BOOST_CHECK(Thread::logId() != *tester.threads.begin());
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/SessionState.cpp b/qpid/cpp/src/tests/SessionState.cpp
deleted file mode 100644
index 56d0055ed8..0000000000
--- a/qpid/cpp/src/tests/SessionState.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/framing/SessionState.h"
-#include "qpid/Exception.h"
-
-#include <boost/bind.hpp>
-#include "unit_test.h"
-
-QPID_AUTO_TEST_SUITE(SessionStateTestSuite)
-
-using namespace std;
-using namespace qpid::framing;
-using namespace boost;
-
-// Create a frame with a one-char string.
-AMQFrame& frame(char s) {
- static AMQFrame frame;
- frame.setBody(AMQContentBody(string(&s, 1)));
- return frame;
-}
-
-// Extract the one-char string from a frame.
-char charFromFrame(const AMQFrame& f) {
- const AMQContentBody* b=dynamic_cast<const AMQContentBody*>(f.getBody());
- BOOST_REQUIRE(b && b->getData().size() > 0);
- return b->getData()[0];
-}
-
-// Sent chars as frames
-void sent(SessionState& session, const std::string& frames) {
- for_each(frames.begin(), frames.end(),
- bind(&SessionState::sent, ref(session), bind(frame, _1)));
-}
-
-// Received chars as frames
-void received(SessionState& session, const std::string& frames) {
- for_each(frames.begin(), frames.end(),
- bind(&SessionState::received, ref(session), bind(frame, _1)));
-}
-
-// Make a string from a ReplayRange.
-std::string replayChars(const SessionState::Replay& frames) {
- string result(frames.size(), ' ');
- transform(frames.begin(), frames.end(), result.begin(),
- bind(&charFromFrame, _1));
- return result;
-}
-
-namespace qpid {
-namespace framing {
-
-bool operator==(const AMQFrame& a, const AMQFrame& b) {
- const AMQContentBody* ab=dynamic_cast<const AMQContentBody*>(a.getBody());
- const AMQContentBody* bb=dynamic_cast<const AMQContentBody*>(b.getBody());
- return ab && bb && ab->getData() == bb->getData();
-}
-
-}} // namespace qpid::framing
-
-
-BOOST_AUTO_TEST_CASE(testSent) {
- // Test that we send solicit-ack at the right interval.
- AMQContentBody f;
- SessionState s1(1);
- BOOST_CHECK(s1.sent(f));
- BOOST_CHECK(s1.sent(f));
- BOOST_CHECK(s1.sent(f));
-
- SessionState s3(3);
- BOOST_CHECK(!s3.sent(f));
- BOOST_CHECK(!s3.sent(f));
- BOOST_CHECK(s3.sent(f));
-
- BOOST_CHECK(!s3.sent(f));
- BOOST_CHECK(!s3.sent(f));
- s3.receivedAck(4);
- BOOST_CHECK(!s3.sent(f));
- BOOST_CHECK(!s3.sent(f));
- BOOST_CHECK(s3.sent(f));
-}
-
-BOOST_AUTO_TEST_CASE(testReplay) {
- // Replay of all frames.
- SessionState session(100);
- sent(session, "abc");
- session.suspend(); session.resuming();
- session.receivedAck(-1);
- BOOST_CHECK_EQUAL(replayChars(session.replay()), "abc");
-
- // Replay with acks
- session.receivedAck(0); // ack a.
- session.suspend();
- session.resuming();
- session.receivedAck(1); // ack b.
- BOOST_CHECK_EQUAL(replayChars(session.replay()), "c");
-
- // Replay after further frames.
- sent(session, "def");
- session.suspend();
- session.resuming();
- session.receivedAck(3);
- BOOST_CHECK_EQUAL(replayChars(session.replay()), "ef");
-
- // Bad ack, too high
- try {
- session.receivedAck(6);
- BOOST_FAIL("expected exception");
- } catch(const std::exception&) {}
-
-}
-
-BOOST_AUTO_TEST_CASE(testReceived) {
- // Check that we request acks at the right interval.
- AMQContentBody f;
- SessionState s1(1);
- BOOST_CHECK_EQUAL(0u, *s1.received(f));
- BOOST_CHECK_EQUAL(1u, *s1.received(f));
- BOOST_CHECK_EQUAL(2u, *s1.received(f));
-
- SessionState s3(3);
- BOOST_CHECK(!s3.received(f));
- BOOST_CHECK(!s3.received(f));
- BOOST_CHECK_EQUAL(2u, *s3.received(f));
-
- BOOST_CHECK(!s3.received(f));
- BOOST_CHECK(!s3.received(f));
- BOOST_CHECK_EQUAL(5u, *s3.received(f));
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/Shlib.cpp b/qpid/cpp/src/tests/Shlib.cpp
deleted file mode 100644
index 3adc33aac9..0000000000
--- a/qpid/cpp/src/tests/Shlib.cpp
+++ /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.
- *
- */
-
-#include "test_tools.h"
-#include "qpid/sys/Shlib.h"
-#include "qpid/Exception.h"
-
-#include "unit_test.h"
-
-QPID_AUTO_TEST_SUITE(ShlibTestSuite)
-
-using namespace qpid::sys;
-typedef void (*CallMe)(int*);
-
-BOOST_AUTO_TEST_CASE(testShlib) {
- Shlib sh(".libs/libshlibtest.so");
- // Double cast to avoid ISO warning.
- CallMe callMe=sh.getSymbol<CallMe>("callMe");
- BOOST_REQUIRE(callMe != 0);
- int unloaded=0;
- callMe(&unloaded);
- sh.unload();
- BOOST_CHECK_EQUAL(42, unloaded);
- try {
- sh.getSymbol("callMe");
- BOOST_FAIL("Expected exception");
- }
- catch (const qpid::Exception&) {}
-}
-
-BOOST_AUTO_TEST_CASE(testAutoShlib) {
- int unloaded = 0;
- {
- AutoShlib sh(".libs/libshlibtest.so");
- CallMe callMe=sh.getSymbol<CallMe>("callMe");
- BOOST_REQUIRE(callMe != 0);
- callMe(&unloaded);
- }
- BOOST_CHECK_EQUAL(42, unloaded);
-}
-
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/SimpleTestCaseBase.cpp b/qpid/cpp/src/tests/SimpleTestCaseBase.cpp
deleted file mode 100644
index 4f071cd02b..0000000000
--- a/qpid/cpp/src/tests/SimpleTestCaseBase.cpp
+++ /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.
- *
- */
-#include "SimpleTestCaseBase.h"
-
-using namespace qpid;
-
-void SimpleTestCaseBase::start()
-{
- if (worker.get()) {
- worker->start();
- }
-}
-
-void SimpleTestCaseBase::stop()
-{
- if (worker.get()) {
- worker->stop();
- }
-}
-
-void SimpleTestCaseBase::report(client::Message& report)
-{
- if (worker.get()) {
- report.getHeaders().setInt("MESSAGE_COUNT", worker->getCount());
- //add number of messages sent or received
- std::stringstream reportstr;
- reportstr << worker->getCount();
- report.setData(reportstr.str());
- }
-}
-
-SimpleTestCaseBase::Sender::Sender(TestOptions& options,
- const Exchange& _exchange,
- const std::string& _key,
- const int _messages)
- : Worker(options, _messages), exchange(_exchange), key(_key) {}
-
-void SimpleTestCaseBase::Sender::init()
-{
- channel.start();
-}
-
-void SimpleTestCaseBase::Sender::start(){
- Message msg;
- while (count < messages) {
- channel.publish(msg, exchange, key);
- count++;
- }
- stop();
-}
-
-SimpleTestCaseBase::Worker::Worker(TestOptions& options, const int _messages) :
- connection(options.trace), messages(_messages), count(0)
-{
- connection.open(options.host, options.port);
- connection.openChannel(channel);
-}
-
-void SimpleTestCaseBase::Worker::stop()
-{
- channel.close();
- connection.close();
-}
-
-int SimpleTestCaseBase::Worker::getCount()
-{
- return count;
-}
-
diff --git a/qpid/cpp/src/tests/SimpleTestCaseBase.h b/qpid/cpp/src/tests/SimpleTestCaseBase.h
deleted file mode 100644
index 7f94fa7e1c..0000000000
--- a/qpid/cpp/src/tests/SimpleTestCaseBase.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef _SimpleTestCaseBase_
-#define _SimpleTestCaseBase_
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <memory>
-#include <sstream>
-
-#include "qpid/Exception.h"
-#include "qpid/client/Channel.h"
-#include "qpid/client/Message.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/MessageListener.h"
-#include "TestCase.h"
-
-
-namespace qpid {
-
-using namespace qpid::client;
-
-class SimpleTestCaseBase : public TestCase
-{
-protected:
- class Worker
- {
- protected:
- client::Connection connection;
- client::Channel channel;
- const int messages;
- int count;
-
- public:
-
- Worker(TestOptions& options, const int messages);
- virtual ~Worker(){}
-
- virtual void stop();
- virtual int getCount();
- virtual void init() = 0;
- virtual void start() = 0;
- };
-
- class Sender : public Worker
- {
- const Exchange& exchange;
- const std::string key;
- public:
- Sender(TestOptions& options,
- const Exchange& exchange,
- const std::string& key,
- const int messages);
- void init();
- void start();
- };
-
- std::auto_ptr<Worker> worker;
-
-public:
- virtual void assign(const std::string& role, framing::FieldTable& params, TestOptions& options) = 0;
-
- virtual ~SimpleTestCaseBase() {}
-
- void start();
- void stop();
- void report(client::Message& report);
-};
-
-}
-
-#endif
diff --git a/qpid/cpp/src/tests/SocketProxy.h b/qpid/cpp/src/tests/SocketProxy.h
deleted file mode 100644
index a37c1f2c3e..0000000000
--- a/qpid/cpp/src/tests/SocketProxy.h
+++ /dev/null
@@ -1,164 +0,0 @@
-#ifndef SOCKETPROXY_H
-#define SOCKETPROXY_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/sys/Socket.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/sys/Mutex.h"
-#include "qpid/client/Connection.h"
-#include "qpid/log/Statement.h"
-
-#include <algorithm>
-
-/**
- * A simple socket proxy that forwards to another socket.
- * Used between client & local broker to simulate network failures.
- */
-class SocketProxy : private qpid::sys::Runnable
-{
- public:
- /** Connect to connectPort on host, start a forwarding thread.
- * Listen for connection on getPort().
- */
- SocketProxy(int connectPort, const std::string host="localhost")
- : closed(false), port(listener.listen())
- {
- int r=::pipe(closePipe);
- if (r<0) throwErrno(QPID_MSG("::pipe returned " << r));
- client.connect(host, connectPort);
- thread = qpid::sys::Thread(static_cast<qpid::sys::Runnable*>(this));
- }
-
- ~SocketProxy() { close(); }
-
- /** Simulate a network disconnect. */
- void close() {
- {
- qpid::sys::Mutex::ScopedLock l(lock);
- if (closed) return;
- closed=true;
- }
- write(closePipe[1], this, 1); // Random byte to closePipe
- thread.join();
- client.close();
- ::close(closePipe[0]);
- ::close(closePipe[1]);
- }
-
- bool isClosed() const {
- qpid::sys::Mutex::ScopedLock l(lock);
- return closed;
- }
-
- uint16_t getPort() const { return port; }
-
- private:
- static void throwErrno(const std::string& msg) {
- throw qpid::Exception(msg+":"+qpid::strError(errno));
- }
- static void throwIf(bool condition, const std::string& msg) {
- if (condition) throw qpid::Exception(msg);
- }
-
- struct FdSet : fd_set {
- FdSet() : maxFd(0) { clear(); }
- void clear() { FD_ZERO(this); }
- void set(int fd) { FD_SET(fd, this); maxFd = std::max(maxFd, fd); }
- bool isSet(int fd) const { return FD_ISSET(fd, this); }
- bool operator[](int fd) const { return isSet(fd); }
-
- int maxFd;
- };
-
- enum { RD=1, WR=2, ER=4 };
-
- struct Selector {
- FdSet rd, wr, er;
-
- void set(int fd, int sets) {
- if (sets & RD) rd.set(fd);
- if (sets & WR) wr.set(fd);
- if (sets & ER) er.set(fd);
- }
-
- int select() {
- for (;;) {
- int maxFd = std::max(rd.maxFd, std::max(wr.maxFd, er.maxFd));
- int r = ::select(maxFd + 1, &rd, &wr, &er, NULL);
- if (r == -1 && errno == EINTR) continue;
- if (r < 0) throwErrno(QPID_MSG("select returned " <<r));
- return r;
- }
- }
- };
-
- void run() {
- std::auto_ptr<qpid::sys::Socket> server;
- try {
- // Accept incoming connections, watch closePipe.
- Selector accept;
- accept.set(listener.toFd(), RD|ER);
- accept.set(closePipe[0], RD|ER);
- accept.select();
- throwIf(accept.rd[closePipe[0]], "Closed by close()");
- throwIf(!accept.rd[listener.toFd()],"Accept failed");
- server.reset(listener.accept(0, 0));
-
- // Pump data between client & server sockets, watch closePipe.
- char buffer[1024];
- for (;;) {
- Selector select;
- select.set(server->toFd(), RD|ER);
- select.set(client.toFd(), RD|ER);
- select.set(closePipe[0], RD|ER);
- select.select();
- throwIf(select.rd[closePipe[0]], "Closed by close()");
- // Read even if fd is in error to throw a useful exception.
- bool gotData=false;
- if (select.rd[server->toFd()] || select.er[server->toFd()]) {
- client.write(buffer, server->read(buffer, sizeof(buffer)));
- gotData=true;
- }
- if (select.rd[client.toFd()] || select.er[client.toFd()]) {
- server->write(buffer, client.read(buffer, sizeof(buffer)));
- gotData=true;
- }
- throwIf(!gotData, "No data from select()");
- }
- }
- catch (const std::exception& e) {
- QPID_LOG(debug, "SocketProxy::run exiting: " << e.what());
- }
- if (server.get()) server->close();
- close();
- }
-
- mutable qpid::sys::Mutex lock;
- bool closed;
- qpid::sys::Socket client, listener;
- uint16_t port;
- int closePipe[2];
- qpid::sys::Thread thread;
-};
-
-#endif
diff --git a/qpid/cpp/src/tests/TestCase.h b/qpid/cpp/src/tests/TestCase.h
deleted file mode 100644
index 07bdd68933..0000000000
--- a/qpid/cpp/src/tests/TestCase.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef _TestCase_
-#define _TestCase_
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/client/Message.h"
-#include "TestOptions.h"
-
-
-namespace qpid {
-
-/**
- * Interface to be implemented by test cases for use with the test
- * runner.
- */
-class TestCase
-{
-public:
- /**
- * Directs the test case to act in a particular role. Some roles
- * may be 'activated' at this stage others may require an explicit
- * start request.
- */
- virtual void assign(const std::string& role, framing::FieldTable& params, TestOptions& options) = 0;
- /**
- * Each test will be started on its own thread, which should block
- * until the test completes (this may or may not require an
- * explicit stop() request).
- */
- virtual void start() = 0;
- /**
- * Requests that the test be stopped if still running.
- */
- virtual void stop() = 0;
- /**
- * Allows the test to fill in details on the final report
- * message. Will be called only after start has returned.
- */
- virtual void report(client::Message& report) = 0;
-
- virtual ~TestCase() {}
-};
-
-}
-
-#endif
diff --git a/qpid/cpp/src/tests/TestOptions.h b/qpid/cpp/src/tests/TestOptions.h
deleted file mode 100644
index 87710964d6..0000000000
--- a/qpid/cpp/src/tests/TestOptions.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef _TestOptions_
-#define _TestOptions_
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Options.h"
-#include "qpid/log/Options.h"
-#include "qpid/Url.h"
-#include "qpid/log/Logger.h"
-#include "qpid/client/Connection.h"
-
-#include <iostream>
-#include <exception>
-
-namespace qpid {
-
-struct TestOptions : public qpid::Options
-{
- TestOptions(const std::string& helpText_=std::string()) :
- Options("Test Options"),
- host("localhost"), port(TcpAddress::DEFAULT_PORT),
- clientid("cpp"), username("guest"), password("guest"),
- help(false), helpText(helpText_)
- {
- addOptions()
- ("host,h", optValue(host, "HOST"), "Broker host to connect to")
- // TODO aconway 2007-06-26: broker is synonym for host. Drop broker?
- ("broker,b", optValue(host, "HOST"), "Broker host to connect to")
- ("port,p", optValue(port, "PORT"), "Broker port to connect to")
- ("virtualhost,v", optValue(virtualhost, "VHOST"), "virtual host")
- ("clientname,n", optValue(clientid, "ID"), "unique client identifier")
- ("username", optValue(username, "USER"), "user name for broker log in.")
- ("password", optValue(password, "USER"), "password for broker log in.")
- ("help", optValue(help), "print this usage statement");
- add(log);
- }
-
- /** As well as parsing, throw help message if requested. */
- void parse(int argc, char** argv) {
- try {
- qpid::Options::parse(argc, argv);
- } catch (const std::exception& e) {
- std::ostringstream msg;
- msg << *this << std::endl << std::endl << e.what() << std::endl;
- throw qpid::Options::Exception(msg.str());
- }
- trace = log.trace;
- qpid::log::Logger::instance().configure(log, argv[0]);
- if (help) {
- std::ostringstream msg;
- msg << *this << std::endl << std::endl << helpText << std::endl;
- throw qpid::Options::Exception(msg.str());
- }
- }
-
- /** Open a connection using option values */
- void open(qpid::client::Connection& connection) {
- connection.open(host, port, username, password, virtualhost);
- }
-
-
- std::string host;
- uint16_t port;
- std::string virtualhost;
- std::string clientid;
- std::string username;
- std::string password;
- bool trace;
- bool help;
- log::Options log;
- std::string helpText;
-};
-
-}
-
-#endif
diff --git a/qpid/cpp/src/tests/TimerTest.cpp b/qpid/cpp/src/tests/TimerTest.cpp
deleted file mode 100644
index 864ddaf702..0000000000
--- a/qpid/cpp/src/tests/TimerTest.cpp
+++ /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.
- *
- */
-#include "qpid/broker/Timer.h"
-#include "qpid/sys/Monitor.h"
-#include "qpid_test_plugin.h"
-#include <math.h>
-#include <iostream>
-#include <memory>
-#include <boost/format.hpp>
-#include <boost/lexical_cast.hpp>
-
-using namespace qpid::broker;
-using namespace qpid::sys;
-using qpid::intrusive_ptr;
-using boost::dynamic_pointer_cast;
-
-class TimerTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(TimerTest);
- CPPUNIT_TEST(testGeneral);
- CPPUNIT_TEST_SUITE_END();
-
- class Counter
- {
- Mutex lock;
- uint counter;
- public:
- Counter() : counter(0) {}
- uint next()
- {
- Mutex::ScopedLock l(lock);
- return ++counter;
- }
- };
-
- class TestTask : public TimerTask
- {
- const AbsTime start;
- const Duration expected;
- AbsTime end;
- bool fired;
- uint position;
- Monitor monitor;
- Counter& counter;
-
- public:
- TestTask(Duration timeout, Counter& _counter)
- : TimerTask(timeout), start(now()), expected(timeout), end(start), fired(false), counter(_counter) {}
-
- void fire()
- {
- Monitor::ScopedLock l(monitor);
- fired = true;
- position = counter.next();
- end = now();
- monitor.notify();
- }
-
- void check(uint expected_position, uint64_t tolerance = 500 * TIME_MSEC)
- {
- Monitor::ScopedLock l(monitor);
- CPPUNIT_ASSERT(fired);
- CPPUNIT_ASSERT_EQUAL(expected_position, position);
- Duration actual(start, end);
- uint64_t difference = abs(expected - actual);
- std::string msg(boost::lexical_cast<std::string>(boost::format("tolerance = %1%, difference = %2%") % tolerance % difference));
- CPPUNIT_ASSERT_MESSAGE(msg, difference < tolerance);
- }
-
- void wait(Duration d)
- {
- Monitor::ScopedLock l(monitor);
- monitor.wait(AbsTime(now(), d));
- }
- };
-
- class DummyRunner : public Runnable
- {
- public:
- void run() {}
- };
-
-public:
-
- void testGeneral()
- {
- Counter counter;
- Timer timer;
- intrusive_ptr<TestTask> task1(new TestTask(Duration(3 * TIME_SEC), counter));
- intrusive_ptr<TestTask> task2(new TestTask(Duration(1 * TIME_SEC), counter));
- intrusive_ptr<TestTask> task3(new TestTask(Duration(4 * TIME_SEC), counter));
- intrusive_ptr<TestTask> task4(new TestTask(Duration(2 * TIME_SEC), counter));
-
- timer.add(task1);
- timer.add(task2);
- timer.add(task3);
- timer.add(task4);
-
- dynamic_pointer_cast<TestTask>(task3)->wait(Duration(6 * TIME_SEC));
-
- dynamic_pointer_cast<TestTask>(task1)->check(3);
- dynamic_pointer_cast<TestTask>(task2)->check(1);
- dynamic_pointer_cast<TestTask>(task3)->check(4);
- dynamic_pointer_cast<TestTask>(task4)->check(2);
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(TimerTest);
-
diff --git a/qpid/cpp/src/tests/TopicExchangeTest.cpp b/qpid/cpp/src/tests/TopicExchangeTest.cpp
deleted file mode 100644
index 9e320b76f9..0000000000
--- a/qpid/cpp/src/tests/TopicExchangeTest.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#include "qpid/broker/TopicExchange.h"
-#include "qpid_test_plugin.h"
-
-using namespace qpid::broker;
-
-Tokens makeTokens(char** begin, char** end)
-{
- Tokens t;
- t.insert(t.end(), begin, end);
- return t;
-}
-
-// Calculate size of an array.
-#define LEN(a) (sizeof(a)/sizeof(a[0]))
-
-// Convert array to token vector
-#define TOKENS(a) makeTokens(a, a + LEN(a))
-
-// Allow CPPUNIT_EQUALS to print a Tokens.
-CppUnit::OStringStream& operator <<(CppUnit::OStringStream& out, const Tokens& v)
-{
- out << "[ ";
- for (Tokens::const_iterator i = v.begin();
- i != v.end(); ++i)
- {
- out << '"' << *i << '"' << (i+1 == v.end() ? "]" : ", ");
- }
- return out;
-}
-
-
-class TokensTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(TokensTest);
- CPPUNIT_TEST(testTokens);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void testTokens()
- {
- Tokens tokens("hello.world");
- char* expect[] = {"hello", "world"};
- CPPUNIT_ASSERT_EQUAL(TOKENS(expect), tokens);
-
- tokens = "a.b.c";
- char* expect2[] = { "a", "b", "c" };
- CPPUNIT_ASSERT_EQUAL(TOKENS(expect2), tokens);
-
- tokens = "";
- CPPUNIT_ASSERT(tokens.empty());
-
- tokens = "x";
- char* expect3[] = { "x" };
- CPPUNIT_ASSERT_EQUAL(TOKENS(expect3), tokens);
-
- tokens = (".x");
- char* expect4[] = { "", "x" };
- CPPUNIT_ASSERT_EQUAL(TOKENS(expect4), tokens);
-
- tokens = ("x.");
- char* expect5[] = { "x", "" };
- CPPUNIT_ASSERT_EQUAL(TOKENS(expect5), tokens);
-
- tokens = (".");
- char* expect6[] = { "", "" };
- CPPUNIT_ASSERT_EQUAL(TOKENS(expect6), tokens);
-
- tokens = ("..");
- char* expect7[] = { "", "", "" };
- CPPUNIT_ASSERT_EQUAL(TOKENS(expect7), tokens);
- }
-
-};
-
-#define ASSERT_NORMALIZED(expect, pattern) \
- CPPUNIT_ASSERT_EQUAL(Tokens(expect), static_cast<Tokens>(TopicPattern(pattern)))
-class TopicPatternTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(TopicPatternTest);
- CPPUNIT_TEST(testNormalize);
- CPPUNIT_TEST(testPlain);
- CPPUNIT_TEST(testStar);
- CPPUNIT_TEST(testHash);
- CPPUNIT_TEST(testMixed);
- CPPUNIT_TEST(testCombo);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testNormalize()
- {
- CPPUNIT_ASSERT(TopicPattern("").empty());
- ASSERT_NORMALIZED("a.b.c", "a.b.c");
- ASSERT_NORMALIZED("a.*.c", "a.*.c");
- ASSERT_NORMALIZED("#", "#");
- ASSERT_NORMALIZED("#", "#.#.#.#");
- ASSERT_NORMALIZED("*.*.*.#", "#.*.#.*.#.#.*");
- ASSERT_NORMALIZED("a.*.*.*.#", "a.*.#.*.#.*.#");
- ASSERT_NORMALIZED("a.*.*.*.#", "a.*.#.*.#.*");
- }
-
- void testPlain() {
- TopicPattern p("ab.cd.e");
- CPPUNIT_ASSERT(p.match("ab.cd.e"));
- CPPUNIT_ASSERT(!p.match("abx.cd.e"));
- CPPUNIT_ASSERT(!p.match("ab.cd"));
- CPPUNIT_ASSERT(!p.match("ab.cd..e."));
- CPPUNIT_ASSERT(!p.match("ab.cd.e."));
- CPPUNIT_ASSERT(!p.match(".ab.cd.e"));
-
- p = "";
- CPPUNIT_ASSERT(p.match(""));
-
- p = ".";
- CPPUNIT_ASSERT(p.match("."));
- }
-
-
- void testStar()
- {
- TopicPattern p("a.*.b");
- CPPUNIT_ASSERT(p.match("a.xx.b"));
- CPPUNIT_ASSERT(!p.match("a.b"));
-
- p = "*.x";
- CPPUNIT_ASSERT(p.match("y.x"));
- CPPUNIT_ASSERT(p.match(".x"));
- CPPUNIT_ASSERT(!p.match("x"));
-
- p = "x.x.*";
- CPPUNIT_ASSERT(p.match("x.x.y"));
- CPPUNIT_ASSERT(p.match("x.x."));
- CPPUNIT_ASSERT(!p.match("x.x"));
- CPPUNIT_ASSERT(!p.match("q.x.y"));
- }
-
- void testHash()
- {
- TopicPattern p("a.#.b");
- CPPUNIT_ASSERT(p.match("a.b"));
- CPPUNIT_ASSERT(p.match("a.x.b"));
- CPPUNIT_ASSERT(p.match("a..x.y.zz.b"));
- CPPUNIT_ASSERT(!p.match("a.b."));
- CPPUNIT_ASSERT(!p.match("q.x.b"));
-
- p = "a.#";
- CPPUNIT_ASSERT(p.match("a"));
- CPPUNIT_ASSERT(p.match("a.b"));
- CPPUNIT_ASSERT(p.match("a.b.c"));
-
- p = "#.a";
- CPPUNIT_ASSERT(p.match("a"));
- CPPUNIT_ASSERT(p.match("x.y.a"));
- }
-
- void testMixed()
- {
- TopicPattern p("*.x.#.y");
- CPPUNIT_ASSERT(p.match("a.x.y"));
- CPPUNIT_ASSERT(p.match("a.x.p.qq.y"));
- CPPUNIT_ASSERT(!p.match("a.a.x.y"));
- CPPUNIT_ASSERT(!p.match("aa.x.b.c"));
-
- p = "a.#.b.*";
- CPPUNIT_ASSERT(p.match("a.b.x"));
- CPPUNIT_ASSERT(p.match("a.x.x.x.b.x"));
- }
-
- void testCombo() {
- TopicPattern p("*.#.#.*.*.#");
- CPPUNIT_ASSERT(p.match("x.y.z"));
- CPPUNIT_ASSERT(p.match("x.y.z.a.b.c"));
- CPPUNIT_ASSERT(!p.match("x.y"));
- CPPUNIT_ASSERT(!p.match("x"));
- }
-};
-
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(TopicPatternTest);
-CPPUNIT_TEST_SUITE_REGISTRATION(TokensTest);
diff --git a/qpid/cpp/src/tests/TxAckTest.cpp b/qpid/cpp/src/tests/TxAckTest.cpp
deleted file mode 100644
index 6c0bc8b5ee..0000000000
--- a/qpid/cpp/src/tests/TxAckTest.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/broker/NullMessageStore.h"
-#include "qpid/broker/RecoveryManager.h"
-#include "qpid/broker/TxAck.h"
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include <list>
-#include <vector>
-
-using std::list;
-using std::vector;
-using namespace qpid;
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-class TxAckTest : public CppUnit::TestCase
-{
-
- class TestMessageStore : public NullMessageStore
- {
- public:
- vector<intrusive_ptr<PersistableMessage> > dequeued;
-
- void dequeue(TransactionContext*, intrusive_ptr<PersistableMessage>& msg, const PersistableQueue& /*queue*/)
- {
- dequeued.push_back(msg);
- }
-
- TestMessageStore() : NullMessageStore() {}
- ~TestMessageStore(){}
- };
-
- CPPUNIT_TEST_SUITE(TxAckTest);
- CPPUNIT_TEST(testPrepare);
- CPPUNIT_TEST(testCommit);
- CPPUNIT_TEST_SUITE_END();
-
-
- AccumulatedAck acked;
- TestMessageStore store;
- Queue::shared_ptr queue;
- vector<intrusive_ptr<Message> > messages;
- list<DeliveryRecord> deliveries;
- TxAck op;
-
-
-public:
-
- TxAckTest() : acked(0), queue(new Queue("my_queue", false, &store, 0)), op(acked, deliveries)
- {
- for(int i = 0; i < 10; i++){
- intrusive_ptr<Message> msg(new Message());
- AMQFrame method(in_place<MessageTransferBody>(
- ProtocolVersion(), 0, "exchange", 0, 0));
- AMQFrame header(in_place<AMQHeaderBody>());
- msg->getFrames().append(method);
- msg->getFrames().append(header);
- msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
- msg->getProperties<DeliveryProperties>()->setRoutingKey("routing_key");
- messages.push_back(msg);
- QueuedMessage qm(queue.get());
- qm.payload = msg;
- deliveries.push_back(DeliveryRecord(qm, queue, "xyz", DeliveryToken::shared_ptr(), (i+1), true));
- }
-
- //assume msgs 1-5, 7 and 9 are all acked (i.e. 6, 8 & 10 are not)
- acked.mark = 5;
- acked.update(7, 7);
- acked.update(9, 9);
- }
-
- void testPrepare()
- {
- //ensure acked messages are discarded, i.e. dequeued from store
- op.prepare(0);
- CPPUNIT_ASSERT_EQUAL((size_t) 7, store.dequeued.size());
- CPPUNIT_ASSERT_EQUAL((size_t) 10, deliveries.size());
- int dequeued[] = {0, 1, 2, 3, 4, 6, 8};
- for (int i = 0; i < 7; i++) {
- CPPUNIT_ASSERT_EQUAL(static_pointer_cast<PersistableMessage>(messages[dequeued[i]]), store.dequeued[i]);
- }
- }
-
- void testCommit()
- {
- //emsure acked messages are removed from list
- op.commit();
- CPPUNIT_ASSERT_EQUAL((size_t) 3, deliveries.size());
- list<DeliveryRecord>::iterator i = deliveries.begin();
- CPPUNIT_ASSERT(i->matches(6));//msg 6
- CPPUNIT_ASSERT((++i)->matches(8));//msg 8
- CPPUNIT_ASSERT((++i)->matches(10));//msg 10
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(TxAckTest);
-
diff --git a/qpid/cpp/src/tests/TxBufferTest.cpp b/qpid/cpp/src/tests/TxBufferTest.cpp
deleted file mode 100644
index afe6d2b0fc..0000000000
--- a/qpid/cpp/src/tests/TxBufferTest.cpp
+++ /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.
- *
- */
-#include "qpid/broker/TxBuffer.h"
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include <vector>
-#include "TxMocks.h"
-
-using namespace qpid::broker;
-using boost::static_pointer_cast;
-
-class TxBufferTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(TxBufferTest);
- CPPUNIT_TEST(testCommitLocal);
- CPPUNIT_TEST(testFailOnCommitLocal);
- CPPUNIT_TEST(testPrepare);
- CPPUNIT_TEST(testFailOnPrepare);
- CPPUNIT_TEST(testRollback);
- CPPUNIT_TEST(testBufferIsClearedAfterRollback);
- CPPUNIT_TEST(testBufferIsClearedAfterCommit);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testCommitLocal(){
- MockTransactionalStore store;
- store.expectBegin().expectCommit();
-
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare().expectCommit();
- MockTxOp::shared_ptr opB(new MockTxOp());
- opB->expectPrepare().expectPrepare().expectCommit().expectCommit();//opB enlisted twice to test relative order
- MockTxOp::shared_ptr opC(new MockTxOp());
- opC->expectPrepare().expectCommit();
-
- TxBuffer buffer;
- buffer.enlist(static_pointer_cast<TxOp>(opA));
- buffer.enlist(static_pointer_cast<TxOp>(opB));
- buffer.enlist(static_pointer_cast<TxOp>(opB));//opB enlisted twice
- buffer.enlist(static_pointer_cast<TxOp>(opC));
-
- CPPUNIT_ASSERT(buffer.commitLocal(&store));
- store.check();
- CPPUNIT_ASSERT(store.isCommitted());
- opA->check();
- opB->check();
- opC->check();
- }
-
- void testFailOnCommitLocal(){
- MockTransactionalStore store;
- store.expectBegin().expectAbort();
-
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare().expectRollback();
- MockTxOp::shared_ptr opB(new MockTxOp(true));
- opB->expectPrepare().expectRollback();
- MockTxOp::shared_ptr opC(new MockTxOp());//will never get prepare as b will fail
- opC->expectRollback();
-
- TxBuffer buffer;
- buffer.enlist(static_pointer_cast<TxOp>(opA));
- buffer.enlist(static_pointer_cast<TxOp>(opB));
- buffer.enlist(static_pointer_cast<TxOp>(opC));
-
- CPPUNIT_ASSERT(!buffer.commitLocal(&store));
- CPPUNIT_ASSERT(store.isAborted());
- store.check();
- opA->check();
- opB->check();
- opC->check();
- }
-
- void testPrepare(){
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare();
- MockTxOp::shared_ptr opB(new MockTxOp());
- opB->expectPrepare();
- MockTxOp::shared_ptr opC(new MockTxOp());
- opC->expectPrepare();
-
- TxBuffer buffer;
- buffer.enlist(static_pointer_cast<TxOp>(opA));
- buffer.enlist(static_pointer_cast<TxOp>(opB));
- buffer.enlist(static_pointer_cast<TxOp>(opC));
-
- CPPUNIT_ASSERT(buffer.prepare(0));
- opA->check();
- opB->check();
- opC->check();
- }
-
- void testFailOnPrepare(){
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectPrepare();
- MockTxOp::shared_ptr opB(new MockTxOp(true));
- opB->expectPrepare();
- MockTxOp::shared_ptr opC(new MockTxOp());//will never get prepare as b will fail
-
- TxBuffer buffer;
- buffer.enlist(static_pointer_cast<TxOp>(opA));
- buffer.enlist(static_pointer_cast<TxOp>(opB));
- buffer.enlist(static_pointer_cast<TxOp>(opC));
-
- CPPUNIT_ASSERT(!buffer.prepare(0));
- opA->check();
- opB->check();
- opC->check();
- }
-
- void testRollback(){
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectRollback();
- MockTxOp::shared_ptr opB(new MockTxOp(true));
- opB->expectRollback();
- MockTxOp::shared_ptr opC(new MockTxOp());
- opC->expectRollback();
-
- TxBuffer buffer;
- buffer.enlist(static_pointer_cast<TxOp>(opA));
- buffer.enlist(static_pointer_cast<TxOp>(opB));
- buffer.enlist(static_pointer_cast<TxOp>(opC));
-
- buffer.rollback();
- opA->check();
- opB->check();
- opC->check();
- }
-
- void testBufferIsClearedAfterRollback(){
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectRollback();
- MockTxOp::shared_ptr opB(new MockTxOp());
- opB->expectRollback();
-
- TxBuffer buffer;
- buffer.enlist(static_pointer_cast<TxOp>(opA));
- buffer.enlist(static_pointer_cast<TxOp>(opB));
-
- buffer.rollback();
- buffer.commit();//second call should not reach ops
- opA->check();
- opB->check();
- }
-
- void testBufferIsClearedAfterCommit(){
- MockTxOp::shared_ptr opA(new MockTxOp());
- opA->expectCommit();
- MockTxOp::shared_ptr opB(new MockTxOp());
- opB->expectCommit();
-
- TxBuffer buffer;
- buffer.enlist(static_pointer_cast<TxOp>(opA));
- buffer.enlist(static_pointer_cast<TxOp>(opB));
-
- buffer.commit();
- buffer.rollback();//second call should not reach ops
- opA->check();
- opB->check();
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(TxBufferTest);
-
diff --git a/qpid/cpp/src/tests/TxMocks.h b/qpid/cpp/src/tests/TxMocks.h
deleted file mode 100644
index 127a27c005..0000000000
--- a/qpid/cpp/src/tests/TxMocks.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#ifndef _tests_TxMocks_h
-#define _tests_TxMocks_h
-
-
-#include "qpid/Exception.h"
-#include "qpid/broker/TransactionalStore.h"
-#include "qpid/broker/TxOp.h"
-#include <iostream>
-#include <vector>
-
-using namespace qpid::broker;
-using boost::static_pointer_cast;
-using std::string;
-
-template <class T> void assertEqualVector(std::vector<T>& expected, std::vector<T>& actual){
- unsigned int i = 0;
- while(i < expected.size() && i < actual.size()){
- CPPUNIT_ASSERT_EQUAL(expected[i], actual[i]);
- i++;
- }
- if (i < expected.size()) {
- throw qpid::Exception(QPID_MSG("Missing " << expected[i]));
- } else if (i < actual.size()) {
- throw qpid::Exception(QPID_MSG("Extra " << actual[i]));
- }
- CPPUNIT_ASSERT_EQUAL(expected.size(), actual.size());
-}
-
-class TxOpConstants{
-protected:
- const string PREPARE;
- const string COMMIT;
- const string ROLLBACK;
-
- TxOpConstants() : PREPARE("PREPARE"), COMMIT("COMMIT"), ROLLBACK("ROLLBACK") {}
-};
-
-class MockTxOp : public TxOp, public TxOpConstants{
- std::vector<string> expected;
- std::vector<string> actual;
- bool failOnPrepare;
- string debugName;
-public:
- typedef boost::shared_ptr<MockTxOp> shared_ptr;
-
- MockTxOp() : failOnPrepare(false) {}
- MockTxOp(bool _failOnPrepare) : failOnPrepare(_failOnPrepare) {}
-
- void setDebugName(string name){
- debugName = name;
- }
-
- void printExpected(){
- std::cout << std::endl << "MockTxOp[" << debugName << "] expects: ";
- for (std::vector<string>::iterator i = expected.begin(); i < expected.end(); i++) {
- if(i != expected.begin()) std::cout << ", ";
- std::cout << *i;
- }
- std::cout << std::endl;
- }
-
- void printActual(){
- std::cout << std::endl << "MockTxOp[" << debugName << "] actual: ";
- for (std::vector<string>::iterator i = actual.begin(); i < actual.end(); i++) {
- if(i != actual.begin()) std::cout << ", ";
- std::cout << *i;
- }
- std::cout << std::endl;
- }
-
- bool prepare(TransactionContext*) throw(){
- actual.push_back(PREPARE);
- return !failOnPrepare;
- }
- void commit() throw(){
- actual.push_back(COMMIT);
- }
- void rollback() throw(){
- if(!debugName.empty()) std::cout << std::endl << "MockTxOp[" << debugName << "]::rollback()" << std::endl;
- actual.push_back(ROLLBACK);
- }
- MockTxOp& expectPrepare(){
- expected.push_back(PREPARE);
- return *this;
- }
- MockTxOp& expectCommit(){
- expected.push_back(COMMIT);
- return *this;
- }
- MockTxOp& expectRollback(){
- expected.push_back(ROLLBACK);
- return *this;
- }
- void check(){
- assertEqualVector(expected, actual);
- }
- ~MockTxOp(){}
-};
-
-class MockTransactionalStore : public TransactionalStore{
- const string BEGIN;
- const string BEGIN2PC;
- const string PREPARE;
- const string COMMIT;
- const string ABORT;
- std::vector<string> expected;
- std::vector<string> actual;
-
- enum states {OPEN = 1, PREPARED = 2, COMMITTED = 3, ABORTED = 4};
- int state;
-
- class TestTransactionContext : public TPCTransactionContext{
- MockTransactionalStore* store;
- public:
- TestTransactionContext(MockTransactionalStore* _store) : store(_store) {}
- void prepare(){
- if(!store->isOpen()) throw "txn already completed";
- store->state = PREPARED;
- }
-
- void commit(){
- if(!store->isOpen() && !store->isPrepared()) throw "txn already completed";
- store->state = COMMITTED;
- }
-
- void abort(){
- if(!store->isOpen() && !store->isPrepared()) throw "txn already completed";
- store->state = ABORTED;
- }
- ~TestTransactionContext(){}
- };
-
-public:
- MockTransactionalStore() :
- BEGIN("BEGIN"), BEGIN2PC("BEGIN2PC"), PREPARE("PREPARE"), COMMIT("COMMIT"), ABORT("ABORT"), state(OPEN){}
-
- void collectPreparedXids(std::set<std::string>&)
- {
- throw "Operation not supported";
- }
-
- std::auto_ptr<TPCTransactionContext> begin(const std::string&){
- actual.push_back(BEGIN2PC);
- std::auto_ptr<TPCTransactionContext> txn(new TestTransactionContext(this));
- return txn;
- }
- std::auto_ptr<TransactionContext> begin(){
- actual.push_back(BEGIN);
- std::auto_ptr<TransactionContext> txn(new TestTransactionContext(this));
- return txn;
- }
- void prepare(TPCTransactionContext& ctxt){
- actual.push_back(PREPARE);
- dynamic_cast<TestTransactionContext&>(ctxt).prepare();
- }
- void commit(TransactionContext& ctxt){
- actual.push_back(COMMIT);
- dynamic_cast<TestTransactionContext&>(ctxt).commit();
- }
- void abort(TransactionContext& ctxt){
- actual.push_back(ABORT);
- dynamic_cast<TestTransactionContext&>(ctxt).abort();
- }
- MockTransactionalStore& expectBegin(){
- expected.push_back(BEGIN);
- return *this;
- }
- MockTransactionalStore& expectBegin2PC(){
- expected.push_back(BEGIN2PC);
- return *this;
- }
- MockTransactionalStore& expectPrepare(){
- expected.push_back(PREPARE);
- return *this;
- }
- MockTransactionalStore& expectCommit(){
- expected.push_back(COMMIT);
- return *this;
- }
- MockTransactionalStore& expectAbort(){
- expected.push_back(ABORT);
- return *this;
- }
- void check(){
- assertEqualVector(expected, actual);
- }
-
- bool isPrepared(){
- return state == PREPARED;
- }
-
- bool isCommitted(){
- return state == COMMITTED;
- }
-
- bool isAborted(){
- return state == ABORTED;
- }
-
- bool isOpen() const{
- return state == OPEN;
- }
- ~MockTransactionalStore(){}
-};
-
-#endif
diff --git a/qpid/cpp/src/tests/TxPublishTest.cpp b/qpid/cpp/src/tests/TxPublishTest.cpp
deleted file mode 100644
index 2b363acfec..0000000000
--- a/qpid/cpp/src/tests/TxPublishTest.cpp
+++ /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.
- *
- */
-#include "qpid/broker/NullMessageStore.h"
-#include "qpid/broker/RecoveryManager.h"
-#include "qpid/broker/TxPublish.h"
-#include "qpid_test_plugin.h"
-#include <iostream>
-#include <list>
-#include <vector>
-#include "MessageUtils.h"
-
-using std::list;
-using std::pair;
-using std::vector;
-using namespace qpid::broker;
-using namespace qpid::framing;
-
-class TxPublishTest : public CppUnit::TestCase
-{
- typedef std::pair<string, intrusive_ptr<PersistableMessage> > msg_queue_pair;
-
- class TestMessageStore : public NullMessageStore
- {
- public:
- vector<msg_queue_pair> enqueued;
-
- void enqueue(TransactionContext*, intrusive_ptr<PersistableMessage>& msg, const PersistableQueue& queue)
- {
- msg->enqueueComplete();
- enqueued.push_back(msg_queue_pair(queue.getName(), msg));
- }
-
- //dont care about any of the other methods:
- TestMessageStore() : NullMessageStore(false) {}
- ~TestMessageStore(){}
- };
-
- CPPUNIT_TEST_SUITE(TxPublishTest);
- CPPUNIT_TEST(testPrepare);
- CPPUNIT_TEST(testCommit);
- CPPUNIT_TEST_SUITE_END();
-
-
- TestMessageStore store;
- Queue::shared_ptr queue1;
- Queue::shared_ptr queue2;
- intrusive_ptr<Message> msg;
- TxPublish op;
-
-public:
-
- TxPublishTest() :
- queue1(new Queue("queue1", false, &store, 0)),
- queue2(new Queue("queue2", false, &store, 0)),
- msg(MessageUtils::createMessage("exchange", "routing_key", "id")),
- op(msg)
- {
- msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
- op.deliverTo(queue1);
- op.deliverTo(queue2);
- }
-
- void testPrepare()
- {
- intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
- //ensure messages are enqueued in store
- op.prepare(0);
- CPPUNIT_ASSERT_EQUAL((size_t) 2, store.enqueued.size());
- CPPUNIT_ASSERT_EQUAL(string("queue1"), store.enqueued[0].first);
- CPPUNIT_ASSERT_EQUAL(pmsg, store.enqueued[0].second);
- CPPUNIT_ASSERT_EQUAL(string("queue2"), store.enqueued[1].first);
- CPPUNIT_ASSERT_EQUAL(pmsg, store.enqueued[1].second);
- CPPUNIT_ASSERT_EQUAL( true, ( static_pointer_cast<PersistableMessage>(msg))->isEnqueueComplete());
- }
-
- void testCommit()
- {
- //ensure messages are delivered to queue
- op.prepare(0);
- op.commit();
- CPPUNIT_ASSERT_EQUAL((uint32_t) 1, queue1->getMessageCount());
- intrusive_ptr<Message> msg_dequeue = queue1->dequeue().payload;
-
- CPPUNIT_ASSERT_EQUAL( true, (static_pointer_cast<PersistableMessage>(msg_dequeue))->isEnqueueComplete());
- CPPUNIT_ASSERT_EQUAL(msg, msg_dequeue);
-
- CPPUNIT_ASSERT_EQUAL((uint32_t) 1, queue2->getMessageCount());
- CPPUNIT_ASSERT_EQUAL(msg, queue2->dequeue().payload);
- }
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(TxPublishTest);
-
diff --git a/qpid/cpp/src/tests/Url.cpp b/qpid/cpp/src/tests/Url.cpp
deleted file mode 100644
index bc07737520..0000000000
--- a/qpid/cpp/src/tests/Url.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-#include "unit_test.h"
-#include "test_tools.h"
-#include "qpid/Url.h"
-#include <boost/assign.hpp>
-
-using namespace std;
-using namespace qpid;
-using namespace boost::assign;
-
-QPID_AUTO_TEST_SUITE(UrlTestSuite)
-
-BOOST_AUTO_TEST_CASE(testUrl_str) {
- Url url;
- url.push_back(TcpAddress("foo.com"));
- url.push_back(TcpAddress("bar.com", 6789));
- BOOST_CHECK_EQUAL("amqp:tcp:foo.com:5672,tcp:bar.com:6789", url.str());
- BOOST_CHECK(Url().str().empty());
-}
-
-
-BOOST_AUTO_TEST_CASE(testUrl_parse) {
- Url url;
- url.parse("amqp:foo.com,tcp:bar.com:1234");
- BOOST_CHECK_EQUAL(2u, url.size());
- BOOST_CHECK_EQUAL("foo.com", boost::get<TcpAddress>(url[0]).host);
- BOOST_CHECK_EQUAL("amqp:tcp:foo.com:5672,tcp:bar.com:1234", url.str());
-
- url.parse("amqp:foo/ignorethis");
- BOOST_CHECK_EQUAL("amqp:tcp:foo:5672", url.str());
-
- url.parse("amqp:");
- BOOST_CHECK_EQUAL("amqp:tcp::5672", url.str());
-
- try {
- url.parse("invalid url");
- BOOST_FAIL("Expected InvalidUrl exception");
- }
- catch (const Url::InvalidUrl&) {}
-
- url.parseNoThrow("invalid url");
- BOOST_CHECK(url.empty());
-}
-
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/Uuid.cpp b/qpid/cpp/src/tests/Uuid.cpp
deleted file mode 100644
index c158cf53d2..0000000000
--- a/qpid/cpp/src/tests/Uuid.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/framing/Uuid.h"
-#include "qpid/framing/Buffer.h"
-
-#include "unit_test.h"
-
-#include <set>
-
-QPID_AUTO_TEST_SUITE(UuidTestSuite)
-
-using namespace std;
-using namespace qpid::framing;
-
-struct UniqueSet : public std::set<Uuid> {
- void operator()(const Uuid& uuid) {
- BOOST_REQUIRE(find(uuid) == end());
- insert(uuid);
- }
-};
-
-BOOST_AUTO_TEST_CASE(testUuidCtor) {
- // Uniqueness
- boost::array<Uuid,1000> uuids;
- for_each(uuids.begin(), uuids.end(), mem_fun_ref(&Uuid::generate));
- UniqueSet unique;
- for_each(uuids.begin(), uuids.end(), unique);
-}
-
-boost::array<uint8_t, 16> sample = {{'\x1b', '\x4e', '\x28', '\xba', '\x2f', '\xa1', '\x11', '\xd2', '\x88', '\x3f', '\xb9', '\xa7', '\x61', '\xbd', '\xe3', '\xfb'}};
-const string sampleStr("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb");
-
-BOOST_AUTO_TEST_CASE(testUuidIstream) {
- Uuid uuid;
- istringstream in(sampleStr);
- in >> uuid;
- BOOST_CHECK(!in.fail());
- BOOST_CHECK(uuid == sample);
-}
-
-BOOST_AUTO_TEST_CASE(testUuidOstream) {
- Uuid uuid(sample.c_array());
- ostringstream out;
- out << uuid;
- BOOST_CHECK(out.good());
- BOOST_CHECK_EQUAL(out.str(), sampleStr);
-}
-
-BOOST_AUTO_TEST_CASE(testUuidEncodeDecode) {
- char* buff = static_cast<char*>(::alloca(Uuid::size()));
- Buffer wbuf(buff, Uuid::size());
- Uuid uuid(sample.c_array());
- uuid.encode(wbuf);
-
- Buffer rbuf(buff, Uuid::size());
- Uuid decoded;
- decoded.decode(rbuf);
- BOOST_CHECK_EQUAL(string(sample.begin(), sample.end()),
- string(decoded.begin(), decoded.end()));
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/ais_check b/qpid/cpp/src/tests/ais_check
deleted file mode 100755
index ae0edf88c1..0000000000
--- a/qpid/cpp/src/tests/ais_check
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Check for requirements, run AIS tests if found.
-#
-
-id -nG | grep '\<ais\>' || \
- NOGROUP="You are not a member of the ais group."
-ps -u root | grep aisexec >/dev/null || \
- NOAISEXEC="The aisexec daemon is not running as root"
-
-if test -n "$NOGROUP" -o -n "$NOAISEXEC"; then
- cat <<EOF
-
- =========== WARNING: NOT RUNNING AIS TESTS ==============
-
- Tests that depend on the openais library (used for clustering)
- will not be run because:
-
- $NOGROUP
- $NOAISEXEC
-
- ==========================================================
-
-EOF
- exit 0; # A warning, not a failure.
-fi
-
-echo ./ais_run | newgrp ais
diff --git a/qpid/cpp/src/tests/ais_run b/qpid/cpp/src/tests/ais_run
deleted file mode 100755
index 0f45edc39c..0000000000
--- a/qpid/cpp/src/tests/ais_run
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-# Run AIS tests, assumes that ais_check has passed and we are
-# running with the ais group ID.
-#
-
-# FIXME aconway 2008-01-30: we should valgrind the cluster brokers.
-
-srcdir=`dirname $0`
-$srcdir/start_cluster 4
-./ais_test
-ret=$?
-$srcdir/stop_cluster
-exit $ret
-
diff --git a/qpid/cpp/src/tests/ais_test.cpp b/qpid/cpp/src/tests/ais_test.cpp
deleted file mode 100644
index 00c61242e4..0000000000
--- a/qpid/cpp/src/tests/ais_test.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// Defines test_main function to link with actual unit test code.
-#define BOOST_AUTO_TEST_MAIN // Boost 1.33
-#define BOOST_TEST_MAIN
-#include "unit_test.h"
-
diff --git a/qpid/cpp/src/tests/client_test.cpp b/qpid/cpp/src/tests/client_test.cpp
deleted file mode 100644
index bd2a541c92..0000000000
--- a/qpid/cpp/src/tests/client_test.cpp
+++ /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.
- *
- */
-
-/**
- * This file provides a simple test (and example) of basic
- * functionality including declaring an exchange and a queue, binding
- * these together, publishing a message and receiving that message
- * asynchronously.
- */
-
-#include <iostream>
-
-#include "TestOptions.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/Message.h"
-#include "qpid/client/Session.h"
-#include "qpid/framing/FrameSet.h"
-#include "qpid/framing/MessageTransferBody.h"
-
-using namespace qpid;
-using namespace qpid::client;
-using qpid::framing::FrameSet;
-using qpid::framing::MessageTransferBody;
-using std::string;
-
-struct Args : public qpid::TestOptions {
- uint msgSize;
- uint maxFrameSize;
-
- Args() : msgSize(26), maxFrameSize(65535)
- {
- addOptions()
- ("size", optValue(msgSize, "N"), "message size")
- ("max-frame-size", optValue(maxFrameSize, "N"), "max frame size");
- }
-};
-
-const std::string chars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
-
-std::string generateData(uint size)
-{
- if (size < chars.length()) {
- return chars.substr(0, size);
- }
- std::string data;
- for (uint i = 0; i < (size / chars.length()); i++) {
- data += chars;
- }
- data += chars.substr(0, size % chars.length());
- return data;
-}
-
-void print(const std::string& text, const Message& msg)
-{
- std::cout << text;
- if (msg.getData().size() > 16) {
- std::cout << msg.getData().substr(0, 16) << "...";
- } else {
- std::cout << msg.getData();
- }
- std::cout << std::endl;
-}
-
-int main(int argc, char** argv)
-{
- try {
- Args opts;
- opts.parse(argc, argv);
-
- //Connect to the broker:
- Connection connection(opts.trace, opts.maxFrameSize);
- opts.open(connection);
- if (opts.trace) std::cout << "Opened connection." << std::endl;
-
- //Create and open a session on the connection through which
- //most functionality is exposed:
- Session session = connection.newSession(ASYNC);
- if (opts.trace) std::cout << "Opened session." << std::endl;
-
-
- //'declare' the exchange and the queue, which will create them
- //as they don't exist
- session.exchangeDeclare(arg::exchange="MyExchange", arg::type="direct");
- if (opts.trace) std::cout << "Declared exchange." << std::endl;
- session.queueDeclare(arg::queue="MyQueue", arg::autoDelete=true, arg::exclusive=true);
- if (opts.trace) std::cout << "Declared queue." << std::endl;
-
- //now bind the queue to the exchange
- session.queueBind(arg::exchange="MyExchange", arg::queue="MyQueue", arg::routingKey="MyKey");
- if (opts.trace) std::cout << "Bound queue to exchange." << std::endl;
-
- //create and send a message to the exchange using the routing
- //key we bound our queue with:
- Message msgOut(generateData(opts.msgSize));
- msgOut.getDeliveryProperties().setRoutingKey("MyKey");
- session.messageTransfer(arg::destination="MyExchange", arg::content=msgOut);
- if (opts.trace) print("Published message: ", msgOut);
-
- //subscribe to the queue, add sufficient credit and then get
- //incoming 'frameset', check that its a message transfer and
- //then convert it to a message (see Dispatcher and
- //SubscriptionManager utilties for common reusable patterns at
- //a higher level)
- session.messageSubscribe(arg::queue="MyQueue", arg::destination="MyId");
- session.messageFlow(arg::destination="MyId", arg::unit=0, arg::value=1); //credit for one message
- session.messageFlow(arg::destination="MyId", arg::unit=1, arg::value=0xFFFFFFFF); //credit for infinite bytes
- if (opts.trace) std::cout << "Subscribed to queue." << std::endl;
- FrameSet::shared_ptr incoming = session.get();
- if (incoming->isA<MessageTransferBody>()) {
- Message msgIn(*incoming, session);
- if (msgIn.getData() == msgOut.getData()) {
- if (opts.trace) std::cout << "Received the exepected message." << std::endl;
- msgIn.acknowledge();
- } else {
- print("Received an unexepected message: ", msgIn);
- }
- }
-
- //close the session & connection
- session.close();
- if (opts.trace) std::cout << "Closed session." << std::endl;
- connection.close();
- if (opts.trace) std::cout << "Closed connection." << std::endl;
- return 0;
- } catch(const std::exception& e) {
- std::cout << e.what() << std::endl;
- }
- return 1;
-}
diff --git a/qpid/cpp/src/tests/cluster.mk b/qpid/cpp/src/tests/cluster.mk
deleted file mode 100644
index ba8d99935f..0000000000
--- a/qpid/cpp/src/tests/cluster.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-if CPG
-#
-# Cluster tests makefile fragment, to be included in Makefile.am
-#
-
-lib_cluster = $(abs_builddir)/../libqpidcluster.la
-
-# NOTE: Programs using the openais library must be run with gid=ais
-# You should do "newgrp ais" before running the tests to run these.
-#
-
-# ais_check checks conditions for AIS tests and runs if ok.
-TESTS+=ais_check
-EXTRA_DIST+=ais_check ais_run
-
-check_PROGRAMS+=ais_test
-ais_test_SOURCES=ais_test.cpp Cpg.cpp
-ais_test_LDADD=$(lib_client) $(lib_cluster) -lboost_unit_test_framework
-
-endif
diff --git a/qpid/cpp/src/tests/cluster_client.cpp b/qpid/cpp/src/tests/cluster_client.cpp
deleted file mode 100644
index cd048d1651..0000000000
--- a/qpid/cpp/src/tests/cluster_client.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "unit_test.h"
-#include "BrokerFixture.h"
-#include "qpid/client/Session.h"
-
-#include <fstream>
-#include <vector>
-#include <functional>
-
-QPID_AUTO_TEST_SUITE(cluster_clientTestSuite)
-
-using namespace qpid;
-using namespace qpid::client;
-using namespace qpid::framing;
-using namespace qpid::client::arg;
-using framing::TransferContent;
-using std::vector;
-using std::string;
-using std::ifstream;
-using std::ws;
-
-struct ClusterConnections : public vector<shared_ptr<Connection> > {
- ClusterConnections() {
- ifstream portfile("cluster.ports");
- BOOST_REQUIRE(portfile.good());
- portfile >> ws;
- while (portfile.good()) {
- uint16_t port;
- portfile >> port >> ws;
- push_back(make_shared_ptr(new Connection(port)));
- back()->open("localhost", port);
- }
- BOOST_REQUIRE(size() > 1);
- }
-
- ~ClusterConnections() {
- for (iterator i = begin(); i != end(); ++i ){
- (*i)->close();
- }
- }
-};
-
-BOOST_AUTO_TEST_CASE(testWiringReplication) {
- // Declare on one broker, use on others.
- ClusterConnections cluster;
- BOOST_REQUIRE(cluster.size() > 1);
-
- Session broker0 = cluster[0]->newSession(ASYNC);
- broker0.exchangeDeclare(exchange="ex");
- broker0.queueDeclare(queue="q");
- broker0.queueBind(exchange="ex", queue="q", routingKey="key");
- broker0.close();
-
- for (size_t i = 1; i < cluster.size(); ++i) {
- Session s = cluster[i]->newSession(ASYNC);
- s.messageTransfer(content=TransferContent("data", "key", "ex"));
- s.messageSubscribe(queue="q", destination="q");
- s.messageFlow(destination="q", unit=0, value=1);//messages
- FrameSet::shared_ptr msg = s.get();
- BOOST_CHECK(msg->isA<MessageTransferBody>());
- BOOST_CHECK_EQUAL(string("data"), msg->getContent());
- s.getExecution().completed(msg->getId(), true, true);
- cluster[i]->close();
- }
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/dlclose_noop.c b/qpid/cpp/src/tests/dlclose_noop.c
deleted file mode 100644
index ba2fa75891..0000000000
--- a/qpid/cpp/src/tests/dlclose_noop.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/*
- * Loaded via LD_PRELOAD this will turn dlclose into a no-op.
- *
- * Allows valgrind to generate useful reports from programs that
- * dynamically unload libraries before exit, such as CppUnit's
- * DllPlugInTester.
- *
- */
-
-#include <stdio.h>
-void* dlclose(void* handle) {}
-
diff --git a/qpid/cpp/src/tests/echo_service.cpp b/qpid/cpp/src/tests/echo_service.cpp
deleted file mode 100644
index c3569d5fd4..0000000000
--- a/qpid/cpp/src/tests/echo_service.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 class provides an example of using AMQP for a request-response
- * style system. 'Requests' are messages sent to a well known
- * destination. A 'service' process consumes these message and
- * responds by echoing the message back to the sender on a
- * sender-specified private queue.
- */
-
-#include "qpid/client/Channel.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/Exchange.h"
-#include "qpid/client/MessageListener.h"
-#include "qpid/client/Queue.h"
-#include "qpid/sys/Time.h"
-#include <iostream>
-#include <sstream>
-
-using namespace qpid::client;
-using namespace qpid::sys;
-using std::string;
-
-
-/**
- * A message listener implementation representing the 'service', this
- * will 'echo' any requests received.
- */
-class EchoServer : public MessageListener{
- Channel* const channel;
-public:
- EchoServer(Channel* channel);
- virtual void received(Message& msg);
-};
-
-/**
- * A message listener implementation that merely prints received
- * messages to the console. Used to report on 'echo' responses.
- */
-class LoggingListener : public MessageListener{
-public:
- virtual void received(Message& msg);
-};
-
-/**
- * A utility class that manages the command line options needed to run
- * the example confirgurably.
- */
-class Args{
- string host;
- int port;
- bool trace;
- bool help;
- bool client;
-public:
- inline Args() : host("localhost"), port(5672), trace(false), help(false), client(false){}
- void parse(int argc, char** argv);
- void usage();
-
- inline const string& getHost() const { return host;}
- inline int getPort() const { return port; }
- inline bool getTrace() const { return trace; }
- inline bool getHelp() const { return help; }
- inline bool getClient() const { return client; }
-};
-
-/**
- * The main test path. There are two basic modes: 'client' and
- * 'service'. First one or more services are started, then one or more
- * clients are started and messages can be sent.
- */
-int main(int argc, char** argv){
- const std::string echo_service("echo_service");
- Args args;
- args.parse(argc, argv);
- if (args.getHelp()) {
- args.usage();
- } else if (args.getClient()) {
- //we have been started in 'client' mode, i.e. we will send an
- //echo requests and print responses received.
- try {
- //Create connection & open a channel
- Connection connection(args.getTrace());
- connection.open(args.getHost(), args.getPort());
- Channel channel;
- connection.openChannel(channel);
-
- //Setup: declare the private 'response' queue and bind it
- //to the direct exchange by its name which will be
- //generated by the server
- Queue response;
- channel.declareQueue(response);
- qpid::framing::FieldTable emptyArgs;
- channel.bind(Exchange::STANDARD_DIRECT_EXCHANGE, response, response.getName(), emptyArgs);
-
- //Consume from the response queue, logging all echoed message to console:
- LoggingListener listener;
- std::string tag;
- channel.consume(response, tag, &listener);
-
- //Process incoming requests on a new thread
- channel.start();
-
- //get messages from console and send them:
- std::string text;
- std::cout << "Enter text to send:" << std::endl;
- while (std::getline(std::cin, text)) {
- std::cout << "Sending " << text << " to echo server." << std::endl;
- Message msg;
- msg.getHeaders().setString("RESPONSE_QUEUE", response.getName());
- msg.setData(text);
- channel.publish(msg, Exchange::STANDARD_DIRECT_EXCHANGE, echo_service);
-
- std::cout << "Enter text to send:" << std::endl;
- }
-
- connection.close();
- } catch(std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- } else {
- // we are in 'service' mode, i.e. we will consume messages
- // from the request queue and echo each request back to the
- // senders own private response queue.
- try {
- //Create connection & open a channel
- Connection connection(args.getTrace());
- connection.open(args.getHost(), args.getPort());
- Channel channel;
- connection.openChannel(channel);
-
- //Setup: declare the 'request' queue and bind it to the direct exchange with a 'well known' name
- Queue request("request");
- channel.declareQueue(request);
- qpid::framing::FieldTable emptyArgs;
- channel.bind(Exchange::STANDARD_DIRECT_EXCHANGE, request, echo_service, emptyArgs);
-
- //Consume from the request queue, echoing back all messages received to the client that sent them
- EchoServer server(&channel);
- std::string tag = "server_tag";
- channel.consume(request, tag, &server);
-
- //Process incoming requests on the main thread
- channel.run();
-
- connection.close();
- } catch(std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- }
-}
-
-EchoServer::EchoServer(Channel* _channel) : channel(_channel){}
-
-void EchoServer::received(Message& message)
-{
- //get name of response queues binding to the default direct exchange:
- const std::string name = message.getHeaders().getString("RESPONSE_QUEUE");
-
- if (name.empty()) {
- std::cout << "Cannot echo " << message.getData() << ", no response queue specified." << std::endl;
- } else {
- //print message to console:
- std::cout << "Echoing " << message.getData() << " back to " << name << std::endl;
-
- //'echo' the message back:
- channel->publish(message, Exchange::STANDARD_DIRECT_EXCHANGE, name);
- }
-}
-
-void LoggingListener::received(Message& message)
-{
- //print message to console:
- std::cout << "Received echo: " << message.getData() << std::endl;
-}
-
-
-void Args::parse(int argc, char** argv){
- for(int i = 1; i < argc; i++){
- string name(argv[i]);
- if("-help" == name){
- help = true;
- break;
- }else if("-host" == name){
- host = argv[++i];
- }else if("-port" == name){
- port = atoi(argv[++i]);
- }else if("-trace" == name){
- trace = true;
- }else if("-client" == name){
- client = true;
- }else{
- std::cout << "Warning: unrecognised option " << name << std::endl;
- }
- }
-}
-
-void Args::usage(){
- std::cout << "Options:" << std::endl;
- std::cout << " -help" << std::endl;
- std::cout << " Prints this usage message" << std::endl;
- std::cout << " -host <host>" << std::endl;
- std::cout << " Specifies host to connect to (default is localhost)" << std::endl;
- std::cout << " -port <port>" << std::endl;
- std::cout << " Specifies port to conect to (default is 5762)" << std::endl;
- std::cout << " -trace" << std::endl;
- std::cout << " Indicates that the frames sent and received should be logged" << std::endl;
- std::cout << " -client" << std::endl;
- std::cout << " Run as a client (else will run as a server)" << std::endl;
-}
diff --git a/qpid/cpp/src/tests/exception_test.cpp b/qpid/cpp/src/tests/exception_test.cpp
deleted file mode 100644
index 715cdaec2a..0000000000
--- a/qpid/cpp/src/tests/exception_test.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "unit_test.h"
-#include "BrokerFixture.h"
-#include "qpid/client/SubscriptionManager.h"
-#include "qpid/sys/Runnable.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/framing/reply_exceptions.h"
-
-QPID_AUTO_TEST_SUITE(exception_test)
-
-
-using namespace std;
-using namespace qpid;
-using namespace sys;
-using namespace client;
-using namespace framing;
-
-using boost::bind;
-using boost::function;
-
-template <class Ex>
-struct Catcher : public Runnable {
- function<void ()> f;
- bool caught;
- Thread thread;
-
- Catcher(function<void ()> f_) : f(f_), caught(false), thread(this) {}
- ~Catcher() { join(); }
-
- void run() {
- try { f(); }
- catch(const Ex& e) {
- caught=true;
- BOOST_MESSAGE(string("Caught expected exception: ")+e.what());
- }
- catch(const std::exception& e) {
- BOOST_ERROR(string("Bad exception: ")+e.what());
- }
- catch(...) {
- BOOST_ERROR(string("Bad exception: unknown"));
- }
- }
-
- bool join() {
- if (thread.id()) {
- thread.join();
- thread=Thread();
- }
- return caught;
- }
-};
-
-BOOST_FIXTURE_TEST_CASE(DisconnectedPop, ProxySessionFixture) {
- ProxyConnection c(broker->getPort());
- session.queueDeclare(arg::queue="q");
- subs.subscribe(lq, "q");
- Catcher<ClosedException> pop(bind(&LocalQueue::pop, boost::ref(lq)));
- connection.proxy.close();
- BOOST_CHECK(pop.join());
-}
-
-BOOST_FIXTURE_TEST_CASE(DisconnectedListen, ProxySessionFixture) {
- struct NullListener : public MessageListener {
- void received(Message&) { BOOST_FAIL("Unexpected message"); }
- } l;
- ProxyConnection c(broker->getPort());
- session.queueDeclare(arg::queue="q");
- subs.subscribe(l, "q");
- Thread t(subs);
- connection.proxy.close();
- t.join();
- BOOST_CHECK_THROW(session.close(), InternalErrorException);
-}
-
-BOOST_FIXTURE_TEST_CASE(NoSuchQueueTest, ProxySessionFixture) {
- BOOST_CHECK_THROW(subs.subscribe(lq, "no such queue").sync(), NotFoundException);
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/fanout_perftest b/qpid/cpp/src/tests/fanout_perftest
deleted file mode 100755
index 602aac25b7..0000000000
--- a/qpid/cpp/src/tests/fanout_perftest
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec `dirname $0`/run_perftest 10000 --mode fanout --npubs 16 --nsubs 16
diff --git a/qpid/cpp/src/tests/interop_runner.cpp b/qpid/cpp/src/tests/interop_runner.cpp
deleted file mode 100644
index 824af7f3b7..0000000000
--- a/qpid/cpp/src/tests/interop_runner.cpp
+++ /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.
- *
- */
-
-#include "qpid/Options.h"
-#include "qpid/ptr_map.h"
-#include "qpid/Exception.h"
-#include "qpid/client/Channel.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/Exchange.h"
-#include "qpid/client/MessageListener.h"
-#include "qpid/client/Queue.h"
-#include "qpid/sys/Thread.h"
-#include "qpid/sys/Time.h"
-#include <iostream>
-#include <memory>
-#include "BasicP2PTest.h"
-#include "BasicPubSubTest.h"
-#include "TestCase.h"
-#include <boost/ptr_container/ptr_map.hpp>
-
-/**
- * Framework for interop tests.
- *
- * [see http://cwiki.apache.org/confluence/display/qpid/Interop+Testing+Specification for details].
- */
-
-using namespace qpid::client;
-using namespace qpid::sys;
-using qpid::TestCase;
-using qpid::TestOptions;
-using qpid::framing::FieldTable;
-using qpid::framing::ReplyTo;
-using namespace std;
-
-class DummyRun : public TestCase
-{
-public:
- DummyRun() {}
- void assign(const string&, FieldTable&, TestOptions&) {}
- void start() {}
- void stop() {}
- void report(qpid::client::Message&) {}
-};
-
-string parse_next_word(const string& input, const string& delims, string::size_type& position);
-
-/**
- */
-class Listener : public MessageListener, private Runnable{
- typedef boost::ptr_map<string, TestCase> TestMap;
-
- Channel& channel;
- TestOptions& options;
- TestMap tests;
- const string name;
- const string topic;
- TestCase* test;
- auto_ptr<Thread> runner;
- ReplyTo reportTo;
- string reportCorrelator;
-
- void shutdown();
- bool invite(const string& name);
- void run();
-
- void sendResponse(Message& response, ReplyTo replyTo);
- void sendResponse(Message& response, Message& request);
- void sendSimpleResponse(const string& type, Message& request);
- void sendReport();
-public:
- Listener(Channel& channel, TestOptions& options);
- void received(Message& msg);
- void bindAndConsume();
- void registerTest(string name, TestCase* test);
-};
-
-int main(int argc, char** argv) {
- try {
- TestOptions options;
- options.parse(argc, argv);
- if (options.help)
- cout << options;
- else {
- Connection connection(options.trace);
- connection.open(options.host, options.port, "guest", "guest", options.virtualhost);
-
- Channel channel;
- connection.openChannel(channel);
-
- Listener listener(channel, options);
- listener.registerTest("TC1_DummyRun", new DummyRun());
- listener.registerTest("TC2_BasicP2P", new qpid::BasicP2PTest());
- listener.registerTest("TC3_BasicPubSub", new qpid::BasicPubSubTest());
-
- listener.bindAndConsume();
-
- channel.run();
- connection.close();
- }
- } catch(const exception& error) {
- cout << error.what() << endl << "Type " << argv[0] << " --help for help" << endl;
- }
-}
-
-Listener::Listener(Channel& _channel, TestOptions& _options) : channel(_channel), options(_options), name(options.clientid), topic("iop.control." + name)
-{}
-
-void Listener::registerTest(string name, TestCase* test)
-{
- tests.insert(name, test);
-}
-
-void Listener::bindAndConsume()
-{
- Queue control(name, true);
- channel.declareQueue(control);
- qpid::framing::FieldTable bindArgs;
- //replace these separate binds with a wildcard once that is supported on java broker
- channel.bind(Exchange::STANDARD_TOPIC_EXCHANGE, control, "iop.control", bindArgs);
- channel.bind(Exchange::STANDARD_TOPIC_EXCHANGE, control, topic, bindArgs);
-
- string tag;
- channel.consume(control, tag, this);
-}
-
-void Listener::sendSimpleResponse(const string& type, Message& request)
-{
- Message response;
- response.getHeaders().setString("CONTROL_TYPE", type);
- response.getHeaders().setString("CLIENT_NAME", name);
- response.getHeaders().setString("CLIENT_PRIVATE_CONTROL_KEY", topic);
- response.getMessageProperties().setCorrelationId(request.getMessageProperties().getCorrelationId());
- sendResponse(response, request);
-}
-
-void Listener::sendResponse(Message& response, Message& request)
-{
- sendResponse(response, request.getMessageProperties().getReplyTo());
-}
-
-void Listener::sendResponse(Message& response, ReplyTo replyTo)
-{
- string exchange = replyTo.getExchangeName();
- string routingKey = replyTo.getRoutingKey();
- channel.publish(response, exchange, routingKey);
-}
-
-void Listener::received(Message& message)
-{
- string type(message.getHeaders().getString("CONTROL_TYPE"));
-
- if (type == "INVITE") {
- string name(message.getHeaders().getString("TEST_NAME"));
- if (name.empty() || invite(name)) {
- sendSimpleResponse("ENLIST", message);
- } else {
- cout << "Can't take part in '" << name << "'" << endl;
- }
- } else if (type == "ASSIGN_ROLE") {
- test->assign(message.getHeaders().getString("ROLE"), message.getHeaders(), options);
- sendSimpleResponse("ACCEPT_ROLE", message);
- } else if (type == "START") {
- reportTo = message.getMessageProperties().getReplyTo();
- reportCorrelator = message.getMessageProperties().getCorrelationId();
- runner = auto_ptr<Thread>(new Thread(this));
- } else if (type == "STATUS_REQUEST") {
- reportTo = message.getMessageProperties().getReplyTo();
- reportCorrelator = message.getMessageProperties().getCorrelationId();
- test->stop();
- sendReport();
- } else if (type == "TERMINATE") {
- if (test) test->stop();
- shutdown();
- } else {
- cerr <<"ERROR!: Received unknown control message: " << type << endl;
- shutdown();
- }
-}
-
-void Listener::shutdown()
-{
- channel.close();
-}
-
-bool Listener::invite(const string& name)
-{
- TestMap::iterator i = tests.find(name);
- test = (i != tests.end()) ? qpid::ptr_map::get_pointer(i) : 0;
- return test;
-}
-
-void Listener::run()
-{
- //NB: this method will be called in its own thread
- //start test and when start returns...
- test->start();
- sendReport();
-}
-
-void Listener::sendReport()
-{
- Message report;
- report.getHeaders().setString("CONTROL_TYPE", "REPORT");
- test->report(report);
- report.getMessageProperties().setCorrelationId(reportCorrelator);
- sendResponse(report, reportTo);
-}
-
-string parse_next_word(const string& input, const string& delims, string::size_type& position)
-{
- string::size_type start = input.find_first_not_of(delims, position);
- if (start == string::npos) {
- return "";
- } else {
- string::size_type end = input.find_first_of(delims, start);
- if (end == string::npos) {
- end = input.length();
- }
- position = end;
- return input.substr(start, end - start);
- }
-}
diff --git a/qpid/cpp/src/tests/latencytest.cpp b/qpid/cpp/src/tests/latencytest.cpp
deleted file mode 100644
index 2b44a5477a..0000000000
--- a/qpid/cpp/src/tests/latencytest.cpp
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-#include <algorithm>
-#include <iostream>
-#include <memory>
-#include <sstream>
-#include <vector>
-#include <unistd.h>
-
-#include "TestOptions.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/Message.h"
-#include "qpid/client/Session.h"
-#include "qpid/client/SubscriptionManager.h"
-
-using namespace qpid;
-using namespace qpid::client;
-using namespace qpid::sys;
-using std::string;
-
-typedef std::vector<std::string> StringSet;
-
-struct Args : public qpid::TestOptions {
- uint size;
- uint count;
- uint rate;
- uint reportFrequency;
- uint queues;
- uint prefetch;
- uint ack;
- bool durable;
- string base;
-
- Args() : size(256), count(1000), rate(0), reportFrequency(1), queues(1),
- prefetch(100), ack(0),
- durable(false), base("latency-test")
- {
- addOptions()
-
- ("size", optValue(size, "N"), "message size")
- ("queues", optValue(queues, "N"), "number of queues")
- ("count", optValue(count, "N"), "number of messages to send")
- ("rate", optValue(rate, "N"), "target message rate (causes count to be ignored)")
- ("report-frequency", optValue(reportFrequency, "N"),
- "number of seconds to wait between reports (ignored unless rate specified)")
- ("prefetch", optValue(prefetch, "N"), "prefetch count (0 implies no flow control, and no acking)")
- ("ack", optValue(ack, "N"), "Ack frequency in messages (defaults to half the prefetch value)")
- ("durable", optValue(durable, "yes|no"), "use durable messages")
- ("queue-base-name", optValue(base, "<name>"), "base name for queues");
- }
-};
-
-const std::string chars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
-
-Args opts;
-
-uint64_t current_time()
-{
- Duration t(now());
- return t;
-}
-
-struct Stats
-{
- Mutex lock;
- uint count;
- double minLatency;
- double maxLatency;
- double totalLatency;
-
- Stats();
- void update(double l);
- void print();
- void reset();
-};
-
-class Client : public Runnable
-{
-protected:
- Connection connection;
- Session session;
- Thread thread;
- string queue;
-
-public:
- Client(const string& q);
- virtual ~Client() {}
-
- void start();
- void join();
- void run();
- virtual void test() = 0;
-};
-
-class Receiver : public Client, public MessageListener
-{
- SubscriptionManager mgr;
- uint count;
- Stats& stats;
-
-public:
- Receiver(const string& queue, Stats& stats);
- void test();
- void received(Message& msg);
- Stats getStats();
-};
-
-
-class Sender : public Client
-{
- string generateData(uint size);
- void sendByRate();
- void sendByCount();
-public:
- Sender(const string& queue);
- void test();
-};
-
-
-class Test
-{
- const string queue;
- Stats stats;
- Receiver receiver;
- Sender sender;
- AbsTime begin;
-
-public:
- Test(const string& q) : queue(q), receiver(queue, stats), sender(queue), begin(now()) {}
- void start();
- void join();
- void report();
-};
-
-
-Client::Client(const string& q) : queue(q)
-{
- opts.open(connection);
- session = connection.newSession(ASYNC);
-}
-
-void Client::start()
-{
- thread = Thread(this);
-}
-
-void Client::join()
-{
- thread.join();
-}
-
-void Client::run()
-{
- try{
- test();
- session.close();
- connection.close();
- } catch(const std::exception& e) {
- std::cout << "Error in receiver: " << e.what() << std::endl;
- }
-}
-
-Receiver::Receiver(const string& q, Stats& s) : Client(q), mgr(session), count(0), stats(s)
-{
- session.queueDeclare(arg::queue=queue, arg::durable=opts.durable, arg::autoDelete=true);
- uint msgCount = session.queueQuery(arg::queue=queue).get().getMessageCount();
- if (msgCount) {
- std::cout << "Warning: found " << msgCount << " msgs on " << queue << ". Purging..." << std::endl;
- session.queuePurge(arg::queue=queue);
- }
- if (opts.prefetch) {
- mgr.setAckPolicy(AckPolicy(opts.ack ? opts.ack : (opts.prefetch / 2)));
- mgr.setFlowControl(opts.prefetch, SubscriptionManager::UNLIMITED, true);
- } else {
- mgr.setConfirmMode(false);
- mgr.setFlowControl(SubscriptionManager::UNLIMITED, SubscriptionManager::UNLIMITED, false);
- }
- mgr.subscribe(*this, queue);
-}
-
-void Receiver::test()
-{
- mgr.run();
- mgr.cancel(queue);
-}
-
-void Receiver::received(Message& msg)
-{
- ++count;
- uint64_t sentAt = msg.getDeliveryProperties().getTimestamp();
- //uint64_t sentAt = msg.getHeaders().getTimestamp("sent-at");// TODO: add support for uint64_t as a field table type
- uint64_t receivedAt = current_time();
-
- stats.update(((double) (receivedAt - sentAt)) / TIME_MSEC);
-
- if (!opts.rate && count >= opts.count) {
- mgr.stop();
- }
-}
-
-void Stats::update(double latency)
-{
- Mutex::ScopedLock l(lock);
- count++;
- if (minLatency == 0 || minLatency > latency) minLatency = latency;
- if (maxLatency == 0 || maxLatency < latency) maxLatency = latency;
- totalLatency += latency;
-}
-
-Stats::Stats() : count(0), minLatency(0), maxLatency(0), totalLatency(0) {}
-
-void Stats::print()
-{
- Mutex::ScopedLock l(lock);
- std::cout << "Latency(ms): min=" << minLatency << ", max=" << maxLatency << ", avg=" << (totalLatency / count);
-}
-
-void Stats::reset()
-{
- Mutex::ScopedLock l(lock);
- count = 0;
- totalLatency = maxLatency = minLatency = 0;
-}
-
-Sender::Sender(const string& q) : Client(q) {}
-
-void Sender::test()
-{
- if (opts.rate) sendByRate();
- else sendByCount();
-}
-
-void Sender::sendByCount()
-{
- Message msg(generateData(opts.size), queue);
- if (opts.durable) {
- msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT);
- }
-
- Completion c;
- for (uint i = 0; i < opts.count; i++) {
- uint64_t sentAt(current_time());
- msg.getDeliveryProperties().setTimestamp(sentAt);
- //msg.getHeaders().setTimestamp("sent-at", sentAt);//TODO add support for uint64_t to field tables
- c = session.messageTransfer(arg::content=msg);
- }
- c.sync();
-}
-
-void Sender::sendByRate()
-{
- Message msg(generateData(opts.size), queue);
- if (opts.durable) {
- msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT);
- }
-
- //calculate metrics required for target rate
- uint msgsPerMsec = opts.rate / 1000;
-
- while (true) {
- uint64_t start(current_time());
- for (uint i = 0; i < msgsPerMsec; i++) {
- uint64_t sentAt(current_time());
- msg.getDeliveryProperties().setTimestamp(sentAt);
- //msg.getHeaders().setTimestamp("sent-at", sentAt);//TODO add support for uint64_t to field tables
- session.messageTransfer(arg::content=msg);
- }
- uint64_t timeTaken = (current_time() - start) / TIME_USEC;
- if (timeTaken < 1000) {
- usleep(1000 - timeTaken);
- } else if (timeTaken > 1000) {
- double timeMsecs = (double) timeTaken / 1000;
- std::cout << "Could not achieve desired rate. Sent " << msgsPerMsec << " in "
- << (timeMsecs) << "ms (" << ((msgsPerMsec * 1000 * 1000) / timeTaken) << " msgs/s)" << std::endl;
- }
- }
-}
-
-string Sender::generateData(uint size)
-{
- if (size < chars.length()) {
- return chars.substr(0, size);
- }
- std::string data;
- for (uint i = 0; i < (size / chars.length()); i++) {
- data += chars;
- }
- data += chars.substr(0, size % chars.length());
- return data;
-}
-
-
-void Test::start()
-{
- receiver.start();
- begin = AbsTime(now());
- sender.start();
-}
-
-void Test::join()
-{
- sender.join();
- receiver.join();
- AbsTime end = now();
- Duration time(begin, end);
- double msecs(time / TIME_MSEC);
- std::cout << "Sent " << opts.count << " msgs through " << queue
- << " in " << msecs << "ms (" << (opts.count * 1000 / msecs) << " msgs/s) ";
- stats.print();
- std::cout << std::endl;
-}
-
-void Test::report()
-{
- stats.print();
- std::cout << std::endl;
- stats.reset();
-}
-
-int main(int argc, char** argv)
-{
- try {
- opts.parse(argc, argv);
- boost::ptr_vector<Test> tests(opts.queues);
- for (uint i = 0; i < opts.queues; i++) {
- std::ostringstream out;
- out << opts.base << "-" << (i+1);
- tests.push_back(new Test(out.str()));
- }
- for (boost::ptr_vector<Test>::iterator i = tests.begin(); i != tests.end(); i++) {
- i->start();
- }
- if (opts.rate) {
- while (true) {
- usleep(opts.reportFrequency * 1000 * 1000);
- //print latency report:
- for (boost::ptr_vector<Test>::iterator i = tests.begin(); i != tests.end(); i++) {
- i->report();
- }
- }
- } else {
- for (boost::ptr_vector<Test>::iterator i = tests.begin(); i != tests.end(); i++) {
- i->join();
- }
- }
-
- return 0;
- } catch(const std::exception& e) {
- std::cout << e.what() << std::endl;
- }
- return 1;
-}
diff --git a/qpid/cpp/src/tests/logging.cpp b/qpid/cpp/src/tests/logging.cpp
deleted file mode 100644
index 2c0ed08105..0000000000
--- a/qpid/cpp/src/tests/logging.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "test_tools.h"
-#include "qpid/log/Logger.h"
-#include "qpid/log/Options.h"
-#include "qpid/memory.h"
-#include "qpid/Options.h"
-
-#include <boost/test/floating_point_comparison.hpp>
-#include <boost/format.hpp>
-#include "unit_test.h"
-
-#include <exception>
-#include <fstream>
-#include <time.h>
-
-
-QPID_AUTO_TEST_SUITE(loggingTestSuite)
-
-using namespace std;
-using namespace boost;
-using namespace qpid::log;
-
-BOOST_AUTO_TEST_CASE(testStatementInit) {
- Statement s=QPID_LOG_STATEMENT_INIT(debug); int line=__LINE__;
- BOOST_CHECK(!s.enabled);
- BOOST_CHECK_EQUAL(string(__FILE__), s.file);
- BOOST_CHECK_EQUAL(line, s.line);
- BOOST_CHECK_EQUAL(debug, s.level);
-}
-
-
-BOOST_AUTO_TEST_CASE(testSelector_enable) {
- Selector s;
- // Simple enable
- s.enable(debug,"foo");
- BOOST_CHECK(s.isEnabled(debug,"foo"));
- BOOST_CHECK(!s.isEnabled(error,"foo"));
- BOOST_CHECK(!s.isEnabled(error,"bar"));
-
- // Substring match
- BOOST_CHECK(s.isEnabled(debug, "bazfoobar"));
- BOOST_CHECK(!s.isEnabled(debug, "bazbar"));
-
- // Different levels for different substrings.
- s.enable(info, "bar");
- BOOST_CHECK(s.isEnabled(debug, "foobar"));
- BOOST_CHECK(s.isEnabled(info, "foobar"));
- BOOST_CHECK(!s.isEnabled(debug, "bar"));
- BOOST_CHECK(!s.isEnabled(info, "foo"));
-
- // Enable-strings
- s.enable("notice:blob");
- BOOST_CHECK(s.isEnabled(notice, "blob"));
- s.enable("error+:oops");
- BOOST_CHECK(s.isEnabled(error, "oops"));
- BOOST_CHECK(s.isEnabled(critical, "oops"));
-}
-
-BOOST_AUTO_TEST_CASE(testStatementEnabled) {
- // Verify that the singleton enables and disables static
- // log statements.
- Logger& l = Logger::instance();
- l.select(Selector(debug));
- static Statement s=QPID_LOG_STATEMENT_INIT(debug);
- BOOST_CHECK(!s.enabled);
- static Statement::Initializer init(s);
- BOOST_CHECK(s.enabled);
-
- static Statement s2=QPID_LOG_STATEMENT_INIT(warning);
- static Statement::Initializer init2(s2);
- BOOST_CHECK(!s2.enabled);
-
- l.select(Selector(warning));
- BOOST_CHECK(!s.enabled);
- BOOST_CHECK(s2.enabled);
-}
-
-struct TestOutput : public Logger::Output {
- vector<string> msg;
- vector<Statement> stmt;
-
- TestOutput(Logger& l) {
- l.output(std::auto_ptr<Logger::Output>(this));
- }
-
- void log(const Statement& s, const string& m) {
- msg.push_back(m);
- stmt.push_back(s);
- }
- string last() { return msg.back(); }
-};
-
-using boost::assign::list_of;
-
-BOOST_AUTO_TEST_CASE(testLoggerOutput) {
- Logger l;
- l.clear();
- l.select(Selector(debug));
- Statement s=QPID_LOG_STATEMENT_INIT(debug);
-
- TestOutput* out=new TestOutput(l);
-
- // Verify message is output.
- l.log(s, "foo");
- vector<string> expect=list_of("foo\n");
- BOOST_CHECK_EQUAL(expect, out->msg);
-
- // Verify multiple outputs
- TestOutput* out2=new TestOutput(l);
- l.log(Statement(), "baz");
- expect.push_back("baz\n");
- BOOST_CHECK_EQUAL(expect, out->msg);
- expect.erase(expect.begin());
- BOOST_CHECK_EQUAL(expect, out2->msg);
-}
-
-BOOST_AUTO_TEST_CASE(testMacro) {
- Logger& l=Logger::instance();
- l.clear();
- l.select(Selector(info));
- TestOutput* out=new TestOutput(l);
- QPID_LOG(info, "foo");
- vector<string> expect=list_of("foo\n");
- BOOST_CHECK_EQUAL(expect, out->msg);
- BOOST_CHECK_EQUAL(__FILE__, out->stmt.front().file);
-
- // Not enabled:
- QPID_LOG(debug, "bar");
- BOOST_CHECK_EQUAL(expect, out->msg);
-
- QPID_LOG(info, 42 << " bingo");
- expect.push_back("42 bingo\n");
- BOOST_CHECK_EQUAL(expect, out->msg);
-}
-
-BOOST_AUTO_TEST_CASE(testLoggerFormat) {
- Logger& l = Logger::instance();
- l.select(Selector(critical));
- TestOutput* out=new TestOutput(l);
-
- // Time format is YYY-Month-dd hh:mm:ss
- l.format(Logger::TIME);
- QPID_LOG(critical, "foo");
- string re("\\d\\d\\d\\d-[A-Z][a-z]+-\\d\\d \\d\\d:\\d\\d:\\d\\d foo\n");
- BOOST_CHECK_REGEX(re, out->last());
-
- l.format(Logger::FILE);
- QPID_LOG(critical, "foo");
- BOOST_CHECK_EQUAL(out->last(), string(__FILE__)+": foo\n");
-
- l.format(Logger::FILE|Logger::LINE);
- QPID_LOG(critical, "foo");
- BOOST_CHECK_REGEX(string(__FILE__)+":\\d+: foo\n", out->last());
-
- l.format(Logger::FUNCTION);
- QPID_LOG(critical, "foo");
-
- l.format(Logger::LEVEL);
- QPID_LOG(critical, "foo");
- BOOST_CHECK_EQUAL("critical foo\n", out->last());
-
- l.format(~0); // Everything
- QPID_LOG(critical, "foo");
- re=".* critical \\[[0-9a-f]*] "+string(__FILE__)+":\\d+:void .*testLoggerFormat.*\\(\\): foo\n";
- BOOST_CHECK_REGEX(re, out->last());
-}
-
-BOOST_AUTO_TEST_CASE(testOstreamOutput) {
- Logger& l=Logger::instance();
- l.clear();
- l.select(Selector(error));
- ostringstream os;
- l.output(os);
- QPID_LOG(error, "foo");
- QPID_LOG(error, "bar");
- QPID_LOG(error, "baz");
- BOOST_CHECK_EQUAL("foo\nbar\nbaz\n", os.str());
-}
-
-#if 0 // This test requires manual intervention. Normally disabled.
-BOOST_AUTO_TEST_CASE(testSyslogOutput) {
- Logger& l=Logger::instance();
- l.clear();
- l.select(Selector(info));
- l.syslog("qpid_test");
- QPID_LOG(info, "Testing QPID");
- BOOST_ERROR("Manually verify that /var/log/messages contains a recent line 'Testing QPID'");
-}
-#endif // 0
-
-int count() {
- static int n = 0;
- return n++;
-}
-
-int loggedCount() {
- static int n = 0;
- QPID_LOG(debug, "counting: " << n);
- return n++;
-}
-
-
-using namespace qpid::sys;
-
-// Measure CPU time.
-clock_t timeLoop(int times, int (*fp)()) {
- clock_t start=clock();
- while (times-- > 0)
- (*fp)();
- return clock() - start;
-}
-
-// Overhead test disabled because it consumes a ton of CPU and takes
-// forever under valgrind. Not friendly for regular test runs.
-//
-#if 0
-BOOST_AUTO_TEST_CASE(testOverhead) {
- // Ensure that the ratio of CPU time for an incrementing loop
- // with and without disabled log statements is in acceptable limits.
- //
- int times=100000000;
- clock_t noLog=timeLoop(times, count);
- clock_t withLog=timeLoop(times, loggedCount);
- double ratio=double(withLog)/double(noLog);
-
- // NB: in initial tests the ratio was consistently below 1.5,
- // 2.5 is reasonable and should avoid spurios failures
- // due to machine load.
- //
- BOOST_CHECK_SMALL(ratio, 2.5);
-}
-#endif // 0
-
-Statement statement(
- Level level, const char* file="", int line=0, const char* fn=0)
-{
- Statement s={0, file, line, fn, level};
- return s;
-}
-
-
-#define ARGC(argv) (sizeof(argv)/sizeof(char*))
-
-BOOST_AUTO_TEST_CASE(testOptionsParse) {
- char* argv[]={
- 0,
- "--log-enable", "error+:foo",
- "--log-enable", "debug:bar",
- "--log-enable", "info",
- "--log-output", "x",
- "--log-output", "y",
- "--log-level", "yes",
- "--log-source", "1",
- "--log-thread", "true",
- "--log-function", "YES"
- };
- qpid::log::Options opts;
- opts.parse(ARGC(argv), argv);
- vector<string> expect=list_of("error+:foo")("debug:bar")("info");
- BOOST_CHECK_EQUAL(expect, opts.selectors);
- expect=list_of("x")("y");
- BOOST_CHECK_EQUAL(expect, opts.outputs);
- BOOST_CHECK(opts.level);
- BOOST_CHECK(opts.source);
- BOOST_CHECK(opts.function);
- BOOST_CHECK(opts.thread);
-}
-
-BOOST_AUTO_TEST_CASE(testOptionsDefault) {
- Options opts;
- vector<string> expect=list_of("stderr");
- BOOST_CHECK_EQUAL(expect, opts.outputs);
- expect=list_of("error+");
- BOOST_CHECK_EQUAL(expect, opts.selectors);
- BOOST_CHECK(opts.time && opts.level);
- BOOST_CHECK(!(opts.source || opts.function || opts.thread));
-}
-
-BOOST_AUTO_TEST_CASE(testSelectorFromOptions) {
- char* argv[]={
- 0,
- "--log-enable", "error+:foo",
- "--log-enable", "debug:bar",
- "--log-enable", "info"
- };
- qpid::log::Options opts;
- opts.parse(ARGC(argv), argv);
- vector<string> expect=list_of("error+:foo")("debug:bar")("info");
- BOOST_CHECK_EQUAL(expect, opts.selectors);
- Selector s(opts);
- BOOST_CHECK(!s.isEnabled(warning, "x"));
- BOOST_CHECK(!s.isEnabled(debug, "x"));
- BOOST_CHECK(s.isEnabled(debug, "bar"));
- BOOST_CHECK(s.isEnabled(error, "foo"));
- BOOST_CHECK(s.isEnabled(critical, "foo"));
-}
-
-BOOST_AUTO_TEST_CASE(testOptionsFormat) {
- Logger l;
- {
- Options opts;
- BOOST_CHECK_EQUAL(Logger::TIME|Logger::LEVEL, l.format(opts));
- char* argv[]={
- 0,
- "--log-time", "no",
- "--log-level", "no",
- "--log-source", "1",
- "--log-thread", "1"
- };
- opts.parse(ARGC(argv), argv);
- BOOST_CHECK_EQUAL(
- Logger::FILE|Logger::LINE|Logger::THREAD, l.format(opts));
- }
- {
- Options opts; // Clear.
- char* argv[]={
- 0,
- "--log-level", "no",
- "--log-thread", "true",
- "--log-function", "YES",
- "--log-time", "YES"
- };
- opts.parse(ARGC(argv), argv);
- BOOST_CHECK_EQUAL(
- Logger::THREAD|Logger::FUNCTION|Logger::TIME,
- l.format(opts));
- }
-}
-
-BOOST_AUTO_TEST_CASE(testLoggerConfigure) {
- Logger& l=Logger::instance();
- l.clear();
- Options opts;
- char* argv[]={
- 0,
- "--log-time", "no",
- "--log-source", "yes",
- "--log-output", "logging.tmp",
- "--log-enable", "critical"
- };
- opts.parse(ARGC(argv), argv);
- l.configure(opts, "test");
- QPID_LOG(critical, "foo"); int srcline=__LINE__;
- ifstream log("logging.tmp");
- string line;
- getline(log, line);
- string expect=(format("critical %s:%d: foo")%__FILE__%srcline).str();
- BOOST_CHECK_EQUAL(expect, line);
- log.close();
- unlink("logging.tmp");
-}
-
-BOOST_AUTO_TEST_CASE(testQuoteNonPrintable) {
- Logger& l=Logger::instance();
- l.clear();
- Options opts;
- opts.outputs.clear();
- opts.outputs.push_back("logging.tmp");
- opts.time=false;
- l.configure(opts, "test");
- char s[] = "null\0tab\tspace newline\nret\r\x80\x99\xff";
- string str(s, sizeof(s));
- QPID_LOG(critical, str);
- ifstream log("logging.tmp");
- string line;
- getline(log, line);
- string expect="critical null\\00tab\\09space newline\\0Aret\\0D\\80\\99\\FF\\00";
- BOOST_CHECK_EQUAL(expect, line);
- log.close();
- unlink("logging.tmp");
-}
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/multiq_perftest b/qpid/cpp/src/tests/multiq_perftest
deleted file mode 100755
index f6644e740c..0000000000
--- a/qpid/cpp/src/tests/multiq_perftest
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec `dirname $0`/run_perftest 10000 --mode shared --qt 16
diff --git a/qpid/cpp/src/tests/perfdist b/qpid/cpp/src/tests/perfdist
deleted file mode 100755
index 816d2d99f6..0000000000
--- a/qpid/cpp/src/tests/perfdist
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-#
-# Distributed perftest.
-# Runs perftest clients on multiple hosts using ssh.
-#
-
-set -e
-usage() {
-cat <<EOF
-usage: $0 <perftest-args> -- <client-hosts ...>
-
-Run perftest with clients running on the listed hosts. Clients are
-assigned to hosts publishers first, then subscribers the host list is
-used round-robin if there are more clients than hosts. perftest-args should
-include a --host <brokerhost> flag.
-
-Do not pass preftest action flags: --setup, --control, --publish, --subscribe.
-The script will pass them to the appropriate client processes.
-
-Note all perftest args must come before --.
-
-Error: $*
-EOF
-exit 1
-}
-
-collect() { eval $COLLECT=\""\$$COLLECT $*"\"; }
-NPUBS=1
-NSUBS=1
-COLLECT=ARGS
-while test $# -gt 0; do
- case $1 in
- --publish|--subscribe|--setup|--control) usage "Don't pass perftest action flags: $1" ;;
- --npubs) collect $1 $2; NPUBS=$2; shift 2 ;;
- --nsubs) collect $1 $2; NSUBS=$2; shift 2 ;;
- --) COLLECT=HOSTS; shift ;;
- *) collect $1; shift ;;
- esac
-done
-if [ -z "$HOSTS" ]; then usage "No hosts listed after --"; fi
-PATH="`dirname $0`:$PATH"
-PERFTEST="`which perftest` $ARGS" || usage "Can't find perftest executable"
-
-HOSTS=($HOSTS)
-start() { ssh ${HOSTS[i % ${#HOSTS[*]}]} $PERFTEST $*& }
-
-$PERFTEST --setup
-for (( i=0 ; i < $NPUBS ; ++i)); do start --publish; done
-for (( ; i < $NPUBS+$NSUBS ; ++i)); do start --subscribe; done
-$PERFTEST --control
diff --git a/qpid/cpp/src/tests/perftest.cpp b/qpid/cpp/src/tests/perftest.cpp
deleted file mode 100644
index b950e432f5..0000000000
--- a/qpid/cpp/src/tests/perftest.cpp
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "TestOptions.h"
-
-#include "qpid/client/Session.h"
-#include "qpid/client/SubscriptionManager.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/Completion.h"
-#include "qpid/client/Message.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/sys/Time.h"
-
-#include <boost/lexical_cast.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-
-#include <iostream>
-#include <sstream>
-#include <numeric>
-#include <algorithm>
-#include <unistd.h>
-
-
-using namespace std;
-using namespace qpid;
-using namespace client;
-using namespace sys;
-using boost::lexical_cast;
-using boost::bind;
-
-enum Mode { SHARED, FANOUT, TOPIC };
-const char* modeNames[] = { "shared", "fanout", "topic" };
-
-// istream/ostream ops so Options can read/display Mode.
-istream& operator>>(istream& in, Mode& mode) {
- string s;
- in >> s;
- int i = find(modeNames, modeNames+3, s) - modeNames;
- if (i >= 3) throw Exception("Invalid mode: "+s);
- mode = Mode(i);
- return in;
-}
-
-ostream& operator<<(ostream& out, Mode mode) {
- return out << modeNames[mode];
-}
-
-
-struct Opts : public TestOptions {
-
- // Actions
- bool setup, control, publish, subscribe;
-
- // Queue policy
- uint32_t queueMaxCount;
- uint64_t queueMaxSize;
-
- // Publisher
- size_t pubs;
- size_t count ;
- size_t size;
- bool confirm;
- bool durable;
- bool uniqueData;
-
- // Subscriber
- size_t subs;
- size_t ack;
-
- // General
- size_t qt;
- size_t iterations;
- Mode mode;
- bool summary;
- uint32_t intervalSub;
- uint32_t intervalPub;
-
- static const std::string helpText;
-
- Opts() :
- TestOptions(helpText),
- setup(false), control(false), publish(false), subscribe(false),
- pubs(1), count(500000), size(1024), confirm(true), durable(false), uniqueData(false),
- subs(1), ack(0),
- qt(1), iterations(1), mode(SHARED), summary(false),
- intervalSub(0), intervalPub(0)
- {
- addOptions()
- ("setup", optValue(setup), "Create shared queues.")
- ("control", optValue(control), "Run test, print report.")
- ("publish", optValue(publish), "Publish messages.")
- ("subscribe", optValue(subscribe), "Subscribe for messages.")
-
- ("mode", optValue(mode, "shared|fanout|topic"), "Test mode."
- "\nshared: --qt queues, --npubs publishers and --nsubs subscribers per queue.\n"
- "\nfanout: --npubs publishers, --nsubs subscribers, fanout exchange."
- "\ntopic: --qt topics, --npubs publishers and --nsubs subscribers per topic.\n")
-
- ("npubs", optValue(pubs, "N"), "Create N publishers.")
- ("count", optValue(count, "N"), "Each publisher sends N messages.")
- ("size", optValue(size, "BYTES"), "Size of messages in bytes.")
- ("pub-confirm", optValue(confirm, "yes|no"), "Publisher use confirm-mode.")
- ("durable", optValue(durable, "yes|no"), "Publish messages as durable.")
- ("unique-data", optValue(uniqueData, "yes|no"), "Make data for each message unique.")
-
- ("nsubs", optValue(subs, "N"), "Create N subscribers.")
- ("sub-ack", optValue(ack, "N"), "N>0: Subscriber acks batches of N.\n"
- "N==0: Subscriber uses unconfirmed mode")
-
- ("qt", optValue(qt, "N"), "Create N queues or topics.")
- ("iterations", optValue(iterations, "N"), "Desired number of iterations of the test.")
- ("summary,s", optValue(summary), "Summary output: pubs/sec subs/sec transfers/sec Mbytes/sec")
-
- ("queue_max_count", optValue(queueMaxCount, "N"), "queue policy: count to trigger 'flow to disk'")
- ("queue_max_size", optValue(queueMaxSize, "N"), "queue policy: accumulated size to trigger 'flow to disk'")
-
- ("interval_sub", optValue(intervalSub, "ms"), ">=0 delay between msg consume")
- ("interval_pub", optValue(intervalPub, "ms"), ">=0 delay between msg publish");
- }
-
- // Computed values
- size_t totalPubs;
- size_t totalSubs;
- size_t transfers;
- size_t subQuota;
-
- void parse(int argc, char** argv) {
- TestOptions::parse(argc, argv);
- switch (mode) {
- case SHARED:
- if (count % subs) {
- count += subs - (count % subs);
- cout << "WARNING: Adjusted --count to " << count
- << " the nearest multiple of --nsubs" << endl;
- }
- totalPubs = pubs*qt;
- totalSubs = subs*qt;
- subQuota = (pubs*count)/subs;
- break;
- case FANOUT:
- if (qt != 1) cerr << "WARNING: Fanout mode, ignoring --qt="
- << qt << endl;
- qt=1;
- totalPubs = pubs;
- totalSubs = subs;
- subQuota = totalPubs*count;
- break;
- case TOPIC:
- totalPubs = pubs*qt;
- totalSubs = subs*qt;
- subQuota = pubs*count;
- break;
- }
- transfers=(totalPubs*count) + (totalSubs*subQuota);
- }
-};
-
-const std::string Opts::helpText=
-"There are two ways to use perftest: single process or multi-process.\n\n"
-"If none of the --setup, --publish, --subscribe or --control options\n"
-"are given perftest will run a single-process test.\n"
-"For a multi-process test first run:\n"
-" perftest --setup <other options>\n"
-"and wait for it to complete. The remaining process should run concurrently::\n"
-"Run --npubs times: perftest --publish <other options>\n"
-"Run --nsubs times: perftest --subscribe <other options>\n"
-"Run once: perftest --control <other options>\n"
-"Note the <other options> must be identical for all processes.\n";
-
-Opts opts;
-
-struct Client : public Runnable {
- Connection connection;
- Session session;
- Thread thread;
-
- Client() {
- opts.open(connection);
- session = connection.newSession(ASYNC);
- }
-
- ~Client() {
- session.close();
- connection.close();
- }
-};
-
-struct Setup : public Client {
-
- void queueInit(string name, bool durable=false, const framing::FieldTable& settings=framing::FieldTable()) {
- session.queueDeclare(arg::queue=name, arg::durable=durable, arg::arguments=settings);
- session.queuePurge(arg::queue=name).sync();
- }
-
- void run() {
- queueInit("pub_start");
- queueInit("pub_done");
- queueInit("sub_ready");
- queueInit("sub_done");
- if (opts.mode==SHARED) {
- framing::FieldTable settings;//queue policy settings
- settings.setInt("qpid.max_count", opts.queueMaxCount);
- settings.setInt("qpid.max_size", opts.queueMaxSize);
- for (size_t i = 0; i < opts.qt; ++i) {
- ostringstream qname;
- qname << "perftest" << i;
- queueInit(qname.str(), opts.durable, settings);
- }
- }
- }
-};
-
-void expect(string actual, string expect) {
- if (expect != actual)
- throw Exception("Expecting "+expect+" but received "+actual);
-
-}
-
-double secs(Duration d) { return double(d)/TIME_SEC; }
-double secs(AbsTime start, AbsTime finish) {
- return secs(Duration(start,finish));
-}
-
-
-// Collect rates & print stats.
-class Stats {
- vector<double> values;
- double sum;
-
- public:
- Stats() : sum(0) {}
-
- // Functor to collect rates.
- void operator()(const string& data) {
- try {
- double d=lexical_cast<double>(data);
- values.push_back(d);
- sum += d;
- } catch (const std::exception&) {
- throw Exception("Bad report: "+data);
- }
- }
-
- double mean() const {
- return sum/values.size();
- }
-
- double stdev() const {
- if (values.size() <= 1) return 0;
- double avg = mean();
- double ssq = 0;
- for (vector<double>::const_iterator i = values.begin();
- i != values.end(); ++i) {
- double x=*i;
- x -= avg;
- ssq += x*x;
- }
- return sqrt(ssq/(values.size()-1));
- }
-
- ostream& print(ostream& out) {
- ostream_iterator<double> o(out, "\n");
- copy(values.begin(), values.end(), o);
- out << "Average: " << mean();
- if (values.size() > 1)
- out << " (std.dev. " << stdev() << ")";
- return out << endl;
- }
-};
-
-
-// Manage control queues, collect and print reports.
-struct Controller : public Client {
-
- SubscriptionManager subs;
-
- Controller() : subs(session) {}
-
- /** Process messages from queue by applying a functor. */
- void process(size_t n, string queue,
- boost::function<void (const string&)> msgFn)
- {
- if (!opts.summary)
- cout << "Processing " << n << " messages from "
- << queue << " " << flush;
- LocalQueue lq;
- subs.setFlowControl(n, SubscriptionManager::UNLIMITED, false);
- subs.subscribe(lq, queue);
- for (size_t i = 0; i < n; ++i) {
- if (!opts.summary) cout << "." << flush;
- msgFn(lq.pop().getData());
- }
- if (!opts.summary) cout << " done." << endl;
- }
-
- void process(size_t n, LocalQueue lq, string queue,
- boost::function<void (const string&)> msgFn)
- {
- session.messageFlow(queue, 0, n);
- if (!opts.summary)
- cout << "Processing " << n << " messages from "
- << queue << " " << flush;
- for (size_t i = 0; i < n; ++i) {
- if (!opts.summary) cout << "." << flush;
- msgFn(lq.pop().getData());
- }
- if (!opts.summary) cout << " done." << endl;
- }
-
- void send(size_t n, string queue, string data) {
- if (!opts.summary)
- cout << "Sending " << data << " " << n << " times to " << queue
- << endl;
- Message msg(data, queue);
- for (size_t i = 0; i < n; ++i)
- session.messageTransfer(arg::content=msg);
- }
-
- void run() { // Controller
- try {
- // Wait for subscribers to be ready.
- process(opts.totalSubs, "sub_ready", bind(expect, _1, "ready"));
-
- LocalQueue pubDone;
- LocalQueue subDone;
- subs.setFlowControl(0, SubscriptionManager::UNLIMITED, false);
- subs.subscribe(pubDone, "pub_done");
- subs.subscribe(subDone, "sub_done");
-
- double txrateTotal(0);
- double mbytesTotal(0);
- double pubRateTotal(0);
- double subRateTotal(0);
-
- for (size_t j = 0; j < opts.iterations; ++j) {
- AbsTime start=now();
- send(opts.totalPubs, "pub_start", "start"); // Start publishers
-
- Stats pubRates;
- Stats subRates;
-
- process(opts.totalPubs, pubDone, "pub_done", boost::ref(pubRates));
- process(opts.totalSubs, subDone, "sub_done", boost::ref(subRates));
-
- AbsTime end=now();
-
- double time=secs(start, end);
- double txrate=opts.transfers/time;
- double mbytes=(txrate*opts.size)/(1024*1024);
-
- if (!opts.summary) {
- cout << endl << "Total " << opts.transfers << " transfers of "
- << opts.size << " bytes in "
- << time << " seconds." << endl;
- cout << endl << "Publish transfers/sec: " << endl;
- pubRates.print(cout);
- cout << endl << "Subscribe transfers/sec: " << endl;
- subRates.print(cout);
- cout << endl
- << "Total transfers/sec: " << txrate << endl
- << "Total Mbytes/sec: " << mbytes << endl;
- }
- else {
- cout << pubRates.mean() << "\t"
- << subRates.mean() << "\t"
- << txrate << "\t"
- << mbytes << endl;
- }
-
- txrateTotal += txrate;
- mbytesTotal += mbytes;
- pubRateTotal += pubRates.mean();
- subRateTotal += subRates.mean();
- }
- if (opts.iterations > 1) {
- cout << "Averages: "<< endl
- << (pubRateTotal / opts.iterations) << "\t"
- << (subRateTotal / opts.iterations) << "\t"
- << (txrateTotal / opts.iterations) << "\t"
- << (mbytesTotal / opts.iterations) << endl;
- }
- }
- catch (const std::exception& e) {
- cout << "Controller exception: " << e.what() << endl;
- exit(1);
- }
- }
-};
-
-
-struct PublishThread : public Client {
- string destination;
- string routingKey;
-
- PublishThread() {};
-
- PublishThread(string key, string dest=string()) {
- destination=dest;
- routingKey=key;
- }
-
- void run() { // Publisher
- Completion completion;
- try {
- string data;
- size_t offset(0);
- if (opts.uniqueData) {
- offset = 5;
- data += "data:";//marker (requested for latency testing tool scripts)
- data += string(sizeof(size_t), 'X');//space for seq no
- data += string(reinterpret_cast<const char*>(session.getId().data()), session.getId().size());
- if (opts.size > data.size()) {
- data += string(opts.size - data.size(), 'X');
- } else if(opts.size < data.size()) {
- cout << "WARNING: Increased --size to " << data.size()
- << " to honour --unique-data" << endl;
- }
- } else {
- size_t msgSize=max(opts.size, sizeof(size_t));
- data = string(msgSize, 'X');
- }
-
- Message msg(data, routingKey);
- if (opts.durable)
- msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT);
-
-
- SubscriptionManager subs(session);
- LocalQueue lq;
- subs.setFlowControl(1, SubscriptionManager::UNLIMITED, true);
- subs.subscribe(lq, "pub_start");
-
- for (size_t j = 0; j < opts.iterations; ++j) {
- expect(lq.pop().getData(), "start");
- AbsTime start=now();
- for (size_t i=0; i<opts.count; i++) {
- // Stamp the iteration into the message data, avoid
- // any heap allocation.
- const_cast<std::string&>(msg.getData()).replace(offset, sizeof(uint32_t),
- reinterpret_cast<const char*>(&i), sizeof(uint32_t));
- completion = session.messageTransfer(
- arg::destination=destination,
- arg::content=msg,
- arg::confirmMode=opts.confirm);
- if (opts.intervalPub) ::usleep(opts.intervalPub*1000);
- }
- if (opts.confirm) completion.sync();
- AbsTime end=now();
- double time=secs(start,end);
-
- // Send result to controller.
- Message report(lexical_cast<string>(opts.count/time), "pub_done");
- session.messageTransfer(arg::content=report);
- }
- session.close();
- }
- catch (const std::exception& e) {
- cout << "PublishThread exception: " << e.what() << endl;
- exit(1);
- }
- }
-};
-
-struct SubscribeThread : public Client {
-
- string queue;
-
- SubscribeThread() {}
-
- SubscribeThread(string q) { queue = q; }
-
- SubscribeThread(string key, string ex) {
- queue=session.getId().str(); // Unique name.
- session.queueDeclare(arg::queue=queue,
- arg::exclusive=true,
- arg::autoDelete=true,
- arg::durable=opts.durable);
- session.queueBind(arg::queue=queue,
- arg::exchange=ex,
- arg::routingKey=key);
- }
-
- void verify(bool cond, const char* test, uint32_t expect, uint32_t actual) {
- if (!cond) {
- Message error(
- QPID_MSG("Sequence error: expected n" << test << expect << " but got " << actual),
- "sub_done");
- session.messageTransfer(arg::content=error);
- throw Exception(error.getData());
- }
- }
-
- void run() { // Subscribe
- try {
- SubscriptionManager subs(session);
- LocalQueue lq(AckPolicy(opts.ack));
- subs.setConfirmMode(opts.ack > 0);
- subs.setFlowControl(opts.subQuota, SubscriptionManager::UNLIMITED,
- false);
- subs.subscribe(lq, queue);
- // Notify controller we are ready.
- session.messageTransfer(arg::content=Message("ready", "sub_ready"));
-
-
- for (size_t j = 0; j < opts.iterations; ++j) {
- if (j > 0) {
- //need to allocate some more credit
- session.messageFlow(queue, 0, opts.subQuota);
- }
- Message msg;
- AbsTime start=now();
- size_t expect=0;
- for (size_t i = 0; i < opts.subQuota; ++i) {
- msg=lq.pop();
- if (opts.intervalSub) ::usleep(opts.intervalSub*1000);
- // TODO aconway 2007-11-23: check message order for.
- // multiple publishers. Need an acorray of counters,
- // one per publisher and a publisher ID in the
- // message. Careful not to introduce a lot of overhead
- // here, e.g. no std::map, std::string etc.
- //
- // For now verify order only for a single publisher.
- size_t offset = opts.uniqueData ? 5 /*marker is 'data:'*/ : 0;
- size_t n = *reinterpret_cast<const uint32_t*>(msg.getData().data() + offset);
- if (opts.pubs == 1) {
- if (opts.subs == 1 || opts.mode == FANOUT) verify(n==expect, "==", expect, n);
- else verify(n>=expect, ">=", expect, n);
- expect = n+1;
- }
- }
- if (opts.ack !=0)
- msg.acknowledge(); // Cumulative ack for final batch.
- AbsTime end=now();
-
- // Report to publisher.
- Message result(lexical_cast<string>(opts.subQuota/secs(start,end)),
- "sub_done");
- session.messageTransfer(arg::content=result);
- }
- session.close();
- }
- catch (const std::exception& e) {
- cout << "SubscribeThread exception: " << e.what() << endl;
- exit(1);
- }
- }
-};
-
-int main(int argc, char** argv) {
-
- try {
- opts.parse(argc, argv);
-
- string exchange;
- switch (opts.mode) {
- case FANOUT: exchange="amq.fanout"; break;
- case TOPIC: exchange="amq.topic"; break;
- case SHARED: break;
- }
-
- bool singleProcess=
- (!opts.setup && !opts.control && !opts.publish && !opts.subscribe);
- if (singleProcess)
- opts.setup = opts.control = opts.publish = opts.subscribe = true;
-
- if (opts.setup) Setup().run(); // Set up queues
-
- boost::ptr_vector<Client> subs(opts.subs);
- boost::ptr_vector<Client> pubs(opts.pubs);
-
- // Start pubs/subs for each queue/topic.
- for (size_t i = 0; i < opts.qt; ++i) {
- ostringstream key;
- key << "perftest" << i; // Queue or topic name.
- if (opts.publish) {
- size_t n = singleProcess ? opts.pubs : 1;
- for (size_t j = 0; j < n; ++j) {
- pubs.push_back(new PublishThread(key.str(), exchange));
- pubs.back().thread=Thread(pubs.back());
- }
- }
- if (opts.subscribe) {
- size_t n = singleProcess ? opts.subs : 1;
- for (size_t j = 0; j < n; ++j) {
- if (opts.mode==SHARED)
- subs.push_back(new SubscribeThread(key.str()));
- else
- subs.push_back(new SubscribeThread(key.str(),exchange));
- subs.back().thread=Thread(subs.back());
- }
- }
- }
-
- if (opts.control) Controller().run();
-
-
- // Wait for started threads.
- if (opts.publish) {
- for (boost::ptr_vector<Client>::iterator i=pubs.begin();
- i != pubs.end();
- ++i)
- i->thread.join();
- }
-
-
- if (opts.subscribe) {
- for (boost::ptr_vector<Client>::iterator i=subs.begin();
- i != subs.end();
- ++i)
- i->thread.join();
- }
- return 0;
- }
- catch (const std::exception& e) {
- cout << endl << e.what() << endl;
- }
- return 1;
-}
-
-
diff --git a/qpid/cpp/src/tests/python_tests b/qpid/cpp/src/tests/python_tests
deleted file mode 100755
index d9754ed0fb..0000000000
--- a/qpid/cpp/src/tests/python_tests
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-# Run the python tests.
-if test -d ../../../python ; then
- cd ../../../python && ./run-tests -v -s ../specs/amqp.0-10-preview.xml -I cpp_failing_0-10.txt -b localhost:$QPID_PORT $PYTHON_TESTS
-else
- echo Warning: python tests not found.
-fi
-
diff --git a/qpid/cpp/src/tests/qpid_test_plugin.h b/qpid/cpp/src/tests/qpid_test_plugin.h
deleted file mode 100644
index b2f4a8ffed..0000000000
--- a/qpid/cpp/src/tests/qpid_test_plugin.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef _qpid_test_plugin_
-#define _qpid_test_plugin_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/**
- * Convenience to include cppunit headers needed by qpid test plugins and
- * workaround for warning from superfluous main() declaration
- * in cppunit/TestPlugIn.h
- */
-
-#include <cppunit/TestCase.h>
-#include <cppunit/TextTestRunner.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-// Redefine CPPUNIT_PLUGIN_IMPLEMENT_MAIN to a dummy typedef to avoid warnings.
-//
-#if defined(CPPUNIT_HAVE_UNIX_DLL_LOADER) || defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)
-#undef CPPUNIT_PLUGIN_IMPLEMENT_MAIN
-#define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() typedef char __CppUnitPlugInImplementMainDummyTypeDef
-#endif
-
-#endif /*!_qpid_test_plugin_*/
diff --git a/qpid/cpp/src/tests/quick_perftest b/qpid/cpp/src/tests/quick_perftest
deleted file mode 100755
index 676436fdc7..0000000000
--- a/qpid/cpp/src/tests/quick_perftest
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec `dirname $0`/run_test ./perftest --summary --count 100
diff --git a/qpid/cpp/src/tests/quick_topictest b/qpid/cpp/src/tests/quick_topictest
deleted file mode 100755
index b1e63b9350..0000000000
--- a/qpid/cpp/src/tests/quick_topictest
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# Quick and quiet topic test for make check.
-test -z "$srcdir" && srcdir=.
-$srcdir/topictest -s2 -m2 -b1 > topictest.log 2>&1 || {
- echo $0 FAILED:
- cat topictest.log
- exit 1
-}
-rm topictest.log
diff --git a/qpid/cpp/src/tests/run-unit-tests b/qpid/cpp/src/tests/run-unit-tests
deleted file mode 100755
index 464ce131f5..0000000000
--- a/qpid/cpp/src/tests/run-unit-tests
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Library names (without path or .so) and CppUnit test paths can be
-# specified on the command line or in env var UNIT_TESTS. For example:
-#
-# Selected test classes:
-# ./run-unit-tests ValueTest ClientChannelTest
-#
-# Individual test method
-# ./run-unit-tests ValueTest :ValueTest::testStringValueEquals
-#
-# Build and run selected tests:
-# make check TESTS=run-unit-tests UNIT_TESTS=ClientChannelTest
-#
-
-for u in $* $UNIT_TESTS ; do
- case $u in
- :*) TEST_ARGS="$TEST_ARGS $u" ;; # A test path.
- *) TEST_ARGS="$TEST_ARGS .libs/$u.so" ;; # A test library.
- esac
-done
-test -z "$TEST_ARGS" && TEST_ARGS=".libs/*Test.so"
-
-test -z "$srcdir" && srcdir=.
-
-# libdlclose_noop prevents unloading symbols needed for valgrind output.
-export LD_PRELOAD=.libs/libdlclose_noop.so
-source $srcdir/run_test DllPlugInTester -c -b $TEST_ARGS
diff --git a/qpid/cpp/src/tests/run_perftest b/qpid/cpp/src/tests/run_perftest
deleted file mode 100755
index c1e66294c1..0000000000
--- a/qpid/cpp/src/tests/run_perftest
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-# Args: count [perftest options...]
-# Run a perftest with count multiplied.
-#
-MULTIPLIER=3
-COUNT=`expr $1 \* $MULTIPLIER`
-shift
-exec `dirname $0`/run_test ./perftest --summary --count $COUNT "$@"
diff --git a/qpid/cpp/src/tests/run_test b/qpid/cpp/src/tests/run_test
deleted file mode 100755
index 0f59509dab..0000000000
--- a/qpid/cpp/src/tests/run_test
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-#
-# Set up environment and run a test executable or script.
-#
-# Output nothing if test passes, show the output if it fails and
-# leave output in <test>.log for examination.
-#
-# If qpidd.port exists run test with QPID_PORT=`cat qpidd.port`
-#
-# If $VALGRIND if is set run under valgrind. If there are valgrind
-# erros show valgrind output, also leave it in <test>.valgrind for
-# examination.
-#
-
-source `dirname $0`/vg_check
-
-
-# Export variables from makefile.
-export VALGRIND srcdir
-
-# Export QPID_PORT if qpidd.port exists.
-test -f qpidd.port && export QPID_PORT=`cat qpidd.port`
-
-# Avoid silly libtool error messages if these are not defined
-test -z "$LC_ALL" && export LC_ALL=
-test -z "$LC_CTYPE" && export LC_CTYPE=
-test -z "$LC_COLLATE" && export LC_COLLATE=
-test -z "$LC_MESSAGES" && export LC_MESSAGES=
-
-VG_LOG="$1.vglog"
-rm -f $VG_LOG
-
-if grep -l "^# Generated by .*libtool" "$1" >/dev/null 2>&1; then
- # This is a libtool "executable". Valgrind it if VALGRIND specified.
- test -n "$VALGRIND" && VALGRIND="$VALGRIND --log-file-exactly=$VG_LOG --"
- # Hide output unless there's an error.
- libtool --mode=execute $VALGRIND "$@" 2>&1 || ERROR=$?
- test -n "$VALGRIND" && vg_check
-else
- # This is a non-libtool shell script, just execute it.
- export VALGRIND srcdir
- exec "$@"
-fi
-
-if test -z "$ERROR"; then
- # Clean up logs if there was no error.
- rm -f $VG_LOG
- exit 0
-else
- exit $ERROR
-fi
diff --git a/qpid/cpp/src/tests/serialize.cpp b/qpid/cpp/src/tests/serialize.cpp
deleted file mode 100644
index a120be6458..0000000000
--- a/qpid/cpp/src/tests/serialize.cpp
+++ /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.
- *
- */
-
-#include "unit_test.h"
-#include "qpid/amqp_0_10/built_in_types.h"
-#include "qpid/amqp_0_10/Codec.h"
-#include <boost/test/test_case_template.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/back_inserter.hpp>
-#include <boost/mpl/copy.hpp>
-#include <boost/mpl/empty_sequence.hpp>
-#include <iterator>
-#include <string>
-#include <ostream>
-#include <netinet/in.h>
-
-// Missing operators needed for tests.
-namespace boost {
-template <class T, size_t N>
-std::ostream& operator<<(std::ostream& out, const array<T,N>& a) {
- std::ostream_iterator<T> o(out, " ");
- std::copy(a.begin(), a.end(), o);
- return out;
-}
-} // boost
-
-namespace qpid {
-namespace sys {
-
-std::ostream& operator<<(std::ostream& out, const AbsTime& t) {
- return out << t.timeValue();
-}
-}
-
-namespace amqp_0_10 {
-template <class T, class SizeType>
-std::ostream& operator<<(std::ostream& out, const CodableString<T,SizeType>& str) {
- std::ostream_iterator<T> o(out, " ");
- std::copy(str.begin(), str.end(), o);
- return out;
-}
-}
-
-} // qpid
-
-
-QPID_AUTO_TEST_SUITE(SerializeTestSuite)
-
-
-
-using namespace std;
-namespace mpl=boost::mpl;
-using namespace qpid::amqp_0_10;
-
-template <class A, class B> struct concat2 { typedef typename mpl::copy<B, typename mpl::back_inserter<A> >::type type; };
-template <class A, class B, class C> struct concat3 { typedef typename concat2<A, typename concat2<B, C>::type>::type type; };
-template <class A, class B, class C, class D> struct concat4 { typedef typename concat2<A, typename concat3<B, C, D>::type>::type type; };
-
-typedef mpl::vector<Bit, Boolean, Char, Int32, Int64, Int8, Uint16, CharUtf32, Uint32, Uint64, Bin8, Uint8>::type IntegralTypes;
-typedef mpl::vector<Bin1024, Bin128, Bin16, Bin256, Bin32, Bin40, Bin512, Bin64, Bin72>::type BinTypes;
-typedef mpl::vector<Double, Float>::type FloatTypes;
-typedef mpl::vector<SequenceNo, Uuid, Datetime, Dec32, Dec64> FixedSizeClassTypes;
-typedef mpl::vector<Vbin8, Str8Latin, Str8, Str8Utf16, Vbin16, Str16Latin, Str16, Str16Utf16, Vbin32> VariableSizeTypes;
-
-
-typedef concat4<IntegralTypes, BinTypes, FloatTypes, FixedSizeClassTypes>::type FixedSizeTypes;
-typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes;
-
-// TODO aconway 2008-02-20: should test 64 bit integrals for order also.
-BOOST_AUTO_TEST_CASE(testNetworkByteOrder) {
- string data;
-
- uint32_t l = 1234567890;
- Codec::encode(std::back_inserter(data), l);
- uint32_t enc=reinterpret_cast<const uint32_t&>(*data.data());
- uint32_t l2 = ntohl(enc);
- BOOST_CHECK_EQUAL(l, l2);
-
- data.clear();
- uint16_t s = 12345;
- Codec::encode(std::back_inserter(data), s);
- uint32_t s2 = ntohs(*reinterpret_cast<const uint32_t*>(data.data()));
- BOOST_CHECK_EQUAL(s, s2);
-}
-
-void testValue(bool& b) { b = true; }
-template <class T> typename boost::enable_if<boost::is_arithmetic<T> >::type testValue(T& n) { n=42; }
-void testValue(long long& l) { l = 12345; }
-void testValue(Datetime& dt) { dt = qpid::sys::now(); }
-void testValue(Uuid& uuid) { uuid=Uuid(true); }
-template <class E, class M> void testValue(Decimal<E,M>& d) { d.exponent=2; d.mantissa=1234; }
-void testValue(SequenceNo& s) { s = 42; }
-template <class T, size_t N> void testValue(boost::array<T,N>& a) { a.assign(42); }
-template <class T, class SizeType> void testValue(CodableString<T, SizeType>& s) {
- char msg[]="foobar";
- s.assign(msg, msg+sizeof(msg));
-}
-
-// FIXME aconway 2008-02-20: test AllTypes
-BOOST_AUTO_TEST_CASE_TEMPLATE(testEncodeDecode, T, FixedSizeTypes)
-{
- string data;
- T t;
- testValue(t);
- Codec::encode(std::back_inserter(data), t);
-
- BOOST_CHECK_EQUAL(Codec::size(t), data.size());
-
- T t2;
- Codec::decode(data.begin(), t2);
- BOOST_CHECK_EQUAL(t,t2);
-}
-
-
-QPID_AUTO_TEST_SUITE_END()
diff --git a/qpid/cpp/src/tests/shared_perftest b/qpid/cpp/src/tests/shared_perftest
deleted file mode 100755
index 212ba22df4..0000000000
--- a/qpid/cpp/src/tests/shared_perftest
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec `dirname $0`/run_perftest 100000 --mode shared --npubs 16 --nsubs 16
diff --git a/qpid/cpp/src/tests/shlibtest.cpp b/qpid/cpp/src/tests/shlibtest.cpp
deleted file mode 100644
index 80320ea7be..0000000000
--- a/qpid/cpp/src/tests/shlibtest.cpp
+++ /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.
- *
- */
-
-int* loaderData = 0;
-extern "C" void callMe(int *i) { loaderData=i; }
-
-struct OnUnload { ~OnUnload() { *loaderData=42; } };
-OnUnload unloader; // For destructor.
-
-
-
diff --git a/qpid/cpp/src/tests/start_broker b/qpid/cpp/src/tests/start_broker
deleted file mode 100755
index 0d4352644b..0000000000
--- a/qpid/cpp/src/tests/start_broker
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-rm -f qpidd.vglog qpidd.log
-test -n "$VALGRIND" && VALGRIND="$VALGRIND --log-file-exactly=qpidd.vglog --"
-exec libtool --mode=execute $VALGRIND ../qpidd --daemon --port 0 --log-output qpidd.log "$@" > qpidd.port
diff --git a/qpid/cpp/src/tests/start_cluster b/qpid/cpp/src/tests/start_cluster
deleted file mode 100755
index 03fb671bdf..0000000000
--- a/qpid/cpp/src/tests/start_cluster
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-# Start a cluster of brokers on local host.
-# Print the cluster's URL.
-#
-
-test -f cluster.ports && { echo "cluster.ports file already exists" ; exit 1; }
-test -z "$*" && { echo "Usage: $0 cluster-size [options]"; exit 1; }
-
-rm -f cluster*.log cluster.ports
-SIZE=$1
-shift
-OPTS=$*
-CLUSTER=`whoami` # Cluster name=user name, avoid clashes.
-for (( i=0; i<SIZE; ++i )); do
- PORT=`../qpidd --load-module ../.libs/libqpidcluster.so -dp0 --log-output=cluster$i.log --cluster-name $CLUSTER $OPTS` || exit 1
- echo $PORT >> cluster.ports
-done
-
-
diff --git a/qpid/cpp/src/tests/stop_broker b/qpid/cpp/src/tests/stop_broker
deleted file mode 100755
index e141ef9841..0000000000
--- a/qpid/cpp/src/tests/stop_broker
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-# Stop the broker, check for errors.
-#
-export QPID_PORT=`cat qpidd.port`
-rm -f qpidd.port
-
-../qpidd --quit || ERROR=$?
-
-# Check qpidd.log.
-grep -a 'warning\|error\|critical' qpidd.log && {
- echo "WARNING: Suspicious broker log entries in qpidd.log, above."
-}
-
-# Check valgrind log.
-if test -n "$VALGRIND"; then
- source `dirname $0`/vg_check
- vg_check qpidd.vglog
-fi
-
-exit $ERROR
diff --git a/qpid/cpp/src/tests/stop_cluster b/qpid/cpp/src/tests/stop_cluster
deleted file mode 100755
index 6afcb527e5..0000000000
--- a/qpid/cpp/src/tests/stop_cluster
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-# Stop brokers on ports listed in cluster.ports
-
-
-PORTS=`cat cluster.ports`
-for PORT in $PORTS ; do
- ../qpidd -qp $PORT || ERROR="$ERROR $PORT"
-done
-rm -f cluster.ports
-
-if [ -n "$ERROR" ]; then
- echo "Errors stopping brokers on ports: $ERROR"
- exit 1
-fi
diff --git a/qpid/cpp/src/tests/test_tools.h b/qpid/cpp/src/tests/test_tools.h
deleted file mode 100644
index 2de4b6fbc1..0000000000
--- a/qpid/cpp/src/tests/test_tools.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef TEST_TOOLS_H
-#define TEST_TOOLS_H
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <boost/test/test_tools.hpp>
-#include <boost/assign/list_of.hpp>
-#include <boost/regex.hpp>
-#include <boost/assign/list_of.hpp>
-#include <vector>
-#include <ostream>
-
-// Print a sequence
-template <class T> std::ostream& seqPrint(std::ostream& o, const T& seq) {
- std::copy(seq.begin(), seq.end(), std::ostream_iterator<typename T::value_type>(o, " "));
- return o;
-}
-
-// Compare sequences
-template <class T, class U>
-bool seqEqual(const T& a, const U& b) {
- typename T::const_iterator i = a.begin();
- typename U::const_iterator j = b.begin();
- while (i != a.end() && j != b.end() && *i == *j) { ++i; ++j; }
- return (i == a.end()) && (j == b.end());
-}
-
-// ostream and == operators so we can compare vectors and boost::assign::list_of
-// with BOOST_CHECK_EQUALS
-namespace std { // In namespace std so boost can find them.
-
-template <class T>
-ostream& operator<<(ostream& o, const vector<T>& v) { return seqPrint(o, v); }
-
-template <class T>
-ostream& operator<<(ostream& o, const boost::assign_detail::generic_list<T>& l) { return seqPrint(o, l); }
-
-template <class T>
-bool operator == (const vector<T>& a, const boost::assign_detail::generic_list<T>& b) { return seqEqual(a, b); }
-
-template <class T>
-bool operator == (const boost::assign_detail::generic_list<T>& b, const vector<T>& a) { return seqEqual(a, b); }
-}
-
-/** NB: order of parameters is regex first, in line with
- * CHECK(expected, actual) convention.
- */
-inline bool regexPredicate(const std::string& re, const std::string& text) {
- return boost::regex_match(text, boost::regex(re));
-}
-
-/** Check for regular expression match. You must #include <boost/regex.hpp> */
-#define BOOST_CHECK_REGEX(re, text) \
- BOOST_CHECK_PREDICATE(regexPredicate, (re)(text))
-
-/** Check if types of two objects (as given by typeinfo::name()) match. */
-#define BOOST_CHECK_TYPEID_EQUAL(a,b) BOOST_CHECK_EQUAL(typeid(a).name(),typeid(b).name())
-
-#endif /*!TEST_TOOLS_H*/
-
diff --git a/qpid/cpp/src/tests/topic_listener.cpp b/qpid/cpp/src/tests/topic_listener.cpp
deleted file mode 100644
index e5e7d24112..0000000000
--- a/qpid/cpp/src/tests/topic_listener.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 provides one half of a test and example of a pub-sub
- * style of interaction. See topic_publisher.cpp for the other half,
- * in which the logic for publishing is defined.
- *
- * This file contains the listener logic. A listener will subscribe to
- * a logical 'topic'. It will count the number of messages it receives
- * and the time elapsed between the first one and the last one. It
- * recognises two types of 'special' message that tell it to (a) send
- * a report containing this information, (b) shutdown (i.e. stop
- * listening).
- */
-
-#include "TestOptions.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/MessageListener.h"
-#include "qpid/client/Session.h"
-#include "qpid/client/SubscriptionManager.h"
-#include "qpid/sys/Time.h"
-#include "qpid/framing/FieldValue.h"
-#include <iostream>
-#include <sstream>
-
-using namespace qpid;
-using namespace qpid::client;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using namespace std;
-
-/**
- * A message listener implementation in which the runtime logic is
- * defined.
- */
-class Listener : public MessageListener{
- Session& session;
- SubscriptionManager& mgr;
- const string responseQueue;
- const bool transactional;
- bool init;
- int count;
- AbsTime start;
-
- void shutdown();
- void report();
-public:
- Listener(Session& session, SubscriptionManager& mgr, const string& reponseQueue, bool tx);
- virtual void received(Message& msg);
-};
-
-/**
- * A utility class for managing the options passed in.
- */
-struct Args : public qpid::TestOptions {
- int ack;
- bool transactional;
- bool durable;
- int prefetch;
-
- Args() : ack(0), transactional(false), durable(false), prefetch(0) {
- addOptions()
- ("ack", optValue(ack, "MODE"), "Ack frequency in messages (defaults to half the prefetch value)")
- ("transactional", optValue(transactional), "Use transactions")
- ("durable", optValue(durable), "subscribers should use durable queues")
- ("prefetch", optValue(prefetch, "N"), "prefetch count (0 implies no flow control, and no acking)");
- }
-};
-
-
-/**
- * The main routine creates a Listener instance and sets it up to
- * consume from a private queue bound to the exchange with the
- * appropriate topic name.
- */
-int main(int argc, char** argv){
- try{
- Args args;
- args.parse(argc, argv);
- if(args.help)
- cout << args << endl;
- else {
- Connection connection(args.trace);
- args.open(connection);
- Session session = connection.newSession(ASYNC);
- if (args.transactional) {
- session.txSelect();
- }
-
- //declare exchange, queue and bind them:
- session.queueDeclare(arg::queue="response");
- std::string control = "control_" + session.getId().str();
- if (args.durable) {
- session.queueDeclare(arg::queue=control, arg::durable=true);
- } else {
- session.queueDeclare(arg::queue=control, arg::exclusive=true, arg::autoDelete=true);
- }
- session.queueBind(arg::exchange="amq.topic", arg::queue=control, arg::routingKey="topic_control");
-
- //set up listener
- SubscriptionManager mgr(session);
- Listener listener(session, mgr, "response", args.transactional);
- if (args.prefetch) {
- mgr.setAckPolicy(AckPolicy(args.ack ? args.ack : (args.prefetch / 2)));
- mgr.setFlowControl(args.prefetch, SubscriptionManager::UNLIMITED, true);
- } else {
- mgr.setConfirmMode(false);
- mgr.setFlowControl(SubscriptionManager::UNLIMITED, SubscriptionManager::UNLIMITED, false);
- }
- mgr.subscribe(listener, control);
-
- cout << "topic_listener: listening..." << endl;
- mgr.run();
- if (args.durable) {
- session.queueDelete(arg::queue=control);
- }
- session.close();
- cout << "closing connection" << endl;
- connection.close();
- }
- return 0;
- } catch (const std::exception& error) {
- cout << "topic_listener: " << error.what() << endl;
- }
- return 1;
-}
-
-Listener::Listener(Session& s, SubscriptionManager& m, const string& _responseq, bool tx) :
- session(s), mgr(m), responseQueue(_responseq), transactional(tx), init(false), count(0){}
-
-void Listener::received(Message& message){
- if(!init){
- start = now();
- count = 0;
- init = true;
- cout << "Batch started." << endl;
- }
- FieldTable::ValuePtr type(message.getHeaders().get("TYPE"));
-
- if(!!type && StringValue("TERMINATION_REQUEST") == *type){
- shutdown();
- }else if(!!type && StringValue("REPORT_REQUEST") == *type){
- message.acknowledge();//acknowledge everything upto this point
- cout <<"Batch ended, sending report." << endl;
- //send a report:
- report();
- init = false;
- }else if (++count % 1000 == 0){
- cout <<"Received " << count << " messages." << endl;
- }
-}
-
-void Listener::shutdown(){
- mgr.stop();
-}
-
-void Listener::report(){
- AbsTime finish = now();
- Duration time(start, finish);
- stringstream reportstr;
- reportstr << "Received " << count << " messages in "
- << time/TIME_MSEC << " ms.";
- Message msg(reportstr.str(), responseQueue);
- msg.getHeaders().setString("TYPE", "REPORT");
- session.messageTransfer(arg::content=msg);
- if(transactional){
- session.txCommit();
- }
-}
-
diff --git a/qpid/cpp/src/tests/topic_perftest b/qpid/cpp/src/tests/topic_perftest
deleted file mode 100755
index 5d317610f3..0000000000
--- a/qpid/cpp/src/tests/topic_perftest
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec `dirname $0`/run_perftest 10000 --mode topic --qt 16
diff --git a/qpid/cpp/src/tests/topic_publisher.cpp b/qpid/cpp/src/tests/topic_publisher.cpp
deleted file mode 100644
index 2271849c35..0000000000
--- a/qpid/cpp/src/tests/topic_publisher.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 provides one half of a test and example of a pub-sub
- * style of interaction. See topic_listener.cpp for the other half, in
- * which the logic for subscribers is defined.
- *
- * This file contains the publisher logic. The publisher will send a
- * number of messages to the exchange with the appropriate routing key
- * for the logical 'topic'. Once it has done this it will then send a
- * request that each subscriber report back with the number of message
- * it has received and the time that elapsed between receiving the
- * first one and receiving the report request. Once the expected
- * number of reports are received, it sends out a request that each
- * subscriber shutdown.
- */
-
-#include "TestOptions.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/MessageListener.h"
-#include "qpid/client/Session.h"
-#include "qpid/client/SubscriptionManager.h"
-#include "qpid/sys/Monitor.h"
-#include <unistd.h>
-#include "qpid/sys/Time.h"
-#include <cstdlib>
-#include <iostream>
-
-using namespace qpid;
-using namespace qpid::client;
-using namespace qpid::sys;
-using namespace std;
-
-/**
- * The publishing logic is defined in this class. It implements
- * message listener and can therfore be used to receive messages sent
- * back by the subscribers.
- */
-class Publisher {
- Session& session;
- SubscriptionManager mgr;
- LocalQueue queue;
- const string controlTopic;
- const bool transactional;
- const bool durable;
-
- string generateData(int size);
-
-public:
- Publisher(Session& session, const string& controlTopic, bool tx, bool durable);
- int64_t publish(int msgs, int listeners, int size);
- void terminate();
-};
-
-/**
- * A utility class for managing the options passed in to the test
- */
-struct Args : public TestOptions {
- int messages;
- int subscribers;
- bool transactional;
- bool durable;
- int batches;
- int delay;
- int size;
-
- Args() : messages(1000), subscribers(1),
- transactional(false), durable(false),
- batches(1), delay(0), size(256)
- {
- addOptions()
- ("messages", optValue(messages, "N"), "how many messages to send")
- ("subscribers", optValue(subscribers, "N"), "how many subscribers to expect reports from")
- ("transactional", optValue(transactional), "client should use transactions")
- ("durable", optValue(durable), "messages should be durable")
- ("batches", optValue(batches, "N"), "how many batches to run")
- ("delay", optValue(delay, "SECONDS"), "Causes a delay between each batch")
- ("size", optValue(size, "BYTES"), "size of the published messages");
- }
-};
-
-int main(int argc, char** argv) {
- try{
- Args args;
- args.parse(argc, argv);
- if(args.help)
- cout << args << endl;
- else {
- Connection connection(args.trace);
- args.open(connection);
- Session session = connection.newSession(ASYNC);
- if (args.transactional) {
- session.txSelect();
- }
-
-
- //declare queue (relying on default binding):
- session.queueDeclare(arg::queue="response");
-
- Publisher publisher(session, "topic_control", args.transactional, args.durable);
-
- int batchSize(args.batches);
- int64_t max(0);
- int64_t min(0);
- int64_t sum(0);
- for(int i = 0; i < batchSize; i++){
- if(i > 0 && args.delay) sleep(args.delay);
- int64_t msecs =
- publisher.publish(args.messages,
- args.subscribers,
- args.size) / TIME_MSEC;
- if(!max || msecs > max) max = msecs;
- if(!min || msecs < min) min = msecs;
- sum += msecs;
- cout << "Completed " << (i+1) << " of " << batchSize
- << " in " << msecs << "ms" << endl;
- }
- publisher.terminate();
- int64_t avg = sum / batchSize;
- if(batchSize > 1){
- cout << batchSize << " batches completed. avg=" << avg <<
- ", max=" << max << ", min=" << min << endl;
- }
- session.close();
- connection.close();
- }
- return 0;
- }catch(exception& error) {
- cout << error.what() << endl;
- }
- return 1;
-}
-
-Publisher::Publisher(Session& _session, const string& _controlTopic, bool tx, bool d) :
- session(_session), mgr(session), controlTopic(_controlTopic), transactional(tx), durable(d)
-{
- mgr.subscribe(queue, "response");
-}
-
-int64_t Publisher::publish(int msgs, int listeners, int size){
- Message msg(generateData(size), controlTopic);
- if (durable) {
- msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT);
- }
- AbsTime start = now();
-
- for(int i = 0; i < msgs; i++){
- session.messageTransfer(arg::content=msg, arg::destination="amq.topic");
- }
- //send report request
- Message reportRequest("", controlTopic);
- reportRequest.getHeaders().setString("TYPE", "REPORT_REQUEST");
- session.messageTransfer(arg::content=reportRequest, arg::destination="amq.topic");
- if(transactional){
- session.txCommit();
- }
- //wait for a response from each listener (TODO, could log these)
- for (int i = 0; i < listeners; i++) {
- Message report = queue.pop();
- }
-
- if(transactional){
- session.txCommit();
- }
-
- AbsTime finish = now();
- return Duration(start, finish);
-}
-
-string Publisher::generateData(int size){
- string data;
- for(int i = 0; i < size; i++){
- data += ('A' + (i / 26));
- }
- return data;
-}
-
-void Publisher::terminate(){
- //send termination request
- Message terminationRequest("", controlTopic);
- terminationRequest.getHeaders().setString("TYPE", "TERMINATION_REQUEST");
- session.messageTransfer(arg::content=terminationRequest, arg::destination="amq.topic");
- if(transactional){
- session.txCommit();
- }
-}
-
diff --git a/qpid/cpp/src/tests/topictest b/qpid/cpp/src/tests/topictest
deleted file mode 100755
index c36aa319ba..0000000000
--- a/qpid/cpp/src/tests/topictest
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-# Run the C++ topic test
-
-# Clean up old log files
-rm -f subscriber_*.log
-
-# Defaults values
-SUBSCRIBERS=10
-MESSAGES=2000
-BATCHES=10
-
-while getopts "s:m:b:h:" opt ; do
- case $opt in
- s) SUBSCRIBERS=$OPTARG ;;
- m) MESSAGES=$OPTARG ;;
- b) BATCHES=$OPTARG ;;
- h) HOST=-h$OPTARG ;;
- ?)
- echo "Usage: %0 [-s <subscribers>] [-m <messages.] [-b <batches>]"
- exit 1
- ;;
- esac
-done
-
-subscribe() {
- echo Start subscriber $1
- LOG="subscriber_$1.log"
- ./topic_listener > $LOG 2>&1 && rm -f $LOG
-}
-
-publish() {
- ./topic_publisher --messages $MESSAGES --batches $BATCHES --subscribers $SUBSCRIBERS $HOST
-}
-
-for ((i=$SUBSCRIBERS ; i--; )); do
- subscribe $i &
-done
-# FIXME aconway 2007-03-27: Hack around startup race. Fix topic test.
-sleep 1
-publish 2>&1 || exit 1
diff --git a/qpid/cpp/src/tests/txtest.cpp b/qpid/cpp/src/tests/txtest.cpp
deleted file mode 100644
index 4c5814986c..0000000000
--- a/qpid/cpp/src/tests/txtest.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <algorithm>
-#include <iostream>
-#include <memory>
-#include <sstream>
-#include <vector>
-
-#include "TestOptions.h"
-#include "qpid/client/Connection.h"
-#include "qpid/client/Message.h"
-#include "qpid/client/Session.h"
-#include "qpid/client/SubscriptionManager.h"
-
-using namespace qpid;
-using namespace qpid::client;
-using namespace qpid::sys;
-using std::string;
-
-typedef std::vector<std::string> StringSet;
-
-struct Args : public qpid::TestOptions {
- bool init, transfer, check;//actions
- uint size;
- bool durable;
- uint queues;
- string base;
- uint msgsPerTx;
- uint txCount;
- uint totalMsgCount;
-
- Args() : init(true), transfer(true), check(true),
- size(256), durable(true), queues(2),
- base("tx-test"), msgsPerTx(1), txCount(1), totalMsgCount(10)
- {
- addOptions()
-
- ("init", optValue(init, "yes|no"), "Declare queues and populate one with the initial set of messages.")
- ("transfer", optValue(transfer, "yes|no"), "'Move' messages from one queue to another using transactions to ensure no message loss.")
- ("check", optValue(check, "yes|no"), "Check that the initial messages are all still available.")
- ("size", optValue(size, "N"), "message size")
- ("durable", optValue(durable, "yes|no"), "use durable messages")
- ("queues", optValue(queues, "N"), "number of queues")
- ("queue-base-name", optValue(base, "<name>"), "base name for queues")
- ("messages-per-tx", optValue(msgsPerTx, "N"), "number of messages transferred per transaction")
- ("tx-count", optValue(txCount, "N"), "number of transactions per 'agent'")
- ("total-messages", optValue(totalMsgCount, "N"), "total number of messages in 'circulation'");
- }
-};
-
-const std::string chars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
-
-std::string generateData(uint size)
-{
- if (size < chars.length()) {
- return chars.substr(0, size);
- }
- std::string data;
- for (uint i = 0; i < (size / chars.length()); i++) {
- data += chars;
- }
- data += chars.substr(0, size % chars.length());
- return data;
-}
-
-void generateSet(const std::string& base, uint count, StringSet& collection)
-{
- for (uint i = 0; i < count; i++) {
- std::ostringstream out;
- out << base << "-" << (i+1);
- collection.push_back(out.str());
- }
-}
-
-Args opts;
-
-struct Client
-{
- Connection connection;
- Session session;
-
- Client()
- {
- opts.open(connection);
- session = connection.newSession(ASYNC);
- }
-
- ~Client()
- {
- try{
- session.close();
- connection.close();
- } catch(const std::exception& e) {
- std::cout << e.what() << std::endl;
- }
- }
-};
-
-struct Transfer : public Client, public Runnable
-{
- std::string src;
- std::string dest;
- Thread thread;
-
- Transfer(const std::string& to, const std::string& from) : src(to), dest(from) {}
-
- void run()
- {
- try {
-
- session.txSelect();
- SubscriptionManager subs(session);
-
- LocalQueue lq(AckPolicy(0));//manual acking
- subs.setFlowControl(opts.msgsPerTx, SubscriptionManager::UNLIMITED, true);
- subs.subscribe(lq, src);
-
- for (uint t = 0; t < opts.txCount; t++) {
- Message in;
- Message out("", dest);
- for (uint m = 0; m < opts.msgsPerTx; m++) {
- in = lq.pop();
- out.setData(in.getData());
- out.getMessageProperties().setCorrelationId(in.getMessageProperties().getCorrelationId());
- out.getDeliveryProperties().setDeliveryMode(in.getDeliveryProperties().getDeliveryMode());
- session.messageTransfer(arg::content=out);
- }
- in.acknowledge();
- session.txCommit();
- }
- } catch(const std::exception& e) {
- std::cout << "Transfer interrupted: " << e.what() << std::endl;
- }
- }
-};
-
-struct Controller : public Client
-{
- StringSet ids;
- StringSet queues;
-
- Controller()
- {
- generateSet(opts.base, opts.queues, queues);
- generateSet("msg", opts.totalMsgCount, ids);
- }
-
- void init()
- {
- //declare queues
- for (StringSet::iterator i = queues.begin(); i != queues.end(); i++) {
- session.queueDeclare(arg::queue=*i, arg::durable=opts.durable).sync();
- }
-
- Message msg(generateData(opts.size), *queues.begin());
- if (opts.durable) {
- msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT);
- }
-
- //publish messages
- for (StringSet::iterator i = ids.begin(); i != ids.end(); i++) {
- msg.getMessageProperties().setCorrelationId(*i);
- session.messageTransfer(arg::content=msg);
- }
- }
-
- void transfer()
- {
- boost::ptr_vector<Transfer> agents(opts.queues);
- //launch transfer agents
- for (StringSet::iterator i = queues.begin(); i != queues.end(); i++) {
- StringSet::iterator next = i + 1;
- if (next == queues.end()) next = queues.begin();
-
- std::cout << "Transfering from " << *i << " to " << *next << std::endl;
- agents.push_back(new Transfer(*i, *next));
- agents.back().thread = Thread(agents.back());
- }
-
- for (boost::ptr_vector<Transfer>::iterator i = agents.begin(); i != agents.end(); i++) {
- i->thread.join();
- }
- }
-
- void check()
- {
- SubscriptionManager subs(session);
- subs.setFlowControl(SubscriptionManager::UNLIMITED, SubscriptionManager::UNLIMITED, false);
- subs.setConfirmMode(false);
-
- StringSet drained;
- //drain each queue and verify the correct set of messages are available
- for (StringSet::iterator i = queues.begin(); i != queues.end(); i++) {
- //subscribe, allocate credit and flush
- LocalQueue lq(AckPolicy(0));//manual acking
- subs.subscribe(lq, *i, *i);
- session.messageFlush(arg::destination=*i).sync();
-
- uint count(0);
- while (!lq.empty()) {
- Message m = lq.pop();
- //add correlation ids of received messages to drained
- drained.push_back(m.getMessageProperties().getCorrelationId());
- ++count;
- }
- std::cout << "Drained " << count << " messages from " << *i << std::endl;
- }
-
- sort(ids.begin(), ids.end());
- sort(drained.begin(), drained.end());
-
- //check that drained == ids
- StringSet missing;
- set_difference(ids.begin(), ids.end(), drained.begin(), drained.end(), back_inserter(missing));
-
- StringSet extra;
- set_difference(drained.begin(), drained.end(), ids.begin(), ids.end(), back_inserter(extra));
-
- if (missing.empty() && extra.empty()) {
- std::cout << "All expected messages were retrieved." << std::endl;
- } else {
- if (!missing.empty()) {
- std::cout << "The following ids were missing:" << std::endl;
- for (StringSet::iterator i = missing.begin(); i != missing.end(); i++) {
- std::cout << " '" << *i << "'" << std::endl;
- }
- }
- if (!extra.empty()) {
- std::cout << "The following extra ids were encountered:" << std::endl;
- for (StringSet::iterator i = extra.begin(); i != extra.end(); i++) {
- std::cout << " '" << *i << "'" << std::endl;
- }
- }
- }
- }
-};
-
-int main(int argc, char** argv)
-{
- try {
- opts.parse(argc, argv);
- Controller controller;
- if (opts.init) controller.init();
- if (opts.transfer) controller.transfer();
- if (opts.check) controller.check();
- return 0;
- } catch(const std::exception& e) {
- std::cout << e.what() << std::endl;
- }
- return 1;
-}
diff --git a/qpid/cpp/src/tests/unit_test.cpp b/qpid/cpp/src/tests/unit_test.cpp
deleted file mode 100644
index 00c61242e4..0000000000
--- a/qpid/cpp/src/tests/unit_test.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// Defines test_main function to link with actual unit test code.
-#define BOOST_AUTO_TEST_MAIN // Boost 1.33
-#define BOOST_TEST_MAIN
-#include "unit_test.h"
-
diff --git a/qpid/cpp/src/tests/unit_test.h b/qpid/cpp/src/tests/unit_test.h
deleted file mode 100644
index 106d640d25..0000000000
--- a/qpid/cpp/src/tests/unit_test.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef QPIPD_TEST_UNIT_TEST_H_
-#define QPIPD_TEST_UNIT_TEST_H_
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-// Workaround so we can build against boost 1.33 and boost 1.34.
-// Remove when we no longer need to support 1.33.
-//
-#include <boost/version.hpp>
-
-#if (BOOST_VERSION < 103400)
-
-# include <boost/test/auto_unit_test.hpp>
-
-# define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name);
-# define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END();
-
-#else
-
-# define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name)
-# define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
-
-# include <boost/test/unit_test.hpp>
-#endif
-
-#endif /*!QPIPD_TEST_UNIT_TEST_H_*/
diff --git a/qpid/cpp/src/tests/vg_check b/qpid/cpp/src/tests/vg_check
deleted file mode 100644
index e9a691abe6..0000000000
--- a/qpid/cpp/src/tests/vg_check
+++ /dev/null
@@ -1,23 +0,0 @@
-# Check for valgrind errors. Sourced by test scripts.
-
-vg_failed() {
- cat $VG_LOG 1>&2
- echo $1 1>&2
- exit 1
-}
-
-vg_check()
-{
- test -z "$1" || VG_LOG=$1
- test -f $VG_LOG || vg_failed Valgrind log file $VG_LOG missing.
- # Ensure there is an ERROR SUMMARY line.
- grep -E '^==[0-9]+== ERROR SUMMARY:' $VG_LOG > /dev/null || \
- vg_failed "No valgrind ERROR SUMMARY line in $$vg_failed."
- # Ensure that the number of errors is 0.
- grep -E '^==[0-9]+== ERROR SUMMARY: [^0]' $VG_LOG > /dev/null && \
- vg_failed "Valgrind reported errors in $vg_out; see above."
- # Check for leaks.
- grep -E '^==[0-9]+== +.* lost: [^0]' $VG_LOG && \
- vg_failed "Found memory leaks (see log file, $VG_LOG); see above."
- true
-}
diff --git a/qpid/cpp/versions b/qpid/cpp/versions
deleted file mode 100755
index 2c82e3fd80..0000000000
--- a/qpid/cpp/versions
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-# Utility to print out currently installed versions of qpid developer
-# dependencies. Assumes that some dependencies are installed with RPM.
-#
-
-for p in pkg-config doxygen help2man autoconf automake libtool ; do
- echo `which $p` `$p --version | head -n1`
-done
-
-for r in apr boost boost-devel cppunit cppunit-devel graphviz; do
- rpm -q $r
-done
diff --git a/qpid/cpp/xml/cluster.xml b/qpid/cpp/xml/cluster.xml
deleted file mode 100644
index d1e3293a3e..0000000000
--- a/qpid/cpp/xml/cluster.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-
-<amqp major="99" minor="0" port="5672">
-
-<class name = "cluster" index = "201">
-
-<doc>Qpid extension class to allow clustered brokers to communicate.</doc>
-
-<method name = "notify" index="10">
- <doc>Notify the cluster of a members URL</doc>
- <!-- No chassis element, this is handled by separte cluster code for now.-->
- <field name="url" domain="longstr" />
-</method>
-
-</class>
-
-</amqp>
diff --git a/qpid/java/broker/bin/msTool.sh b/qpid/java/broker/bin/msTool.sh
deleted file mode 100755
index 73b1eb2ec7..0000000000
--- a/qpid/java/broker/bin/msTool.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-die() {
- if [[ $1 = -usage ]]; then
- shift
- usage=true
- else
- usage=false
- fi
- echo "$@"
- $usage && echo
- $usage && usage
- exit 1
-}
-
-cygwin=false
-if [[ "$(uname -a | fgrep Cygwin)" != "" ]]; then
- cygwin=true
-fi
-
-if [ -z "$QPID_TOOLS" ]; then
- if [ -z "$QPID_HOME" ]; then
- die "QPID_TOOLS must be set"
- else
- QPID_TOOLS=$QPID_HOME
- fi
-fi
-
-if $cygwin; then
- QPID_TOOLS=$(cygpath -w $QPID_TOOLS)
-fi
-
-# Set classpath to include Qpid jar with all required jars in manifest
-QPID_LIBS=$QPID_TOOLS/lib/qpid-incubating.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java \
- JAVA_VM=-server \
- JAVA_OPTS=-Dlog4j.configuration=file:$QPID_TOOLS/etc/mstool-log4j.xml \
- QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run org.apache.qpid.tools.messagestore.MessageStoreTool "$@"
diff --git a/qpid/java/broker/bin/qpid-passwd b/qpid/java/broker/bin/qpid-passwd
deleted file mode 100644
index f046252522..0000000000
--- a/qpid/java/broker/bin/qpid-passwd
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Set classpath to include Qpid jar with all required jars in manifest
-QPID_LIBS=$QPID_HOME/lib/qpid-incubating.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java \
- JAVA_VM=-server \
- JAVA_MEM=-Xmx1024m \
- QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run org.apache.qpid.tools.security.Passwd "$@"
diff --git a/qpid/java/broker/bin/qpid-server b/qpid/java/broker/bin/qpid-server
deleted file mode 100644
index f1f4d72e64..0000000000
--- a/qpid/java/broker/bin/qpid-server
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Set classpath to include Qpid jar with all required jars in manifest
-QPID_LIBS=$QPID_HOME/lib/qpid-incubating.jar:$QPID_HOME/lib/bdbstore-launch.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java \
- JAVA_VM=-server \
- JAVA_MEM=-Xmx1024m \
- JAVA_GC="-XX:-UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError" \
- QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run org.apache.qpid.server.Main "$@"
diff --git a/qpid/java/broker/bin/qpid-server-bdb.bat b/qpid/java/broker/bin/qpid-server-bdb.bat
deleted file mode 100644
index 8964e577df..0000000000
--- a/qpid/java/broker/bin/qpid-server-bdb.bat
+++ /dev/null
@@ -1,22 +0,0 @@
-@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-set BDBSTORE_HOME=c:\qpid\trunk\java\bdbstore
-set QPID_MODULE_JARS=%BDBSTORE_HOME%\target\qpid-bdbstore-1.0-incubating-M2-SNAPSHOT.jar;%BDBSTORE_HOME%\lib\bdb\je-3.1.0.jar
-.\qpid-server.bat \ No newline at end of file
diff --git a/qpid/java/broker/bin/qpid-server.bat b/qpid/java/broker/bin/qpid-server.bat
deleted file mode 100644
index a99022cd2d..0000000000
--- a/qpid/java/broker/bin/qpid-server.bat
+++ /dev/null
@@ -1,70 +0,0 @@
-@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-echo off
-REM Script to run the Qpid Java Broker
-
-rem Guess QPID_HOME if not defined
-set CURRENT_DIR=%cd%
-if not "%QPID_HOME%" == "" goto gotHome
-set QPID_HOME=%CURRENT_DIR%
-echo %QPID_HOME%
-if exist "%QPID_HOME%\bin\qpid-server.bat" goto okHome
-cd ..
-set QPID_HOME=%cd%
-cd %CURRENT_DIR%
-:gotHome
-if exist "%QPID_HOME%\bin\qpid-server.bat" goto okHome
-echo The QPID_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program
-goto end
-:okHome
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo The JAVA_HOME environment variable is not defined
-echo This environment variable is needed to run this program
-goto exit
-:gotJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-goto okJavaHome
-:noJavaHome
-echo The JAVA_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program.
-goto exit
-:okJavaHome
-
-rem Slurp the command line arguments. This loop allows for an unlimited number
-rem of agruments (up to the command line limit, anyway).
-set QPID_ARGS=%1
-if ""%1""=="""" goto runCommand
-shift
-:loop
-if ""%1""=="""" goto runCommand
-set QPID_ARGS=%QPID_ARGS% %1
-shift
-goto loop
-
-rem QPID_OPTS intended to hold any -D props for use
-rem user must enclose any value for QPID_OPTS in double quotes
-:runCommand
-set LAUNCH_JAR=%QPID_HOME%\lib\qpid-incubating.jar
-set MODULE_JARS=%QPID_MODULE_JARS%
-"%JAVA_HOME%\bin\java" -server -Xmx1024m %QPID_OPTS% -DQPID_HOME="%QPID_HOME%" -cp "%LAUNCH_JAR%;%MODULE_JARS%" org.apache.qpid.server.Main %QPID_ARGS%
-
-:end
diff --git a/qpid/java/broker/bin/qpid.start b/qpid/java/broker/bin/qpid.start
deleted file mode 100644
index 78c34e70b4..0000000000
--- a/qpid/java/broker/bin/qpid.start
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-exec qpid-server -run:debug "$@" \ No newline at end of file
diff --git a/qpid/java/broker/bin/qpid.stop b/qpid/java/broker/bin/qpid.stop
deleted file mode 100644
index 6482fc3293..0000000000
--- a/qpid/java/broker/bin/qpid.stop
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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.stop Script
-#
-# Script checks for a given pid running PROGRAM and attempts to quit it
-#
-
-MAX_ATTEMPTS=1
-SLEEP_DELAY=1
-PROGRAM="DQPID"
-
-
-#
-# Print what is going to be done
-#
-printActions()
-{
-#ps=`ps o command p $1|grep $PROGRAM`
-ps=`ps -o args -p $1|grep $PROGRAM`
-echo "Attempting to kill: $ps"
-}
-
-#
-# Forcably Quit the specified PID($1)
-#
-forceQuit()
-{
-kill -9 $1
-}
-
-
-#
-# Gracefully ask the PID($1) to quit
-#
-quit()
-{
-kill $1
-}
-
-#
-# Grep the ps log for the PID ($1) to ensure that it has quit
-#
-lookup()
-{
-result=`ps -o args -p $1 |grep -v grep |grep $PROGRAM |wc -l`
-}
-
-#
-# Sleep and then check then lookup the PID($1) to ensure it has quit
-#
-check()
-{
-echo "Waiting $SLEEP_DELAY second for $1 to exit"
-sleep $SLEEP_DELAY
-lookup $1
-}
-
-
-
-#
-# Verify the PID($1) is available
-#
-verifyPid()
-{
-lookup $1
-if [[ $[$result] == 1 ]] ; then
- brokerspid=$1
-else
- echo "Unable to locate Qpid Process with PID $1"
- exit -1
-fi
-}
-
-#
-# Main Run
-#
-
-# Check if we are killing all qpid pids or just one.
-if [[ $# == 0 ]] ; then
- echo "Killing All Qpid Brokers for user: '$USER'"
- qpid.stopall
- exit $?
-else
- verifyPid $1
-fi
-
-printActions $brokerspid
-
-# Attempt to quit the process MAX_ATTEMPTS Times
-attempt=0
-while [[ $[$result] > 0 && $[$attempt] < $[$MAX_ATTEMPTS] ]] ; do
- quit $brokerspid
- check $brokerspid
- attempt=$[$attempt + 1]
-done
-
-# Check that it has quit
-if [[ $[$result] == 0 ]] ; then
- echo "Process quit"
- exit 0
-else
-
- # Now attempt to force quit the process
- attempt=0
- while [[ $[$result] > 0 && $[$attempt] < $[$MAX_ATTEMPTS] ]] ; do
- forceQuit $brokerspid
- check $brokerspid
- attempt=$[$attempt + 1]
- done
-
-
- # Output final status
- if [[ $[$result] > 0 && $[$attempt] == $[$MAX_ATTEMPTS] ]] ; then
- echo "Stopped trying to kill process: $brokerspid"
- echo "Attempted to stop $attempt times"
- else
- echo "Done "
- fi
-fi
diff --git a/qpid/java/broker/bin/qpid.stopall b/qpid/java/broker/bin/qpid.stopall
deleted file mode 100644
index d71f591de8..0000000000
--- a/qpid/java/broker/bin/qpid.stopall
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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.stopall script
-#
-# Script attempts to stop all PROGRAMs running under the current user
-# Utilises qpid.stop to perform the actual stopping
-#
-
-PROGRAM="DQPID"
-
-#
-# grep ps for instances of $PROGRAM and collect PIDs
-#
-lookup()
-{
-#pids=`ps o pid,command | grep $PROGRAM | grep -v grep | cut -d ' ' -f 1`
-pids=`ps -ef |grep $USER | grep $PROGRAM | grep -v grep | awk '{print $2}'`
-result=`echo -n $pids | wc -w`
-}
-
-
-#
-# Show the PS output for given set of pids
-#
-showPids()
-{
-ps -o user,pid,args -p $pids
-}
-
-
-#
-# Main Run
-#
-
-lookup
-
-if [[ $[$result] == 0 ]] ; then
- echo "No Qpid Brokers found running under user '$USER'"
- exit 0
-fi
-
-for pid in $pids ; do
-
-qpid.stop $pid
-
-done
-
-# Check we have quit all
-lookup
-
-if [[ $[$result] == 0 ]] ; then
- echo "All Qpid brokers successfully quit"
-else
- echo "Some brokers were not quit"
- showPids $pids
-fi
diff --git a/qpid/java/broker/bin/run.bat b/qpid/java/broker/bin/run.bat
deleted file mode 100755
index 5b0aa0f23b..0000000000
--- a/qpid/java/broker/bin/run.bat
+++ /dev/null
@@ -1,31 +0,0 @@
-@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-@echo off
-set CORE_CLASSES=..\classes;..\testclasses
-
-set COMMONDIR=..\..\common
-
-set COMMONLIB=%COMMONDIR%\lib\slf4j\slf4j-simple.jar;%COMMONDIR%\lib\logging-log4j\log4j-1.2.9.jar;%COMMONDIR%\lib\mina\mina-core-0.9.2.jar
-
-set DIST=..\lib\bdb\je-3.0.12.jar;..\dist\amqpd.jar;..\..\client\dist\amqp-common.jar
-
-set CP=%CORE_CLASSES%;%DIST%;%COMMONLIB%
-
-"%JAVA_HOME%\bin\java" -Xmx512m -Damqj.logging.level=INFO -cp %CP% %*
diff --git a/qpid/java/broker/bin/run.sh b/qpid/java/broker/bin/run.sh
deleted file mode 100755
index 6b62049e94..0000000000
--- a/qpid/java/broker/bin/run.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-
-COMMONDIR=../../common
-
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/slf4j/slf4j-simple.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/logging-log4j/log4j-1.2.13.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/mina/mina-core-0.9.5-SNAPSHOT.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-collections/commons-collections-3.1.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-cli/commons-cli-1.0.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-configuration/commons-configuration-1.2.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-logging/commons-logging-api.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-logging/commons-logging.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-lang/commons-lang-2.1.jar
-COMMONLIB=$COMMONLIB:$COMMONDIR/lib/junit/junit-4.0.jar
-
-DIST=../lib/bdb/je-3.0.12.jar:../dist/amqpd-tests.jar:../dist/amqpd.jar:../../client/dist/amqp-common.jar
-
-CP=../intellijclasses:$DIST:$COMMONLIB
-
-if [ "$(uname -a | fgrep Cygwin)" != "" ]; then
- CP=$(cygpath --mixed --path $CP)
-fi
-
-"$JAVA_HOME/bin/java" -Xmx512m -Dprepopulate=10 -Damqj.logging.level=INFO -cp $CP $*
diff --git a/qpid/java/broker/bin/runAll b/qpid/java/broker/bin/runAll
deleted file mode 100644
index 4ced1d263b..0000000000
--- a/qpid/java/broker/bin/runAll
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-doRun()
-{
- class=$1
- shift
- echo
- echo ================================================================================
- echo Running $class
- ./run.sh $class "$@"
-}
-
-# parameters are: clients messages iterations
-doRun org.apache.qpid.server.queue.SendPerfTest 10 1000 100
-
-doRun org.apache.qpid.server.queue.QueuePerfTest
-
-doRun org.apache.qpid.server.queue.QueueConcurrentPerfTest
diff --git a/qpid/java/broker/distribution/pom.xml b/qpid/java/broker/distribution/pom.xml
deleted file mode 100644
index 9875e9bf2b..0000000000
--- a/qpid/java/broker/distribution/pom.xml
+++ /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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-broker-distribution</artifactId>
- <packaging>jar</packaging>
- <version>1.0-incubating-M2-SNAPSHOT</version>
- <name>Qpid Broker Distributions</name>
- <url>http://cwiki.apache.org/confluence/display/qpid</url>
-
- <parent>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid</artifactId>
- <version>1.0-incubating-M2-SNAPSHOT</version>
- </parent>
-
- <properties>
- <topDirectoryLocation>..</topDirectoryLocation>
- <java.source.version>1.5</java.source.version>
- <qpid.version>${pom.version}</qpid.version>
- <qpid.targetDir>${project.build.directory}</qpid.targetDir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-broker</artifactId>
- <type>jar</type>
- </dependency>
- </dependencies>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>${java.source.version}</source>
- <target>${java.source.version}</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>${assembly.version}</version>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/broker-bin.xml</descriptor>
- </descriptors>
- <finalName>qpid-${pom.version}</finalName>
- <outputDirectory>${qpid.targetDir}</outputDirectory>
- <tarLongFileMode>gnu</tarLongFileMode>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <finalName>qpid-incubating</finalName>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- </manifest>
- </archive>
- </configuration>
- </plugin>
-
- </plugins>
- </pluginManagement>
-
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>distribution-package</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/broker-bin.xml</descriptor>
- <descriptor>src/main/assembly/broker-src.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- </build>
-
- <profiles>
- <profile>
- <id>tests</id>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-broker</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>distribution-package</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/broker-bin-tests.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- </build>
- </profile>
- </profiles>
-</project>
diff --git a/qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml b/qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml
deleted file mode 100644
index fa017d6232..0000000000
--- a/qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<assembly>
- <id>java-broker-bin-with-tests</id>
- <includeBaseDirectory>false</includeBaseDirectory>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
-
- <fileSets>
- <fileSet>
- <!-- Apache license files -->
- <directory>../../resources</directory>
- <outputDirectory>qpid-${qpid.version}</outputDirectory>
- <includes>
- <include>DISCLAIMER</include>
- <include>LICENSE.txt</include>
- <include>NOTICE.txt</include>
- <include>README.txt</include>
- </includes>
- </fileSet>
-
- <fileSet>
- <directory>../../release-docs</directory>
- <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
- <includes>
- <include>RELEASE_NOTES.txt</include>
- </includes>
- </fileSet>
-
- <!-- Include easy access to test source-->
- <fileSet>
- <directory>../src/test</directory>
- <outputDirectory>qpid-${qpid.version}/src</outputDirectory>
- <includes>
- <include>**/*.java</include>
- </includes>
- </fileSet>
-
- <!-- Execution Scripts -->
- <fileSet>
- <directory>../bin/</directory>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <includes>
- <include>**/*</include>
- </includes>
- <fileMode>777</fileMode> <!-- RWX -->
- </fileSet>
-
- <!-- Configuration -->
- <fileSet>
- <directory>../etc/</directory>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <includes>
- <include>**/*</include>
- </includes>
- <fileMode>420</fileMode>
- </fileSet>
-
- <!-- Metadata Jar -->
- <fileSet>
- <directory>target</directory>
- <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
- <includes>
- <include>qpid-incubating.jar</include>
- </includes>
- </fileSet>
- </fileSets>
-
-
- <files>
- <!-- Common Run scripts -->
- <file>
- <source>../../common/bin/qpid-run</source>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <destName>qpid-run</destName>
- <fileMode>493</fileMode>
- </file>
-
- <!-- Common Configuration -->
- <file>
- <source>../../common/etc/qpid-run.conf</source>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <destName>qpid-run.conf</destName>
- <fileMode>420</fileMode>
- </file>
- </files>
-
- <dependencySets>
- <dependencySet>
- <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
- <unpack>false</unpack>
- <excludes>
- <exclude>org.apache.qpid:qpid-broker-distribution</exclude>
- </excludes>
- </dependencySet>
- </dependencySets>
-</assembly>
diff --git a/qpid/java/broker/distribution/src/main/assembly/broker-bin.xml b/qpid/java/broker/distribution/src/main/assembly/broker-bin.xml
deleted file mode 100644
index e66190a3f4..0000000000
--- a/qpid/java/broker/distribution/src/main/assembly/broker-bin.xml
+++ /dev/null
@@ -1,183 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<assembly>
- <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
- <id>java-broker-bin</id>
- <includeBaseDirectory>false</includeBaseDirectory>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
-
- <fileSets>
- <!-- Apache Licensing -->
- <fileSet>
- <directory>../../resources</directory>
- <outputDirectory>qpid-${qpid.version}</outputDirectory>
- <includes>
- <include>DISCLAIMER</include>
- <include>LICENSE.txt</include>
- <include>NOTICE.txt</include>
- <include>README.txt</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>../..</directory>
- <outputDirectory>qpid-${qpid.version}</outputDirectory>
- <includes>
- <include>*.txt</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>../../src/main/release-docs</directory>
- <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
- <includes>
- <include>RELEASE_NOTES.txt</include>
- </includes>
- </fileSet>
-
- <!-- Metadata Jar -->
- <fileSet>
- <directory>target</directory>
- <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
- <includes>
- <include>qpid-incubating.jar</include>
- </includes>
- </fileSet>
- </fileSets>
- <files>
- <!-- due to a bug in the assembly plugin (MASSEMBLY-153) you have
- to use decimal numbers to specify fileMode -->
- <file>
- <source>../../common/etc/qpid-run.conf</source>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <destName>qpid-run.conf</destName>
- <fileMode>420</fileMode>
- </file>
- <file>
- <source>../etc/config.xml</source>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <destName>config.xml</destName>
- <fileMode>420</fileMode>
- </file>
- <file>
- <source>../etc/jmxremote.access</source>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <destName>jmxremote.access</destName>
- <fileMode>420</fileMode>
- </file>
- <file>
- <source>../etc/log4j.xml</source>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <destName>log4j.xml</destName>
- <fileMode>420</fileMode>
- </file>
- <file>
- <source>../etc/passwd</source>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <destName>passwd</destName>
- <fileMode>420</fileMode>
- </file>
- <file>
- <source>../etc/qpid-server.conf</source>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <destName>qpid-server.conf</destName>
- <fileMode>420</fileMode>
- </file>
- <file>
- <source>../etc/virtualhosts.xml</source>
- <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
- <destName>virtualhosts.xml</destName>
- <fileMode>420</fileMode>
- </file>
- <file>
- <source>../../common/bin/qpid-run</source>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <destName>qpid-run</destName>
- <fileMode>473</fileMode>
- </file>
- <file>
- <source>../bin/qpid-passwd</source>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <destName>qpid-passwd</destName>
- <fileMode>473</fileMode>
- </file>
- <file>
- <source>../bin/qpid-server</source>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <destName>qpid-server</destName>
- <fileMode>473</fileMode>
- </file>
- <file>
- <source>../bin/qpid-server.bat</source>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <destName>qpid-server.bat</destName>
- <fileMode>473</fileMode>
- </file>
- <file>
- <source>../bin/run.bat</source>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <destName>run.bat</destName>
- <fileMode>473</fileMode>
- </file>
- <file>
- <source>../bin/run.sh</source>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <destName>run.sh</destName>
- <fileMode>473</fileMode>
- </file>
- <file>
- <source>../bin/runAll</source>
- <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
- <destName>runAll</destName>
- <fileMode>473</fileMode>
- </file>
- </files>
-
- <dependencySets>
- <dependencySet>
- <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
- <unpack>false</unpack>
- <!-- This needs to be tidied up QPID-280 -->
- <excludes>
- <exclude>org.apache.qpid:qpid-broker-distribution</exclude>
- <exclude>org.apache.qpid.management:org.apache.qpid.management.ui</exclude>
- <exclude>org.eclipse.core:org.eclipse.core.commands</exclude>
- <exclude>org.eclipse.core:org.eclipse.core.contenttype</exclude>
- <exclude>org.eclipse.core:org.eclipse.core.expressions</exclude>
- <exclude>org.eclipse.core:org.eclipse.core.jobs</exclude>
- <exclude>org.eclipse.core:org.eclipse.core.runtime</exclude>
- <exclude>org.eclipse.core:org.eclipse.core.runtime.compatibility.auth</exclude>
- <exclude>org.eclipse.core:org.eclipse.core.runtime.compatibility.registry</exclude>
- <exclude>org.eclipse.equinox:org.eclipse.equinox.common</exclude>
- <exclude>org.eclipse.equinox:org.eclipse.equinox.preferences</exclude>
- <exclude>org.eclipse.equinox:org.eclipse.equinox.registry</exclude>
- <exclude>org.eclipse.help:org.eclipse.help</exclude>
- <exclude>org.eclipse.jface:org.eclipse.jface</exclude>
- <exclude>org.eclipse.osgi:org.eclipse.osgi</exclude>
- <exclude>org.eclipse.swt:org.eclipse.swt</exclude>
- <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86</exclude>
- <exclude>org.eclipse.ui:org.eclipse.ui</exclude>
- <exclude>org.eclipse.ui:org.eclipse.ui.forms</exclude>
- <exclude>org.eclipse.ui:org.eclipse.ui.workbench</exclude>
- </excludes>
- </dependencySet>
- </dependencySets>
-</assembly>
diff --git a/qpid/java/broker/distribution/src/main/assembly/broker-src.xml b/qpid/java/broker/distribution/src/main/assembly/broker-src.xml
deleted file mode 100644
index 28a22c3851..0000000000
--- a/qpid/java/broker/distribution/src/main/assembly/broker-src.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<assembly>
- <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
- <id>java-broker-src</id>
- <includeBaseDirectory>false</includeBaseDirectory>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
-
- <fileSets>
- <!-- Apache Licensing -->
- <fileSet>
- <directory>../../resources</directory>
- <outputDirectory>qpid-${qpid.version}-src</outputDirectory>
- <includes>
- <include>DISCLAIMER</include>
- <include>LICENSE.txt</include>
- <include>licenses/*.*</include>
- <include>NOTICE.txt</include>
- <include>README.txt</include>
- <include>BUILDING.txt</include>
- </includes>
- </fileSet>
- <!-- Broker source -->
- <fileSet>
- <directory>..</directory>
- <outputDirectory>qpid-${qpid.version}-src</outputDirectory>
- <includes>
- <include>**/*</include>
- </includes>
- <!-- Tidy up wrt to QPID-280 -->
- <excludes>
- <exclude>build.xml</exclude>
- <exclude>distribution/build.xml</exclude>
- <exclude>benchmark</exclude>
- <exclude>benchmark/**/*</exclude>
- <exclude>**/target</exclude>
- <exclude>**/target/**/*</exclude>
- <exclude>**/build</exclude>
- <exclude>**/build/**/*</exclude>
- <exclude>**/.settings</exclude>
- <exclude>**/.classpath</exclude>
- <exclude>**/.project</exclude>
- <exclude>**/.wtpmodules</exclude>
- <exclude>**/surefire*</exclude>
- <exclude>**/cobertura.ser</exclude>
- <exclude>bin</exclude>
- <exclude>bin/*</exclude>
- <exclude>lib</exclude>
- <exclude>lib/**/*</exclude>
- <exclude>**/var/journal</exclude>
- <exclude>**/build.out*</exclude>
- <exclude>**/eclipse-plugin/bin/**</exclude>
- <exclude>**/eclipse-plugin/plugins/**</exclude>
- <exclude>**/eclipse-plugin/src/main/resources/**</exclude>
- </excludes>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/qpid/java/broker/etc/access b/qpid/java/broker/etc/access
deleted file mode 100644
index 58b7443fa9..0000000000
--- a/qpid/java/broker/etc/access
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-guest:localhost(rw),test(rw) \ No newline at end of file
diff --git a/qpid/java/broker/etc/acl.config.xml b/qpid/java/broker/etc/acl.config.xml
deleted file mode 100644
index 701b71dbec..0000000000
--- a/qpid/java/broker/etc/acl.config.xml
+++ /dev/null
@@ -1,229 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<broker>
- <prefix>${QPID_HOME}</prefix>
- <work>${QPID_WORK}</work>
- <conf>${prefix}/etc</conf>
- <connector>
- <!-- Uncomment out this block and edit the keystorePath and keystorePassword
- to enable SSL support
- <ssl>
- <enabled>true</enabled>
- <sslOnly>true</sslOnly>
- <keystorePath>/path/to/keystore.ks</keystorePath>
- <keystorePassword>keystorepass</keystorePassword>
- </ssl>-->
- <qpidnio>false</qpidnio>
- <!-- I've had the 0.0 and 0.1 Reader threads continually throwing IOException when client closes-->
- <protectio>false</protectio>
- <transport>nio</transport>
- <port>5672</port>
- <sslport>8672</sslport>
- <socketReceiveBuffer>32768</socketReceiveBuffer>
- <socketSendBuffer>32768</socketSendBuffer>
- </connector>
- <management>
- <enabled>true</enabled>
- <jmxport>8999</jmxport>
- <security-enabled>false</security-enabled>
- </management>
- <advanced>
- <filterchain enableExecutorPool="true"/>
- <enablePooledAllocator>false</enablePooledAllocator>
- <enableDirectBuffers>false</enableDirectBuffers>
- <framesize>65535</framesize>
- <compressBufferOnQueue>false</compressBufferOnQueue>
- <enableJMSXUserID>false</enableJMSXUserID>
- </advanced>
-
- <security>
- <principal-databases>
- <!-- Example use of Base64 encoded MD5 hashes for authentication via CRAM-MD5-Hashed -->
- <principal-database>
- <name>passwordfile</name>
- <class>org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase</class>
- <attributes>
- <attribute>
- <name>passwordFile</name>
- <value>${conf}/qpid.passwd</value>
- </attribute>
- </attributes>
- </principal-database>
- </principal-databases>
-
- <access>
- <class>org.apache.qpid.server.security.access.plugins.DenyAll</class>
- </access>
-
- <jmx>
- <access>${conf}/jmxremote.access</access>
- <principal-database>passwordfile</principal-database>
- </jmx>
- </security>
-
- <virtualhosts>
- <directory>${conf}/virtualhosts</directory>
-
- <virtualhost>
- <name>test</name>
- <test>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
-
- <queues>
- <exchange>amq.direct</exchange>
- <!-- 4Mb -->
- <maximumQueueDepth>4235g264</maximumQueueDepth>
- <!-- 2Mb -->
- <maximumMessageSize>2117632</maximumMessageSize>
- <!-- 10 mins -->
- <maximumMessageAge>600000</maximumMessageAge>
- </queues>
-
-
- <security>
- <access>
- <class>org.apache.qpid.server.security.access.plugins.SimpleXML</class>
- </access>
-
- <access_control_list>
- <!-- This section grants pubish rights to an exchange + routing key pair -->
- <publish>
- <exchanges>
- <exchange>
- <name>amq.direct</name>
- <routing_keys>
-
- <!-- Allow clients to publish requests -->
- <routing_key>
- <value>example.RequestQueue</value>
- <users>
- <user>client</user>
- </users>
- </routing_key>
-
- <!-- Allow the processor to respond to a client on their Temporary Topic -->
- <routing_key>
- <value>tmp_*</value>
- <users>
- <user>server</user>
- </users>
- </routing_key>
- </routing_keys>
-
- </exchange>
- </exchanges>
- </publish>
-
- <!-- This section grants users the ability to consume from the broker -->
- <consume>
- <queues>
-
- <!-- Allow the clients to consume from their temporary queues-->
- <queue>
- <temporary/>
- <users>
- <user>client</user>
- </users>
- </queue>
-
-
- <!-- Only allow the server to consume from the Request Queue-->
- <queue>
- <name>example.RequestQueue</name>
- <users>
- <user>server</user>
- </users>
- </queue>
-
-
- </queues>
- </consume>
-
- <!-- This section grants clients the ability to create queues and exchanges -->
- <create>
- <queues>
- <!-- Allow clients to create temporary queues-->
- <queue>
- <temporary/>
- <exchanges>
- <exchange>
- <name>amq.direct</name>
- <users>
- <user>client</user>
- </users>
- </exchange>
- </exchanges>
- </queue>
- <!-- Allow the server to create the Request Queue-->
- <queue>
- <name>example.RequestQueue</name>
- <users>
- <user>server</user>
- </users>
- </queue>
-
- </queues>
- </create>
-
-
- </access_control_list>
-
- </security>
- </test>
- </virtualhost>
-
-
- <virtualhost>
- <name>development</name>
- <development>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
- </development>
- </virtualhost>
-
- <virtualhost>
- <name>localhost</name>
- <localhost>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
- </localhost>
- </virtualhost>
-
- </virtualhosts>
-
- <heartbeat>
- <delay>0</delay>
- <timeoutFactor>2.0</timeoutFactor>
- </heartbeat>
-
- <queue>
- <auto_register>false</auto_register>
- </queue>
-
- <virtualhosts>${conf}/virtualhosts.xml</virtualhosts>
-</broker>
-
-
diff --git a/qpid/java/broker/etc/config.xml b/qpid/java/broker/etc/config.xml
deleted file mode 100644
index 78d96e52fd..0000000000
--- a/qpid/java/broker/etc/config.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<broker>
- <prefix>${QPID_HOME}</prefix>
- <work>${QPID_WORK}</work>
- <conf>${prefix}/etc</conf>
- <connector>
- <!-- Uncomment out this block and edit the keystorePath and keystorePassword
- to enable SSL support
- <ssl>
- <enabled>true</enabled>
- <sslOnly>true</sslOnly>
- <keystorePath>/path/to/keystore.ks</keystorePath>
- <keystorePassword>keystorepass</keystorePassword>
- </ssl>-->
- <qpidnio>false</qpidnio>
- <protectio>false</protectio>
- <transport>nio</transport>
- <port>5672</port>
- <sslport>8672</sslport>
- <socketReceiveBuffer>32768</socketReceiveBuffer>
- <socketSendBuffer>32768</socketSendBuffer>
- </connector>
- <management>
- <enabled>true</enabled>
- <jmxport>8999</jmxport>
- <security-enabled>false</security-enabled>
- </management>
- <advanced>
- <filterchain enableExecutorPool="true"/>
- <enablePooledAllocator>false</enablePooledAllocator>
- <enableDirectBuffers>false</enableDirectBuffers>
- <framesize>65535</framesize>
- <compressBufferOnQueue>false</compressBufferOnQueue>
- <enableJMSXUserID>false</enableJMSXUserID>
- </advanced>
-
- <security>
- <principal-databases>
- <!-- Example use of Base64 encoded MD5 hashes for authentication via CRAM-MD5-Hashed -->
- <principal-database>
- <name>passwordfile</name>
- <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
- <attributes>
- <attribute>
- <name>passwordFile</name>
- <value>${conf}/passwd</value>
- </attribute>
- </attributes>
- </principal-database>
- </principal-databases>
-
- <access>
- <class>org.apache.qpid.server.security.access.plugins.AllowAll</class>
- </access>
- <jmx>
- <access>${conf}/jmxremote.access</access>
- <principal-database>passwordfile</principal-database>
- </jmx>
- </security>
-
- <virtualhosts>
- <directory>${conf}/virtualhosts</directory>
-
- <virtualhost>
- <name>localhost</name>
- <localhost>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
-
- <housekeeping>
- <expiredMessageCheckPeriod>20000</expiredMessageCheckPeriod>
- </housekeeping>
-
- </localhost>
- </virtualhost>
-
- <virtualhost>
- <name>development</name>
- <development>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
- </development>
- </virtualhost>
-
- <virtualhost>
- <name>test</name>
- <test>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
- </test>
- </virtualhost>
-
- </virtualhosts>
- <heartbeat>
- <delay>0</delay>
- <timeoutFactor>2.0</timeoutFactor>
- </heartbeat>
- <queue>
- <auto_register>true</auto_register>
- </queue>
-
- <virtualhosts>${conf}/virtualhosts.xml</virtualhosts>
-</broker>
-
-
diff --git a/qpid/java/broker/etc/debug.log4j.xml b/qpid/java/broker/etc/debug.log4j.xml
deleted file mode 100644
index 71f9502b75..0000000000
--- a/qpid/java/broker/etc/debug.log4j.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="ArchivingFileAppender" class="org.apache.log4j.QpidCompositeRollingAppender">
- <!-- Ensure that logs allways have the dateFormat set-->
- <param name="StaticLogFileName" value="false"/>
- <param name="File" value="${QPID_WORK}/log/${logprefix}qpid${logsuffix}.log"/>
- <param name="Append" value="false"/>
- <!-- Change the direction so newer files have bigger numbers -->
- <!-- So log.1 is written then log.2 etc This prevents a lot of file renames at log rollover -->
- <param name="CountDirection" value="1"/>
- <!-- Use default 10MB -->
- <!--param name="MaxFileSize" value="100000"/-->
- <param name="DatePattern" value="'.'yyyy-MM-dd-HH-mm"/>
- <!-- Unlimited number of backups -->
- <param name="MaxSizeRollBackups" value="-1"/>
- <!-- Compress(gzip) the backup files-->
- <param name="CompressBackupFiles" value="true"/>
- <!-- Compress the backup files using a second thread -->
- <param name="CompressAsync" value="true"/>
- <!-- Start at zero numbered files-->
- <param name="ZeroBased" value="true"/>
- <!-- Backup Location -->
- <param name="backupFilesToPath" value="${QPID_WORK}/backup/log"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <appender name="FileAppender" class="org.apache.log4j.FileAppender">
- <param name="File" value="${QPID_WORK}/log/${logprefix}qpid${logsuffix}.log"/>
- <param name="Append" value="false"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <appender name="AlertFile" class="org.apache.log4j.FileAppender">
- <param name="File" value="${QPID_WORK}/log/alert.log"/>
- <param name="Append" value="false"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <category name="Qpid.Broker">
- <priority value="debug"/>
- <appender-ref ref="AlertFile"/>
- <!--appender-ref ref="STDOUT"/-->
- </category>
-
-
- <category name="org.apache.qpid.server.queue.AMQQueueMBean">
- <priority value="info"/>
- <appender-ref ref="AlertFile"/>
- </category>
-
-
- <!-- Provide warnings to standard output -->
- <!--category name="org.apache.qpid">
- <priority value="warn"/>
- <appender-ref ref="STDOUT"/>
- </category-->
-
-
- <!-- Additional level settings for debugging -->
- <!-- Each class in the Broker is a category that can have its logging level adjusted. -->
- <!-- This will provide more details if available about that classes processing. -->
- <!--category name="org.apache.qpid.server.txn">
- <priority value="debug"/>
- </category>-->
-
- <!--<category name="org.apache.qpid.server.store">
- <priority value="debug"/>
- </category-->
-
- <!-- Log all info events to file -->
- <root>
- <priority value="debug"/>
- <appender-ref ref="STDOUT"/>
- <!--appender-ref ref="FileAppender"/-->
- </root>
-
-</log4j:configuration>
diff --git a/qpid/java/broker/etc/jmxremote.access b/qpid/java/broker/etc/jmxremote.access
deleted file mode 100644
index 1a51a6991b..0000000000
--- a/qpid/java/broker/etc/jmxremote.access
+++ /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.
-
-#Generated by JMX Console : Last edited by user:admin
-#Tue Jun 12 16:46:39 BST 2007
-admin=admin
-guest=readonly
-user=readwrite
diff --git a/qpid/java/broker/etc/log4j.xml b/qpid/java/broker/etc/log4j.xml
deleted file mode 100644
index af8e7a8293..0000000000
--- a/qpid/java/broker/etc/log4j.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="ArchivingFileAppender" class="org.apache.log4j.QpidCompositeRollingAppender">
- <!-- Ensure that logs allways have the dateFormat set-->
- <param name="StaticLogFileName" value="false"/>
- <param name="File" value="${QPID_WORK}/log/${logprefix}qpid${logsuffix}.log"/>
- <param name="Append" value="false"/>
- <!-- Change the direction so newer files have bigger numbers -->
- <!-- So log.1 is written then log.2 etc This prevents a lot of file renames at log rollover -->
- <param name="CountDirection" value="1"/>
- <!-- Use default 10MB -->
- <!--param name="MaxFileSize" value="100000"/-->
- <param name="DatePattern" value="'.'yyyy-MM-dd-HH-mm"/>
- <!-- Unlimited number of backups -->
- <param name="MaxSizeRollBackups" value="-1"/>
- <!-- Compress(gzip) the backup files-->
- <param name="CompressBackupFiles" value="true"/>
- <!-- Compress the backup files using a second thread -->
- <param name="CompressAsync" value="true"/>
- <!-- Start at zero numbered files-->
- <param name="ZeroBased" value="true"/>
- <!-- Backup Location -->
- <param name="backupFilesToPath" value="${QPID_WORK}/backup/log"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <appender name="FileAppender" class="org.apache.log4j.FileAppender">
- <param name="File" value="${QPID_WORK}/log/${logprefix}qpid${logsuffix}.log"/>
- <param name="Append" value="false"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <appender name="AlertFile" class="org.apache.log4j.FileAppender">
- <param name="File" value="${QPID_WORK}/log/alert.log"/>
- <param name="Append" value="false"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <category name="Qpid.Broker">
- <priority value="debug"/>
- <appender-ref ref="AlertFile"/>
- <appender-ref ref="STDOUT"/>
- </category>
-
- <category name="org.apache.qpid.server.queue.AMQQueueMBean">
- <priority value="info"/>
- <appender-ref ref="AlertFile"/>
- </category>
-
- <!-- Provide warnings to standard output -->
- <category name="org.apache.qpid">
- <priority value="warn"/>
- <appender-ref ref="STDOUT"/>
- </category>
-
-
- <!-- Examples of additional logging settings -->
- <!-- Used to generate extra debug. See debug.log4j.xml -->
-
- <!--<category name="org.apache.qpid.server.store">
- <priority value="debug"/>
- </category-->
-
- <!--category name="org.apache.qpid.server.txn">
- <priority value="debug"/>
- </category>-->
-
- <!-- Log all info events to file -->
- <root>
- <priority value="info"/>
- <appender-ref ref="FileAppender"/>
- <!--appender-ref ref="ArchivingFileAppender"/-->
- </root>
-
-</log4j:configuration>
diff --git a/qpid/java/broker/etc/md5passwd b/qpid/java/broker/etc/md5passwd
deleted file mode 100644
index 6a149919de..0000000000
--- a/qpid/java/broker/etc/md5passwd
+++ /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.
-#
-guest:CE4DQ6BIb/BVMN9scFyLtA==
-admin:ISMvKXpXpadDiUoOSoAfww==
-user:aBzonUodYLhwSa8s9A10sA==
diff --git a/qpid/java/broker/etc/mstool-log4j.xml b/qpid/java/broker/etc/mstool-log4j.xml
deleted file mode 100644
index 8c46010e2d..0000000000
--- a/qpid/java/broker/etc/mstool-log4j.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
-
- <layout class="org.apache.log4j.PatternLayout">
- <!--param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/-->
- <param name="ConversionPattern" value="%d %-5p [%t] (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <category name="org.apache.qpid.tools">
- <priority value="info"/>
- </category>
-
- <category name="org.apache.qpid">
- <priority value="error"/>
- </category>
-
- <category name="org.apache.qpid.server.security">
- <priority value="error"/>
- </category>
-
- <category name="org.apache.qpid.server.management">
- <priority value="error"/>
- </category>
-
-
- <root>
- <priority value="info"/>
- <appender-ref ref="STDOUT"/>
- </root>
-</log4j:configuration>
diff --git a/qpid/java/broker/etc/passwd b/qpid/java/broker/etc/passwd
deleted file mode 100644
index 7aca438551..0000000000
--- a/qpid/java/broker/etc/passwd
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-guest:guest
-client:guest
-server:guest
-
diff --git a/qpid/java/broker/etc/passwdVhost b/qpid/java/broker/etc/passwdVhost
deleted file mode 100644
index 48ce8299b6..0000000000
--- a/qpid/java/broker/etc/passwdVhost
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-guest:guest:localhost,test
diff --git a/qpid/java/broker/etc/persistent_config.xml b/qpid/java/broker/etc/persistent_config.xml
deleted file mode 100644
index 2143009711..0000000000
--- a/qpid/java/broker/etc/persistent_config.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT 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 is an example config using the BDBMessageStore available from
- the Red Hat Messaging project at etp.108.redhat.com and distributed under GPL.
- -->
-
-<broker>
- <prefix>${QPID_HOME}</prefix>
- <work>${QPID_WORK}</work>
- <conf>${prefix}/etc</conf>
- <connector>
- <transport>nio</transport>
- <port>5672</port>
- <sslport>8672</sslport>
- <socketReceiveBuffer>32768</socketReceiveBuffer>
- <socketSendBuffer>32768</socketSendBuffer>
- </connector>
- <management>
- <enabled>true</enabled>
- <jmxport>8999</jmxport>
- </management>
- <advanced>
- <filterchain enableExecutorPool="true"/>
- <enablePooledAllocator>false</enablePooledAllocator>
- <enableDirectBuffers>false</enableDirectBuffers>
- <framesize>65535</framesize>
- <compressBufferOnQueue>false</compressBufferOnQueue>
- </advanced>
-
- <security>
- <principal-databases>
- <principal-database>
- <name>passwordfile</name>
- <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
- <attributes>
- <attribute>
- <name>passwordFile</name>
- <value>${conf}/passwd</value>
- </attribute>
- </attributes>
- </principal-database>
- </principal-databases>
-
- <access>
- <class>org.apache.qpid.server.security.access.plugins.AllowAll</class>
- </access>
- <jmx>
- <access>${conf}/jmxremote.access</access>
- <principal-database>passwordfile</principal-database>
- </jmx>
- </security>
-
- <virtualhosts>
- <virtualhost>
- <name>localhost</name>
- <localhost>
- <store>
- <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
- <environment-path>${work}/bdbstore/localhost-store</environment-path>
- </store>
- </localhost>
- </virtualhost>
-
- <virtualhost>
- <name>development</name>
- <development>
- <store>
- <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
- <environment-path>${work}/bdbstore/development-store</environment-path>
- </store>
- </development>
- </virtualhost>
-
- <virtualhost>
- <name>test</name>
- <test>
- <store>
- <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
- <environment-path>${work}/bdbstore/test-store</environment-path>
- </store>
- </test>
- </virtualhost>
-
- </virtualhosts>
- <heartbeat>
- <delay>0</delay>
- <timeoutFactor>2.0</timeoutFactor>
- </heartbeat>
- <queue>
- <auto_register>true</auto_register>
- </queue>
-
- <virtualhosts>${conf}/virtualhosts.xml</virtualhosts>
-</broker>
-
-
diff --git a/qpid/java/broker/etc/qpid-server.conf b/qpid/java/broker/etc/qpid-server.conf
deleted file mode 100644
index c310094817..0000000000
--- a/qpid/java/broker/etc/qpid-server.conf
+++ /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.
-#
-
-QPID_LIBS=$QPID_HOME/lib/qpid-incubating.jar:$QPID_HOME/lib/bdbstore-launch.jar
-
-export JAVA=java \
- JAVA_VM=-server \
- JAVA_MEM=-Xmx1024m \
- CLASSPATH=$QPID_LIBS
diff --git a/qpid/java/broker/etc/qpid-server.conf.jpp b/qpid/java/broker/etc/qpid-server.conf.jpp
deleted file mode 100644
index 3ed2431ef3..0000000000
--- a/qpid/java/broker/etc/qpid-server.conf.jpp
+++ /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.
-#
-
-QPID_LIBS=$(build-classpath backport-util-concurrent \
- commons-beanutils \
- commons-beanutils-core \
- commons-cli \
- commons-codec \
- commons-collections \
- commons-configuration \
- commons-digester \
- commons-lang \
- commons-logging \
- commons-logging-api \
- dom4j \
- geronimo-jms-1.1-api \
- isorelax \
- jaxen \
- log4j \
- mina/core \
- mina/filter-ssl \
- mina/java5 \
- msv-msv \
- qpid-broker \
- qpid-client \
- qpid-common \
- relaxngDatatype \
- slf4j)
-
-export JAVA=java \
- JAVA_VM=-server \
- JAVA_MEM=-Xmx1024m \
- CLASSPATH=$QPID_LIBS
diff --git a/qpid/java/broker/etc/qpid.passwd b/qpid/java/broker/etc/qpid.passwd
deleted file mode 100644
index dbfb9d1923..0000000000
--- a/qpid/java/broker/etc/qpid.passwd
+++ /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.
-#
-guest:CE4DQ6BIb/BVMN9scFyLtA==
-admin:ISMvKXpXpadDiUoOSoAfww==
-user:CE4DQ6BIb/BVMN9scFyLtA==
-server:CE4DQ6BIb/BVMN9scFyLtA==
-client:CE4DQ6BIb/BVMN9scFyLtA==
diff --git a/qpid/java/broker/etc/transient_config.xml b/qpid/java/broker/etc/transient_config.xml
deleted file mode 100644
index 5b13090f4c..0000000000
--- a/qpid/java/broker/etc/transient_config.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT 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 is an example config file that uses the MemoryMessageStore.
- As a result it is aimed at brokers sending transient messages.
-
- -->
-<broker>
- <prefix>${QPID_HOME}</prefix>
- <work>${QPID_WORK}</work>
- <conf>${prefix}/etc</conf>
- <connector>
- <transport>nio</transport>
- <port>5672</port>
- <sslport>8672</sslport>
- <socketReceiveBuffer>32768</socketReceiveBuffer>
- <socketSendBuffer>32768</socketSendBuffer>
- </connector>
- <management>
- <enabled>true</enabled>
- <jmxport>8999</jmxport>
- </management>
- <advanced>
- <filterchain enableExecutorPool="true"/>
- <enablePooledAllocator>false</enablePooledAllocator>
- <enableDirectBuffers>false</enableDirectBuffers>
- <framesize>65535</framesize>
- <compressBufferOnQueue>false</compressBufferOnQueue>
- </advanced>
-
- <security>
- <principal-databases>
- <principal-database>
- <name>passwordfile</name>
- <class>org.apache.qpid.server.security.auth.database.PlainPasswordVhostFilePrincipalDatabase</class>
- <attributes>
- <attribute>
- <name>passwordFile</name>
- <value>${conf}/passwdVhost</value>
- </attribute>
- </attributes>
- </principal-database>
- </principal-databases>
- <access>
- <class>org.apache.qpid.server.security.access.plugins.AllowAll</class>
- </access>
- <jmx>
- <access>${conf}/jmxremote.access</access>
- <principal-database>passwordfile</principal-database>
- </jmx>
- </security>
-
- <virtualhosts>
- <virtualhost>
- <name>localhost</name>
- <localhost>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
-
- <security>
- <access>
- <class>org.apache.qpid.server.security.old.PrincipalDatabaseAccessManager</class>
- <attributes>
- <attribute>
- <name>principalDatabase</name>
- <value>passwordfile</value>
- </attribute>
- <attribute>
- <name>defaultAccessManager</name>
- <value>DenyAll</value>
- </attribute>
- </attributes>
- </access>
- </security>
- </localhost>
- </virtualhost>
-
- <virtualhost>
- <name>development</name>
- <development>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
- </development>
- </virtualhost>
-
- <virtualhost>
- <name>test</name>
- <test>
- <store>
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
- </test>
- </virtualhost>
-
- </virtualhosts>
- <heartbeat>
- <delay>0</delay>
- <timeoutFactor>2.0</timeoutFactor>
- </heartbeat>
- <queue>
- <auto_register>true</auto_register>
- </queue>
-
- <virtualhosts>${conf}/virtualhosts.xml</virtualhosts>
-</broker>
-
-
diff --git a/qpid/java/broker/etc/virtualhosts.xml b/qpid/java/broker/etc/virtualhosts.xml
deleted file mode 100644
index f62ec3f5d7..0000000000
--- a/qpid/java/broker/etc/virtualhosts.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<virtualhosts>
- <default>test</default>
- <virtualhost>
- <name>localhost</name>
- <localhost>
- <exchanges>
- <exchange>
- <type>direct</type>
- <name>test.direct</name>
- <durable>true</durable>
- </exchange>
- <exchange>
- <type>topic</type>
- <name>test.topic</name>
- </exchange>
- </exchanges>
- <queues>
- <exchange>amq.direct</exchange>
- <maximumQueueDepth>4235264</maximumQueueDepth> <!-- 4Mb -->
- <maximumMessageSize>2117632</maximumMessageSize> <!-- 2Mb -->
- <maximumMessageAge>600000</maximumMessageAge> <!-- 10 mins -->
-
- <queue>
- <name>queue</name>
- </queue>
- <queue>
- <name>ping</name>
- </queue>
- <queue>
- <name>test-queue</name>
- <test-queue>
- <exchange>test.direct</exchange>
- <durable>true</durable>
- </test-queue>
- </queue>
- <queue>
- <name>test-ping</name>
- <test-ping>
- <exchange>test.direct</exchange>
- </test-ping>
- </queue>
-
- </queues>
- </localhost>
- </virtualhost>
-
-
- <virtualhost>
- <name>development</name>
- <development>
- <queues>
- <minimumAlertRepeatGap>30000</minimumAlertRepeatGap>
- <maximumMessageCount>5000</maximumMessageCount>
- <queue>
- <name>queue</name>
- <queue>
- <exchange>amq.direct</exchange>
- <maximumQueueDepth>4235264</maximumQueueDepth> <!-- 4Mb -->
- <maximumMessageSize>2117632</maximumMessageSize> <!-- 2Mb -->
- <maximumMessageAge>600000</maximumMessageAge> <!-- 10 mins -->
- </queue>
- </queue>
- <queue>
- <name>ping</name>
- <ping>
- <exchange>amq.direct</exchange>
- <maximumQueueDepth>4235264</maximumQueueDepth> <!-- 4Mb -->
- <maximumMessageSize>2117632</maximumMessageSize> <!-- 2Mb -->
- <maximumMessageAge>600000</maximumMessageAge> <!-- 10 mins -->
- </ping>
- </queue>
- </queues>
- </development>
- </virtualhost>
- <virtualhost>
- <name>test</name>
- <test>
- <queues>
- <minimumAlertRepeatGap>30000</minimumAlertRepeatGap>
- <maximumMessageCount>5000</maximumMessageCount>
- <queue>
- <name>queue</name>
- <queue>
- <exchange>amq.direct</exchange>
- <maximumQueueDepth>4235264</maximumQueueDepth> <!-- 4Mb -->
- <maximumMessageSize>2117632</maximumMessageSize> <!-- 2Mb -->
- <maximumMessageAge>600000</maximumMessageAge> <!-- 10 mins -->
- </queue>
- </queue>
- <queue>
- <name>ping</name>
- <ping>
- <exchange>amq.direct</exchange>
- <maximumQueueDepth>4235264</maximumQueueDepth> <!-- 4Mb -->
- <maximumMessageSize>2117632</maximumMessageSize> <!-- 2Mb -->
- <maximumMessageAge>600000</maximumMessageAge> <!-- 10 mins -->
- </ping>
- </queue>
- </queues>
- </test>
- </virtualhost>
-</virtualhosts>
diff --git a/qpid/java/broker/pom.xml b/qpid/java/broker/pom.xml
deleted file mode 100644
index 1dd613e5f9..0000000000
--- a/qpid/java/broker/pom.xml
+++ /dev/null
@@ -1,272 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-broker</artifactId>
- <packaging>jar</packaging>
- <version>1.0-incubating-M2.1-SNAPSHOT</version>
- <name>Qpid Broker</name>
- <url>http://cwiki.apache.org/confluence/display/qpid</url>
-
- <parent>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid</artifactId>
- <version>1.0-incubating-M2.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <properties>
- <topDirectoryLocation>..</topDirectoryLocation>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-common</artifactId>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.4.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.4.0</version>
- </dependency>
-
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.framework</artifactId>
- <version>1.0.0</version>
- </dependency>
- </dependencies>
-
- <build>
-
- <plugins>
-
-
- <!--plugin>
- <artifactId>minijar-maven-plugin</artifactId>
- <groupId>org.codehaus.mojo</groupId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>minijars</goal>
- </goals>
- <configuration>
- <stripUnusedClasses>true</stripUnusedClasses>
- </configuration>
- </execution>
- </executions>
- </plugin-->
-
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>javacc-maven-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <configuration>
- <sourceDirectory>${basedir}/src/main/grammar</sourceDirectory>
- <outputDirectory>${basedir}/target/generated-sources</outputDirectory>
- <packageName>org.apache.qpid.server.filter.jms.selector</packageName>
- </configuration>
- <goals>
- <goal>javacc</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemProperties>
- <property>
- <name>amqj.noAutoCreateVMBroker</name>
- <value>true</value>
- </property>
- <property>
- <name>amqj.logging.level</name>
- <value>${amqj.logging.level}</value>
- </property>
- <property>
- <name>log4j.configuration</name>
- <value>file:///${basedir}/src/main/java/log4j.properties</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
-
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- <testResources>
- <testResource>
- <targetPath>src/</targetPath>
- <filtering>false</filtering>
- <directory>src/test/java</directory>
- <includes>
- <include>**/*.java</include>
- </includes>
- </testResource>
- </testResources>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>${antrun.version}</version>
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-nodeps</artifactId>
- <version>1.6.5</version>
- </dependency>
- </dependencies>
-
- <executions>
- <execution>
- <id>python_test</id>
- <phase>test</phase>
- <configuration>
- <tasks>
-
- <condition property="skip-python-tests" value="true">
- <isset property="skip.python.tests"/>
- </condition>
-
- <property name="command"
- value="python run-tests -v -I java_failing.txt -b localhost:2110 -s ../specs/amqp.0-9.no-wip.xml"/>
- <!--value="bash -c 'python run-tests -v -I java_failing.txt'"/>-->
-
- <ant antfile="python-test.xml" inheritRefs="true">
- <target name="run-tests" />
- </ant>
-
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
-
-
- </build>
-
-</project>
diff --git a/qpid/java/broker/python-test.xml b/qpid/java/broker/python-test.xml
deleted file mode 100755
index 5c263e3169..0000000000
--- a/qpid/java/broker/python-test.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<!-- ====================================================================== -->
-<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. -->
-<!-- ====================================================================== -->
-
-<project basedir="." default="default">
-
- <target name="default" >
- <echo message="Used via maven to run python tests."/>
- </target>
-
- <dirname property="broker.dir" file="${ant.file.python-test}"/>
-
- <property name="pythondir" value="${broker.dir}/../../python"/>
-
- <target name="run-tests" unless="skip-python-tests">
-
- <echo message="Starting Broker with command"/>
-
- <java classname="org.apache.qpid.server.RunBrokerWithCommand"
- fork="true"
- dir="${pythondir}"
- failonerror="true"
- >
- <arg value="${command}"/>
- <arg value="-p"/>
- <arg value="2110"/>
- <arg value="-m"/>
- <arg value="2111"/>
-
- <classpath refid="maven.test.classpath"/>
- <sysproperty key="QPID_HOME" value="${broker.dir}"/>
- <sysproperty key="QPID_WORK" value="${broker.dir}${file.separator}target"/>
- </java>
-
- </target>
-</project>
diff --git a/qpid/java/broker/src/main/grammar/SelectorParser.jj b/qpid/java/broker/src/main/grammar/SelectorParser.jj
deleted file mode 100644
index f6a843e080..0000000000
--- a/qpid/java/broker/src/main/grammar/SelectorParser.jj
+++ /dev/null
@@ -1,621 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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
- OPTIMIZE_TOKEN_MANAGER = true;
- 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.server.filter.jms.selector;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-
-import org.apache.qpid.AMQInvalidArgumentException;
-import org.apache.qpid.server.filter.ArithmeticExpression;
-import org.apache.qpid.server.filter.BooleanExpression;
-import org.apache.qpid.server.filter.ComparisonExpression;
-import org.apache.qpid.server.filter.ConstantExpression;
-import org.apache.qpid.server.filter.Expression;
-import org.apache.qpid.server.filter.LogicExpression;
-import org.apache.qpid.server.filter.PropertyExpression;
-import org.apache.qpid.server.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 AMQInvalidArgumentException {
- this.ReInit(new StringReader(sql));
-
- try {
- return this.JmsSelector();
- }
- catch (Throwable e) {
- throw (AMQInvalidArgumentException)new AMQInvalidArgumentException(sql).initCause(e);
- }
-
- }
-
- 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" >
- | < XPATH : "XPATH" >
- | < XQUERY : "XQUERY" >
-}
-
-/* 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 = stringLitteral()
- [ <ESCAPE> u = stringLitteral() ]
- {
- left = ComparisonExpression.createLike(left, t, u);
- }
- |
- LOOKAHEAD(2)
- {
- u=null;
- }
- <NOT> <LIKE> t = stringLitteral() [ <ESCAPE> u = stringLitteral() ]
- {
- 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 = stringLitteral()
- {
- list = new ArrayList();
- list.add( t );
- }
- (
- ","
- t = stringLitteral()
- {
- list.add( t );
- }
-
- )*
- ")"
- {
- left = ComparisonExpression.createInFilter(left, list);
- }
- |
- LOOKAHEAD(2)
- <NOT> <IN>
- "("
- t = stringLitteral()
- {
- list = new ArrayList();
- list.add( t );
- }
- (
- ","
- t = stringLitteral()
- {
- 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) );
- }
- |
- <XPATH> s=stringLitteral()
- {
- left = UnaryExpression.createXPath( s );
- }
- |
- <XQUERY> s=stringLitteral()
- {
- left = UnaryExpression.createXQuery( s );
- }
- |
- 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 = stringLitteral()
- {
- 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 stringLitteral() :
-{
- 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 == '\'' )
- 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/broker/src/main/java/log4j.properties b/qpid/java/broker/src/main/java/log4j.properties
deleted file mode 100644
index 6788c65463..0000000000
--- a/qpid/java/broker/src/main/java/log4j.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-log4j.rootCategory=${amqj.logging.level}, console
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=all
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%t %d %p [%c{4}] %m%n
diff --git a/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java b/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java
deleted file mode 100644
index 7e0c4defe1..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java
+++ /dev/null
@@ -1,1007 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.log4j;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.Writer;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.zip.GZIPOutputStream;
-
-import org.apache.log4j.helpers.CountingQuietWriter;
-import org.apache.log4j.helpers.LogLog;
-import org.apache.log4j.helpers.OptionConverter;
-import org.apache.log4j.spi.LoggingEvent;
-
-/**
- * <p>CompositeRollingAppender combines RollingFileAppender and DailyRollingFileAppender<br> It can function as either
- * or do both at the same time (making size based rolling files like RollingFileAppender until a data/time boundary is
- * crossed at which time it rolls all of those files as per the DailyRollingFileAppender) based on the setting for
- * <code>rollingStyle</code>.<br> <br> To use CompositeRollingAppender to roll log files as they reach a certain size
- * (like RollingFileAppender), set rollingStyle=1 (@see config.size)<br> To use CompositeRollingAppender to roll log
- * files at certain time intervals (daily for example), set rollingStyle=2 and a datePattern (@see config.time)<br> To
- * have CompositeRollingAppender roll log files at a certain size AND rename those according to time intervals, set
- * rollingStyle=3 (@see config.composite)<br>
- *
- * <p>A of few additional optional features have been added:<br> -- Attach date pattern for current log file (@see
- * staticLogFileName)<br> -- Backup number increments for newer files (@see countDirection)<br> -- Infinite number of
- * backups by file size (@see maxSizeRollBackups)<br> <br> <p>A few notes and warnings: For large or infinite number of
- * backups countDirection > 0 is highly recommended, with staticLogFileName = false if time based rolling is also used
- * -- this will reduce the number of file renamings to few or none. Changing staticLogFileName or countDirection
- * without clearing the directory could have nasty side effects. If Date/Time based rolling is enabled,
- * CompositeRollingAppender will attempt to roll existing files in the directory without a date/time tag based on the
- * last modified date of the base log files last modification.<br> <br> <p>A maximum number of backups based on
- * date/time boundries would be nice but is not yet implemented.<br>
- *
- * @author Kevin Steppe
- * @author Heinz Richter
- * @author Eirik Lygre
- * @author Ceki G&uuml;lc&uuml;
- * @author Martin Ritchie
- */
-public class QpidCompositeRollingAppender extends FileAppender
-{
- // The code assumes that the following 'time' constants are in a increasing
- // sequence.
- static final int TOP_OF_TROUBLE = -1;
- static final int TOP_OF_MINUTE = 0;
- static final int TOP_OF_HOUR = 1;
- static final int HALF_DAY = 2;
- static final int TOP_OF_DAY = 3;
- static final int TOP_OF_WEEK = 4;
- static final int TOP_OF_MONTH = 5;
-
- /** Style of rolling to use */
- static final int BY_SIZE = 1;
- static final int BY_DATE = 2;
- static final int BY_COMPOSITE = 3;
-
- // Not currently used
- static final String S_BY_SIZE = "Size";
- static final String S_BY_DATE = "Date";
- static final String S_BY_COMPOSITE = "Composite";
-
- /** The date pattern. By default, the pattern is set to "'.'yyyy-MM-dd" meaning daily rollover. */
- private String datePattern = "'.'yyyy-MM-dd";
-
- /**
- * The actual formatted filename that is currently being written to or will be the file transferred to on roll over
- * (based on staticLogFileName).
- */
- private String scheduledFilename = null;
-
- /** The timestamp when we shall next recompute the filename. */
- private long nextCheck = System.currentTimeMillis() - 1;
-
- /** Holds date of last roll over */
- Date now = new Date();
-
- SimpleDateFormat sdf;
-
- /** Helper class to determine next rollover time */
- RollingCalendar rc = new RollingCalendar();
-
- /** Current period for roll overs */
- int checkPeriod = TOP_OF_TROUBLE;
-
- /** The default maximum file size is 10MB. */
- protected long maxFileSize = 10 * 1024 * 1024;
-
- /** There is zero backup files by default. */
- protected int maxSizeRollBackups = 0;
- /** How many sized based backups have been made so far */
- protected int curSizeRollBackups = 0;
-
- /** not yet implemented */
- protected int maxTimeRollBackups = -1;
- protected int curTimeRollBackups = 0;
-
- /**
- * By default newer files have lower numbers. (countDirection < 0) ie. log.1 is most recent, log.5 is the 5th
- * backup, etc... countDirection > 0 does the opposite ie. log.1 is the first backup made, log.5 is the 5th backup
- * made, etc. For infinite backups use countDirection > 0 to reduce rollOver costs.
- */
- protected int countDirection = -1;
-
- /** Style of rolling to Use. BY_SIZE (1), BY_DATE(2), BY COMPOSITE(3) */
- protected int rollingStyle = BY_COMPOSITE;
- protected boolean rollDate = true;
- protected boolean rollSize = true;
-
- /**
- * By default file.log is always the current file. Optionally file.log.yyyy-mm-dd for current formated datePattern
- * can by the currently logging file (or file.log.curSizeRollBackup or even file.log.yyyy-mm-dd.curSizeRollBackup)
- * This will make time based roll overs with a large number of backups much faster -- it won't have to rename all
- * the backups!
- */
- protected boolean staticLogFileName = true;
-
- /** FileName provided in configuration. Used for rolling properly */
- protected String baseFileName;
-
- /** Do we want to .gz our backup files. */
- protected boolean compress = false;
-
- /** Do we want to use a second thread when compressing our backup files. */
- protected boolean compressAsync = false;
-
- /** Do we want to start numbering files at zero. */
- protected boolean zeroBased = false;
-
- /** Path provided in configuration. Used for moving backup files to */
- protected String backupFilesToPath = null;
- private final ConcurrentLinkedQueue<CompressJob> _compress = new ConcurrentLinkedQueue<CompressJob>();
- private AtomicBoolean _compressing = new AtomicBoolean(false);
-
- /** The default constructor does nothing. */
- public QpidCompositeRollingAppender()
- { }
-
- /**
- * Instantiate a <code>CompositeRollingAppender</code> and open the file designated by <code>filename</code>. The
- * opened filename will become the ouput destination for this appender.
- */
- public QpidCompositeRollingAppender(Layout layout, String filename, String datePattern) throws IOException
- {
- this(layout, filename, datePattern, true);
- }
-
- /**
- * Instantiate a CompositeRollingAppender and open the file designated by <code>filename</code>. The opened filename
- * will become the ouput destination for this appender.
- *
- * <p>If the <code>append</code> parameter is true, the file will be appended to. Otherwise, the file desginated by
- * <code>filename</code> will be truncated before being opened.
- */
- public QpidCompositeRollingAppender(Layout layout, String filename, boolean append) throws IOException
- {
- super(layout, filename, append);
- }
-
- /**
- * Instantiate a CompositeRollingAppender and open the file designated by <code>filename</code>. The opened filename
- * will become the ouput destination for this appender.
- */
- public QpidCompositeRollingAppender(Layout layout, String filename, String datePattern, boolean append)
- throws IOException
- {
- super(layout, filename, append);
- this.datePattern = datePattern;
- activateOptions();
- }
-
- /**
- * Instantiate a CompositeRollingAppender and open the file designated by <code>filename</code>. The opened filename
- * will become the output destination for this appender.
- *
- * <p>The file will be appended to. DatePattern is default.
- */
- public QpidCompositeRollingAppender(Layout layout, String filename) throws IOException
- {
- super(layout, filename);
- }
-
- /**
- * The <b>DatePattern</b> takes a string in the same format as expected by {@link java.text.SimpleDateFormat}. This
- * options determines the rollover schedule.
- */
- public void setDatePattern(String pattern)
- {
- datePattern = pattern;
- }
-
- /** Returns the value of the <b>DatePattern</b> option. */
- public String getDatePattern()
- {
- return datePattern;
- }
-
- /** Returns the value of the <b>maxSizeRollBackups</b> option. */
- public int getMaxSizeRollBackups()
- {
- return maxSizeRollBackups;
- }
-
- /**
- * Get the maximum size that the output file is allowed to reach before being rolled over to backup files.
- *
- * @since 1.1
- */
- public long getMaximumFileSize()
- {
- return maxFileSize;
- }
-
- /**
- * <p>Set the maximum number of backup files to keep around based on file size.
- *
- * <p>The <b>MaxSizeRollBackups</b> option determines how many backup files are kept before the oldest is erased.
- * This option takes an integer value. If set to zero, then there will be no backup files and the log file will be
- * truncated when it reaches <code>MaxFileSize</code>. If a negative number is supplied then no deletions will be
- * made. Note that this could result in very slow performance as a large number of files are rolled over unless
- * {@link #setCountDirection} up is used.
- *
- * <p>The maximum applys to -each- time based group of files and -not- the total. Using a daily roll the maximum
- * total files would be (#days run) * (maxSizeRollBackups)
- */
- public void setMaxSizeRollBackups(int maxBackups)
- {
- maxSizeRollBackups = maxBackups;
- }
-
- /**
- * Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
- *
- * <p>This method is equivalent to {@link #setMaxFileSize} except that it is required for differentiating the setter
- * taking a <code>long</code> argument from the setter taking a <code>String</code> argument by the JavaBeans {@link
- * java.beans.Introspector Introspector}.
- *
- * @see #setMaxFileSize(String)
- */
- public void setMaxFileSize(long maxFileSize)
- {
- this.maxFileSize = maxFileSize;
- }
-
- /**
- * Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
- *
- * <p>This method is equivalent to {@link #setMaxFileSize} except that it is required for differentiating the setter
- * taking a <code>long</code> argument from the setter taking a <code>String</code> argument by the JavaBeans {@link
- * java.beans.Introspector Introspector}.
- *
- * @see #setMaxFileSize(String)
- */
- public void setMaximumFileSize(long maxFileSize)
- {
- this.maxFileSize = maxFileSize;
- }
-
- /**
- * Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
- *
- * <p>In configuration files, the <b>MaxFileSize</b> option takes an long integer in the range 0 - 2^63. You can
- * specify the value with the suffixes "KB", "MB" or "GB" so that the integer is interpreted being expressed
- * respectively in kilobytes, megabytes or gigabytes. For example, the value "10KB" will be interpreted as 10240.
- */
- public void setMaxFileSize(String value)
- {
- maxFileSize = OptionConverter.toFileSize(value, maxFileSize + 1);
- }
-
- protected void setQWForFiles(Writer writer)
- {
- qw = new CountingQuietWriter(writer, errorHandler);
- }
-
- // Taken verbatum from DailyRollingFileAppender
- int computeCheckPeriod()
- {
- RollingCalendar c = new RollingCalendar();
- // set sate to 1970-01-01 00:00:00 GMT
- Date epoch = new Date(0);
- if (datePattern != null)
- {
- for (int i = TOP_OF_MINUTE; i <= TOP_OF_MONTH; i++)
- {
- String r0 = sdf.format(epoch);
- c.setType(i);
- Date next = new Date(c.getNextCheckMillis(epoch));
- String r1 = sdf.format(next);
- // LogLog.debug("Type = "+i+", r0 = "+r0+", r1 = "+r1);
- if ((r0 != null) && (r1 != null) && !r0.equals(r1))
- {
- return i;
- }
- }
- }
-
- return TOP_OF_TROUBLE; // Deliberately head for trouble...
- }
-
- // Now for the new stuff
- /**
- * Handles append time behavior for CompositeRollingAppender. This checks if a roll over either by date (checked
- * first) or time (checked second) is need and then appends to the file last.
- */
- protected void subAppend(LoggingEvent event)
- {
-
- if (rollDate)
- {
- long n = System.currentTimeMillis();
- if (n >= nextCheck)
- {
- now.setTime(n);
- nextCheck = rc.getNextCheckMillis(now);
-
- rollOverTime();
- }
- }
-
- if (rollSize)
- {
- if ((fileName != null) && (((CountingQuietWriter) qw).getCount() >= maxFileSize))
- {
- rollOverSize();
- }
- }
-
- super.subAppend(event);
- }
-
- public void setFile(String file)
- {
- baseFileName = file.trim();
- fileName = file.trim();
- }
-
- /**
- * Creates and opens the file for logging. If <code>staticLogFileName</code> is false then the fully qualified name
- * is determined and used.
- */
- public synchronized void setFile(String fileName, boolean append) throws IOException
- {
- if (!staticLogFileName)
- {
- scheduledFilename = fileName = fileName.trim() + sdf.format(now);
- if (countDirection > 0)
- {
- scheduledFilename = fileName = fileName + '.' + (++curSizeRollBackups);
- }
- }
-
- super.setFile(fileName, append, bufferedIO, bufferSize);
-
- if (append)
- {
- File f = new File(fileName);
- ((CountingQuietWriter) qw).setCount(f.length());
- }
- }
-
- public int getCountDirection()
- {
- return countDirection;
- }
-
- public void setCountDirection(int direction)
- {
- countDirection = direction;
- }
-
- public int getRollingStyle()
- {
- return rollingStyle;
- }
-
- public void setRollingStyle(int style)
- {
- rollingStyle = style;
- switch (rollingStyle)
- {
-
- case BY_SIZE:
- rollDate = false;
- rollSize = true;
- break;
-
- case BY_DATE:
- rollDate = true;
- rollSize = false;
- break;
-
- case BY_COMPOSITE:
- rollDate = true;
- rollSize = true;
- break;
-
- default:
- errorHandler.error("Invalid rolling Style, use 1 (by size only), 2 (by date only) or 3 (both)");
- }
- }
-
- /*
- public void setRollingStyle(String style) {
- if (style == S_BY_SIZE) {
- rollingStyle = BY_SIZE;
- }
- else if (style == S_BY_DATE) {
- rollingStyle = BY_DATE;
- }
- else if (style == S_BY_COMPOSITE) {
- rollingStyle = BY_COMPOSITE;
- }
- }
- */
- public boolean getStaticLogFileName()
- {
- return staticLogFileName;
- }
-
- public void setStaticLogFileName(boolean s)
- {
- staticLogFileName = s;
- }
-
- public void setStaticLogFileName(String value)
- {
- setStaticLogFileName(OptionConverter.toBoolean(value, true));
- }
-
- public boolean getCompressBackupFiles()
- {
- return compress;
- }
-
- public void setCompressBackupFiles(boolean c)
- {
- compress = c;
- }
-
- public boolean getCompressAsync()
- {
- return compressAsync;
- }
-
- public void setCompressAsync(boolean c)
- {
- compressAsync = c;
- if (compressAsync)
- {
- executor = Executors.newFixedThreadPool(1);
-
- compressor = new Compressor();
- }
- }
-
- public boolean getZeroBased()
- {
- return zeroBased;
- }
-
- public void setZeroBased(boolean z)
- {
- zeroBased = z;
- }
-
- public String getBackupFilesToPath()
- {
- return backupFilesToPath;
- }
-
- public void setbackupFilesToPath(String path)
- {
- File td = new File(path);
- if (!td.exists())
- {
- td.mkdirs();
- }
-
- backupFilesToPath = path;
- }
-
- /**
- * Initializes based on exisiting conditions at time of <code> activateOptions</code>. The following is done:<br>
- * <br> A) determine curSizeRollBackups<br> B) determine curTimeRollBackups (not implemented)<br> C) initiates a
- * roll over if needed for crossing a date boundary since the last run.
- */
- protected void existingInit()
- {
-
- if (zeroBased)
- {
- curSizeRollBackups = -1;
- }
-
- curTimeRollBackups = 0;
-
- // part A starts here
- String filter;
- if (staticLogFileName || !rollDate)
- {
- filter = baseFileName + ".*";
- }
- else
- {
- filter = scheduledFilename + ".*";
- }
-
- File f = new File(baseFileName);
- f = f.getParentFile();
- if (f == null)
- {
- f = new File(".");
- }
-
- LogLog.debug("Searching for existing files in: " + f);
- String[] files = f.list();
-
- if (files != null)
- {
- for (int i = 0; i < files.length; i++)
- {
- if (!files[i].startsWith(baseFileName))
- {
- continue;
- }
-
- int index = files[i].lastIndexOf(".");
-
- if (staticLogFileName)
- {
- int endLength = files[i].length() - index;
- if ((baseFileName.length() + endLength) != files[i].length())
- {
- // file is probably scheduledFilename + .x so I don't care
- continue;
- }
- }
-
- try
- {
- int backup = Integer.parseInt(files[i].substring(index + 1, files[i].length()));
- LogLog.debug("From file: " + files[i] + " -> " + backup);
- if (backup > curSizeRollBackups)
- {
- curSizeRollBackups = backup;
- }
- }
- catch (Exception e)
- {
- // this happens when file.log -> file.log.yyyy-mm-dd which is normal
- // when staticLogFileName == false
- LogLog.debug("Encountered a backup file not ending in .x " + files[i]);
- }
- }
- }
-
- LogLog.debug("curSizeRollBackups starts at: " + curSizeRollBackups);
- // part A ends here
-
- // part B not yet implemented
-
- // part C
- if (staticLogFileName && rollDate)
- {
- File old = new File(baseFileName);
- if (old.exists())
- {
- Date last = new Date(old.lastModified());
- if (!(sdf.format(last).equals(sdf.format(now))))
- {
- scheduledFilename = baseFileName + sdf.format(last);
- LogLog.debug("Initial roll over to: " + scheduledFilename);
- rollOverTime();
- }
- }
- }
-
- LogLog.debug("curSizeRollBackups after rollOver at: " + curSizeRollBackups);
- // part C ends here
-
- }
-
- /**
- * Sets initial conditions including date/time roll over information, first check, scheduledFilename, and calls
- * <code>existingInit</code> to initialize the current # of backups.
- */
- public void activateOptions()
- {
-
- // REMOVE removed rollDate from boolean to enable Alex's change
- if (datePattern != null)
- {
- now.setTime(System.currentTimeMillis());
- sdf = new SimpleDateFormat(datePattern);
- int type = computeCheckPeriod();
- // printPeriodicity(type);
- rc.setType(type);
- // next line added as this removes the name check in rollOver
- nextCheck = rc.getNextCheckMillis(now);
- }
- else
- {
- if (rollDate)
- {
- LogLog.error("Either DatePattern or rollingStyle options are not set for [" + name + "].");
- }
- }
-
- existingInit();
-
- if (rollDate && (fileName != null) && (scheduledFilename == null))
- {
- scheduledFilename = fileName + sdf.format(now);
- }
-
- try
- {
- this.setFile(fileName, true);
- }
- catch (IOException e)
- {
- errorHandler.error("Cannot set file name:" + fileName);
- }
-
- super.activateOptions();
- }
-
- /**
- * Rollover the file(s) to date/time tagged file(s). Opens the new file (through setFile) and resets
- * curSizeRollBackups.
- */
- protected void rollOverTime()
- {
-
- curTimeRollBackups++;
-
- this.closeFile(); // keep windows happy.
-
- // delete the old stuff here
-
- if (staticLogFileName)
- {
- /* Compute filename, but only if datePattern is specified */
- if (datePattern == null)
- {
- errorHandler.error("Missing DatePattern option in rollOver().");
-
- return;
- }
-
- // is the new file name equivalent to the 'current' one
- // something has gone wrong if we hit this -- we should only
- // roll over if the new file will be different from the old
- String dateFormat = sdf.format(now);
- if (scheduledFilename.equals(fileName + dateFormat))
- {
- errorHandler.error("Compare " + scheduledFilename + " : " + fileName + dateFormat);
-
- return;
- }
-
- // close current file, and rename it to datedFilename
- this.closeFile();
-
- // we may have to roll over a large number of backups here
- String from, to;
- for (int i = 1; i <= curSizeRollBackups; i++)
- {
- from = fileName + '.' + i;
- to = scheduledFilename + '.' + i;
- rollFile(from, to, false);
- }
-
- rollFile(fileName, scheduledFilename, compress);
- }
- else
- {
- if (compress)
- {
- compress(fileName);
- }
- }
-
- try
- {
- // This will also close the file. This is OK since multiple
- // close operations are safe.
- curSizeRollBackups = 0; // We're cleared out the old date and are ready for the new
-
- // new scheduled name
- scheduledFilename = fileName + sdf.format(now);
- this.setFile(baseFileName, false);
- }
- catch (IOException e)
- {
- errorHandler.error("setFile(" + fileName + ", false) call failed.");
- }
-
- }
-
- /**
- * Renames file <code>from</code> to file <code>to</code>. It also checks for existence of target file and deletes
- * if it does.
- */
- protected void rollFile(String from, String to, boolean compress)
- {
- if (from.equals(to))
- {
- if (compress)
- {
- LogLog.debug("Attempting to compress file with same output name.");
- }
-
- return;
- }
-
- File target = new File(to);
- if (target.exists())
- {
- LogLog.debug("deleting existing target file: " + target);
- target.delete();
- }
-
- File file = new File(from);
- if (compress)
- {
- compress(file, target);
- }
- else
- {
- if (!file.getPath().equals(target.getPath()))
- {
- file.renameTo(target);
- }
- }
-
- LogLog.debug(from + " -> " + to);
- }
-
- protected void compress(String file)
- {
- File f = new File(file);
- compress(f, f);
- }
-
- private void compress(File from, File target)
- {
- if (compressAsync)
- {
- synchronized (_compress)
- {
- _compress.offer(new CompressJob(from, target));
- }
-
- startCompression();
- }
- else
- {
- doCompress(from, target);
- }
- }
-
- private void startCompression()
- {
- if (_compressing.compareAndSet(false, true))
- {
- executor.execute(compressor);
- }
- }
-
- /** Delete's the specified file if it exists */
- protected static void deleteFile(String fileName)
- {
- File file = new File(fileName);
- if (file.exists())
- {
- file.delete();
- }
- }
-
- /**
- * Implements roll overs base on file size.
- *
- * <p>If the maximum number of size based backups is reached (<code>curSizeRollBackups == maxSizeRollBackups</code)
- * then the oldest file is deleted -- it's index determined by the sign of countDirection.<br> If
- * <code>countDirection</code> < 0, then files {<code>File.1</code>, ..., <code>File.curSizeRollBackups -1</code>}
- * are renamed to {<code>File.2</code>, ..., <code>File.curSizeRollBackups</code>}. Moreover, <code>File</code> is
- * renamed <code>File.1</code> and closed.<br>
- *
- * A new file is created to receive further log output.
- *
- * <p>If <code>maxSizeRollBackups</code> is equal to zero, then the <code>File</code> is truncated with no backup
- * files created.
- *
- * <p>If <code>maxSizeRollBackups</code> < 0, then <code>File</code> is renamed if needed and no files are deleted.
- */
-
- // synchronization not necessary since doAppend is alreasy synched
- protected void rollOverSize()
- {
- File file;
-
- this.closeFile(); // keep windows happy.
-
- LogLog.debug("rolling over count=" + ((CountingQuietWriter) qw).getCount());
- LogLog.debug("maxSizeRollBackups = " + maxSizeRollBackups);
- LogLog.debug("curSizeRollBackups = " + curSizeRollBackups);
- LogLog.debug("countDirection = " + countDirection);
-
- // If maxBackups <= 0, then there is no file renaming to be done.
- if (maxSizeRollBackups != 0)
- {
-
- if (countDirection < 0)
- {
- // Delete the oldest file, to keep Windows happy.
- if (curSizeRollBackups == maxSizeRollBackups)
- {
- deleteFile(fileName + '.' + maxSizeRollBackups);
- curSizeRollBackups--;
- }
-
- // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
- for (int i = curSizeRollBackups; i >= 1; i--)
- {
- rollFile((fileName + "." + i), (fileName + '.' + (i + 1)), false);
- }
-
- curSizeRollBackups++;
- // Rename fileName to fileName.1
- rollFile(fileName, fileName + ".1", compress);
-
- } // REMOVE This code branching for Alexander Cerna's request
- else if (countDirection == 0)
- {
- // rollFile based on date pattern
- curSizeRollBackups++;
- now.setTime(System.currentTimeMillis());
- scheduledFilename = fileName + sdf.format(now);
- rollFile(fileName, scheduledFilename, compress);
- }
- else
- { // countDirection > 0
- if ((curSizeRollBackups >= maxSizeRollBackups) && (maxSizeRollBackups > 0))
- {
- // delete the first and keep counting up.
- int oldestFileIndex = curSizeRollBackups - maxSizeRollBackups + 1;
- deleteFile(fileName + '.' + oldestFileIndex);
- }
-
- if (staticLogFileName)
- {
- curSizeRollBackups++;
- rollFile(fileName, fileName + '.' + curSizeRollBackups, compress);
- }
- else
- {
- if (compress)
- {
- compress(fileName);
- }
- }
- }
- }
-
- try
- {
- // This will also close the file. This is OK since multiple
- // close operations are safe.
- this.setFile(baseFileName, false);
- }
- catch (IOException e)
- {
- LogLog.error("setFile(" + fileName + ", false) call failed.", e);
- }
- }
-
- protected synchronized void doCompress(File from, File to)
- {
- String toFile;
- if (backupFilesToPath == null)
- {
- toFile = to.getPath() + ".gz";
- }
- else
- {
- toFile = backupFilesToPath + System.getProperty("file.separator") + to.getName() + ".gz";
- }
-
- File target = new File(toFile);
- if (target.exists())
- {
- LogLog.debug("deleting existing target file: " + target);
- target.delete();
- }
-
- try
- {
- // Create the GZIP output stream
- GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(target));
-
- // Open the input file
- FileInputStream in = new FileInputStream(from);
-
- // Transfer bytes from the input file to the GZIP output stream
- byte[] buf = new byte[1024];
- int len;
- while ((len = in.read(buf)) > 0)
- {
- out.write(buf, 0, len);
- }
-
- in.close();
-
- // Complete the GZIP file
- out.finish();
- out.close();
- // Remove old file.
- from.delete();
- }
- catch (IOException e)
- {
- if (target.exists())
- {
- target.delete();
- }
-
- rollFile(from.getPath(), to.getPath(), false);
- }
- }
-
- private class CompressJob
- {
- File _from, _to;
-
- CompressJob(File from, File to)
- {
- _from = from;
- _to = to;
- }
-
- File getFrom()
- {
- return _from;
- }
-
- File getTo()
- {
- return _to;
- }
- }
-
- Compressor compressor = null;
-
- Executor executor;
-
- private class Compressor implements Runnable
- {
- public void run()
- {
- boolean running = true;
- while (running)
- {
- CompressJob job = _compress.poll();
-
- doCompress(job.getFrom(), job.getTo());
-
- synchronized (_compress)
- {
- if (_compress.isEmpty())
- {
- running = false;
- _compressing.set(false);
- }
- }
- }
-
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java b/qpid/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java
deleted file mode 100644
index 40ff590a0a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.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.
- *
- */
-package org.apache.qpid.configuration;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.cli.PosixParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-
-public class Configuration
-{
- public static final String QPID_HOME = "QPID_HOME";
-
- final String QPIDHOME = System.getProperty(QPID_HOME);
-
- private static Logger _devlog = LoggerFactory.getLogger(Configuration.class);
-
- public static final String DEFAULT_LOG_CONFIG_FILENAME = "log4j.xml";
- public static final String DEFAULT_CONFIG_FILE = "etc/config.xml";
-
- protected final Options _options = new Options();
- protected CommandLine _commandLine;
- protected File _configFile;
-
-
- public Configuration()
- {
-
- }
-
- public void processCommandline(String[] args) throws InitException
- {
- try
- {
- _commandLine = new PosixParser().parse(_options, args);
- }
- catch (ParseException e)
- {
- throw new InitException("Unable to parse commmandline", e);
- }
-
- final File defaultConfigFile = new File(QPIDHOME, DEFAULT_CONFIG_FILE);
- setConfig(new File(_commandLine.getOptionValue("c", defaultConfigFile.getPath())));
- }
-
- public void setConfig(File file)
- {
- _configFile = file;
- }
-
- /**
- * @param option The option to set.
- */
- public void setOption(Option option)
- {
- _options.addOption(option);
- }
-
- /**
- * getOptionValue from the configuration
- * @param option variable argument, first string is option to get, second if present is the default value.
- * @return the String for the given option or null if not present (if default value not specified)
- */
- public String getOptionValue(String... option)
- {
- if (option.length == 1)
- {
- return _commandLine.getOptionValue(option[0]);
- }
- else if (option.length == 2)
- {
- return _commandLine.getOptionValue(option[0], option[1]);
- }
- return null;
- }
-
- public void loadConfig(File file) throws InitException
- {
- setConfig(file);
- loadConfig();
- }
-
- private void loadConfig() throws InitException
- {
- if (!_configFile.exists())
- {
- String error = "File " + _configFile + " could not be found. Check the file exists and is readable.";
-
- if (QPIDHOME == null)
- {
- error = error + "\nNote: " + QPID_HOME + " is not set.";
- }
-
- throw new InitException(error, null);
- }
- else
- {
- _devlog.debug("Using configuration file " + _configFile.getAbsolutePath());
- }
-
-// String logConfig = _commandLine.getOptionValue("l");
-// String logWatchConfig = _commandLine.getOptionValue("w", "0");
-// if (logConfig != null)
-// {
-// File logConfigFile = new File(logConfig);
-// configureLogging(logConfigFile, logWatchConfig);
-// }
-// else
-// {
-// File configFileDirectory = _configFile.getParentFile();
-// File logConfigFile = new File(configFileDirectory, DEFAULT_LOG_CONFIG_FILENAME);
-// configureLogging(logConfigFile, logWatchConfig);
-// }
- }
-
-
-// private void configureLogging(File logConfigFile, String logWatchConfig)
-// {
-// int logWatchTime = 0;
-// try
-// {
-// logWatchTime = Integer.parseInt(logWatchConfig);
-// }
-// catch (NumberFormatException e)
-// {
-// _devlog.error("Log watch configuration value of " + logWatchConfig + " is invalid. Must be "
-// + "a non-negative integer. Using default of zero (no watching configured");
-// }
-//
-// if (logConfigFile.exists() && logConfigFile.canRead())
-// {
-// _devlog.info("Configuring logger using configuration file " + logConfigFile.getAbsolutePath());
-// if (logWatchTime > 0)
-// {
-// _devlog.info("log file " + logConfigFile.getAbsolutePath() + " will be checked for changes every "
-// + logWatchTime + " seconds");
-// // log4j expects the watch interval in milliseconds
-// DOMConfigurator.configureAndWatch(logConfigFile.getAbsolutePath(), logWatchTime * 1000);
-// }
-// else
-// {
-// DOMConfigurator.configure(logConfigFile.getAbsolutePath());
-// }
-// }
-// else
-// {
-// System.err.println("Logging configuration error: unable to read file " + logConfigFile.getAbsolutePath());
-// System.err.println("Using basic log4j configuration");
-// BasicConfigurator.configure();
-// }
-// }
-
- public File getConfigFile()
- {
- return _configFile;
- }
-
-
- public class InitException extends Exception
- {
- InitException(String msg, Throwable cause)
- {
- super(msg, cause);
- }
- }
-} \ No newline at end of file
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
deleted file mode 100644
index 9335723bc5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.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.
- *
- */
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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.server;
-
-import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.commons.configuration.Configuration;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.exchange.ExchangeFactory;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.management.AMQManagedObject;
-import org.apache.qpid.server.management.MBeanConstructor;
-import org.apache.qpid.server.management.MBeanDescription;
-import org.apache.qpid.server.management.ManagedBroker;
-import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-/**
- * This MBean implements the broker management interface and exposes the
- * Broker level management features like creating and deleting exchanges and queue.
- */
-@MBeanDescription("This MBean exposes the broker level management features")
-public class AMQBrokerManagerMBean extends AMQManagedObject implements ManagedBroker
-{
- private final QueueRegistry _queueRegistry;
- private final ExchangeRegistry _exchangeRegistry;
- private final ExchangeFactory _exchangeFactory;
- private final MessageStore _messageStore;
-
- private final VirtualHost.VirtualHostMBean _virtualHostMBean;
-
- @MBeanConstructor("Creates the Broker Manager MBean")
- public AMQBrokerManagerMBean(VirtualHost.VirtualHostMBean virtualHostMBean) throws JMException
- {
- super(ManagedBroker.class, ManagedBroker.TYPE);
-
- _virtualHostMBean = virtualHostMBean;
- VirtualHost virtualHost = virtualHostMBean.getVirtualHost();
-
- _queueRegistry = virtualHost.getQueueRegistry();
- _exchangeRegistry = virtualHost.getExchangeRegistry();
- _messageStore = virtualHost.getMessageStore();
- _exchangeFactory = virtualHost.getExchangeFactory();
- }
-
- public String getObjectInstanceName()
- {
- return _virtualHostMBean.getVirtualHost().getName();
- }
-
- /**
- * Creates new exchange and registers it with the registry.
- *
- * @param exchangeName
- * @param type
- * @param durable
- * @throws JMException
- */
- public void createNewExchange(String exchangeName, String type, boolean durable) throws JMException
- {
- try
- {
- synchronized (_exchangeRegistry)
- {
- Exchange exchange = _exchangeRegistry.getExchange(new AMQShortString(exchangeName));
- if (exchange == null)
- {
- exchange = _exchangeFactory.createExchange(new AMQShortString(exchangeName), new AMQShortString(type),
- durable, false, 0);
- _exchangeRegistry.registerExchange(exchange);
- }
- else
- {
- throw new JMException("The exchange \"" + exchangeName + "\" already exists.");
- }
- }
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex, "Error in creating exchange " + exchangeName);
- }
- }
-
- /**
- * Unregisters the exchange from registry.
- *
- * @param exchangeName
- * @throws JMException
- */
- public void unregisterExchange(String exchangeName) throws JMException
- {
- // TODO
- // Check if the exchange is in use.
- // boolean inUse = false;
- // Check if there are queue-bindings with the exchange and unregister
- // when there are no bindings.
- try
- {
- _exchangeRegistry.unregisterExchange(new AMQShortString(exchangeName), false);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex, "Error in unregistering exchange " + exchangeName);
- }
- }
-
- /**
- * Creates a new queue and registers it with the registry and puts it
- * in persistance storage if durable queue.
- *
- * @param queueName
- * @param durable
- * @param owner
- * @throws JMException
- */
- public void createNewQueue(String queueName, String owner, boolean durable) throws JMException
- {
- AMQQueue queue = _queueRegistry.getQueue(new AMQShortString(queueName));
- if (queue != null)
- {
- throw new JMException("The queue \"" + queueName + "\" already exists.");
- }
-
- try
- {
- AMQShortString ownerShortString = null;
- if (owner != null)
- {
- ownerShortString = new AMQShortString(owner);
- }
-
- queue = new AMQQueue(new AMQShortString(queueName), durable, ownerShortString, false, getVirtualHost());
- if (queue.isDurable() && !queue.isAutoDelete())
- {
- _messageStore.createQueue(queue);
- }
-
- Configuration virtualHostDefaultQueueConfiguration =
- VirtualHostConfiguration.getDefaultQueueConfiguration(queue);
- if (virtualHostDefaultQueueConfiguration != null)
- {
- Configurator.configure(queue, virtualHostDefaultQueueConfiguration);
- }
-
- _queueRegistry.registerQueue(queue);
- }
- catch (AMQException ex)
- {
- JMException jme = new JMException(ex.getMessage());
- jme.initCause(ex);
- throw new MBeanException(jme, "Error in creating queue " + queueName);
- }
- }
-
- private VirtualHost getVirtualHost()
- {
- return _virtualHostMBean.getVirtualHost();
- }
-
- /**
- * Deletes the queue from queue registry and persistant storage.
- *
- * @param queueName
- * @throws JMException
- */
- public void deleteQueue(String queueName) throws JMException
- {
- AMQQueue queue = _queueRegistry.getQueue(new AMQShortString(queueName));
- if (queue == null)
- {
- throw new JMException("The Queue " + queueName + " is not a registerd queue.");
- }
-
- try
- {
- queue.delete();
- _messageStore.removeQueue(new AMQShortString(queueName));
-
- }
- catch (AMQException ex)
- {
- JMException jme = new JMException(ex.getMessage());
- jme.initCause(ex);
- throw new MBeanException(jme, "Error in deleting queue " + queueName);
- }
- }
-
- public ManagedObject getParentObject()
- {
- return _virtualHostMBean;
- }
-
- // This will have a single instance for a virtual host, so not having the name property in the ObjectName
- public ObjectName getObjectName() throws MalformedObjectNameException
- {
- return getObjectNameForSingleInstanceMBean();
- }
-} // End of MBean class
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
deleted file mode 100644
index 5542fbc9b6..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
+++ /dev/null
@@ -1,1021 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.configuration.Configured;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.server.ack.UnacknowledgedMessage;
-import org.apache.qpid.server.ack.UnacknowledgedMessageMap;
-import org.apache.qpid.server.ack.UnacknowledgedMessageMapImpl;
-import org.apache.qpid.server.exchange.MessageRouter;
-import org.apache.qpid.server.exchange.NoRouteException;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.*;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.txn.LocalTransactionalContext;
-import org.apache.qpid.server.txn.NonTransactionalContext;
-import org.apache.qpid.server.txn.TransactionalContext;
-import org.apache.qpid.server.configuration.Configurator;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-public class AMQChannel
-{
- public static final int DEFAULT_PREFETCH = 5000;
-
- private static final Logger _log = Logger.getLogger(AMQChannel.class);
-
- private final int _channelId;
-
- // private boolean _transactional;
-
- private long _prefetch_HighWaterMark;
-
- private long _prefetch_LowWaterMark;
-
- private long _prefetchSize;
-
- /**
- * The delivery tag is unique per channel. This is pre-incremented before putting into the deliver frame so that
- * value of this represents the <b>last</b> tag sent out
- */
- private long _deliveryTag = 0;
-
- /** A channel has a default queue (the last declared) that is used when no queue name is explictily set */
- private AMQQueue _defaultQueue;
-
- /** This tag is unique per subscription to a queue. The server returns this in response to a basic.consume request. */
- private int _consumerTag;
-
- /**
- * The current message - which may be partial in the sense that not all frames have been received yet - which has
- * been received by this channel. As the frames are received the message gets updated and once all frames have been
- * received the message can then be routed.
- */
- private AMQMessage _currentMessage;
-
- /** Maps from consumer tag to queue instance. Allows us to unsubscribe from a queue. */
- private final Map<AMQShortString, AMQQueue> _consumerTag2QueueMap = new HashMap<AMQShortString, AMQQueue>();
-
- private final MessageStore _messageStore;
-
- private UnacknowledgedMessageMap _unacknowledgedMessageMap = new UnacknowledgedMessageMapImpl(DEFAULT_PREFETCH);
-
- private final AtomicBoolean _suspended = new AtomicBoolean(false);
-
- private TransactionalContext _txnContext, _nonTransactedContext;
-
- /**
- * A context used by the message store enabling it to track context for a given channel even across thread
- * boundaries
- */
- private final StoreContext _storeContext;
-
- private final List<RequiredDeliveryException> _returnMessages = new LinkedList<RequiredDeliveryException>();
-
- private MessageHandleFactory _messageHandleFactory = new MessageHandleFactory();
-
- private Set<Long> _browsedAcks = new HashSet<Long>();
-
- // Why do we need this reference ? - ritchiem
- private final AMQProtocolSession _session;
- private boolean _closing;
-
- @Configured(path = "advanced.enableJMSXUserID",
- defaultValue = "false")
- public boolean ENABLE_JMSXUserID;
-
-
- public AMQChannel(AMQProtocolSession session, int channelId, MessageStore messageStore)
- throws AMQException
- {
- //Set values from configuration
- Configurator.configure(this);
-
- _session = session;
- _channelId = channelId;
- _storeContext = new StoreContext("Session: " + session.getClientIdentifier() + "; channel: " + channelId);
- _prefetch_HighWaterMark = DEFAULT_PREFETCH;
- _prefetch_LowWaterMark = _prefetch_HighWaterMark / 2;
- _messageStore = messageStore;
-
- // by default the session is non-transactional
- _txnContext = new NonTransactionalContext(_messageStore, _storeContext, this, _returnMessages, _browsedAcks);
- }
-
- /** Sets this channel to be part of a local transaction */
- public void setLocalTransactional()
- {
- _txnContext = new LocalTransactionalContext(_messageStore, _storeContext, _returnMessages);
- }
-
- public boolean isTransactional()
- {
- // this does not look great but there should only be one "non-transactional"
- // transactional context, while there could be several transactional ones in
- // theory
- return !(_txnContext instanceof NonTransactionalContext);
- }
-
- public int getChannelId()
- {
- return _channelId;
- }
-
- public long getPrefetchCount()
- {
- return _prefetch_HighWaterMark;
- }
-
- public void setPrefetchCount(long prefetchCount)
- {
- _prefetch_HighWaterMark = prefetchCount;
- }
-
- public long getPrefetchSize()
- {
- return _prefetchSize;
- }
-
- public void setPrefetchSize(long prefetchSize)
- {
- _prefetchSize = prefetchSize;
- }
-
- public long getPrefetchLowMarkCount()
- {
- return _prefetch_LowWaterMark;
- }
-
- public void setPrefetchLowMarkCount(long prefetchCount)
- {
- _prefetch_LowWaterMark = prefetchCount;
- }
-
- public long getPrefetchHighMarkCount()
- {
- return _prefetch_HighWaterMark;
- }
-
- public void setPrefetchHighMarkCount(long prefetchCount)
- {
- _prefetch_HighWaterMark = prefetchCount;
- }
-
- public void setPublishFrame(MessagePublishInfo info, AMQProtocolSession publisher, final Exchange e) throws AMQException
- {
-
- _currentMessage = new AMQMessage(_messageStore.getNewMessageId(), info, _txnContext);
- _currentMessage.setPublisher(publisher);
- _currentMessage.setExchange(e);
- }
-
- public void publishContentHeader(ContentHeaderBody contentHeaderBody, AMQProtocolSession protocolSession)
- throws AMQException
- {
- if (_currentMessage == null)
- {
- throw new AMQException("Received content header without previously receiving a BasicPublish frame");
- }
- else
- {
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Content header received on channel " + _channelId);
- }
-
- if (ENABLE_JMSXUserID)
- {
- //Set JMSXUserID
- BasicContentHeaderProperties properties = (BasicContentHeaderProperties) contentHeaderBody.properties;
- //fixme: fudge for QPID-677
- properties.getHeaders().keySet();
-
- properties.setUserId(protocolSession.getAuthorizedID().getName());
- }
-
- _currentMessage.setContentHeaderBody(contentHeaderBody);
- _currentMessage.setExpiration();
-
- routeCurrentMessage();
- _currentMessage.routingComplete(_messageStore, _storeContext, _messageHandleFactory);
-
- // check and deliver if header says body length is zero
- if (contentHeaderBody.bodySize == 0)
- {
- _txnContext.messageProcessed(protocolSession);
- _currentMessage = null;
- }
- }
- }
-
- public void publishContentBody(ContentBody contentBody, AMQProtocolSession protocolSession) throws AMQException
- {
- if (_currentMessage == null)
- {
- throw new AMQException("Received content body without previously receiving a JmsPublishBody");
- }
-
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Content body received on channel " + _channelId);
- }
-
- try
- {
-
- // returns true iff the message was delivered (i.e. if all data was
- // received
- if (_currentMessage.addContentBodyFrame(_storeContext,
- protocolSession.getMethodRegistry().getProtocolVersionMethodConverter().convertToContentChunk(
- contentBody)))
- {
- // callback to allow the context to do any post message processing
- // primary use is to allow message return processing in the non-tx case
- _txnContext.messageProcessed(protocolSession);
- _currentMessage = null;
- }
- }
- catch (AMQException e)
- {
- // we want to make sure we don't keep a reference to the message in the
- // event of an error
- _currentMessage = null;
- throw e;
- }
- }
-
- protected void routeCurrentMessage() throws AMQException
- {
- try
- {
- _currentMessage.route();
- }
- catch (NoRouteException e)
- {
- _returnMessages.add(e);
- }
- }
-
- public long getNextDeliveryTag()
- {
- return ++_deliveryTag;
- }
-
- public int getNextConsumerTag()
- {
- return ++_consumerTag;
- }
-
- /**
- * Subscribe to a queue. We register all subscriptions in the channel so that if the channel is closed we can clean
- * up all subscriptions, even if the client does not explicitly unsubscribe from all queues.
- *
- * @param tag the tag chosen by the client (if null, server will generate one)
- * @param queue the queue to subscribe to
- * @param session the protocol session of the subscriber
- * @param noLocal Flag stopping own messages being receivied.
- * @param exclusive Flag requesting exclusive access to the queue
- * @param acks Are acks enabled for this subscriber
- * @param filters Filters to apply to this subscriber
- *
- * @return the consumer tag. This is returned to the subscriber and used in subsequent unsubscribe requests
- *
- * @throws ConsumerTagNotUniqueException if the tag is not unique
- * @throws AMQException if something goes wrong
- */
- public AMQShortString subscribeToQueue(AMQShortString tag, AMQQueue queue, AMQProtocolSession session, boolean acks,
- FieldTable filters, boolean noLocal, boolean exclusive) throws AMQException, ConsumerTagNotUniqueException
- {
- if (tag == null)
- {
- tag = new AMQShortString("sgen_" + getNextConsumerTag());
- }
-
- if (_consumerTag2QueueMap.containsKey(tag))
- {
- throw new ConsumerTagNotUniqueException();
- }
-
- queue.registerProtocolSession(session, _channelId, tag, acks, filters, noLocal, exclusive);
- _consumerTag2QueueMap.put(tag, queue);
-
- return tag;
- }
-
- public void unsubscribeConsumer(AMQProtocolSession session, AMQShortString consumerTag) throws AMQException
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Unacked Map Dump size:" + _unacknowledgedMessageMap.size());
- _unacknowledgedMessageMap.visit(new UnacknowledgedMessageMap.Visitor()
- {
-
- public boolean callback(UnacknowledgedMessage message) throws AMQException
- {
- _log.debug(message);
-
- return true;
- }
-
- public void visitComplete()
- {
- }
- });
- }
-
- AMQQueue q = _consumerTag2QueueMap.remove(consumerTag);
- if (q != null)
- {
- q.unregisterProtocolSession(session, _channelId, consumerTag);
- }
- }
-
- /**
- * Called from the protocol session to close this channel and clean up. T
- *
- * @param session The session to close
- *
- * @throws AMQException if there is an error during closure
- */
- public void close(AMQProtocolSession session) throws AMQException
- {
- _txnContext.rollback();
- unsubscribeAllConsumers(session);
- try
- {
- requeue();
- }
- catch (AMQException e)
- {
- _log.error("Caught AMQException whilst attempting to reque:" + e);
- }
-
- setClosing(true);
- }
-
- private void setClosing(boolean closing)
- {
- _closing = closing;
- }
-
- private void unsubscribeAllConsumers(AMQProtocolSession session) throws AMQException
- {
- if (_log.isInfoEnabled())
- {
- if (!_consumerTag2QueueMap.isEmpty())
- {
- _log.info("Unsubscribing all consumers on channel " + toString());
- }
- else
- {
- _log.info("No consumers to unsubscribe on channel " + toString());
- }
- }
-
- for (Map.Entry<AMQShortString, AMQQueue> me : _consumerTag2QueueMap.entrySet())
- {
- if (_log.isInfoEnabled())
- {
- _log.info("Unsubscribing consumer '" + me.getKey() + "' on channel " + toString());
- }
-
- me.getValue().unregisterProtocolSession(session, _channelId, me.getKey());
- }
-
- _consumerTag2QueueMap.clear();
- }
-
- /**
- * Add a message to the channel-based list of unacknowledged messages
- *
- * @param entry the record of the message on the queue that was delivered
- * @param deliveryTag the delivery tag used when delivering the message (see protocol spec for description of the
- * delivery tag)
- * @param consumerTag The tag for the consumer that is to acknowledge this message.
- */
- public void addUnacknowledgedMessage(QueueEntry entry, long deliveryTag, AMQShortString consumerTag)
- {
- if (_log.isDebugEnabled())
- {
- if (entry.getQueue() == null)
- {
- _log.debug("Adding unacked message with a null queue:" + entry.debugIdentity());
- }
- else
- {
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + " Adding unacked message(" + entry.getMessage().toString() + " DT:" + deliveryTag
- + ") with a queue(" + entry.getQueue() + ") for " + consumerTag);
- }
- }
- }
-
- synchronized (_unacknowledgedMessageMap.getLock())
- {
- _unacknowledgedMessageMap.add(deliveryTag, new UnacknowledgedMessage(entry, consumerTag, deliveryTag));
- checkSuspension();
- }
- }
-
- private final String id = "(" + System.identityHashCode(this) + ")";
-
- public String debugIdentity()
- {
- return _channelId + id;
- }
-
- /**
- * Called to attempt re-delivery all outstanding unacknowledged messages on the channel. May result in delivery to
- * this same channel or to other subscribers.
- *
- * @throws org.apache.qpid.AMQException if the requeue fails
- */
- public void requeue() throws AMQException
- {
- // we must create a new map since all the messages will get a new delivery tag when they are redelivered
- Collection<UnacknowledgedMessage> messagesToBeDelivered = _unacknowledgedMessageMap.cancelAllMessages();
-
- // Deliver these messages out of the transaction as their delivery was never
- // part of the transaction only the receive.
- TransactionalContext deliveryContext = null;
-
- if (!messagesToBeDelivered.isEmpty())
- {
- if (_log.isInfoEnabled())
- {
- _log.info("Requeuing " + messagesToBeDelivered.size() + " unacked messages. for " + toString());
- }
-
- if (!(_txnContext instanceof NonTransactionalContext))
- {
- // if (_nonTransactedContext == null)
- {
- _nonTransactedContext =
- new NonTransactionalContext(_messageStore, _storeContext, this, _returnMessages, _browsedAcks);
- }
-
- deliveryContext = _nonTransactedContext;
- }
- else
- {
- deliveryContext = _txnContext;
- }
- }
-
- for (UnacknowledgedMessage unacked : messagesToBeDelivered)
- {
- if (!unacked.isQueueDeleted())
- {
- // Ensure message is released for redelivery
- unacked.entry.release();
-
- // Mark message redelivered
- unacked.getMessage().setRedelivered(true);
-
- // Deliver Message
- deliveryContext.deliver(unacked.entry, false);
-
- // Should we allow access To the DM to directy deliver the message?
- // As we don't need to check for Consumers or worry about incrementing the message count?
- // unacked.queue.getDeliveryManager().deliver(_storeContext, unacked.queue.getName(), unacked.message, false);
- }
- }
-
- }
-
- /**
- * Requeue a single message
- *
- * @param deliveryTag The message to requeue
- *
- * @throws AMQException If something goes wrong.
- */
- public void requeue(long deliveryTag) throws AMQException
- {
- UnacknowledgedMessage unacked = _unacknowledgedMessageMap.remove(deliveryTag);
-
- if (unacked != null)
- {
-
- // Ensure message is released for redelivery
- if (!unacked.isQueueDeleted())
- {
- unacked.entry.release();
- }
-
- // Mark message redelivered
- unacked.getMessage().setRedelivered(true);
-
- // Deliver these messages out of the transaction as their delivery was never
- // part of the transaction only the receive.
- TransactionalContext deliveryContext;
- if (!(_txnContext instanceof NonTransactionalContext))
- {
- // if (_nonTransactedContext == null)
- {
- _nonTransactedContext =
- new NonTransactionalContext(_messageStore, _storeContext, this, _returnMessages, _browsedAcks);
- }
-
- deliveryContext = _nonTransactedContext;
- }
- else
- {
- deliveryContext = _txnContext;
- }
-
- if (!unacked.isQueueDeleted())
- {
- // Redeliver the messages to the front of the queue
- deliveryContext.deliver(unacked.entry, true);
- // Deliver increments the message count but we have already deliverted this once so don't increment it again
- // this was because deliver did an increment changed this.
- }
- else
- {
- _log.warn(System.identityHashCode(this) + " Requested requeue of message(" + unacked.getMessage().debugIdentity()
- + "):" + deliveryTag + " but no queue defined and no DeadLetter queue so DROPPING message.");
- // _log.error("Requested requeue of message:" + deliveryTag +
- // " but no queue defined using DeadLetter queue:" + getDeadLetterQueue());
- //
- // deliveryContext.deliver(unacked.message, getDeadLetterQueue(), false);
- //
- }
- }
- else
- {
- _log.warn("Requested requeue of message:" + deliveryTag + " but no such delivery tag exists."
- + _unacknowledgedMessageMap.size());
-
- if (_log.isDebugEnabled())
- {
- _unacknowledgedMessageMap.visit(new UnacknowledgedMessageMap.Visitor()
- {
- int count = 0;
-
- public boolean callback(UnacknowledgedMessage message) throws AMQException
- {
- _log.debug(
- (count++) + ": (" + message.getMessage().debugIdentity() + ")" + "[" + message.deliveryTag + "]");
-
- return false; // Continue
- }
-
- public void visitComplete()
- {
- }
- });
- }
- }
-
- }
-
- /**
- * Called to resend all outstanding unacknowledged messages to this same channel.
- *
- * @param requeue Are the messages to be requeued or dropped.
- *
- * @throws AMQException When something goes wrong.
- */
- public void resend(final boolean requeue) throws AMQException
- {
- final List<UnacknowledgedMessage> msgToRequeue = new LinkedList<UnacknowledgedMessage>();
- final List<UnacknowledgedMessage> msgToResend = new LinkedList<UnacknowledgedMessage>();
-
- if (_log.isDebugEnabled())
- {
- _log.debug("unacked map Size:" + _unacknowledgedMessageMap.size());
- }
-
- // Process the Unacked-Map.
- // Marking messages who still have a consumer for to be resent
- // and those that don't to be requeued.
- _unacknowledgedMessageMap.visit(new UnacknowledgedMessageMap.Visitor()
- {
- public boolean callback(UnacknowledgedMessage message) throws AMQException
- {
- AMQShortString consumerTag = message.consumerTag;
- AMQMessage msg = message.getMessage();
- msg.setRedelivered(true);
- if (consumerTag != null)
- {
- // Consumer exists
- if (_consumerTag2QueueMap.containsKey(consumerTag))
- {
- msgToResend.add(message);
- }
- else // consumer has gone
- {
- msgToRequeue.add(message);
- }
- }
- else
- {
- // Message has no consumer tag, so was "delivered" to a GET
- // or consumer no longer registered
- // cannot resend, so re-queue.
- if (!message.isQueueDeleted())
- {
- if (requeue)
- {
- msgToRequeue.add(message);
- }
- else
- {
- _log.info("No DeadLetter Queue and requeue not requested so dropping message:" + message);
- }
- }
- else
- {
- _log.info("Message.queue is null and no DeadLetter Queue so dropping message:" + message);
- }
- }
-
- // false means continue processing
- return false;
- }
-
- public void visitComplete()
- {
- }
- });
-
- // Process Messages to Resend
- if (_log.isDebugEnabled())
- {
- if (!msgToResend.isEmpty())
- {
- _log.debug("Preparing (" + msgToResend.size() + ") message to resend.");
- }
- else
- {
- _log.debug("No message to resend.");
- }
- }
-
- for (UnacknowledgedMessage message : msgToResend)
- {
- AMQMessage msg = message.getMessage();
-
- // Our Java Client will always suspend the channel when resending!
- // If the client has requested the messages be resent then it is
- // their responsibility to ensure that thay are capable of receiving them
- // i.e. The channel hasn't been server side suspended.
- // if (isSuspended())
- // {
- // _log.info("Channel is suspended so requeuing");
- // //move this message to requeue
- // msgToRequeue.add(message);
- // }
- // else
- // {
- // release to allow it to be delivered
- message.entry.release();
-
- // Without any details from the client about what has been processed we have to mark
- // all messages in the unacked map as redelivered.
- msg.setRedelivered(true);
-
- Subscription sub = message.entry.getDeliveredSubscription();
-
- if (sub != null)
- {
- // Get the lock so we can tell if the sub scription has closed.
- // will stop delivery to this subscription until the lock is released.
- // note: this approach would allow the use of a single queue if the
- // PreDeliveryQueue would allow head additions.
- // In the Java Qpid client we are suspended whilst doing this so it is all rather Mute..
- // needs guidance from AMQP WG Model SIG
- synchronized (sub.getSendLock())
- {
- if (sub.isClosed())
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Subscription(" + System.identityHashCode(sub)
- + ") closed during resend so requeuing message");
- }
- // move this message to requeue
- msgToRequeue.add(message);
- }
- else
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Requeuing " + msg.debugIdentity() + " for resend via sub:"
- + System.identityHashCode(sub));
- }
-
- sub.addToResendQueue(message.entry);
- _unacknowledgedMessageMap.remove(message.deliveryTag);
- }
- } // sync(sub.getSendLock)
- }
- else
- {
-
- if (_log.isInfoEnabled())
- {
- _log.info("DeliveredSubscription not recorded so just requeueing(" + message.toString()
- + ")to prevent loss");
- }
- // move this message to requeue
- msgToRequeue.add(message);
- }
- } // for all messages
- // } else !isSuspend
-
- if (_log.isInfoEnabled())
- {
- if (!msgToRequeue.isEmpty())
- {
- _log.info("Preparing (" + msgToRequeue.size() + ") message to requeue to.");
- }
- }
-
- // Deliver these messages out of the transaction as their delivery was never
- // part of the transaction only the receive.
- TransactionalContext deliveryContext;
- if (!(_txnContext instanceof NonTransactionalContext))
- {
- if (_nonTransactedContext == null)
- {
- _nonTransactedContext =
- new NonTransactionalContext(_messageStore, _storeContext, this, _returnMessages, _browsedAcks);
- }
-
- deliveryContext = _nonTransactedContext;
- }
- else
- {
- deliveryContext = _txnContext;
- }
-
- // Process Messages to Requeue at the front of the queue
- for (UnacknowledgedMessage message : msgToRequeue)
- {
- message.entry.release();
- message.entry.setRedelivered(true);
-
- deliveryContext.deliver(message.entry, true);
-
- _unacknowledgedMessageMap.remove(message.deliveryTag);
- }
- }
-
- /**
- * Callback indicating that a queue has been deleted. We must update the structure of unacknowledged messages to
- * remove the queue reference and also decrement any message reference counts, without actually removing the item
- * since we may get an ack for a delivery tag that was generated from the deleted queue.
- *
- * @param queue the queue that has been deleted
- *
- * @throws org.apache.qpid.AMQException if there is an error processing the unacked messages
- */
- public void queueDeleted(final AMQQueue queue) throws AMQException
- {
- _unacknowledgedMessageMap.visit(new UnacknowledgedMessageMap.Visitor()
- {
- public boolean callback(UnacknowledgedMessage message) throws AMQException
- {
- if (message.getQueue() == queue)
- {
- try
- {
- message.discard(_storeContext);
- message.setQueueDeleted(true);
-
- }
- catch (AMQException e)
- {
- _log.error(
- "Error decrementing ref count on message " + message.getMessage().getMessageId() + ": " + e, e);
- }
- }
-
- return false;
- }
-
- public void visitComplete()
- {
- }
- });
- }
-
- /**
- * Acknowledge one or more messages.
- *
- * @param deliveryTag the last delivery tag
- * @param multiple if true will acknowledge all messages up to an including the delivery tag. if false only
- * acknowledges the single message specified by the delivery tag
- *
- * @throws AMQException if the delivery tag is unknown (e.g. not outstanding) on this channel
- */
- public void acknowledgeMessage(long deliveryTag, boolean multiple) throws AMQException
- {
- synchronized (_unacknowledgedMessageMap.getLock())
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Unacked (PreAck) Size:" + _unacknowledgedMessageMap.size());
- }
-
- _unacknowledgedMessageMap.acknowledgeMessage(deliveryTag, multiple, _txnContext);
-
- if (_log.isDebugEnabled())
- {
- _log.debug("Unacked (PostAck) Size:" + _unacknowledgedMessageMap.size());
- }
-
- }
-
- checkSuspension();
- }
-
- /**
- * Used only for testing purposes.
- *
- * @return the map of unacknowledged messages
- */
- public UnacknowledgedMessageMap getUnacknowledgedMessageMap()
- {
- return _unacknowledgedMessageMap;
- }
-
- private void checkSuspension()
- {
- boolean suspend;
-
- suspend =
- ((_prefetch_HighWaterMark != 0) && (_unacknowledgedMessageMap.size() >= _prefetch_HighWaterMark))
- || ((_prefetchSize != 0) && (_prefetchSize < _unacknowledgedMessageMap.getUnacknowledgeBytes()));
-
- setSuspended(suspend);
- }
-
- public void setSuspended(boolean suspended)
- {
- boolean isSuspended = _suspended.get();
-
- if (isSuspended && !suspended)
- {
- // Continue being suspended if we are above the _prefetch_LowWaterMark
- suspended = _unacknowledgedMessageMap.size() > _prefetch_LowWaterMark;
- }
-
- boolean wasSuspended = _suspended.getAndSet(suspended);
- if (wasSuspended != suspended)
- {
- if (wasSuspended)
- {
- _log.debug("Unsuspending channel " + this);
- // may need to deliver queued messages
- for (AMQQueue q : _consumerTag2QueueMap.values())
- {
- q.deliverAsync();
- }
- }
- else
- {
- _log.debug("Suspending channel " + this);
- }
- }
- }
-
- public boolean isSuspended()
- {
- return _suspended.get();
- }
-
- public void commit() throws AMQException
- {
- if (!isTransactional())
- {
- throw new AMQException("Fatal error: commit called on non-transactional channel");
- }
-
- _txnContext.commit();
- }
-
- public void rollback() throws AMQException
- {
- _txnContext.rollback();
- }
-
- public String toString()
- {
- StringBuilder sb = new StringBuilder(30);
- sb.append("Channel: id ").append(_channelId).append(", transaction mode: ").append(isTransactional());
- sb.append(", prefetch marks: ").append(_prefetch_LowWaterMark);
- sb.append("/").append(_prefetch_HighWaterMark);
-
- return sb.toString();
- }
-
- public void setDefaultQueue(AMQQueue queue)
- {
- _defaultQueue = queue;
- }
-
- public AMQQueue getDefaultQueue()
- {
- return _defaultQueue;
- }
-
- public StoreContext getStoreContext()
- {
- return _storeContext;
- }
-
- public void processReturns(AMQProtocolSession session) throws AMQException
- {
- if(!_returnMessages.isEmpty())
- {
- for (RequiredDeliveryException bouncedMessage : _returnMessages)
- {
- AMQMessage message = bouncedMessage.getAMQMessage();
- session.getProtocolOutputConverter().writeReturn(message, _channelId, bouncedMessage.getReplyCode().getCode(),
- new AMQShortString(bouncedMessage.getMessage()));
-
- message.decrementReference(_storeContext);
- }
-
- _returnMessages.clear();
- }
- }
-
- public boolean wouldSuspend(AMQMessage msg)
- {
- if (isSuspended())
- {
- return true;
- }
- else
- {
- boolean willSuspend =
- ((_prefetch_HighWaterMark != 0) && ((_unacknowledgedMessageMap.size() + 1) > _prefetch_HighWaterMark));
- if (!willSuspend)
- {
- final long unackedSize = _unacknowledgedMessageMap.getUnacknowledgeBytes();
-
- willSuspend = (_prefetchSize != 0) && (unackedSize != 0) && (_prefetchSize < (msg.getSize() + unackedSize));
- }
-
- if (willSuspend)
- {
- setSuspended(true);
- }
-
- return willSuspend;
- }
-
- }
-
- public TransactionalContext getTransactionalContext()
- {
- return _txnContext;
- }
-
- public boolean isClosing()
- {
- return _closing;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/ConsumerTagNotUniqueException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/ConsumerTagNotUniqueException.java
deleted file mode 100644
index 9a98af5689..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/ConsumerTagNotUniqueException.java
+++ /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.
- *
- */
-package org.apache.qpid.server;
-
-public class ConsumerTagNotUniqueException extends Exception
-{
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java
deleted file mode 100644
index d8a8cfb6d1..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.cli.PosixParser;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.common.SimpleByteBufferAllocator;
-import org.apache.mina.common.FixedSizeByteBufferAllocator;
-import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
-import org.apache.mina.transport.socket.nio.SocketSessionConfig;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.common.QpidProperties;
-import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.pool.ReadWriteThreadModel;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
-import org.apache.qpid.server.management.JMXManagedObjectRegistry;
-import org.apache.qpid.server.protocol.AMQPFastProtocolHandler;
-import org.apache.qpid.server.protocol.AMQPProtocolProvider;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
-import org.apache.qpid.server.transport.ConnectorConfiguration;
-import org.apache.qpid.url.URLSyntaxException;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.BindException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Main entry point for AMQPD.
- *
- */
-@SuppressWarnings({"AccessStaticViaInstance"})
-public class Main
-{
- private static final Logger _logger = Logger.getLogger(Main.class);
- public static final Logger _brokerLogger = Logger.getLogger("Qpid.Broker");
-
- private static final String DEFAULT_CONFIG_FILE = "etc/config.xml";
-
- private static final String DEFAULT_LOG_CONFIG_FILENAME = "log4j.xml";
- public static final String QPID_HOME = "QPID_HOME";
- private static final int IPV4_ADDRESS_LENGTH = 4;
-
- private static final char IPV4_LITERAL_SEPARATOR = '.';
-
- protected static class InitException extends Exception
- {
- InitException(String msg, Throwable cause)
- {
- super(msg, cause);
- }
- }
-
- protected final Options options = new Options();
- protected CommandLine commandLine;
-
- protected Main(String[] args)
- {
- setOptions(options);
- if (parseCommandline(args))
- {
- execute();
- }
- }
-
- protected boolean parseCommandline(String[] args)
- {
- try
- {
- commandLine = new PosixParser().parse(options, args);
-
- return true;
- }
- catch (ParseException e)
- {
- System.err.println("Error: " + e.getMessage());
- HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp("Qpid", options, true);
-
- return false;
- }
- }
-
- protected void setOptions(Options options)
- {
- Option help = new Option("h", "help", false, "print this message");
- Option version = new Option("v", "version", false, "print the version information and exit");
- Option configFile =
- OptionBuilder.withArgName("file").hasArg().withDescription("use given configuration file").withLongOpt("config")
- .create("c");
- Option port =
- OptionBuilder.withArgName("port").hasArg()
- .withDescription("listen on the specified port. Overrides any value in the config file")
- .withLongOpt("port").create("p");
- Option mport =
- OptionBuilder.withArgName("mport").hasArg()
- .withDescription("listen on the specified management port. Overrides any value in the config file")
- .withLongOpt("mport").create("m");
-
-
- Option bind =
- OptionBuilder.withArgName("bind").hasArg()
- .withDescription("bind to the specified address. Overrides any value in the config file")
- .withLongOpt("bind").create("b");
- Option logconfig =
- OptionBuilder.withArgName("logconfig").hasArg()
- .withDescription("use the specified log4j xml configuration file. By "
- + "default looks for a file named " + DEFAULT_LOG_CONFIG_FILENAME
- + " in the same directory as the configuration file").withLongOpt("logconfig").create("l");
- Option logwatchconfig =
- OptionBuilder.withArgName("logwatch").hasArg()
- .withDescription("monitor the log file configuration file for changes. Units are seconds. "
- + "Zero means do not check for changes.").withLongOpt("logwatch").create("w");
-
- options.addOption(help);
- options.addOption(version);
- options.addOption(configFile);
- options.addOption(logconfig);
- options.addOption(logwatchconfig);
- options.addOption(port);
- options.addOption(mport);
- options.addOption(bind);
- }
-
- protected void execute()
- {
- // note this understands either --help or -h. If an option only has a long name you can use that but if
- // an option has a short name and a long name you must use the short name here.
- if (commandLine.hasOption("h"))
- {
- HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp("Qpid", options, true);
- }
- else if (commandLine.hasOption("v"))
- {
- String ver = QpidProperties.getVersionString();
-
- StringBuilder protocol = new StringBuilder("AMQP version(s) [major.minor]: ");
-
- boolean first = true;
- for (ProtocolVersion pv : ProtocolVersion.getSupportedProtocolVersions())
- {
- if (first)
- {
- first = false;
- }
- else
- {
- protocol.append(", ");
- }
-
- protocol.append(pv.getMajorVersion()).append('-').append(pv.getMinorVersion());
-
- }
-
- System.out.println(ver + " (" + protocol + ")");
- }
- else
- {
- try
- {
- startup();
- }
- catch (InitException e)
- {
- System.out.println(e.getMessage());
- _brokerLogger.error("Initialisation Error : " + e.getMessage());
-
- }
- catch (ConfigurationException e)
- {
- System.out.println("Error configuring message broker: " + e);
- _brokerLogger.error("Error configuring message broker: " + e);
- e.printStackTrace();
- }
- catch (Exception e)
- {
- System.out.println("Error intialising message broker: " + e);
- _brokerLogger.error("Error intialising message broker: " + e);
- e.printStackTrace();
- }
- }
- }
-
- protected void startup() throws InitException, ConfigurationException, Exception
- {
- final String QpidHome = System.getProperty(QPID_HOME);
- final File defaultConfigFile = new File(QpidHome, DEFAULT_CONFIG_FILE);
- final File configFile = new File(commandLine.getOptionValue("c", defaultConfigFile.getPath()));
- if (!configFile.exists())
- {
- String error = "File " + configFile + " could not be found. Check the file exists and is readable.";
-
- if (QpidHome == null)
- {
- error = error + "\nNote: " + QPID_HOME + " is not set.";
- }
-
- throw new InitException(error, null);
- }
- else
- {
- System.out.println("Using configuration file " + configFile.getAbsolutePath());
- }
-
- String logConfig = commandLine.getOptionValue("l");
- String logWatchConfig = commandLine.getOptionValue("w", "0");
- if (logConfig != null)
- {
- File logConfigFile = new File(logConfig);
- configureLogging(logConfigFile, logWatchConfig);
- }
- else
- {
- File configFileDirectory = configFile.getParentFile();
- File logConfigFile = new File(configFileDirectory, DEFAULT_LOG_CONFIG_FILENAME);
- configureLogging(logConfigFile, logWatchConfig);
- }
-
- ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configFile);
-
-
- updateManagementPort(config.getConfiguration(), commandLine.getOptionValue("m"));
-
-
-
- ApplicationRegistry.initialise(config);
-
-
- //fixme .. use QpidProperties.getVersionString when we have fixed the classpath issues
- // that are causing the broker build to pick up the wrong properties file and hence say
- // Starting Qpid Client
- _brokerLogger.info("Starting Qpid Broker " + QpidProperties.getReleaseVersion()
- + " build: " + QpidProperties.getBuildVersion());
-
- ConnectorConfiguration connectorConfig =
- ApplicationRegistry.getInstance().getConfiguredObject(ConnectorConfiguration.class);
-
- ByteBuffer.setUseDirectBuffers(connectorConfig.enableDirectBuffers);
-
- // the MINA default is currently to use the pooled allocator although this may change in future
- // once more testing of the performance of the simple allocator has been done
- if (!connectorConfig.enablePooledAllocator)
- {
- ByteBuffer.setAllocator(new FixedSizeByteBufferAllocator());
- }
-
- int port = connectorConfig.port;
-
- String portStr = commandLine.getOptionValue("p");
- if (portStr != null)
- {
- try
- {
- port = Integer.parseInt(portStr);
- }
- catch (NumberFormatException e)
- {
- throw new InitException("Invalid port: " + portStr, e);
- }
- }
-
- String VIRTUAL_HOSTS = "virtualhosts";
-
- Object virtualHosts = ApplicationRegistry.getInstance().getConfiguration().getProperty(VIRTUAL_HOSTS);
-
- if (virtualHosts != null)
- {
- if (virtualHosts instanceof Collection)
- {
- int totalVHosts = ((Collection) virtualHosts).size();
- for (int vhost = 0; vhost < totalVHosts; vhost++)
- {
- setupVirtualHosts(configFile.getParent(), (String) ((List) virtualHosts).get(vhost));
- }
- }
- else
- {
- setupVirtualHosts(configFile.getParent(), (String) virtualHosts);
- }
- }
-
- bind(port, connectorConfig);
-
- }
-
- /**
- * Update the configuration data with the management port.
- * @param configuration
- * @param managementPort The string from the command line
- */
- private void updateManagementPort(Configuration configuration, String managementPort)
- {
- if (managementPort != null)
- {
- int mport;
- int defaultMPort = configuration.getInt(JMXManagedObjectRegistry.MANAGEMENT_PORT_CONFIG_PATH);
- try
- {
- mport = Integer.parseInt(managementPort);
- configuration.setProperty(JMXManagedObjectRegistry.MANAGEMENT_PORT_CONFIG_PATH, mport);
- }
- catch (NumberFormatException e)
- {
- _logger.warn("Invalid management port: " + managementPort + " will use default:" + defaultMPort, e);
- }
- }
- }
-
- protected void setupVirtualHosts(String configFileParent, String configFilePath)
- throws ConfigurationException, AMQException, URLSyntaxException
- {
- String configVar = "${conf}";
-
- if (configFilePath.startsWith(configVar))
- {
- configFilePath = configFileParent + configFilePath.substring(configVar.length());
- }
-
- if (configFilePath.indexOf(".xml") != -1)
- {
- VirtualHostConfiguration vHostConfig = new VirtualHostConfiguration(configFilePath);
- vHostConfig.performBindings();
- }
- else
- {
- // the virtualhosts value is a path. Search it for XML files.
-
- File virtualHostDir = new File(configFilePath);
-
- String[] fileNames = virtualHostDir.list();
-
- for (int each = 0; each < fileNames.length; each++)
- {
- if (fileNames[each].endsWith(".xml"))
- {
- VirtualHostConfiguration vHostConfig =
- new VirtualHostConfiguration(configFilePath + "/" + fileNames[each]);
- vHostConfig.performBindings();
- }
- }
- }
- }
-
- protected void bind(int port, ConnectorConfiguration connectorConfig) throws BindException
- {
- String bindAddr = commandLine.getOptionValue("b");
- if (bindAddr == null)
- {
- bindAddr = connectorConfig.bindAddress;
- }
-
- try
- {
- // IoAcceptor acceptor = new SocketAcceptor(connectorConfig.processors);
- IoAcceptor acceptor = connectorConfig.createAcceptor();
- SocketAcceptorConfig sconfig = (SocketAcceptorConfig) acceptor.getDefaultConfig();
- SocketSessionConfig sc = (SocketSessionConfig) sconfig.getSessionConfig();
-
- sc.setReceiveBufferSize(connectorConfig.socketReceiveBufferSize);
- sc.setSendBufferSize(connectorConfig.socketWriteBuferSize);
- sc.setTcpNoDelay(connectorConfig.tcpNoDelay);
-
- // if we do not use the executor pool threading model we get the default leader follower
- // implementation provided by MINA
- if (connectorConfig.enableExecutorPool)
- {
- sconfig.setThreadModel(ReadWriteThreadModel.getInstance());
- }
-
- if (!connectorConfig.enableSSL || !connectorConfig.sslOnly)
- {
- AMQPFastProtocolHandler handler = new AMQPProtocolProvider().getHandler();
- InetSocketAddress bindAddress;
- if (bindAddr.equals("wildcard"))
- {
- bindAddress = new InetSocketAddress(port);
- }
- else
- {
- bindAddress = new InetSocketAddress(InetAddress.getByAddress(parseIP(bindAddr)), port);
- }
-
- acceptor.bind(bindAddress, handler, sconfig);
- //fixme qpid.AMQP should be using qpidproperties to get value
- _brokerLogger.info("Qpid.AMQP listening on non-SSL address " + bindAddress);
- }
-
- if (connectorConfig.enableSSL)
- {
- AMQPFastProtocolHandler handler = new AMQPProtocolProvider().getHandler();
- try
- {
-
- acceptor.bind(new InetSocketAddress(connectorConfig.sslPort), handler, sconfig);
- //fixme qpid.AMQP should be using qpidproperties to get value
- _brokerLogger.info("Qpid.AMQP listening on SSL port " + connectorConfig.sslPort);
-
- }
- catch (IOException e)
- {
- _brokerLogger.error("Unable to listen on SSL port: " + e, e);
- }
- }
-
- //fixme qpid.AMQP should be using qpidproperties to get value
- _brokerLogger.info("Qpid Broker Ready :" + QpidProperties.getReleaseVersion()
- + " build: " + QpidProperties.getBuildVersion());
- }
- catch (Exception e)
- {
- _logger.error("Unable to bind service to registry: " + e, e);
- //fixme this need tidying up
- throw new BindException(e.getMessage());
- }
- }
-
- public static void main(String[] args)
- {
-
- new Main(args);
- }
-
- private byte[] parseIP(String address) throws Exception
- {
- char[] literalBuffer = address.toCharArray();
- int byteCount = 0;
- int currByte = 0;
- byte[] ip = new byte[IPV4_ADDRESS_LENGTH];
- for (int i = 0; i < literalBuffer.length; i++)
- {
- char currChar = literalBuffer[i];
- if ((currChar >= '0') && (currChar <= '9'))
- {
- currByte = (currByte * 10) + (Character.digit(currChar, 10) & 0xFF);
- }
-
- if (currChar == IPV4_LITERAL_SEPARATOR || (i + 1 == literalBuffer.length))
- {
- ip[byteCount++] = (byte) currByte;
- currByte = 0;
- }
- }
-
- if (byteCount != 4)
- {
- throw new Exception("Invalid IP address: " + address);
- }
- return ip;
- }
-
- private void configureLogging(File logConfigFile, String logWatchConfig)
- {
- int logWatchTime = 0;
- try
- {
- logWatchTime = Integer.parseInt(logWatchConfig);
- }
- catch (NumberFormatException e)
- {
- System.err.println("Log watch configuration value of " + logWatchConfig + " is invalid. Must be "
- + "a non-negative integer. Using default of zero (no watching configured");
- }
-
- if (logConfigFile.exists() && logConfigFile.canRead())
- {
- System.out.println("Configuring logger using configuration file " + logConfigFile.getAbsolutePath());
- if (logWatchTime > 0)
- {
- System.out.println("log file " + logConfigFile.getAbsolutePath() + " will be checked for changes every "
- + logWatchTime + " seconds");
- // log4j expects the watch interval in milliseconds
- DOMConfigurator.configureAndWatch(logConfigFile.getAbsolutePath(), logWatchTime * 1000);
- }
- else
- {
- DOMConfigurator.configure(logConfigFile.getAbsolutePath());
- }
- }
- else
- {
- System.err.println("Logging configuration error: unable to read file " + logConfigFile.getAbsolutePath());
- System.err.println("Using basic log4j configuration");
- BasicConfigurator.configure();
- }
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/ManagedChannel.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/ManagedChannel.java
deleted file mode 100644
index e76f9c3f6c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/ManagedChannel.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server;
-
-import java.io.IOException;
-
-import javax.management.JMException;
-
-/**
- * The managed interface exposed to allow management of channels.
- * @author Bhupendra Bhardwaj
- * @version 0.1
- */
-public interface ManagedChannel
-{
- static final String TYPE = "Channel";
-
- /**
- * Tells whether the channel is transactional.
- * @return true if the channel is transactional.
- * @throws IOException
- */
- boolean isTransactional() throws IOException;
-
- /**
- * Tells the number of unacknowledged messages in this channel.
- * @return number of unacknowledged messages.
- * @throws IOException
- */
- int getUnacknowledgedMessageCount() throws IOException;
-
-
- //********** Operations *****************//
-
- /**
- * Commits the transactions if the channel is transactional.
- * @throws IOException
- * @throws JMException
- */
- void commitTransactions() throws IOException, JMException;
-
- /**
- * Rollsback the transactions if the channel is transactional.
- * @throws IOException
- * @throws JMException
- */
- void rollbackTransactions() throws IOException, JMException;
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/RequiredDeliveryException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/RequiredDeliveryException.java
deleted file mode 100644
index d61bb8916a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/RequiredDeliveryException.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * Signals that a required delivery could not be made. This could be bacuse of the immediate flag being set and the
- * queue having no consumers, or the mandatory flag being set and the exchange having no valid bindings.
- *
- * <p/>The failed message is associated with this error condition, by taking a reference to it. This enables the
- * correct compensating action to be taken against the message, for example, bouncing it back to the sender.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represent failure to deliver a message that must be delivered.
- * <tr><td> Associate the failed message with the error condition. <td> {@link AMQMessage}
- * </table>
- */
-public abstract class RequiredDeliveryException extends AMQException
-{
- private final AMQMessage _amqMessage;
-
- public RequiredDeliveryException(String message, AMQMessage payload)
- {
- super(message);
-
- // Increment the reference as this message is in the routing phase
- // and so will have the ref decremented as routing fails.
- // we need to keep this message around so we can return it in the
- // handler. So increment here.
- _amqMessage = payload.takeReference();
-
- // payload.incrementReference();
- }
-
- public AMQMessage getAMQMessage()
- {
- return _amqMessage;
- }
-
- public AMQConstant getErrorCode()
- {
- return getReplyCode();
- }
-
- public abstract AMQConstant getReplyCode();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/TxAck.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/TxAck.java
deleted file mode 100644
index c62a7880a8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/TxAck.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.ack;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.txn.TxnOp;
-
-/**
- * A TxnOp implementation for handling accumulated acks
- */
-public class TxAck implements TxnOp
-{
- private final UnacknowledgedMessageMap _map;
- private final List <UnacknowledgedMessage> _unacked = new LinkedList<UnacknowledgedMessage>();
- private final List<Long> _individual = new LinkedList<Long>();
- private long _deliveryTag;
- private boolean _multiple;
-
- public TxAck(UnacknowledgedMessageMap map)
- {
- _map = map;
- }
-
- public void update(long deliveryTag, boolean multiple)
- {
- if (!multiple)
- {
- //have acked a single message that is not part of
- //the previously acked region so record
- //individually
- _individual.add(deliveryTag);//_multiple && !multiple
- }
- else if (deliveryTag > _deliveryTag)
- {
- //have simply moved the last acked message on a
- //bit
- _deliveryTag = deliveryTag;
- _multiple = true;
- }
- }
-
- public void consolidate()
- {
- //lookup all the unacked messages that have been acked in this transaction
- if (_multiple)
- {
- //get all the unacked messages for the accumulated
- //multiple acks
- _map.collect(_deliveryTag, true, _unacked);
- }
- //get any unacked messages for individual acks outside the
- //range covered by multiple acks
- for (long tag : _individual)
- {
- if(_deliveryTag < tag)
- {
- _map.collect(tag, false, _unacked);
- }
- }
- }
-
- public boolean checkPersistent() throws AMQException
- {
- //if any of the messages in unacked are persistent the txn
- //buffer must be marked as persistent:
- for (UnacknowledgedMessage msg : _unacked)
- {
- if (msg.getMessage().isPersistent())
- {
- return true;
- }
- }
- return false;
- }
-
- public void prepare(StoreContext storeContext) throws AMQException
- {
- //make persistent changes, i.e. dequeue and decrementReference
- for (UnacknowledgedMessage msg : _unacked)
- {
- //Message has been ack so discard it. This will dequeue and decrement the reference.
- msg.discard(storeContext);
-
- }
- }
-
- public void undoPrepare()
- {
- //decrementReference is annoyingly untransactional (due to
- //in memory counter) so if we failed in prepare for full
- //txn, this op will have to compensate by fixing the count
- //in memory (persistent changes will be rolled back by store)
- for (UnacknowledgedMessage msg : _unacked)
- {
- msg.getMessage().takeReference();
- }
- }
-
- public void commit(StoreContext storeContext)
- {
- //remove the unacked messages from the channels map
- _map.remove(_unacked);
- }
-
- public void rollback(StoreContext storeContext)
- {
- }
-}
-
-
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessage.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessage.java
deleted file mode 100644
index df7cecc940..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessage.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.server.ack;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueEntry;
-import org.apache.qpid.server.store.StoreContext;
-
-public class UnacknowledgedMessage
-{
- public final QueueEntry entry;
- public final AMQShortString consumerTag;
- public final long deliveryTag;
-
- private boolean _queueDeleted;
-
-
- public UnacknowledgedMessage(QueueEntry entry, AMQShortString consumerTag, long deliveryTag)
- {
- this.entry = entry;
- this.consumerTag = consumerTag;
- this.deliveryTag = deliveryTag;
- }
-
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
- sb.append("Q:");
- sb.append(entry.getQueue());
- sb.append(" M:");
- sb.append(entry.getMessage());
- sb.append(" CT:");
- sb.append(consumerTag);
- sb.append(" DT:");
- sb.append(deliveryTag);
-
- return sb.toString();
- }
-
- public void discard(StoreContext storeContext) throws AMQException
- {
- if (entry.getQueue() != null)
- {
- entry.getQueue().dequeue(storeContext, entry);
- }
- //if the queue is null then the message is waiting to be acked, but has been removed.
- entry.getMessage().decrementReference(storeContext);
- }
-
- public AMQMessage getMessage()
- {
- return entry.getMessage();
- }
-
- public AMQQueue getQueue()
- {
- return entry.getQueue();
- }
-
- public void setQueueDeleted(boolean queueDeleted)
- {
- _queueDeleted = queueDeleted;
- }
-
- public boolean isQueueDeleted()
- {
- return _queueDeleted;
- }
-}
-
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessageMap.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessageMap.java
deleted file mode 100644
index b69a917081..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessageMap.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.
- *
- */
-package org.apache.qpid.server.ack;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.txn.TransactionalContext;
-
-public interface UnacknowledgedMessageMap
-{
- public interface Visitor
- {
- /**
- * @param message the message being iterated over
- * @return true to stop iteration, false to continue
- * @throws AMQException
- */
- boolean callback(UnacknowledgedMessage message) throws AMQException;
-
- void visitComplete();
- }
-
- void visit(Visitor visitor) throws AMQException;
-
- Object getLock();
-
- void add(long deliveryTag, UnacknowledgedMessage message);
-
- void collect(long deliveryTag, boolean multiple, List<UnacknowledgedMessage> msgs);
-
- boolean contains(long deliveryTag) throws AMQException;
-
- void remove(List<UnacknowledgedMessage> msgs);
-
- UnacknowledgedMessage remove(long deliveryTag);
-
- void drainTo(Collection<UnacknowledgedMessage> destination, long deliveryTag) throws AMQException;
-
- Collection<UnacknowledgedMessage> cancelAllMessages();
-
- void acknowledgeMessage(long deliveryTag, boolean multiple, TransactionalContext txnContext) throws AMQException;
-
- int size();
-
- void clear();
-
- UnacknowledgedMessage get(long deliveryTag);
-
- /**
- * Get the set of delivery tags that are outstanding.
- *
- * @return a set of delivery tags
- */
- Set<Long> getDeliveryTags();
-
- public long getUnacknowledgeBytes();
-}
-
-
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessageMapImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessageMapImpl.java
deleted file mode 100644
index 20ee646a40..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/ack/UnacknowledgedMessageMapImpl.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.ack;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.txn.TransactionalContext;
-
-public class UnacknowledgedMessageMapImpl implements UnacknowledgedMessageMap
-{
- private final Object _lock = new Object();
-
- private long _unackedSize;
-
- private Map<Long, UnacknowledgedMessage> _map;
-
- private long _lastDeliveryTag;
-
- private final int _prefetchLimit;
-
- public UnacknowledgedMessageMapImpl(int prefetchLimit)
- {
- _prefetchLimit = prefetchLimit;
- _map = new LinkedHashMap<Long, UnacknowledgedMessage>(prefetchLimit);
- }
-
- /*public UnacknowledgedMessageMapImpl(Object lock, Map<Long, UnacknowledgedMessage> map)
- {
- _lock = lock;
- _map = map;
- } */
-
- public void collect(long deliveryTag, boolean multiple, List<UnacknowledgedMessage> msgs)
- {
- if (multiple)
- {
- collect(deliveryTag, msgs);
- }
- else
- {
- msgs.add(get(deliveryTag));
- }
-
- }
-
- public boolean contains(long deliveryTag) throws AMQException
- {
- synchronized (_lock)
- {
- return _map.containsKey(deliveryTag);
- }
- }
-
- public void remove(List<UnacknowledgedMessage> msgs)
- {
- synchronized (_lock)
- {
- for (UnacknowledgedMessage msg : msgs)
- {
- remove(msg.deliveryTag);
- }
- }
- }
-
- public UnacknowledgedMessage remove(long deliveryTag)
- {
- synchronized (_lock)
- {
-
- UnacknowledgedMessage message = _map.remove(deliveryTag);
- if(message != null)
- {
- _unackedSize -= message.getMessage().getSize();
- }
-
- return message;
- }
- }
-
- public void visit(Visitor visitor) throws AMQException
- {
- synchronized (_lock)
- {
- Collection<UnacknowledgedMessage> currentEntries = _map.values();
- for (UnacknowledgedMessage msg : currentEntries)
- {
- visitor.callback(msg);
- }
- visitor.visitComplete();
- }
- }
-
- public Object getLock()
- {
- return _lock;
- }
-
- public void add(long deliveryTag, UnacknowledgedMessage message)
- {
- synchronized (_lock)
- {
- _map.put(deliveryTag, message);
- _unackedSize += message.getMessage().getSize();
- _lastDeliveryTag = deliveryTag;
- }
- }
-
- public Collection<UnacknowledgedMessage> cancelAllMessages()
- {
- synchronized (_lock)
- {
- Collection<UnacknowledgedMessage> currentEntries = _map.values();
- _map = new LinkedHashMap<Long, UnacknowledgedMessage>(_prefetchLimit);
- _unackedSize = 0l;
- return currentEntries;
- }
- }
-
- public void acknowledgeMessage(long deliveryTag, boolean multiple, TransactionalContext txnContext)
- throws AMQException
- {
- synchronized (_lock)
- {
- txnContext.acknowledgeMessage(deliveryTag, _lastDeliveryTag, multiple, this);
- }
- }
-
- public int size()
- {
- synchronized (_lock)
- {
- return _map.size();
- }
- }
-
- public void clear()
- {
- synchronized (_lock)
- {
- _map.clear();
- _unackedSize = 0l;
- }
- }
-
- public void drainTo(Collection<UnacknowledgedMessage> destination, long deliveryTag) throws AMQException
- {
- synchronized (_lock)
- {
- Iterator<Map.Entry<Long, UnacknowledgedMessage>> it = _map.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry<Long, UnacknowledgedMessage> unacked = it.next();
-
- if (unacked.getKey() > deliveryTag)
- {
- //This should not occur now.
- throw new AMQException("UnacknowledgedMessageMap is out of order:" + unacked.getKey() +
- " When deliveryTag is:" + deliveryTag + "ES:" + _map.entrySet().toString());
- }
-
- it.remove();
- _unackedSize -= unacked.getValue().getMessage().getSize();
-
- destination.add(unacked.getValue());
- if (unacked.getKey() == deliveryTag)
- {
- break;
- }
- }
- }
- }
-
- public UnacknowledgedMessage get(long key)
- {
- synchronized (_lock)
- {
- return _map.get(key);
- }
- }
-
- public Set<Long> getDeliveryTags()
- {
- synchronized (_lock)
- {
- return _map.keySet();
- }
- }
-
- private void collect(long key, List<UnacknowledgedMessage> msgs)
- {
- synchronized (_lock)
- {
- for (Map.Entry<Long, UnacknowledgedMessage> entry : _map.entrySet())
- {
- msgs.add(entry.getValue());
- if (entry.getKey() == key)
- {
- break;
- }
- }
- }
- }
-
- public long getUnacknowledgeBytes()
- {
- return _unackedSize;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/Configurator.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/Configurator.java
deleted file mode 100644
index 31c1b61a21..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/Configurator.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.configuration;
-
-import java.lang.reflect.Field;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.log4j.Logger;
-import org.apache.qpid.configuration.Configured;
-import org.apache.qpid.configuration.PropertyException;
-import org.apache.qpid.configuration.PropertyUtils;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-
-/**
- * This class contains utilities for populating classes automatically from values pulled from configuration
- * files.
- */
-public class Configurator
-{
- private static final Logger _logger = Logger.getLogger(Configurator.class);
-
-
- /**
- * Configure a given instance using the supplied configuration. Note that superclasses are <b>not</b>
- * currently configured but this could easily be added if required.
- * @param instance the instance to configure
- * @param config the configuration to use to configure the object
- */
- public static void configure(Object instance, Configuration config)
- {
-
- for (Field f : instance.getClass().getDeclaredFields())
- {
- Configured annotation = f.getAnnotation(Configured.class);
- if (annotation != null)
- {
- setValueInField(f, instance, config, annotation);
- }
- }
- }
-
-
-
- /**
- * Configure a given instance using the application configuration. Note that superclasses are <b>not</b>
- * currently configured but this could easily be added if required.
- * @param instance the instance to configure
- */
- public static void configure(Object instance)
- {
- configure(instance, ApplicationRegistry.getInstance().getConfiguration());
- }
-
- private static void setValueInField(Field f, Object instance, Configuration config, Configured annotation)
- {
- Class fieldClass = f.getType();
- String configPath = annotation.path();
- try
- {
- if (fieldClass == String.class)
- {
- String val = config.getString(configPath, annotation.defaultValue());
- val = PropertyUtils.replaceProperties(val);
- f.set(instance, val);
- }
- else if (fieldClass == int.class)
- {
- int val = config.getInt(configPath, Integer.parseInt(annotation.defaultValue()));
- f.setInt(instance, val);
- }
- else if (fieldClass == long.class)
- {
- long val = config.getLong(configPath, Long.parseLong(annotation.defaultValue()));
- f.setLong(instance, val);
- }
- else if (fieldClass == double.class)
- {
- double val = config.getDouble(configPath, Double.parseDouble(annotation.defaultValue()));
- f.setDouble(instance, val);
- }
- else if (fieldClass == boolean.class)
- {
- boolean val = config.getBoolean(configPath, Boolean.parseBoolean(annotation.defaultValue()));
- f.setBoolean(instance, val);
- }
- else
- {
- _logger.error("Unsupported field type " + fieldClass + " for " + f + " IGNORING configured value");
- }
- }
- catch (PropertyException e)
- {
- _logger.error("Unable to expand property: " + e + " INGORING field " + f, e);
- }
- catch (IllegalAccessException e)
- {
- _logger.error("Unable to access field " + f + " IGNORING configured value");
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
deleted file mode 100644
index 8573902af4..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.configuration;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.exchange.ExchangeFactory;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class VirtualHostConfiguration
-{
- private static final Logger _logger = Logger.getLogger(VirtualHostConfiguration.class);
-
- private static XMLConfiguration _config;
-
- private static final String VIRTUALHOST_PROPERTY_BASE = "virtualhost.";
-
-
- public VirtualHostConfiguration(String configFile) throws ConfigurationException
- {
- _logger.info("Loading Config file:" + configFile);
-
- _config = new XMLConfiguration(configFile);
-
- }
-
-
-
- private void configureVirtualHost(String virtualHostName, Configuration configuration) throws ConfigurationException, AMQException
- {
- _logger.debug("Loding configuration for virtaulhost: "+virtualHostName);
-
-
- VirtualHost virtualHost = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost(virtualHostName);
-
-
-
- if(virtualHost == null)
- {
- throw new ConfigurationException("Unknown virtual host: " + virtualHostName);
- }
-
- List exchangeNames = configuration.getList("exchanges.exchange.name");
-
- for(Object exchangeNameObj : exchangeNames)
- {
- String exchangeName = String.valueOf(exchangeNameObj);
- configureExchange(virtualHost, exchangeName, configuration);
- }
-
-
- List queueNames = configuration.getList("queues.queue.name");
-
- for(Object queueNameObj : queueNames)
- {
- String queueName = String.valueOf(queueNameObj);
- configureQueue(virtualHost, queueName, configuration);
- }
-
- }
-
- private void configureExchange(VirtualHost virtualHost, String exchangeNameString, Configuration configuration) throws AMQException
- {
-
- CompositeConfiguration exchangeConfiguration = new CompositeConfiguration();
-
- exchangeConfiguration.addConfiguration(configuration.subset("exchanges.exchange."+ exchangeNameString));
- exchangeConfiguration.addConfiguration(configuration.subset("exchanges"));
-
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
- MessageStore messageStore = virtualHost.getMessageStore();
- ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
- ExchangeFactory exchangeFactory = virtualHost.getExchangeFactory();
-
- AMQShortString exchangeName = new AMQShortString(exchangeNameString);
-
-
- Exchange exchange;
-
-
-
- synchronized (exchangeRegistry)
- {
- exchange = exchangeRegistry.getExchange(exchangeName);
- if(exchange == null)
- {
-
- AMQShortString type = new AMQShortString(exchangeConfiguration.getString("type","direct"));
- boolean durable = exchangeConfiguration.getBoolean("durable",false);
- boolean autodelete = exchangeConfiguration.getBoolean("autodelete",false);
-
- Exchange newExchange = exchangeFactory.createExchange(exchangeName,type,durable,autodelete,0);
- exchangeRegistry.registerExchange(newExchange);
- }
-
- }
- }
-
- public static CompositeConfiguration getDefaultQueueConfiguration(AMQQueue queue)
- {
- CompositeConfiguration queueConfiguration = null;
- if (_config == null)
- return null;
-
- Configuration vHostConfiguration = _config.subset(VIRTUALHOST_PROPERTY_BASE + queue.getVirtualHost().getName());
-
- if (vHostConfiguration == null)
- return null;
-
- Configuration defaultQueueConfiguration = vHostConfiguration.subset("queues");
- if (defaultQueueConfiguration != null)
- {
- queueConfiguration = new CompositeConfiguration();
- queueConfiguration.addConfiguration(defaultQueueConfiguration);
- }
-
- return queueConfiguration;
- }
-
- private void configureQueue(VirtualHost virtualHost, String queueNameString, Configuration configuration) throws AMQException, ConfigurationException
- {
- CompositeConfiguration queueConfiguration = new CompositeConfiguration();
-
- queueConfiguration.addConfiguration(configuration.subset("queues.queue."+ queueNameString));
- queueConfiguration.addConfiguration(configuration.subset("queues"));
-
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
- MessageStore messageStore = virtualHost.getMessageStore();
- ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
-
-
- AMQShortString queueName = new AMQShortString(queueNameString);
-
- AMQQueue queue;
-
- synchronized (queueRegistry)
- {
- queue = queueRegistry.getQueue(queueName);
-
- if (queue == null)
- {
- _logger.info("Creating queue '" + queueName + "' on virtual host " + virtualHost.getName());
-
- boolean durable = queueConfiguration.getBoolean("durable" ,false);
- boolean autodelete = queueConfiguration.getBoolean("autodelete", false);
- String owner = queueConfiguration.getString("owner", null);
-
- queue = new AMQQueue(queueName,
- durable,
- owner == null ? null : new AMQShortString(owner) /* These queues will have no owner */,
- autodelete /* Therefore autodelete makes no sence */, virtualHost);
-
- if (queue.isDurable())
- {
- messageStore.createQueue(queue);
- }
-
- queueRegistry.registerQueue(queue);
- }
- else
- {
- _logger.info("Queue '" + queueNameString + "' already exists on virtual host "+virtualHost.getName()+", not creating.");
- }
-
- String exchangeName = queueConfiguration.getString("exchange", null);
-
- Exchange exchange = exchangeRegistry.getExchange(exchangeName == null ? null : new AMQShortString(exchangeName));
-
- if(exchange == null)
- {
- exchange = virtualHost.getExchangeRegistry().getDefaultExchange();
- }
-
- if (exchange == null)
- {
- throw new ConfigurationException("Attempt to bind queue to unknown exchange:" + exchangeName);
- }
-
- synchronized (exchange)
- {
- List routingKeys = queueConfiguration.getList("routingKey");
- if(routingKeys == null || routingKeys.isEmpty())
- {
- routingKeys = Collections.singletonList(queue.getName());
- }
-
- for(Object routingKeyNameObj : routingKeys)
- {
- AMQShortString routingKey = new AMQShortString(String.valueOf(routingKeyNameObj));
-
-
- queue.bind(routingKey, null, exchange);
-
-
- _logger.info("Queue '" + queue.getName() + "' bound to exchange:" + exchangeName + " RK:'" + routingKey + "'");
- }
-
- if(exchange != virtualHost.getExchangeRegistry().getDefaultExchange())
- {
- queue.bind(queue.getName(), null, virtualHost.getExchangeRegistry().getDefaultExchange());
- }
- }
-
- }
-
-
-
- Configurator.configure(queue, queueConfiguration);
- }
-
-
- public void performBindings() throws AMQException, ConfigurationException
- {
- List virtualHostNames = _config.getList(VIRTUALHOST_PROPERTY_BASE + "name");
- String defaultVirtualHostName = _config.getString("default");
- if(defaultVirtualHostName != null)
- {
- ApplicationRegistry.getInstance().getVirtualHostRegistry().setDefaultVirtualHostName(defaultVirtualHostName);
- }
- _logger.info("Configuring " + virtualHostNames == null ? 0 : virtualHostNames.size() + " virtual hosts: " + virtualHostNames);
-
- for(Object nameObject : virtualHostNames)
- {
- String name = String.valueOf(nameObject);
- configureVirtualHost(name, _config.subset(VIRTUALHOST_PROPERTY_BASE + name));
- }
-
- if (virtualHostNames == null || virtualHostNames.isEmpty())
- {
- throw new ConfigurationException(
- "Virtualhost Configuration document does not contain a valid virtualhost.");
- }
- }
-
-
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
deleted file mode 100644
index 9ebb893362..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.exchange;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.NotCompliantMBeanException;
-import javax.management.ObjectName;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.TabularType;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.ArrayType;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.management.AMQManagedObject;
-import org.apache.qpid.server.management.Managable;
-import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.server.management.ManagedObjectRegistry;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import java.util.List;
-import java.util.Map;
-
-public abstract class AbstractExchange implements Exchange, Managable
-{
- private AMQShortString _name;
-
-
-
- protected boolean _durable;
- protected String _exchangeType;
- protected int _ticket;
-
- private VirtualHost _virtualHost;
-
- protected ExchangeMBean _exchangeMbean;
-
- /**
- * Whether the exchange is automatically deleted once all queues have detached from it
- */
- protected boolean _autoDelete;
-
- /**
- * Abstract MBean class. This has some of the methods implemented from
- * management intrerface for exchanges. Any implementaion of an
- * Exchange MBean should extend this class.
- */
- protected abstract class ExchangeMBean extends AMQManagedObject implements ManagedExchange
- {
- // open mbean data types for representing exchange bindings
- protected String[] _bindingItemNames;
- protected String[] _bindingItemIndexNames;
- protected OpenType[] _bindingItemTypes;
- protected CompositeType _bindingDataType;
- protected TabularType _bindinglistDataType;
- protected TabularDataSupport _bindingList;
-
- public ExchangeMBean() throws NotCompliantMBeanException
- {
- super(ManagedExchange.class, ManagedExchange.TYPE);
- }
-
- protected void init() throws OpenDataException
- {
- _bindingItemNames = new String[]{"Binding Key", "Queue Names"};
- _bindingItemIndexNames = new String[]{_bindingItemNames[0]};
-
- _bindingItemTypes = new OpenType[2];
- _bindingItemTypes[0] = SimpleType.STRING;
- _bindingItemTypes[1] = new ArrayType(1, SimpleType.STRING);
- _bindingDataType = new CompositeType("Exchange Binding", "Binding key and Queue names",
- _bindingItemNames, _bindingItemNames, _bindingItemTypes);
- _bindinglistDataType = new TabularType("Exchange Bindings", "Exchange Bindings for " + getName(),
- _bindingDataType, _bindingItemIndexNames);
- }
-
- public ManagedObject getParentObject()
- {
- return _virtualHost.getManagedObject();
- }
-
- public String getObjectInstanceName()
- {
- return _name.toString();
- }
-
- public String getName()
- {
- return _name.toString();
- }
-
- public String getExchangeType()
- {
- return _exchangeType;
- }
-
- public Integer getTicketNo()
- {
- return _ticket;
- }
-
- public boolean isDurable()
- {
- return _durable;
- }
-
- public boolean isAutoDelete()
- {
- return _autoDelete;
- }
-
- // Added exchangetype in the object name lets maangement apps to do any customization required
- public ObjectName getObjectName() throws MalformedObjectNameException
- {
- String objNameString = super.getObjectName().toString();
- objNameString = objNameString + ",ExchangeType=" + _exchangeType;
- return new ObjectName(objNameString);
- }
-
- protected ManagedObjectRegistry getManagedObjectRegistry()
- {
- return ApplicationRegistry.getInstance().getManagedObjectRegistry();
- }
- } // End of MBean class
-
- public AMQShortString getName()
- {
- return _name;
- }
-
- /**
- * Concrete exchanges must implement this method in order to create the managed representation. This is
- * called during initialisation (template method pattern).
- * @return the MBean
- */
- protected abstract ExchangeMBean createMBean() throws AMQException;
-
- public void initialise(VirtualHost host, AMQShortString name, boolean durable, int ticket, boolean autoDelete) throws AMQException
- {
- _virtualHost = host;
- _name = name;
- _durable = durable;
- _autoDelete = autoDelete;
- _ticket = ticket;
- _exchangeMbean = createMBean();
- _exchangeMbean.register();
- }
-
- public boolean isDurable()
- {
- return _durable;
- }
-
- public boolean isAutoDelete()
- {
- return _autoDelete;
- }
-
- public int getTicket()
- {
- return _ticket;
- }
-
- public void close() throws AMQException
- {
- if (_exchangeMbean != null)
- {
- _exchangeMbean.unregister();
- }
- }
-
- abstract public Map<AMQShortString, List<AMQQueue>> getBindings();
-
- public String toString()
- {
- return getClass().getName() + "[" + getName() +"]";
- }
-
- public ManagedObject getManagedObject()
- {
- return _exchangeMbean;
- }
-
- public VirtualHost getVirtualHost()
- {
- return _virtualHost;
- }
-
- public QueueRegistry getQueueRegistry()
- {
- return getVirtualHost().getQueueRegistry();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
deleted file mode 100644
index 1a9dc6673a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.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.server.exchange;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.apache.commons.configuration.Configuration;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQUnknownExchangeType;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class DefaultExchangeFactory implements ExchangeFactory
-{
- private static final Logger _logger = Logger.getLogger(DefaultExchangeFactory.class);
-
- private Map<AMQShortString, ExchangeType<? extends Exchange>> _exchangeClassMap = new HashMap<AMQShortString, ExchangeType<? extends Exchange>>();
- private final VirtualHost _host;
-
- public DefaultExchangeFactory(VirtualHost host)
- {
- _host = host;
- registerExchangeType(DestNameExchange.TYPE);
- registerExchangeType(DestWildExchange.TYPE);
- registerExchangeType(HeadersExchange.TYPE);
- registerExchangeType(FanoutExchange.TYPE);
- }
-
- public void registerExchangeType(ExchangeType<? extends Exchange> type)
- {
- _exchangeClassMap.put(type.getName(), type);
- }
-
- public Collection<ExchangeType<? extends Exchange>> getRegisteredTypes()
- {
- return _exchangeClassMap.values();
- }
-
- public Exchange createExchange(AMQShortString exchange, AMQShortString type, boolean durable, boolean autoDelete,
- int ticket)
- throws AMQException
- {
- ExchangeType<? extends Exchange> exchType = _exchangeClassMap.get(type);
- if (exchType == null)
- {
-
- throw new AMQUnknownExchangeType("Unknown exchange type: " + type);
- }
- Exchange e = exchType.newInstance(_host, exchange, durable, ticket, autoDelete);
- return e;
- }
-
- public void initialise(Configuration hostConfig)
- {
-
- if (hostConfig == null)
- {
- return;
- }
-
- for(Object className : hostConfig.getList("custom-exchanges.class-name"))
- {
- try
- {
- ExchangeType<?> exchangeType = ApplicationRegistry.getInstance().getPluginManager().getExchanges().get(String.valueOf(className));
- if (exchangeType == null)
- {
- _logger.error("No such custom exchange class found: \""+String.valueOf(className)+"\"");
- return;
- }
- Class<? extends ExchangeType> exchangeTypeClass = exchangeType.getClass();
- ExchangeType type = exchangeTypeClass.newInstance();
- registerExchangeType(type);
- }
- catch (ClassCastException classCastEx)
- {
- _logger.error("No custom exchange class: \""+String.valueOf(className)+"\" cannot be registered as it does not extend class \""+ExchangeType.class+"\"");
- }
- catch (IllegalAccessException e)
- {
- _logger.error("Cannot create custom exchange class: \""+String.valueOf(className)+"\"",e);
- }
- catch (InstantiationException e)
- {
- _logger.error("Cannot create custom exchange class: \""+String.valueOf(className)+"\"",e);
- }
- }
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
deleted file mode 100644
index 98abf7977a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.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.server.exchange;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.protocol.ExchangeInitialiser;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import java.util.Collection;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-public class DefaultExchangeRegistry implements ExchangeRegistry
-{
- private static final Logger _log = Logger.getLogger(DefaultExchangeRegistry.class);
-
- /**
- * Maps from exchange name to exchange instance
- */
- private ConcurrentMap<AMQShortString, Exchange> _exchangeMap = new ConcurrentHashMap<AMQShortString, Exchange>();
-
- private Exchange _defaultExchange;
- private VirtualHost _host;
-
- public DefaultExchangeRegistry(VirtualHost host)
- {
- //create 'standard' exchanges:
- _host = host;
-
- }
-
- public void initialise() throws AMQException
- {
- new ExchangeInitialiser().initialise(_host.getExchangeFactory(), this);
- }
-
- public MessageStore getMessageStore()
- {
- return _host.getMessageStore();
- }
-
- public void registerExchange(Exchange exchange) throws AMQException
- {
- _exchangeMap.put(exchange.getName(), exchange);
- if (exchange.isDurable())
- {
- getMessageStore().createExchange(exchange);
- }
- }
-
- public void setDefaultExchange(Exchange exchange)
- {
- _defaultExchange = exchange;
- }
-
- public Exchange getDefaultExchange()
- {
- return _defaultExchange;
- }
-
- public Collection<AMQShortString> getExchangeNames()
- {
- return _exchangeMap.keySet();
- }
-
- public void unregisterExchange(AMQShortString name, boolean inUse) throws AMQException
- {
- // TODO: check inUse argument
- Exchange e = _exchangeMap.remove(name);
- if (e != null)
- {
- if (e.isDurable())
- {
- getMessageStore().removeExchange(e);
- }
- e.close();
- }
- else
- {
- throw new AMQException("Unknown exchange " + name);
- }
- }
-
- public Exchange getExchange(AMQShortString name)
- {
- if ((name == null) || name.length() == 0)
- {
- return getDefaultExchange();
- }
- else
- {
- return _exchangeMap.get(name);
- }
-
- }
-
- /**
- * Routes content through exchanges, delivering it to 1 or more queues.
- * @param payload
- * @throws AMQException if something goes wrong delivering data
- */
- public void routeContent(AMQMessage payload) throws AMQException
- {
- final AMQShortString exchange = payload.getMessagePublishInfo().getExchange();
- final Exchange exch = getExchange(exchange);
- // there is a small window of opportunity for the exchange to be deleted in between
- // the BasicPublish being received (where the exchange is validated) and the final
- // content body being received (which triggers this method)
- // TODO: check where the exchange is validated
- if (exch == null)
- {
- throw new AMQException("Exchange '" + exchange + "' does not exist");
- }
- exch.route(payload);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java
deleted file mode 100644
index 12347c0278..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.exchange;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.server.management.MBeanConstructor;
-import org.apache.qpid.server.management.MBeanDescription;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class DestNameExchange extends AbstractExchange
-{
- private static final Logger _logger = Logger.getLogger(DestNameExchange.class);
-
- /**
- * Maps from queue name to queue instances
- */
- private final Index _index = new Index();
-
- public static final ExchangeType<DestNameExchange> TYPE = new ExchangeType<DestNameExchange>()
- {
-
- public AMQShortString getName()
- {
- return ExchangeDefaults.DIRECT_EXCHANGE_CLASS;
- }
-
- public Class<DestNameExchange> getExchangeClass()
- {
- return DestNameExchange.class;
- }
-
- public DestNameExchange newInstance(VirtualHost host,
- AMQShortString name,
- boolean durable,
- int ticket,
- boolean autoDelete) throws AMQException
- {
- DestNameExchange exch = new DestNameExchange();
- exch.initialise(host,name,durable,ticket,autoDelete);
- return exch;
- }
-
- public AMQShortString getDefaultExchangeName()
- {
- return ExchangeDefaults.DIRECT_EXCHANGE_NAME;
- }
- };
-
- /**
- * MBean class implementing the management interfaces.
- */
- @MBeanDescription("Management Bean for Direct Exchange")
- private final class DestNameExchangeMBean extends ExchangeMBean
- {
- @MBeanConstructor("Creates an MBean for AMQ direct exchange")
- public DestNameExchangeMBean() throws JMException
- {
- super();
- _exchangeType = "direct";
- init();
- }
-
- public TabularData bindings() throws OpenDataException
- {
- Map<AMQShortString, List<AMQQueue>> bindings = _index.getBindingsMap();
- _bindingList = new TabularDataSupport(_bindinglistDataType);
-
- for (Map.Entry<AMQShortString, List<AMQQueue>> entry : bindings.entrySet())
- {
- AMQShortString key = entry.getKey();
- List<String> queueList = new ArrayList<String>();
-
- List<AMQQueue> queues = entry.getValue();
- for (AMQQueue q : queues)
- {
- queueList.add(q.getName().toString());
- }
-
- Object[] bindingItemValues = {key.toString(), queueList.toArray(new String[0])};
- CompositeData bindingData = new CompositeDataSupport(_bindingDataType, _bindingItemNames, bindingItemValues);
- _bindingList.put(bindingData);
- }
-
- return _bindingList;
- }
-
- public void createNewBinding(String queueName, String binding) throws JMException
- {
- AMQQueue queue = getQueueRegistry().getQueue(new AMQShortString(queueName));
- if (queue == null)
- {
- throw new JMException("Queue \"" + queueName + "\" is not registered with the exchange.");
- }
-
- try
- {
- queue.bind(new AMQShortString(binding), null, DestNameExchange.this);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex);
- }
- }
-
- }// End of MBean class
-
-
- protected ExchangeMBean createMBean() throws AMQException
- {
- try
- {
- return new DestNameExchangeMBean();
- }
- catch (JMException ex)
- {
- _logger.error("Exception occured in creating the direct exchange mbean", ex);
- throw new AMQException("Exception occured in creating the direct exchange mbean", ex);
- }
- }
-
- public AMQShortString getType()
- {
- return ExchangeDefaults.DIRECT_EXCHANGE_CLASS;
- }
-
- public void registerQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- assert queue != null;
- assert routingKey != null;
- if (!_index.add(routingKey, queue))
- {
- _logger.debug("Queue " + queue + " is already registered with routing key " + routingKey);
- }
- else
- {
- _logger.debug("Binding queue " + queue + " with routing key " + routingKey + " to exchange " + this);
- }
- }
-
- public void deregisterQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- assert queue != null;
- assert routingKey != null;
-
- if (!_index.remove(routingKey, queue))
- {
- throw new AMQException(AMQConstant.NOT_FOUND, "Queue " + queue + " was not registered with exchange " + this.getName() +
- " with routing key " + routingKey + ". No queue was registered with that _routing key");
- }
- }
-
- public void route(AMQMessage payload) throws AMQException
- {
- final MessagePublishInfo info = payload.getMessagePublishInfo();
- final AMQShortString routingKey = info.getRoutingKey() == null ? AMQShortString.EMPTY_STRING : info.getRoutingKey();
- final List<AMQQueue> queues = (routingKey == null) ? null : _index.get(routingKey);
- if (queues == null || queues.isEmpty())
- {
- String msg = "Routing key " + routingKey + " is not known to " + this;
- if (info.isMandatory() || info.isImmediate())
- {
- throw new NoRouteException(msg, payload);
- }
- else
- {
- _logger.error("MESSAGE LOSS: Message should be sent on a Dead Letter Queue");
- _logger.warn(msg);
- }
- }
- else
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Publishing message to queue " + queues);
- }
-
- payload.enqueue(queues);
-
-
- }
- }
-
- public boolean isBound(AMQShortString routingKey, FieldTable arguments, AMQQueue queue)
- {
- return isBound(routingKey,queue);
- }
-
- public boolean isBound(AMQShortString routingKey, AMQQueue queue)
- {
- final List<AMQQueue> queues = _index.get(routingKey);
- return queues != null && queues.contains(queue);
- }
-
- public boolean isBound(AMQShortString routingKey)
- {
- final List<AMQQueue> queues = _index.get(routingKey);
- return queues != null && !queues.isEmpty();
- }
-
- public boolean isBound(AMQQueue queue)
- {
- Map<AMQShortString, List<AMQQueue>> bindings = _index.getBindingsMap();
- for (List<AMQQueue> queues : bindings.values())
- {
- if (queues.contains(queue))
- {
- return true;
- }
- }
- return false;
- }
-
- public boolean hasBindings()
- {
- return !_index.getBindingsMap().isEmpty();
- }
-
- public Map<AMQShortString, List<AMQQueue>> getBindings()
- {
- return _index.getBindingsMap();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DestWildExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DestWildExchange.java
deleted file mode 100644
index 6fa3686152..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DestWildExchange.java
+++ /dev/null
@@ -1,579 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.exchange;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.AMQShortStringTokenizer;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.server.management.MBeanConstructor;
-import org.apache.qpid.server.management.MBeanDescription;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-public class DestWildExchange extends AbstractExchange
-{
-
- public static final ExchangeType<DestWildExchange> TYPE = new ExchangeType<DestWildExchange>()
- {
-
- public AMQShortString getName()
- {
- return ExchangeDefaults.TOPIC_EXCHANGE_CLASS;
- }
-
- public Class<DestWildExchange> getExchangeClass()
- {
- return DestWildExchange.class;
- }
-
- public DestWildExchange newInstance(VirtualHost host,
- AMQShortString name,
- boolean durable,
- int ticket,
- boolean autoDelete) throws AMQException
- {
- DestWildExchange exch = new DestWildExchange();
- exch.initialise(host, name, durable, ticket, autoDelete);
- return exch;
- }
-
- public AMQShortString getDefaultExchangeName()
- {
- return ExchangeDefaults.TOPIC_EXCHANGE_NAME;
- }
- };
-
-
- private static final Logger _logger = Logger.getLogger(DestWildExchange.class);
-
- private final ConcurrentHashMap<AMQShortString, List<AMQQueue>> _bindingKey2queues =
- new ConcurrentHashMap<AMQShortString, List<AMQQueue>>();
- private final ConcurrentHashMap<AMQShortString, List<AMQQueue>> _simpleBindingKey2queues =
- new ConcurrentHashMap<AMQShortString, List<AMQQueue>>();
- private final ConcurrentHashMap<AMQShortString, List<AMQQueue>> _wildCardBindingKey2queues =
- new ConcurrentHashMap<AMQShortString, List<AMQQueue>>();
-
- private static final byte TOPIC_SEPARATOR = (byte)'.';
- private static final AMQShortString TOPIC_SEPARATOR_AS_SHORTSTRING = new AMQShortString(".");
- private static final AMQShortString AMQP_STAR_TOKEN = new AMQShortString("*");
- private static final AMQShortString AMQP_HASH_TOKEN = new AMQShortString("#");
- private ConcurrentHashMap<AMQShortString, AMQShortString[]> _bindingKey2Tokenized =
- new ConcurrentHashMap<AMQShortString, AMQShortString[]>();
- private static final byte HASH_BYTE = (byte)'#';
- private static final byte STAR_BYTE = (byte)'*';
-
- /** DestWildExchangeMBean class implements the management interface for the Topic exchanges. */
- @MBeanDescription("Management Bean for Topic Exchange")
- private final class DestWildExchangeMBean extends ExchangeMBean
- {
- @MBeanConstructor("Creates an MBean for AMQ topic exchange")
- public DestWildExchangeMBean() throws JMException
- {
- super();
- _exchangeType = "topic";
- init();
- }
-
- /** returns exchange bindings in tabular form */
- public TabularData bindings() throws OpenDataException
- {
- _bindingList = new TabularDataSupport(_bindinglistDataType);
- for (Map.Entry<AMQShortString, List<AMQQueue>> entry : _bindingKey2queues.entrySet())
- {
- AMQShortString key = entry.getKey();
- List<String> queueList = new ArrayList<String>();
-
- List<AMQQueue> queues = getMatchedQueues(key);
- for (AMQQueue q : queues)
- {
- queueList.add(q.getName().toString());
- }
-
- Object[] bindingItemValues = {key.toString(), queueList.toArray(new String[0])};
- CompositeData bindingData = new CompositeDataSupport(_bindingDataType, _bindingItemNames, bindingItemValues);
- _bindingList.put(bindingData);
- }
-
- return _bindingList;
- }
-
- public void createNewBinding(String queueName, String binding) throws JMException
- {
- AMQQueue queue = getQueueRegistry().getQueue(new AMQShortString(queueName));
- if (queue == null)
- {
- throw new JMException("Queue \"" + queueName + "\" is not registered with the exchange.");
- }
-
- try
- {
- queue.bind(new AMQShortString(binding), null, DestWildExchange.this);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex);
- }
- }
-
- } // End of MBean class
-
- public AMQShortString getType()
- {
- return ExchangeDefaults.TOPIC_EXCHANGE_CLASS;
- }
-
- public synchronized void registerQueue(AMQShortString rKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- assert queue != null;
- assert rKey != null;
-
- _logger.debug("Registering queue " + queue.getName() + " with routing key " + rKey);
-
- // we need to use putIfAbsent, which is an atomic operation, to avoid a race condition
- List<AMQQueue> queueList = _bindingKey2queues.putIfAbsent(rKey, new CopyOnWriteArrayList<AMQQueue>());
-
-
-
-
-
-
-
- // if we got null back, no previous value was associated with the specified routing key hence
- // we need to read back the new value just put into the map
- if (queueList == null)
- {
- queueList = _bindingKey2queues.get(rKey);
- }
-
-
-
- if (!queueList.contains(queue))
- {
- queueList.add(queue);
-
-
- if(rKey.contains(HASH_BYTE) || rKey.contains(STAR_BYTE))
- {
- AMQShortString routingKey = normalize(rKey);
- List<AMQQueue> queueList2 = _wildCardBindingKey2queues.putIfAbsent(routingKey, new CopyOnWriteArrayList<AMQQueue>());
-
- if(queueList2 == null)
- {
- queueList2 = _wildCardBindingKey2queues.get(routingKey);
- AMQShortStringTokenizer keyTok = routingKey.tokenize(TOPIC_SEPARATOR);
-
- ArrayList<AMQShortString> keyTokList = new ArrayList<AMQShortString>(keyTok.countTokens());
-
- while (keyTok.hasMoreTokens())
- {
- keyTokList.add(keyTok.nextToken());
- }
-
- _bindingKey2Tokenized.put(routingKey, keyTokList.toArray(new AMQShortString[keyTokList.size()]));
- }
- queueList2.add(queue);
-
- }
- else
- {
- List<AMQQueue> queueList2 = _simpleBindingKey2queues.putIfAbsent(rKey, new CopyOnWriteArrayList<AMQQueue>());
- if(queueList2 == null)
- {
- queueList2 = _simpleBindingKey2queues.get(rKey);
- }
- queueList2.add(queue);
-
- }
-
-
-
-
- }
- else if (_logger.isDebugEnabled())
- {
- _logger.debug("Queue " + queue + " is already registered with routing key " + rKey);
- }
-
-
-
- }
-
- private AMQShortString normalize(AMQShortString routingKey)
- {
- if(routingKey == null)
- {
- routingKey = AMQShortString.EMPTY_STRING;
- }
-
- AMQShortStringTokenizer routingTokens = routingKey.tokenize(TOPIC_SEPARATOR);
-
- List<AMQShortString> subscriptionList = new ArrayList<AMQShortString>();
-
- while (routingTokens.hasMoreTokens())
- {
- subscriptionList.add(routingTokens.nextToken());
- }
-
- int size = subscriptionList.size();
-
- for (int index = 0; index < size; index++)
- {
- // if there are more levels
- if ((index + 1) < size)
- {
- if (subscriptionList.get(index).equals(AMQP_HASH_TOKEN))
- {
- if (subscriptionList.get(index + 1).equals(AMQP_HASH_TOKEN))
- {
- // we don't need #.# delete this one
- subscriptionList.remove(index);
- size--;
- // redo this normalisation
- index--;
- }
-
- if (subscriptionList.get(index + 1).equals(AMQP_STAR_TOKEN))
- {
- // we don't want #.* swap to *.#
- // remove it and put it in at index + 1
- subscriptionList.add(index + 1, subscriptionList.remove(index));
- }
- }
- } // if we have more levels
- }
-
-
-
- AMQShortString normalizedString = AMQShortString.join(subscriptionList, TOPIC_SEPARATOR_AS_SHORTSTRING);
-
- return normalizedString;
- }
-
- public void route(AMQMessage payload) throws AMQException
- {
- MessagePublishInfo info = payload.getMessagePublishInfo();
-
- final AMQShortString routingKey = info.getRoutingKey();
-
- List<AMQQueue> queues = getMatchedQueues(routingKey);
- // if we have no registered queues we have nothing to do
- // TODO: add support for the immediate flag
- if ((queues == null) || queues.isEmpty())
- {
- if (info.isMandatory() || info.isImmediate())
- {
- String msg = "Topic " + routingKey + " is not known to " + this;
- throw new NoRouteException(msg, payload);
- }
- else
- {
- _logger.warn("No queues found for routing key " + routingKey);
- _logger.warn("Routing map contains: " + _bindingKey2queues);
-
- return;
- }
- }
-
- payload.enqueue(queues);
-
- }
-
- public boolean isBound(AMQShortString routingKey, FieldTable arguments, AMQQueue queue)
- {
- return isBound(routingKey, queue);
- }
-
- public boolean isBound(AMQShortString routingKey, AMQQueue queue)
- {
- List<AMQQueue> queues = _bindingKey2queues.get(normalize(routingKey));
-
- return (queues != null) && queues.contains(queue);
- }
-
- public boolean isBound(AMQShortString routingKey)
- {
- List<AMQQueue> queues = _bindingKey2queues.get(normalize(routingKey));
-
- return (queues != null) && !queues.isEmpty();
- }
-
- public boolean isBound(AMQQueue queue)
- {
- for (List<AMQQueue> queues : _bindingKey2queues.values())
- {
- if (queues.contains(queue))
- {
- return true;
- }
- }
-
- return false;
- }
-
- public boolean hasBindings()
- {
- return !_bindingKey2queues.isEmpty();
- }
-
- public synchronized void deregisterQueue(AMQShortString rKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- assert queue != null;
- assert rKey != null;
-
- List<AMQQueue> queues = _bindingKey2queues.get(rKey);
- if (queues == null)
- {
- throw new AMQException(AMQConstant.NOT_FOUND, "Queue " + queue + " was not registered with exchange " + this.getName()
- + " with routing key " + rKey + ". No queue was registered with that _routing key");
-
- }
-
- boolean removedQ = queues.remove(queue);
- if (!removedQ)
- {
- throw new AMQException(AMQConstant.NOT_FOUND, "Queue " + queue + " was not registered with exchange " + this.getName()
- + " with routing key " + rKey);
- }
-
-
- if(rKey.contains(HASH_BYTE) || rKey.contains(STAR_BYTE))
- {
- AMQShortString bindingKey = normalize(rKey);
- List<AMQQueue> queues2 = _wildCardBindingKey2queues.get(bindingKey);
- queues2.remove(queue);
- if(queues2.isEmpty())
- {
- _wildCardBindingKey2queues.remove(bindingKey);
- _bindingKey2Tokenized.remove(bindingKey);
- }
-
- }
- else
- {
- List<AMQQueue> queues2 = _simpleBindingKey2queues.get(rKey);
- queues2.remove(queue);
- if(queues2.isEmpty())
- {
- _simpleBindingKey2queues.remove(rKey);
- }
-
- }
-
-
-
-
- if (queues.isEmpty())
- {
- _bindingKey2queues.remove(rKey);
- }
- }
-
- protected ExchangeMBean createMBean() throws AMQException
- {
- try
- {
- return new DestWildExchangeMBean();
- }
- catch (JMException ex)
- {
- _logger.error("Exception occured in creating the topic exchenge mbean", ex);
- throw new AMQException("Exception occured in creating the topic exchenge mbean", ex);
- }
- }
-
- public Map<AMQShortString, List<AMQQueue>> getBindings()
- {
- return _bindingKey2queues;
- }
-
- private List<AMQQueue> getMatchedQueues(AMQShortString routingKey)
- {
-
- List<AMQQueue> list = null;
-
- if(!_wildCardBindingKey2queues.isEmpty())
- {
-
-
- AMQShortStringTokenizer routingTokens = routingKey.tokenize(TOPIC_SEPARATOR);
-
- final int routingTokensCount = routingTokens.countTokens();
-
-
- AMQShortString[] routingkeyTokens = new AMQShortString[routingTokensCount];
-
- if(routingTokensCount == 1)
- {
- routingkeyTokens[0] =routingKey;
- }
- else
- {
-
-
- int token = 0;
- while (routingTokens.hasMoreTokens())
- {
-
- AMQShortString next = routingTokens.nextToken();
-
- routingkeyTokens[token++] = next;
- }
- }
- for (AMQShortString bindingKey : _wildCardBindingKey2queues.keySet())
- {
-
- AMQShortString[] bindingKeyTokens = _bindingKey2Tokenized.get(bindingKey);
-
-
- boolean matching = true;
- boolean done = false;
-
- int depthPlusRoutingSkip = 0;
- int depthPlusQueueSkip = 0;
-
- final int bindingKeyTokensCount = bindingKeyTokens.length;
-
- while (matching && !done)
- {
-
- if ((bindingKeyTokensCount == depthPlusQueueSkip) || (routingTokensCount == depthPlusRoutingSkip))
- {
- done = true;
-
- // if it was the routing key that ran out of digits
- if (routingTokensCount == depthPlusRoutingSkip)
- {
- if (bindingKeyTokensCount > depthPlusQueueSkip)
- { // a hash and it is the last entry
- matching =
- bindingKeyTokens[depthPlusQueueSkip].equals(AMQP_HASH_TOKEN)
- && (bindingKeyTokensCount == (depthPlusQueueSkip + 1));
- }
- }
- else if (routingTokensCount > depthPlusRoutingSkip)
- {
- // There is still more routing key to check
- matching = false;
- }
-
- continue;
- }
-
- // if the values on the two topics don't match
- if (!bindingKeyTokens[depthPlusQueueSkip].equals(routingkeyTokens[depthPlusRoutingSkip]))
- {
- if (bindingKeyTokens[depthPlusQueueSkip].equals(AMQP_STAR_TOKEN))
- {
- depthPlusQueueSkip++;
- depthPlusRoutingSkip++;
-
- continue;
- }
- else if (bindingKeyTokens[depthPlusQueueSkip].equals(AMQP_HASH_TOKEN))
- {
- // Is this a # at the end
- if (bindingKeyTokensCount == (depthPlusQueueSkip + 1))
- {
- done = true;
-
- continue;
- }
-
- // otherwise # in the middle
- while (routingTokensCount > depthPlusRoutingSkip)
- {
- if (routingkeyTokens[depthPlusRoutingSkip].equals(bindingKeyTokens[depthPlusQueueSkip + 1]))
- {
- depthPlusQueueSkip += 2;
- depthPlusRoutingSkip++;
-
- break;
- }
-
- depthPlusRoutingSkip++;
- }
-
- continue;
- }
-
- matching = false;
- }
-
- depthPlusQueueSkip++;
- depthPlusRoutingSkip++;
- }
-
- if (matching)
- {
- if(list == null)
- {
- list = new ArrayList<AMQQueue>(_wildCardBindingKey2queues.get(bindingKey));
- }
- else
- {
- list.addAll(_wildCardBindingKey2queues.get(bindingKey));
- }
- }
- }
-
- }
- if(!_simpleBindingKey2queues.isEmpty())
- {
- List<AMQQueue> queues = _simpleBindingKey2queues.get(routingKey);
- if(list == null)
- {
- if(queues == null)
- {
- list = Collections.EMPTY_LIST;
- }
- else
- {
- list = new ArrayList<AMQQueue>(queues);
- }
- }
- else if(queues != null)
- {
- list.addAll(queues);
- }
-
- }
-
- return list;
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Exchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Exchange.java
deleted file mode 100644
index 37cd85a8f8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Exchange.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.server.exchange;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import java.util.List;
-import java.util.Map;
-
-public interface Exchange
-{
- AMQShortString getName();
-
- AMQShortString getType();
-
- void initialise(VirtualHost host, AMQShortString name, boolean durable, int ticket, boolean autoDelete) throws AMQException;
-
- boolean isDurable();
-
- /**
- * @return true if the exchange will be deleted after all queues have been detached
- */
- boolean isAutoDelete();
-
- int getTicket();
-
- void close() throws AMQException;
-
- void registerQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException;
-
- void deregisterQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException;
-
- void route(AMQMessage message) throws AMQException;
-
-
- /**
- * Determines whether a message would be isBound to a particular queue using a specific routing key and arguments
- * @param routingKey
- * @param arguments
- * @param queue
- * @return
- * @throws AMQException
- */
- boolean isBound(AMQShortString routingKey, FieldTable arguments, AMQQueue queue);
-
- /**
- * Determines whether a message would be isBound to a particular queue using a specific routing key
- * @param routingKey
- * @param queue
- * @return
- * @throws AMQException
- */
- boolean isBound(AMQShortString routingKey, AMQQueue queue);
-
- /**
- * Determines whether a message is routing to any queue using a specific _routing key
- * @param routingKey
- * @return
- * @throws AMQException
- */
- boolean isBound(AMQShortString routingKey);
-
- boolean isBound(AMQQueue queue);
-
- /**
- * Returns true if this exchange has at least one binding associated with it.
- * @return
- * @throws AMQException
- */
- boolean hasBindings();
-
- Map<AMQShortString, List<AMQQueue>> getBindings();
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
deleted file mode 100644
index 0bcfec7181..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.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.server.exchange;
-
-import java.util.Collection;
-
-import org.apache.commons.configuration.Configuration;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-
-
-public interface ExchangeFactory
-{
- Exchange createExchange(AMQShortString exchange, AMQShortString type, boolean durable, boolean autoDelete,
- int ticket)
- throws AMQException;
-
- void initialise(Configuration hostConfig);
-
- Collection<ExchangeType<? extends Exchange>> getRegisteredTypes();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeInUseException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeInUseException.java
deleted file mode 100644
index c77f114428..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeInUseException.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.server.exchange;
-
-import org.apache.qpid.AMQException;
-
-/**
- * ExchangeInUseRegistry indicates that an exchange cannot be unregistered because it is currently being used.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represents failure to unregister exchange that is in use.
- * </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
- * @todo This exception is not used. However, it is part of the ExchangeRegistry interface, and looks like code is
- * going to need to be added to throw/deal with this. Alternatively ExchangeResitries may be able to handle the
- * issue internally.
- */
-public class ExchangeInUseException extends AMQException
-{
- public ExchangeInUseException(String exchangeName)
- {
- super("Exchange " + exchangeName + " is currently in use");
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
deleted file mode 100644
index fe3b19e74e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.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.server.exchange;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-
-import java.util.Collection;
-
-
-public interface ExchangeRegistry extends MessageRouter
-{
- void registerExchange(Exchange exchange) throws AMQException;
-
- /**
- * Unregister an exchange
- * @param name name of the exchange to delete
- * @param inUse if true, do NOT delete the exchange if it is in use (has queues bound to it)
- * @throws ExchangeInUseException when the exchange cannot be deleted because it is in use
- * @throws AMQException
- */
- void unregisterExchange(AMQShortString name, boolean inUse) throws ExchangeInUseException, AMQException;
-
- Exchange getExchange(AMQShortString name);
-
- void setDefaultExchange(Exchange exchange);
-
- Exchange getDefaultExchange();
-
- Collection<AMQShortString> getExchangeNames();
-
- void initialise() throws AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeType.java
deleted file mode 100644
index 0b55caa2f1..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeType.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.server.exchange;
-
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-
-public interface ExchangeType<T extends Exchange>
-{
- public AMQShortString getName();
- public Class<T> getExchangeClass();
- public T newInstance(VirtualHost host, AMQShortString name,
- boolean durable, int ticket, boolean autoDelete) throws AMQException;
- public AMQShortString getDefaultExchangeName();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java
deleted file mode 100644
index e7c887f306..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.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.server.exchange;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.server.management.MBeanConstructor;
-import org.apache.qpid.server.management.MBeanDescription;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-public class FanoutExchange extends AbstractExchange
-{
- private static final Logger _logger = Logger.getLogger(FanoutExchange.class);
-
- /**
- * Maps from queue name to queue instances
- */
- private final CopyOnWriteArraySet<AMQQueue> _queues = new CopyOnWriteArraySet<AMQQueue>();
-
- /**
- * MBean class implementing the management interfaces.
- */
- @MBeanDescription("Management Bean for Fanout Exchange")
- private final class FanoutExchangeMBean extends ExchangeMBean
- {
- @MBeanConstructor("Creates an MBean for AMQ fanout exchange")
- public FanoutExchangeMBean() throws JMException
- {
- super();
- _exchangeType = "fanout";
- init();
- }
-
- public TabularData bindings() throws OpenDataException
- {
-
- _bindingList = new TabularDataSupport(_bindinglistDataType);
-
- for (AMQQueue queue : _queues)
- {
- String queueName = queue.getName().toString();
-
- Object[] bindingItemValues = {queueName, new String[]{queueName}};
- CompositeData bindingData = new CompositeDataSupport(_bindingDataType, _bindingItemNames, bindingItemValues);
- _bindingList.put(bindingData);
- }
-
- return _bindingList;
- }
-
- public void createNewBinding(String queueName, String binding) throws JMException
- {
- AMQQueue queue = getQueueRegistry().getQueue(new AMQShortString(queueName));
- if (queue == null)
- {
- throw new JMException("Queue \"" + queueName + "\" is not registered with the exchange.");
- }
-
- try
- {
- queue.bind(new AMQShortString(binding), null, FanoutExchange.this);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex);
- }
- }
-
- } // End of MBean class
-
- protected ExchangeMBean createMBean() throws AMQException
- {
- try
- {
- return new FanoutExchange.FanoutExchangeMBean();
- }
- catch (JMException ex)
- {
- _logger.error("Exception occured in creating the direct exchange mbean", ex);
- throw new AMQException("Exception occured in creating the direct exchange mbean", ex);
- }
- }
-
- public static final ExchangeType<FanoutExchange> TYPE = new ExchangeType<FanoutExchange>()
- {
-
- public AMQShortString getName()
- {
- return ExchangeDefaults.FANOUT_EXCHANGE_CLASS;
- }
-
- public Class<FanoutExchange> getExchangeClass()
- {
- return FanoutExchange.class;
- }
-
- public FanoutExchange newInstance(VirtualHost host,
- AMQShortString name,
- boolean durable,
- int ticket,
- boolean autoDelete) throws AMQException
- {
- FanoutExchange exch = new FanoutExchange();
- exch.initialise(host, name, durable, ticket, autoDelete);
- return exch;
- }
-
- public AMQShortString getDefaultExchangeName()
- {
- return ExchangeDefaults.FANOUT_EXCHANGE_NAME;
- }
- };
-
- public Map<AMQShortString, List<AMQQueue>> getBindings()
- {
- return null;
- }
-
- public AMQShortString getType()
- {
- return ExchangeDefaults.FANOUT_EXCHANGE_CLASS;
- }
-
- public void registerQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- assert queue != null;
-
- if (_queues.contains(queue))
- {
- _logger.debug("Queue " + queue + " is already registered");
- }
- else
- {
- _queues.add(queue);
- _logger.debug("Binding queue " + queue + " with routing key " + routingKey + " to exchange " + this);
- }
- }
-
- public void deregisterQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- assert queue != null;
-
- if (!_queues.remove(queue))
- {
- throw new AMQException(AMQConstant.NOT_FOUND, "Queue " + queue + " was not registered with exchange " + this.getName() + ". ");
- }
- }
-
- public void route(AMQMessage payload) throws AMQException
- {
- final MessagePublishInfo publishInfo = payload.getMessagePublishInfo();
- final AMQShortString routingKey = publishInfo.getRoutingKey();
- if ((_queues == null) || _queues.isEmpty())
- {
- String msg = "No queues bound to " + this;
- if (publishInfo.isMandatory() || publishInfo.isImmediate())
- {
- throw new NoRouteException(msg, payload);
- }
- else
- {
- _logger.warn(msg);
- }
- }
- else
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Publishing message to queue " + _queues);
- }
-
- payload.enqueue(new ArrayList(_queues));
-
- }
- }
-
- public boolean isBound(AMQShortString routingKey, FieldTable arguments, AMQQueue queue)
- {
- return isBound(routingKey, queue);
- }
-
- public boolean isBound(AMQShortString routingKey, AMQQueue queue)
- {
- return _queues.contains(queue);
- }
-
- public boolean isBound(AMQShortString routingKey)
- {
-
- return (_queues != null) && !_queues.isEmpty();
- }
-
- public boolean isBound(AMQQueue queue)
- {
-
- return _queues.contains(queue);
- }
-
- public boolean hasBindings()
- {
- return !_queues.isEmpty();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
deleted file mode 100644
index 2b7df4361a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.exchange;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.framing.AMQTypedValue;
-import org.apache.qpid.framing.FieldTable;
-
-/**
- * Defines binding and matching based on a set of headers.
- */
-class HeadersBinding
-{
- private static final Logger _logger = Logger.getLogger(HeadersBinding.class);
-
- private final FieldTable _mappings;
- private final Set<String> required = new HashSet<String>();
- private final Map<String,Object> matches = new HashMap<String,Object>();
- private boolean matchAny;
-
- private final class MatchesOrProcessor implements FieldTable.FieldTableElementProcessor
- {
- private Boolean _result = Boolean.FALSE;
-
- public boolean processElement(String propertyName, AMQTypedValue value)
- {
- if((value != null) && (value.getValue() != null) && value.getValue().equals(matches.get(propertyName)))
- {
- _result = Boolean.TRUE;
- return false;
- }
- return true;
- }
-
- public Object getResult()
- {
- return _result;
- }
- }
-
- private final class RequiredOrProcessor implements FieldTable.FieldTableElementProcessor
- {
- Boolean _result = Boolean.FALSE;
-
- public boolean processElement(String propertyName, AMQTypedValue value)
- {
- if(required.contains(propertyName))
- {
- _result = Boolean.TRUE;
- return false;
- }
- return true;
- }
-
- public Object getResult()
- {
- return _result;
- }
- }
-
-
-
- /**
- * Creates a binding for a set of mappings. Those mappings whose value is
- * null or the empty string are assumed only to be required headers, with
- * no constraint on the value. Those with a non-null value are assumed to
- * define a required match of value.
- * @param mappings the defined mappings this binding should use
- */
-
- HeadersBinding(FieldTable mappings)
- {
- _mappings = mappings;
- initMappings();
- }
-
- private void initMappings()
- {
-
- _mappings.processOverElements(new FieldTable.FieldTableElementProcessor()
- {
-
- public boolean processElement(String propertyName, AMQTypedValue value)
- {
- if (isSpecial(propertyName))
- {
- processSpecial(propertyName, value.getValue());
- }
- else if (value.getValue() == null || value.getValue().equals(""))
- {
- required.add(propertyName);
- }
- else
- {
- matches.put(propertyName,value.getValue());
- }
-
- return true;
- }
-
- public Object getResult()
- {
- return null;
- }
- });
- }
-
- protected FieldTable getMappings()
- {
- return _mappings;
- }
-
- /**
- * Checks whether the supplied headers match the requirements of this binding
- * @param headers the headers to check
- * @return true if the headers define any required keys and match any required
- * values
- */
- public boolean matches(FieldTable headers)
- {
- if(headers == null)
- {
- return required.isEmpty() && matches.isEmpty();
- }
- else
- {
- return matchAny ? or(headers) : and(headers);
- }
- }
-
- private boolean and(FieldTable headers)
- {
- if(headers.keys().containsAll(required))
- {
- for(Map.Entry<String, Object> e : matches.entrySet())
- {
- if(!e.getValue().equals(headers.getObject(e.getKey())))
- {
- return false;
- }
- }
- return true;
- }
- else
- {
- return false;
- }
- }
-
-
- private boolean or(final FieldTable headers)
- {
- if(required.isEmpty() || !(Boolean) headers.processOverElements(new RequiredOrProcessor()))
- {
- return ((!matches.isEmpty()) && (Boolean) headers.processOverElements(new MatchesOrProcessor()))
- || (required.isEmpty() && matches.isEmpty());
- }
- else
- {
- return true;
- }
- }
-
- private void processSpecial(String key, Object value)
- {
- if("X-match".equalsIgnoreCase(key))
- {
- matchAny = isAny(value);
- }
- else
- {
- _logger.warn("Ignoring special header: " + key);
- }
- }
-
- private boolean isAny(Object value)
- {
- if(value instanceof String)
- {
- if("any".equalsIgnoreCase((String) value)) return true;
- if("all".equalsIgnoreCase((String) value)) return false;
- }
- _logger.warn("Ignoring unrecognised match type: " + value);
- return false;//default to all
- }
-
- static boolean isSpecial(Object key)
- {
- return key instanceof String && isSpecial((String) key);
- }
-
- static boolean isSpecial(String key)
- {
- return key.startsWith("X-") || key.startsWith("x-");
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java
deleted file mode 100644
index 68ad88c4cb..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.exchange;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.AMQTypedValue;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.management.MBeanConstructor;
-import org.apache.qpid.server.management.MBeanDescription;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import javax.management.JMException;
-import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-/**
- * An exchange that binds queues based on a set of required headers and header values
- * and routes messages to these queues by matching the headers of the message against
- * those with which the queues were bound.
- * <p/>
- * <pre>
- * The Headers Exchange
- *
- * Routes messages according to the value/presence of fields in the message header table.
- * (Basic and JMS content has a content header field called "headers" that is a table of
- * message header fields).
- *
- * class = "headers"
- * routing key is not used
- *
- * Has the following binding arguments:
- *
- * the X-match field - if "all", does an AND match (used for GRM), if "any", does an OR match.
- * other fields prefixed with "X-" are ignored (and generate a console warning message).
- * a field with no value or empty value indicates a match on presence only.
- * a field with a value indicates match on field presence and specific value.
- *
- * Standard instances:
- *
- * amq.match - pub/sub on field content/value
- * </pre>
- */
-public class HeadersExchange extends AbstractExchange
-{
- private static final Logger _logger = Logger.getLogger(HeadersExchange.class);
-
-
-
- public static final ExchangeType<HeadersExchange> TYPE = new ExchangeType<HeadersExchange>()
- {
-
- public AMQShortString getName()
- {
- return ExchangeDefaults.HEADERS_EXCHANGE_CLASS;
- }
-
- public Class<HeadersExchange> getExchangeClass()
- {
- return HeadersExchange.class;
- }
-
- public HeadersExchange newInstance(VirtualHost host, AMQShortString name, boolean durable, int ticket,
- boolean autoDelete) throws AMQException
- {
- HeadersExchange exch = new HeadersExchange();
- exch.initialise(host, name, durable, ticket, autoDelete);
- return exch;
- }
-
- public AMQShortString getDefaultExchangeName()
- {
-
- return ExchangeDefaults.HEADERS_EXCHANGE_NAME;
- }
- };
-
-
- private final List<Registration> _bindings = new CopyOnWriteArrayList<Registration>();
-
- /**
- * HeadersExchangeMBean class implements the management interface for the
- * Header Exchanges.
- */
- @MBeanDescription("Management Bean for Headers Exchange")
- private final class HeadersExchangeMBean extends ExchangeMBean
- {
- @MBeanConstructor("Creates an MBean for AMQ Headers exchange")
- public HeadersExchangeMBean() throws JMException
- {
- super();
- _exchangeType = "headers";
- init();
- }
-
- /**
- * initialises the OpenType objects.
- */
- protected void init() throws OpenDataException
- {
- _bindingItemNames = new String[]{"Binding No", "Queue Name", "Queue Bindings"};
- _bindingItemIndexNames = new String[]{_bindingItemNames[0]};
-
- _bindingItemTypes = new OpenType[3];
- _bindingItemTypes[0] = SimpleType.INTEGER;
- _bindingItemTypes[1] = SimpleType.STRING;
- _bindingItemTypes[2] = new ArrayType(1, SimpleType.STRING);
- _bindingDataType = new CompositeType("Exchange Binding", "Queue name and header bindings",
- _bindingItemNames, _bindingItemNames, _bindingItemTypes);
- _bindinglistDataType = new TabularType("Exchange Bindings", "List of exchange bindings for " + getName(),
- _bindingDataType, _bindingItemIndexNames);
- }
-
- public TabularData bindings() throws OpenDataException
- {
- _bindingList = new TabularDataSupport(_bindinglistDataType);
- int count = 1;
- for (Iterator<Registration> itr = _bindings.iterator(); itr.hasNext();)
- {
- Registration registration = itr.next();
- String queueName = registration.queue.getName().toString();
-
- HeadersBinding headers = registration.binding;
- FieldTable headerMappings = headers.getMappings();
- final List<String> mappingList = new ArrayList<String>();
-
- headerMappings.processOverElements(new FieldTable.FieldTableElementProcessor()
- {
-
- public boolean processElement(String propertyName, AMQTypedValue value)
- {
- mappingList.add(propertyName + "=" + value.getValue());
- return true;
- }
-
- public Object getResult()
- {
- return mappingList;
- }
- });
-
-
- Object[] bindingItemValues = {count++, queueName, mappingList.toArray(new String[0])};
- CompositeData bindingData = new CompositeDataSupport(_bindingDataType, _bindingItemNames, bindingItemValues);
- _bindingList.put(bindingData);
- }
-
- return _bindingList;
- }
-
- /**
- * Creates bindings. Binding pattern is as follows-
- * <attributename>=<value>,<attributename>=<value>,...
- * @param queueName
- * @param binding
- * @throws javax.management.JMException
- */
- public void createNewBinding(String queueName, String binding) throws JMException
- {
- AMQQueue queue = getQueueRegistry().getQueue(new AMQShortString(queueName));
-
- if (queue == null)
- {
- throw new JMException("Queue \"" + queueName + "\" is not registered with the exchange.");
- }
-
- String[] bindings = binding.split(",");
- FieldTable bindingMap = new FieldTable();
- for (int i = 0; i < bindings.length; i++)
- {
- String[] keyAndValue = bindings[i].split("=");
- if (keyAndValue == null || keyAndValue.length < 2)
- {
- throw new JMException("Format for headers binding should be \"<attribute1>=<value1>,<attribute2>=<value2>\" ");
- }
- bindingMap.setString(keyAndValue[0], keyAndValue[1]);
- }
-
- _bindings.add(new Registration(new HeadersBinding(bindingMap), queue));
- }
-
- } // End of MBean class
-
- public AMQShortString getType()
- {
- return ExchangeDefaults.HEADERS_EXCHANGE_CLASS;
- }
-
- public void registerQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- _logger.debug("Exchange " + getName() + ": Binding " + queue.getName() + " with " + args);
- _bindings.add(new Registration(new HeadersBinding(args), queue));
- }
-
- public void deregisterQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- _logger.debug("Exchange " + getName() + ": Unbinding " + queue.getName());
- if(!_bindings.remove(new Registration(new HeadersBinding(args), queue)))
- {
- throw new AMQException(AMQConstant.NOT_FOUND, "Queue " + queue + " was not registered with exchange " + this.getName()
- + " with headers args " + args);
- }
- }
-
- public void route(AMQMessage payload) throws AMQException
- {
- FieldTable headers = getHeaders(payload.getContentHeaderBody());
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Exchange " + getName() + ": routing message with headers " + headers);
- }
- boolean routed = false;
- for (Registration e : _bindings)
- {
- if (e.binding.matches(headers))
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Exchange " + getName() + ": delivering message with headers " +
- headers + " to " + e.queue.getName());
- }
- payload.enqueue(e.queue);
- routed = true;
- }
- }
- if (!routed)
- {
-
- String msg = "Exchange " + getName() + ": message not routable.";
-
- if (payload.getMessagePublishInfo().isMandatory() || payload.getMessagePublishInfo().isImmediate())
- {
- throw new NoRouteException(msg, payload);
- }
- else
- {
- _logger.warn(msg);
- }
-
- }
- }
-
- public boolean isBound(AMQShortString routingKey, FieldTable arguments, AMQQueue queue)
- {
- //fixme isBound here should take the arguements in to consideration.
- return isBound(routingKey, queue);
- }
-
- public boolean isBound(AMQShortString routingKey, AMQQueue queue)
- {
- return isBound(queue);
- }
-
- public boolean isBound(AMQShortString routingKey)
- {
- return hasBindings();
- }
-
- public boolean isBound(AMQQueue queue)
- {
- for (Registration r : _bindings)
- {
- if (r.queue.equals(queue))
- {
- return true;
- }
- }
- return false;
- }
-
- public boolean hasBindings()
- {
- return !_bindings.isEmpty();
- }
-
- protected FieldTable getHeaders(ContentHeaderBody contentHeaderFrame)
- {
- //what if the content type is not 'basic'? 'file' and 'stream' content classes also define headers,
- //but these are not yet implemented.
- return ((BasicContentHeaderProperties) contentHeaderFrame.properties).getHeaders();
- }
-
- protected ExchangeMBean createMBean() throws AMQException
- {
- try
- {
- return new HeadersExchangeMBean();
- }
- catch (JMException ex)
- {
- _logger.error("Exception occured in creating the HeadersExchangeMBean", ex);
- throw new AMQException("Exception occured in creating the HeadersExchangeMBean", ex);
- }
- }
-
- public Map<AMQShortString, List<AMQQueue>> getBindings()
- {
- return null;
- }
-
- private static class Registration
- {
- private final HeadersBinding binding;
- private final AMQQueue queue;
-
- Registration(HeadersBinding binding, AMQQueue queue)
- {
- this.binding = binding;
- this.queue = queue;
- }
-
- public int hashCode()
- {
- return queue.hashCode();
- }
-
- public boolean equals(Object o)
- {
- return o instanceof Registration && ((Registration) o).queue.equals(queue);
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Index.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Index.java
deleted file mode 100644
index eacdad8a8e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Index.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.server.exchange;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.queue.AMQQueue;
-
-/**
- * An index of queues against routing key. Allows multiple queues to be stored
- * against the same key. Used in the DestNameExchange.
- */
-class Index
-{
- private ConcurrentMap<AMQShortString, List<AMQQueue>> _index
- = new ConcurrentHashMap<AMQShortString, List<AMQQueue>>();
-
- synchronized boolean add(AMQShortString key, AMQQueue queue)
- {
- List<AMQQueue> queues = _index.get(key);
- if(queues == null)
- {
- queues = new CopyOnWriteArrayList<AMQQueue>();
- //next call is atomic, so there is no race to create the list
- List<AMQQueue> active = _index.putIfAbsent(key, queues);
- if(active != null)
- {
- //someone added the new one in faster than we did, so use theirs
- queues = active;
- }
- }
- if(queues.contains(queue))
- {
- return false;
- }
- else
- {
- return queues.add(queue);
- }
- }
-
- synchronized boolean remove(AMQShortString key, AMQQueue queue)
- {
- List<AMQQueue> queues = _index.get(key);
- if (queues != null)
- {
- boolean removed = queues.remove(queue);
- if (queues.size() == 0)
- {
- _index.remove(key);
- }
- return removed;
- }
- return false;
- }
-
- List<AMQQueue> get(AMQShortString key)
- {
- return _index.get(key);
- }
-
- Map<AMQShortString, List<AMQQueue>> getBindingsMap()
- {
- return new HashMap<AMQShortString, List<AMQQueue>>(_index);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ManagedExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ManagedExchange.java
deleted file mode 100644
index 5d6d68b3c8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ManagedExchange.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.server.exchange;
-
-import java.io.IOException;
-
-import javax.management.JMException;
-import javax.management.MBeanOperationInfo;
-import javax.management.openmbean.TabularData;
-
-import org.apache.qpid.server.management.MBeanAttribute;
-import org.apache.qpid.server.management.MBeanOperation;
-import org.apache.qpid.server.management.MBeanOperationParameter;
-import org.apache.qpid.server.queue.ManagedQueue;
-
-/**
- * The management interface exposed to allow management of an Exchange.
- * @author Robert J. Greig
- * @author Bhupendra Bhardwaj
- * @version 0.1
- */
-public interface ManagedExchange
-{
- static final String TYPE = "Exchange";
-
- /**
- * Returns the name of the managed exchange.
- * @return the name of the exchange.
- * @throws IOException
- */
- @MBeanAttribute(name="Name", description=TYPE + " Name")
- String getName() throws IOException;
-
- @MBeanAttribute(name="ExchangeType", description="Exchange Type")
- String getExchangeType() throws IOException;
-
- @MBeanAttribute(name="TicketNo", description="Exchange Ticket No")
- Integer getTicketNo() throws IOException;
-
- /**
- * Tells if the exchange is durable or not.
- * @return true if the exchange is durable.
- * @throws IOException
- */
- @MBeanAttribute(name="Durable", description="true if Exchange is durable")
- boolean isDurable() throws IOException;
-
- /**
- * Tells if the exchange is set for autodelete or not.
- * @return true if the exchange is set as autodelete.
- * @throws IOException
- */
- @MBeanAttribute(name="AutoDelete", description="true if Exchange is AutoDelete")
- boolean isAutoDelete() throws IOException;
-
- // Operations
-
- /**
- * Returns all the bindings this exchange has with the queues.
- * @return the bindings with the exchange.
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="bindings", description="view the queue bindings for this exchange")
- TabularData bindings() throws IOException, JMException;
-
- /**
- * Creates new binding with the given queue and binding.
- * @param queueName
- * @param binding
- * @throws JMException
- */
- @MBeanOperation(name="createNewBinding",
- description="create a new binding with this exchange",
- impact= MBeanOperationInfo.ACTION)
- void createNewBinding(@MBeanOperationParameter(name= ManagedQueue.TYPE, description="Queue name") String queueName,
- @MBeanOperationParameter(name="Binding", description="New binding")String binding)
- throws JMException;
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/MessageRouter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/MessageRouter.java
deleted file mode 100644
index 7508e80f7f..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/MessageRouter.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.server.exchange;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * Separated out from the ExchangeRegistry interface to allow components
- * that use only this part to have a dependency with a reduced footprint.
- *
- */
-public interface MessageRouter
-{
- /**
- * Routes content through exchanges, delivering it to 1 or more queues.
- * @param message the message to be routed
- *
- * @throws org.apache.qpid.AMQException if something goes wrong delivering data
- */
- void routeContent(AMQMessage message) throws AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/NoRouteException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/NoRouteException.java
deleted file mode 100644
index 1d6ab3842d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/NoRouteException.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.server.exchange;
-
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.RequiredDeliveryException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * NoRouteException is a {@link RequiredDeliveryException} that represents the failure case where a manadatory message
- * cannot be delivered because there is no route for the message. The AMQP status code, 312, is always used to report
- * this condition.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represent failure to deliver a message that must be delivered.
- * </table>
- */
-public class NoRouteException extends RequiredDeliveryException
-{
- public NoRouteException(String msg, AMQMessage message)
- {
- super(msg, message);
- }
-
- public AMQConstant getReplyCode()
- {
- return AMQConstant.NO_ROUTE;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java
deleted file mode 100644
index fb5220f4da..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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.server.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * 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;
-
- /**
- * @param left
- * @param right
- */
- 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 RuntimeException("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 RuntimeException("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 RuntimeException("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 RuntimeException("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 RuntimeException("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 new Integer(left.intValue() + right.intValue());
-
- case LONG:
- return new Long(left.longValue() + right.longValue());
-
- default:
- return new Double(left.doubleValue() + right.doubleValue());
- }
- }
-
- protected Number minus(Number left, Number right)
- {
- switch (numberType(left, right))
- {
-
- case INTEGER:
- return new Integer(left.intValue() - right.intValue());
-
- case LONG:
- return new Long(left.longValue() - right.longValue());
-
- default:
- return new Double(left.doubleValue() - right.doubleValue());
- }
- }
-
- protected Number multiply(Number left, Number right)
- {
- switch (numberType(left, right))
- {
-
- case INTEGER:
- return new Integer(left.intValue() * right.intValue());
-
- case LONG:
- return new Long(left.longValue() * right.longValue());
-
- default:
- return new Double(left.doubleValue() * right.doubleValue());
- }
- }
-
- protected Number divide(Number left, Number right)
- {
- return new Double(left.doubleValue() / right.doubleValue());
- }
-
- protected Number mod(Number left, Number right)
- {
- return new Double(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 RuntimeException("Cannot convert value: " + value + " into a number");
- }
- }
-
- public Object evaluate(AMQMessage message) throws AMQException
- {
- Object lvalue = left.evaluate(message);
- if (lvalue == null)
- {
- return null;
- }
-
- Object rvalue = right.evaluate(message);
- if (rvalue == null)
- {
- return null;
- }
-
- return evaluate(lvalue, rvalue);
- }
-
- /**
- * @param lvalue
- * @param rvalue
- * @return
- */
- protected abstract Object evaluate(Object lvalue, Object rvalue);
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java
deleted file mode 100644
index 024257bea9..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.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.server.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
-{
- protected Expression left;
- protected 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
- */
- public abstract String getExpressionSymbol();
-
- /**
- * @param expression
- */
- public void setRight(Expression expression)
- {
- right = expression;
- }
-
- /**
- * @param expression
- */
- public void setLeft(Expression expression)
- {
- left = expression;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/BooleanExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/BooleanExpression.java
deleted file mode 100644
index e28ff79820..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/BooleanExpression.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.server.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * A BooleanExpression is an expression that always
- * produces a Boolean result.
- */
-public interface BooleanExpression extends Expression
-{
-
- /**
- * @param message
- * @return true if the expression evaluates to Boolean.TRUE.
- * @throws AMQException
- */
- public boolean matches(AMQMessage message) throws AMQException;
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java
deleted file mode 100644
index 72a9ef7969..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.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;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * 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 REGEXP_CONTROL_CHARS = new HashSet();
-
- static
- {
- REGEXP_CONTROL_CHARS.add(new Character('.'));
- REGEXP_CONTROL_CHARS.add(new Character('\\'));
- REGEXP_CONTROL_CHARS.add(new Character('['));
- REGEXP_CONTROL_CHARS.add(new Character(']'));
- REGEXP_CONTROL_CHARS.add(new Character('^'));
- REGEXP_CONTROL_CHARS.add(new Character('$'));
- REGEXP_CONTROL_CHARS.add(new Character('?'));
- REGEXP_CONTROL_CHARS.add(new Character('*'));
- REGEXP_CONTROL_CHARS.add(new Character('+'));
- REGEXP_CONTROL_CHARS.add(new Character('{'));
- REGEXP_CONTROL_CHARS.add(new Character('}'));
- REGEXP_CONTROL_CHARS.add(new Character('|'));
- REGEXP_CONTROL_CHARS.add(new Character('('));
- REGEXP_CONTROL_CHARS.add(new Character(')'));
- REGEXP_CONTROL_CHARS.add(new Character(':'));
- REGEXP_CONTROL_CHARS.add(new Character('&'));
- REGEXP_CONTROL_CHARS.add(new Character('<'));
- REGEXP_CONTROL_CHARS.add(new Character('>'));
- REGEXP_CONTROL_CHARS.add(new Character('='));
- REGEXP_CONTROL_CHARS.add(new Character('!'));
- }
-
- static class LikeExpression extends UnaryExpression implements BooleanExpression
- {
-
- Pattern likePattern;
-
- /**
- * @param right
- */
- 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(new Character(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(AMQMessage message) throws AMQException
- {
-
- Object rv = this.getRight().evaluate(message);
-
- if (rv == null)
- {
- return null;
- }
-
- if (!(rv instanceof String))
- {
- return
- Boolean.FALSE;
- // throw new RuntimeException("LIKE can only operate on String identifiers. LIKE attemped on: '" + rv.getClass());
- }
-
- return likePattern.matcher((String) rv).matches() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public boolean matches(AMQMessage message) throws AMQException
- {
- 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 RuntimeException(
- "The ESCAPE string litteral 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 RuntimeException("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 RuntimeException("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 ComparisonExpression(left, right)
- {
-
- public Object evaluate(AMQMessage message) throws AMQException
- {
- Object lv = left.evaluate(message);
- Object rv = right.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 "=";
- }
- };
- }
-
- 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 >, >=, < or <= expressions.s
- *
- * @param expr
- */
- 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 RuntimeException("Value '" + expr + "' cannot be compared.");
- }
-
- if (expr instanceof BooleanExpression)
- {
- throw new RuntimeException("Value '" + expr + "' cannot be compared.");
- }
- }
-
- /**
- * Validates that the expression can be used in == or <> expression.
- * Cannot not be NULL TRUE or FALSE litterals.
- *
- * @param expr
- */
- public static void checkEqualOperand(Expression expr)
- {
- if (expr instanceof ConstantExpression)
- {
- Object value = ((ConstantExpression) expr).getValue();
- if (value == null)
- {
- throw new RuntimeException("'" + 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 RuntimeException("'" + left + "' cannot be compared with '" + right + "'");
- }
- }
- }
-
- /**
- * @param left
- * @param right
- */
- public ComparisonExpression(Expression left, Expression right)
- {
- super(left, right);
- }
-
- public Object evaluate(AMQMessage message) throws AMQException
- {
- Comparable lv = (Comparable) left.evaluate(message);
- if (lv == null)
- {
- return null;
- }
-
- Comparable rv = (Comparable) right.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 = new Short(((Number) lv).shortValue());
- }
- else if (rc == Integer.class)
- {
- lv = new Integer(((Number) lv).intValue());
- }
- else if (rc == Long.class)
- {
- lv = new Long(((Number) lv).longValue());
- }
- else if (rc == Float.class)
- {
- lv = new Float(((Number) lv).floatValue());
- }
- else if (rc == Double.class)
- {
- lv = new Double(((Number) lv).doubleValue());
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Short.class)
- {
- if (rc == Integer.class)
- {
- lv = new Integer(((Number) lv).intValue());
- }
- else if (rc == Long.class)
- {
- lv = new Long(((Number) lv).longValue());
- }
- else if (rc == Float.class)
- {
- lv = new Float(((Number) lv).floatValue());
- }
- else if (rc == Double.class)
- {
- lv = new Double(((Number) lv).doubleValue());
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Integer.class)
- {
- if (rc == Long.class)
- {
- lv = new Long(((Number) lv).longValue());
- }
- else if (rc == Float.class)
- {
- lv = new Float(((Number) lv).floatValue());
- }
- else if (rc == Double.class)
- {
- lv = new Double(((Number) lv).doubleValue());
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Long.class)
- {
- if (rc == Integer.class)
- {
- rv = new Long(((Number) rv).longValue());
- }
- else if (rc == Float.class)
- {
- lv = new Float(((Number) lv).floatValue());
- }
- else if (rc == Double.class)
- {
- lv = new Double(((Number) lv).doubleValue());
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Float.class)
- {
- if (rc == Integer.class)
- {
- rv = new Float(((Number) rv).floatValue());
- }
- else if (rc == Long.class)
- {
- rv = new Float(((Number) rv).floatValue());
- }
- else if (rc == Double.class)
- {
- lv = new Double(((Number) lv).doubleValue());
- }
- else
- {
- return Boolean.FALSE;
- }
- }
- else if (lc == Double.class)
- {
- if (rc == Integer.class)
- {
- rv = new Double(((Number) rv).doubleValue());
- }
- else if (rc == Long.class)
- {
- rv = new Double(((Number) rv).doubleValue());
- }
- else if (rc == Float.class)
- {
- rv = new Float(((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(AMQMessage message) throws AMQException
- {
- Object object = evaluate(message);
-
- return (object != null) && (object == Boolean.TRUE);
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ConstantExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ConstantExpression.java
deleted file mode 100644
index 0e729cc521..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ConstantExpression.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.server.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 org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * 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(AMQMessage message) throws AMQException
- {
- 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 = new Long(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 = new Integer(value.intValue());
- }
-
- return new ConstantExpression(value);
- }
-
- public static ConstantExpression createFromHex(String text)
- {
- Number value = new Long(Long.parseLong(text.substring(2), 16));
- long l = value.longValue();
- if ((Integer.MIN_VALUE <= l) && (l <= Integer.MAX_VALUE))
- {
- value = new Integer(value.intValue());
- }
-
- return new ConstantExpression(value);
- }
-
- public static ConstantExpression createFromOctal(String text)
- {
- Number value = new Long(Long.parseLong(text, 8));
- long l = value.longValue();
- if ((Integer.MIN_VALUE <= l) && (l <= Integer.MAX_VALUE))
- {
- value = new Integer(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(AMQMessage message) throws AMQException
- {
- 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).booleanValue() ? "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
- * @return
- */
- public static String encodeString(String s)
- {
- StringBuffer b = new StringBuffer();
- 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/broker/src/main/java/org/apache/qpid/server/filter/Expression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/Expression.java
deleted file mode 100644
index 5f646c15db..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/Expression.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.server.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * Represents an expression
- */
-public interface Expression
-{
-
- /**
- * @return the value of this expression
- */
- public Object evaluate(AMQMessage message) throws AMQException;
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManager.java
deleted file mode 100644
index c82de9fa15..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManager.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.server.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import org.apache.qpid.server.queue.AMQMessage;
-
-public interface FilterManager
-{
- void add(MessageFilter filter);
-
- void remove(MessageFilter filter);
-
- boolean allAllow(AMQMessage msg);
-
- boolean hasFilters();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java
deleted file mode 100644
index 311f0680ec..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.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.
- *
- *
- */
-package org.apache.qpid.server.filter;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.common.AMQPFilterTypes;
-import org.apache.qpid.framing.FieldTable;
-
-
-public class FilterManagerFactory
-{
- //private final static Logger _logger = LoggerFactory.getLogger(FilterManagerFactory.class);
- private final static org.apache.log4j.Logger _logger = org.apache.log4j.Logger.getLogger(FilterManagerFactory.class);
-
- //fixme move to a common class so it can be refered to from client code.
-
- public static FilterManager createManager(FieldTable filters) throws AMQException
- {
- FilterManager manager = null;
-
- if (filters != null)
- {
-
- manager = new SimpleFilterManager();
-
- if(filters.containsKey(AMQPFilterTypes.JMS_SELECTOR.getValue()))
- {
- String selector = filters.getString(AMQPFilterTypes.JMS_SELECTOR.getValue());
-
- if (selector != null && !selector.equals(""))
- {
- manager.add(new JMSSelectorFilter(selector));
- }
-
- }
-
- if (filters.containsKey(AMQPFilterTypes.NO_CONSUME.getValue()))
- {
- manager.add(new NoConsumerFilter());
- }
-
-
-
- //If we added no filters don't bear the overhead of having an filter manager
- if (!manager.hasFilters())
- {
- manager = null;
- }
- }
- else
- {
- _logger.debug("No Filters found.");
- }
-
-
- return manager;
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/JMSSelectorFilter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/JMSSelectorFilter.java
deleted file mode 100644
index 32f58ed666..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/JMSSelectorFilter.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.filter;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.filter.jms.selector.SelectorParser;
-import org.apache.qpid.server.queue.AMQMessage;
-
-
-
-public class JMSSelectorFilter implements MessageFilter
-{
- private final static Logger _logger = org.apache.log4j.Logger.getLogger(JMSSelectorFilter.class);
-
- private String _selector;
- private BooleanExpression _matcher;
-
- public JMSSelectorFilter(String selector) throws AMQException
- {
- _selector = selector;
- _logger.info("Created JMSSelectorFilter with selector:" + _selector);
-
-
- _matcher = new SelectorParser().parse(selector);
-
-
- }
-
- public boolean matches(AMQMessage message)
- {
- try
- {
- boolean match = _matcher.matches(message);
- _logger.info(message + " match(" + match + ") selector(" + System.identityHashCode(_selector) + "):" + _selector);
- return match;
- }
- catch (AMQException e)
- {
- //fixme this needs to be sorted.. it shouldn't happen
- e.printStackTrace();
- }
- return false;
- }
-
- public String getSelector()
- {
- return _selector;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java
deleted file mode 100644
index c8cbdb2125..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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.server.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * 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 LogicExpression(lvalue, rvalue)
- {
-
- public Object evaluate(AMQMessage message) throws AMQException
- {
-
- Boolean lv = (Boolean) left.evaluate(message);
- // Can we do an OR shortcut??
- if ((lv != null) && lv.booleanValue())
- {
- return Boolean.TRUE;
- }
-
- Boolean rv = (Boolean) right.evaluate(message);
-
- return (rv == null) ? null : rv;
- }
-
- public String getExpressionSymbol()
- {
- return "OR";
- }
- };
- }
-
- public static BooleanExpression createAND(BooleanExpression lvalue, BooleanExpression rvalue)
- {
- return new LogicExpression(lvalue, rvalue)
- {
-
- public Object evaluate(AMQMessage message) throws AMQException
- {
-
- Boolean lv = (Boolean) left.evaluate(message);
-
- // Can we do an AND shortcut??
- if (lv == null)
- {
- return null;
- }
-
- if (!lv.booleanValue())
- {
- return Boolean.FALSE;
- }
-
- Boolean rv = (Boolean) right.evaluate(message);
-
- return (rv == null) ? null : rv;
- }
-
- public String getExpressionSymbol()
- {
- return "AND";
- }
- };
- }
-
- /**
- * @param left
- * @param right
- */
- public LogicExpression(BooleanExpression left, BooleanExpression right)
- {
- super(left, right);
- }
-
- public abstract Object evaluate(AMQMessage message) throws AMQException;
-
- public boolean matches(AMQMessage message) throws AMQException
- {
- Object object = evaluate(message);
-
- return (object != null) && (object == Boolean.TRUE);
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/MessageFilter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/MessageFilter.java
deleted file mode 100644
index e6bfe974d5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/MessageFilter.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.server.filter;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-public interface MessageFilter
-{
- boolean matches(AMQMessage message) throws AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java
deleted file mode 100644
index 47ca930d12..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.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.server.filter;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-public class NoConsumerFilter implements MessageFilter
-{
- private final static Logger _logger = org.apache.log4j.Logger.getLogger(NoConsumerFilter.class);
-
-
- public NoConsumerFilter() throws AMQException
- {
- _logger.info("Created NoConsumerFilter");
- }
-
- public boolean matches(AMQMessage message)
- {
- return true;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/PropertyExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/PropertyExpression.java
deleted file mode 100644
index 5ab360ca19..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/PropertyExpression.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.server.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import java.util.HashMap;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.CommonContentHeaderProperties;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * Represents a property expression
- */
-public class PropertyExpression implements Expression
-{
- // Constants - defined the same as JMS
- private static final int NON_PERSISTENT = 1;
- private static final int PERSISTENT = 2;
- private static final int DEFAULT_PRIORITY = 4;
-
- private static final Logger _logger = org.apache.log4j.Logger.getLogger(PropertyExpression.class);
-
- private static final HashMap<String, Expression> JMS_PROPERTY_EXPRESSIONS = new HashMap<String, Expression>();
-
- static
- {
- JMS_PROPERTY_EXPRESSIONS.put("JMSDestination", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
- //TODO
- return null;
- }
- });
- JMS_PROPERTY_EXPRESSIONS.put("JMSReplyTo", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
- try
- {
- CommonContentHeaderProperties _properties =
- (CommonContentHeaderProperties)
- message.getContentHeaderBody().properties;
- AMQShortString replyTo = _properties.getReplyTo();
-
- return (replyTo == null) ? null : replyTo.toString();
- }
- catch (AMQException e)
- {
- _logger.warn(e);
-
- return null;
- }
-
- }
-
- });
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSType", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
- try
- {
- CommonContentHeaderProperties _properties =
- (CommonContentHeaderProperties)
- message.getContentHeaderBody().properties;
- AMQShortString type = _properties.getType();
-
- return (type == null) ? null : type.toString();
- }
- catch (AMQException e)
- {
- _logger.warn(e);
-
- return null;
- }
-
- }
- });
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSDeliveryMode", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
- try
- {
- int mode = message.isPersistent() ? PERSISTENT : NON_PERSISTENT;
- if (_logger.isDebugEnabled())
- {
- _logger.debug("JMSDeliveryMode is :" + mode);
- }
-
- return mode;
- }
- catch (AMQException e)
- {
- _logger.warn(e);
- }
-
- return NON_PERSISTENT;
- }
- });
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSPriority", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
- try
- {
- CommonContentHeaderProperties _properties =
- (CommonContentHeaderProperties)
- message.getContentHeaderBody().properties;
-
- return (int) _properties.getPriority();
- }
- catch (AMQException e)
- {
- _logger.warn(e);
- }
-
- return DEFAULT_PRIORITY;
- }
- });
-
- JMS_PROPERTY_EXPRESSIONS.put("AMQMessageID", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
-
- try
- {
- CommonContentHeaderProperties _properties =
- (CommonContentHeaderProperties)
- message.getContentHeaderBody().properties;
- AMQShortString messageId = _properties.getMessageId();
-
- return (messageId == null) ? null : messageId;
- }
- catch (AMQException e)
- {
- _logger.warn(e);
-
- return null;
- }
-
- }
- });
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSTimestamp", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
-
- try
- {
- CommonContentHeaderProperties _properties =
- (CommonContentHeaderProperties)
- message.getContentHeaderBody().properties;
-
- return _properties.getTimestamp();
- }
- catch (AMQException e)
- {
- _logger.warn(e);
-
- return null;
- }
-
- }
- });
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSCorrelationID", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
-
- try
- {
- CommonContentHeaderProperties _properties =
- (CommonContentHeaderProperties)
- message.getContentHeaderBody().properties;
- AMQShortString correlationId = _properties.getCorrelationId();
-
- return (correlationId == null) ? null : correlationId.toString();
- }
- catch (AMQException e)
- {
- _logger.warn(e);
-
- return null;
- }
-
- }
- });
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSExpiration", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
-
- try
- {
- CommonContentHeaderProperties _properties =
- (CommonContentHeaderProperties)
- message.getContentHeaderBody().properties;
-
- return _properties.getExpiration();
- }
- catch (AMQException e)
- {
- _logger.warn(e);
-
- return null;
- }
-
- }
- });
-
- JMS_PROPERTY_EXPRESSIONS.put("JMSRedelivered", new Expression()
- {
- public Object evaluate(AMQMessage message)
- {
- return message.isRedelivered();
- }
- });
-
- }
-
- private final String name;
- private final Expression jmsPropertyExpression;
-
- public PropertyExpression(String name)
- {
- this.name = name;
- jmsPropertyExpression = JMS_PROPERTY_EXPRESSIONS.get(name);
- }
-
- public Object evaluate(AMQMessage message) throws AMQException
- {
-
- if (jmsPropertyExpression != null)
- {
- return jmsPropertyExpression.evaluate(message);
- }
- else
- {
-
- CommonContentHeaderProperties _properties =
- (CommonContentHeaderProperties) message.getContentHeaderBody().properties;
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Looking up property:" + name);
- _logger.debug("Properties are:" + _properties.getHeaders().keySet());
- }
-
- return _properties.getHeaders().getObject(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);
-
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/SimpleFilterManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/SimpleFilterManager.java
deleted file mode 100644
index 62a45f5420..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/SimpleFilterManager.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.filter;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-public class SimpleFilterManager implements FilterManager
-{
- private final Logger _logger = Logger.getLogger(SimpleFilterManager.class);
-
- private final ConcurrentLinkedQueue<MessageFilter> _filters;
-
- public SimpleFilterManager()
- {
- _logger.debug("Creating SimpleFilterManager");
- _filters = new ConcurrentLinkedQueue<MessageFilter>();
- }
-
- public void add(MessageFilter filter)
- {
- _filters.add(filter);
- }
-
- public void remove(MessageFilter filter)
- {
- _filters.remove(filter);
- }
-
- public boolean allAllow(AMQMessage msg)
- {
- for (MessageFilter filter : _filters)
- {
- try
- {
- if (!filter.matches(msg))
- {
- return false;
- }
- }
- catch (AMQException e)
- {
- //fixme
- e.printStackTrace();
- return false;
- }
- }
- return true;
- }
-
- public boolean hasFilters()
- {
- return !_filters.isEmpty();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/UnaryExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/UnaryExpression.java
deleted file mode 100644
index 83b4ed5358..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/UnaryExpression.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.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.Iterator;
-import java.util.List;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-/**
- * 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);
- protected Expression right;
-
- public static Expression createNegate(Expression left)
- {
- return new UnaryExpression(left)
- {
- public Object evaluate(AMQMessage message) throws AMQException
- {
- Object rvalue = right.evaluate(message);
- if (rvalue == null)
- {
- return null;
- }
-
- if (rvalue instanceof Number)
- {
- return negate((Number) rvalue);
- }
-
- return null;
- }
-
- public String getExpressionSymbol()
- {
- return "-";
- }
- };
- }
-
- 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 BooleanUnaryExpression(right)
- {
- public Object evaluate(AMQMessage message) throws AMQException
- {
-
- Object rvalue = right.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()
- {
- StringBuffer answer = new StringBuffer();
- answer.append(right);
- answer.append(" ");
- answer.append(getExpressionSymbol());
- answer.append(" ( ");
-
- int count = 0;
- for (Iterator i = inList.iterator(); i.hasNext();)
- {
- Object o = (Object) i.next();
- 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";
- }
- }
- };
- }
-
- abstract static class BooleanUnaryExpression extends UnaryExpression implements BooleanExpression
- {
- public BooleanUnaryExpression(Expression left)
- {
- super(left);
- }
-
- public boolean matches(AMQMessage message) throws AMQException
- {
- Object object = evaluate(message);
-
- return (object != null) && (object == Boolean.TRUE);
- }
- }
- ;
-
- public static BooleanExpression createNOT(BooleanExpression left)
- {
- return new BooleanUnaryExpression(left)
- {
- public Object evaluate(AMQMessage message) throws AMQException
- {
- Boolean lvalue = (Boolean) right.evaluate(message);
- if (lvalue == null)
- {
- return null;
- }
-
- return lvalue.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
- }
-
- public String getExpressionSymbol()
- {
- return "NOT";
- }
- };
- }
-
- public static BooleanExpression createXPath(final String xpath)
- {
- return new XPathExpression(xpath);
- }
-
- public static BooleanExpression createXQuery(final String xpath)
- {
- return new XQueryExpression(xpath);
- }
-
- public static BooleanExpression createBooleanCast(Expression left)
- {
- return new BooleanUnaryExpression(left)
- {
- public Object evaluate(AMQMessage message) throws AMQException
- {
- Object rvalue = right.evaluate(message);
- if (rvalue == null)
- {
- return null;
- }
-
- if (!rvalue.getClass().equals(Boolean.class))
- {
- return Boolean.FALSE;
- }
-
- return ((Boolean) rvalue).booleanValue() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public String toString()
- {
- return right.toString();
- }
-
- public String getExpressionSymbol()
- {
- return "";
- }
- };
- }
-
- private static Number negate(Number left)
- {
- Class clazz = left.getClass();
- if (clazz == Integer.class)
- {
- return new Integer(-left.intValue());
- }
- else if (clazz == Long.class)
- {
- return new Long(-left.longValue());
- }
- else if (clazz == Float.class)
- {
- return new Float(-left.floatValue());
- }
- else if (clazz == Double.class)
- {
- return new Double(-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 new Long(Long.MIN_VALUE);
- }
-
- return bd;
- }
- else
- {
- throw new RuntimeException("Don't know how to negate: " + left);
- }
- }
-
- public UnaryExpression(Expression left)
- {
- this.right = left;
- }
-
- public Expression getRight()
- {
- return right;
- }
-
- public void setRight(Expression expression)
- {
- right = expression;
- }
-
- /**
- * @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)
- {
-
- 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
- */
- public abstract String getExpressionSymbol();
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XPathExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XPathExpression.java
deleted file mode 100644
index f5454afae5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XPathExpression.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.
- */
-package org.apache.qpid.server.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Used to evaluate an XPath Expression in a JMS selector.
- */
-public final class XPathExpression implements BooleanExpression {
-
- private static final Logger log = Logger.getLogger(XPathExpression.class);
- private static final String EVALUATOR_SYSTEM_PROPERTY = "org.apache.qpid.server.filter.XPathEvaluatorClassName";
- private static final String DEFAULT_EVALUATOR_CLASS_NAME=XalanXPathEvaluator.class.getName();
-
- private static final Constructor EVALUATOR_CONSTRUCTOR;
-
- static {
- String cn = System.getProperty(EVALUATOR_SYSTEM_PROPERTY, DEFAULT_EVALUATOR_CLASS_NAME);
- Constructor m = null;
- try {
- try {
- m = getXPathEvaluatorConstructor(cn);
- } catch (Throwable e) {
- log.warn("Invalid "+XPathEvaluator.class.getName()+" implementation: "+cn+", reason: "+e,e);
- cn = DEFAULT_EVALUATOR_CLASS_NAME;
- try {
- m = getXPathEvaluatorConstructor(cn);
- } catch (Throwable e2) {
- log.error("Default XPath evaluator could not be loaded",e);
- }
- }
- } finally {
- EVALUATOR_CONSTRUCTOR = m;
- }
- }
-
- private static Constructor getXPathEvaluatorConstructor(String cn) throws ClassNotFoundException, SecurityException, NoSuchMethodException {
- Class c = XPathExpression.class.getClassLoader().loadClass(cn);
- if( !XPathEvaluator.class.isAssignableFrom(c) ) {
- throw new ClassCastException(""+c+" is not an instance of "+XPathEvaluator.class);
- }
- return c.getConstructor(new Class[]{String.class});
- }
-
- private final String xpath;
- private final XPathEvaluator evaluator;
-
- static public interface XPathEvaluator {
- public boolean evaluate(AMQMessage message) throws AMQException;
- }
-
- XPathExpression(String xpath) {
- this.xpath = xpath;
- this.evaluator = createEvaluator(xpath);
- }
-
- private XPathEvaluator createEvaluator(String xpath2) {
- try {
- return (XPathEvaluator)EVALUATOR_CONSTRUCTOR.newInstance(new Object[]{xpath});
- } catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- if( cause instanceof RuntimeException ) {
- throw (RuntimeException)cause;
- }
- throw new RuntimeException("Invalid XPath Expression: "+xpath+" reason: "+e.getMessage(), e);
- } catch (Throwable e) {
- throw new RuntimeException("Invalid XPath Expression: "+xpath+" reason: "+e.getMessage(), e);
- }
- }
-
- public Object evaluate(AMQMessage message) throws AMQException {
-// try {
-//FIXME this is flow to disk work
-// if( message.isDropped() )
-// return null;
- return evaluator.evaluate(message) ? Boolean.TRUE : Boolean.FALSE;
-// } catch (IOException e) {
-//
-// JMSException exception = new JMSException(e.getMessage());
-// exception.initCause(e);
-// throw exception;
-//
-// }
-
- }
-
- public String toString() {
- return "XPATH "+ConstantExpression.encodeString(xpath);
- }
-
- /**
- * @param message
- * @return true if the expression evaluates to Boolean.TRUE.
- * @throws AMQException
- */
- public boolean matches(AMQMessage message) throws AMQException
- {
- Object object = evaluate(message);
- return object!=null && object==Boolean.TRUE;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XQueryExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XQueryExpression.java
deleted file mode 100644
index f5debb607a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XQueryExpression.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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.server.filter;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-/**
- * Used to evaluate an XQuery Expression in a JMS selector.
- */
-public final class XQueryExpression implements BooleanExpression {
- private final String xpath;
-
- XQueryExpression(String xpath) {
- super();
- this.xpath = xpath;
- }
-
- public Object evaluate(AMQMessage message) throws AMQException {
- return Boolean.FALSE;
- }
-
- public String toString() {
- return "XQUERY "+ConstantExpression.encodeString(xpath);
- }
-
- /**
- * @param message
- * @return true if the expression evaluates to Boolean.TRUE.
- * @throws AMQException
- */
- public boolean matches(AMQMessage message) throws AMQException
- {
- Object object = evaluate(message);
- return object!=null && object==Boolean.TRUE;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XalanXPathEvaluator.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XalanXPathEvaluator.java
deleted file mode 100644
index 35d770fd5d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/XalanXPathEvaluator.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.server.filter;
-//
-// Based on like named file from r450141 of the Apache ActiveMQ project <http://www.activemq.org/site/home.html>
-//
-
-import java.io.ByteArrayInputStream;
-import java.io.StringReader;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.xpath.CachedXPathAPI;
-import org.w3c.dom.Document;
-import org.w3c.dom.traversal.NodeIterator;
-import org.xml.sax.InputSource;
-
-public class XalanXPathEvaluator implements XPathExpression.XPathEvaluator {
-
- private final String xpath;
-
- public XalanXPathEvaluator(String xpath) {
- this.xpath = xpath;
- }
-
- public boolean evaluate(AMQMessage m) throws AMQException
- {
- // TODO - we would have to check the content type and then evaluate the content
- // here... is this really a feature we wish to implement? - RobG
- /*
-
- if( m instanceof TextMessage ) {
- String text = ((TextMessage)m).getText();
- return evaluate(text);
- } else if ( m instanceof BytesMessage ) {
- BytesMessage bm = (BytesMessage) m;
- byte data[] = new byte[(int) bm.getBodyLength()];
- bm.readBytes(data);
- return evaluate(data);
- }
- */
- return false;
-
- }
-
- private boolean evaluate(byte[] data) {
- try {
-
- InputSource inputSource = new InputSource(new ByteArrayInputStream(data));
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder dbuilder = factory.newDocumentBuilder();
- Document doc = dbuilder.parse(inputSource);
-
- CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
- NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc,xpath);
- return iterator.nextNode()!=null;
-
- } catch (Throwable e) {
- return false;
- }
- }
-
- private boolean evaluate(String text) {
- try {
- InputSource inputSource = new InputSource(new StringReader(text));
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder dbuilder = factory.newDocumentBuilder();
- Document doc = dbuilder.parse(inputSource);
-
- // We should associated the cachedXPathAPI object with the message being evaluated
- // since that should speedup subsequent xpath expressions.
- CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
- NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc,xpath);
- return iterator.nextNode()!=null;
- } catch (Throwable e) {
- return false;
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/AccessRequestHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/AccessRequestHandler.java
deleted file mode 100644
index 6ace626c28..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/AccessRequestHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.apache.qpid.server.handler;
-
-import org.apache.qpid.framing.*;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.AMQException;
-
-/**
- * @author Apache Software Foundation
- *
- *
- */
-public class AccessRequestHandler implements StateAwareMethodListener<AccessRequestBody>
-{
- private static final AccessRequestHandler _instance = new AccessRequestHandler();
-
-
- public static AccessRequestHandler getInstance()
- {
- return _instance;
- }
-
- private AccessRequestHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, AccessRequestBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
-
- // We don't implement access control class, but to keep clients happy that expect it
- // always use the "0" ticket.
- AccessRequestOkBody response = methodRegistry.createAccessRequestOkBody(0);
-
- session.writeFrame(response.generateFrame(channelId));
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicAckMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicAckMethodHandler.java
deleted file mode 100644
index f90e7c3dff..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicAckMethodHandler.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicAckBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class BasicAckMethodHandler implements StateAwareMethodListener<BasicAckBody>
-{
- private static final Logger _log = Logger.getLogger(BasicAckMethodHandler.class);
-
- private static final BasicAckMethodHandler _instance = new BasicAckMethodHandler();
-
- public static BasicAckMethodHandler getInstance()
- {
- return _instance;
- }
-
- private BasicAckMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicAckBody body, int channelId) throws AMQException
- {
- AMQProtocolSession protocolSession = stateManager.getProtocolSession();
-
-
- if (_log.isDebugEnabled())
- {
- _log.debug("Ack(Tag:" + body.getDeliveryTag() + ":Mult:" + body.getMultiple() + ") received on channel " + channelId);
- }
-
- final AMQChannel channel = protocolSession.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- // this method throws an AMQException if the delivery tag is not known
- channel.acknowledgeMessage(body.getDeliveryTag(), body.getMultiple());
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java
deleted file mode 100644
index bda1c16cf6..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.BasicCancelBody;
-import org.apache.qpid.framing.BasicCancelOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.log4j.Logger;
-
-public class BasicCancelMethodHandler implements StateAwareMethodListener<BasicCancelBody>
-{
- private static final Logger _log = Logger.getLogger(BasicCancelMethodHandler.class);
-
- private static final BasicCancelMethodHandler _instance = new BasicCancelMethodHandler();
-
- public static BasicCancelMethodHandler getInstance()
- {
- return _instance;
- }
-
- private BasicCancelMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicCancelBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- final AMQChannel channel = session.getChannel(channelId);
-
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- if (_log.isDebugEnabled())
- {
- _log.debug("BasicCancel: for:" + body.getConsumerTag() +
- " nowait:" + body.getNowait());
- }
-
- channel.unsubscribeConsumer(session, body.getConsumerTag());
- if (!body.getNowait())
- {
- MethodRegistry methodRegistry = session.getMethodRegistry();
- BasicCancelOkBody cancelOkBody = methodRegistry.createBasicCancelOkBody(body.getConsumerTag());
- session.writeFrame(cancelOkBody.generateFrame(channelId));
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java
deleted file mode 100644
index 7cd4afdb77..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.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.
- *
- */
-package org.apache.qpid.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.ConsumerTagNotUniqueException;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class BasicConsumeMethodHandler implements StateAwareMethodListener<BasicConsumeBody>
-{
- private static final Logger _logger = Logger.getLogger(BasicConsumeMethodHandler.class);
-
- private static final BasicConsumeMethodHandler _instance = new BasicConsumeMethodHandler();
-
- public static BasicConsumeMethodHandler getInstance()
- {
- return _instance;
- }
-
- private BasicConsumeMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicConsumeBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
-
-
-
- AMQChannel channel = session.getChannel(channelId);
-
- VirtualHost vHost = session.getVirtualHost();
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
- else
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("BasicConsume: from '" + body.getQueue() +
- "' for:" + body.getConsumerTag() +
- " nowait:" + body.getNowait() +
- " args:" + body.getArguments());
- }
-
- AMQQueue queue = body.getQueue() == null ? channel.getDefaultQueue() : vHost.getQueueRegistry().getQueue(body.getQueue().intern());
-
- if (queue == null)
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("No queue for '" + body.getQueue() + "'");
- }
- if (body.getQueue() != null)
- {
- String msg = "No such queue, '" + body.getQueue() + "'";
- throw body.getChannelException(AMQConstant.NOT_FOUND, msg);
- }
- else
- {
- String msg = "No queue name provided, no default queue defined.";
- throw body.getConnectionException(AMQConstant.NOT_ALLOWED, msg);
- }
- }
- else
- {
-
- final AMQShortString consumerTagName;
-
- //Perform ACLs
- vHost.getAccessManager().authorise(session, Permission.CONSUME, body, queue);
-
- if (body.getConsumerTag() != null)
- {
- consumerTagName = body.getConsumerTag().intern();
- }
- else
- {
- consumerTagName = null;
- }
-
- try
- {
- AMQShortString consumerTag = channel.subscribeToQueue(consumerTagName, queue, session, !body.getNoAck(),
- body.getArguments(), body.getNoLocal(), body.getExclusive());
- if (!body.getNowait())
- {
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createBasicConsumeOkBody(consumerTag);
- session.writeFrame(responseBody.generateFrame(channelId));
-
- }
-
- //now allow queue to start async processing of any backlog of messages
- queue.deliverAsync();
- }
- catch (org.apache.qpid.AMQInvalidArgumentException ise)
- {
- _logger.debug("Closing connection due to invalid selector");
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createChannelCloseBody(AMQConstant.INVALID_ARGUMENT.getCode(),
- new AMQShortString(ise.getMessage()),
- body.getClazz(),
- body.getMethod());
- session.writeFrame(responseBody.generateFrame(channelId));
-
-
- }
- catch (ConsumerTagNotUniqueException e)
- {
- AMQShortString msg = new AMQShortString("Non-unique consumer tag, '" + body.getConsumerTag() + "'");
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createConnectionCloseBody(AMQConstant.NOT_ALLOWED.getCode(), // replyCode
- msg, // replytext
- body.getClazz(),
- body.getMethod());
- session.writeFrame(responseBody.generateFrame(0));
- }
- catch (AMQQueue.ExistingExclusiveSubscription e)
- {
- throw body.getChannelException(AMQConstant.ACCESS_REFUSED,
- "Cannot subscribe to queue "
- + queue.getName()
- + " as it already has an existing exclusive consumer");
- }
- catch (AMQQueue.ExistingSubscriptionPreventsExclusive e)
- {
- throw body.getChannelException(AMQConstant.ACCESS_REFUSED,
- "Cannot subscribe to queue "
- + queue.getName()
- + " exclusively as it already has a consumer");
- }
-
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicGetMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicGetMethodHandler.java
deleted file mode 100644
index f8f9127809..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicGetMethodHandler.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicGetBody;
-import org.apache.qpid.framing.BasicGetEmptyBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class BasicGetMethodHandler implements StateAwareMethodListener<BasicGetBody>
-{
- private static final Logger _log = Logger.getLogger(BasicGetMethodHandler.class);
-
- private static final BasicGetMethodHandler _instance = new BasicGetMethodHandler();
-
- public static BasicGetMethodHandler getInstance()
- {
- return _instance;
- }
-
- private BasicGetMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicGetBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
-
- VirtualHost vHost = session.getVirtualHost();
-
- AMQChannel channel = session.getChannel(channelId);
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
- else
- {
- AMQQueue queue = body.getQueue() == null ? channel.getDefaultQueue() : vHost.getQueueRegistry().getQueue(body.getQueue());
-
- if (queue == null)
- {
- _log.info("No queue for '" + body.getQueue() + "'");
- if(body.getQueue()!=null)
- {
- throw body.getConnectionException(AMQConstant.NOT_FOUND,
- "No such queue, '" + body.getQueue()+ "'");
- }
- else
- {
- throw body.getConnectionException(AMQConstant.NOT_ALLOWED,
- "No queue name provided, no default queue defined.");
- }
- }
- else
- {
-
- //Perform ACLs
- vHost.getAccessManager().authorise(session, Permission.CONSUME, body, queue);
-
- if (!queue.performGet(session, channel, !body.getNoAck()))
- {
- MethodRegistry methodRegistry = session.getMethodRegistry();
- // TODO - set clusterId
- BasicGetEmptyBody responseBody = methodRegistry.createBasicGetEmptyBody(null);
-
-
- session.writeFrame(responseBody.generateFrame(channelId));
- }
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java
deleted file mode 100644
index 0f99a21ee5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.BasicPublishBody;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class BasicPublishMethodHandler implements StateAwareMethodListener<BasicPublishBody>
-{
- private static final Logger _logger = Logger.getLogger(BasicPublishMethodHandler.class);
-
- private static final BasicPublishMethodHandler _instance = new BasicPublishMethodHandler();
-
-
- public static BasicPublishMethodHandler getInstance()
- {
- return _instance;
- }
-
- private BasicPublishMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicPublishBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Publish received on channel " + channelId);
- }
-
- AMQShortString exchange = body.getExchange();
- // TODO: check the delivery tag field details - is it unique across the broker or per subscriber?
- if (exchange == null)
- {
- exchange = ExchangeDefaults.DEFAULT_EXCHANGE_NAME;
-
- }
-
- VirtualHost vHost = session.getVirtualHost();
- Exchange e = vHost.getExchangeRegistry().getExchange(exchange);
- // if the exchange does not exist we raise a channel exception
- if (e == null)
- {
- throw body.getChannelException(AMQConstant.NOT_FOUND, "Unknown exchange name");
- }
- else
- {
- // The partially populated BasicDeliver frame plus the received route body
- // is stored in the channel. Once the final body frame has been received
- // it is routed to the exchange.
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- //Access Control
- vHost.getAccessManager().authorise(session, Permission.PUBLISH, body, e);
-
- MessagePublishInfo info = session.getMethodRegistry().getProtocolVersionMethodConverter().convertToInfo(body);
- info.setExchange(exchange);
- channel.setPublishFrame(info, session, e);
- }
- }
-
-}
-
-
-
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java
deleted file mode 100644
index 3c95180dca..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicQosBody;
-import org.apache.qpid.framing.BasicQosOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.AMQChannel;
-
-public class BasicQosHandler implements StateAwareMethodListener<BasicQosBody>
-{
- private static final BasicQosHandler _instance = new BasicQosHandler();
-
- public static BasicQosHandler getInstance()
- {
- return _instance;
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicQosBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- AMQChannel channel = session.getChannel(channelId);
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- channel.setPrefetchCount(body.getPrefetchCount());
- channel.setPrefetchSize(body.getPrefetchSize());
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createBasicQosOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverMethodHandler.java
deleted file mode 100644
index c7842cd643..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverMethodHandler.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.
- *
- */
-package org.apache.qpid.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicRecoverBody;
-import org.apache.qpid.framing.BasicRecoverOkBody;
-import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.amqp_8_0.MethodRegistry_8_0;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class BasicRecoverMethodHandler implements StateAwareMethodListener<BasicRecoverBody>
-{
- private static final Logger _logger = Logger.getLogger(BasicRecoverMethodHandler.class);
-
- private static final BasicRecoverMethodHandler _instance = new BasicRecoverMethodHandler();
-
- public static BasicRecoverMethodHandler getInstance()
- {
- return _instance;
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicRecoverBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- _logger.debug("Recover received on protocol session " + session + " and channel " + channelId);
- AMQChannel channel = session.getChannel(channelId);
-
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- channel.resend(body.getRequeue());
-
- // Qpid 0-8 hacks a synchronous -ok onto recover.
- // In Qpid 0-9 we create a separate sync-recover, sync-recover-ok pair to be "more" compliant
- if(session.getProtocolVersion().equals(ProtocolVersion.v8_0))
- {
- MethodRegistry_8_0 methodRegistry = (MethodRegistry_8_0) session.getMethodRegistry();
- AMQMethodBody recoverOk = methodRegistry.createBasicRecoverOkBody();
- session.writeFrame(recoverOk.generateFrame(channelId));
-
- }
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverSyncMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverSyncMethodHandler.java
deleted file mode 100644
index 15484273c8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverSyncMethodHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.qpid.server.handler;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.framing.BasicRecoverBody;
-import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.BasicRecoverSyncBody;
-import org.apache.qpid.framing.amqp_0_9.MethodRegistry_0_9;
-import org.apache.qpid.framing.amqp_8_0.MethodRegistry_8_0;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.AMQException;
-
-public class BasicRecoverSyncMethodHandler implements StateAwareMethodListener<BasicRecoverSyncBody>
-{
- private static final Logger _logger = Logger.getLogger(BasicRecoverSyncMethodHandler.class);
-
- private static final BasicRecoverSyncMethodHandler _instance = new BasicRecoverSyncMethodHandler();
-
- public static BasicRecoverSyncMethodHandler getInstance()
- {
- return _instance;
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicRecoverSyncBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- _logger.debug("Recover received on protocol session " + session + " and channel " + channelId);
- AMQChannel channel = session.getChannel(channelId);
-
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- channel.resend(body.getRequeue());
-
- // Qpid 0-8 hacks a synchronous -ok onto recover.
- // In Qpid 0-9 we create a separate sync-recover, sync-recover-ok pair to be "more" compliant
- if(session.getProtocolVersion().equals(ProtocolVersion.v0_9))
- {
- MethodRegistry_0_9 methodRegistry = (MethodRegistry_0_9) session.getMethodRegistry();
- AMQMethodBody recoverOk = methodRegistry.createBasicRecoverSyncOkBody();
- session.writeFrame(recoverOk.generateFrame(channelId));
-
- }
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRejectMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRejectMethodHandler.java
deleted file mode 100644
index 069cc6ea2c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRejectMethodHandler.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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicRejectBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.ack.UnacknowledgedMessage;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.log4j.Logger;
-
-public class BasicRejectMethodHandler implements StateAwareMethodListener<BasicRejectBody>
-{
- private static final Logger _logger = Logger.getLogger(BasicRejectMethodHandler.class);
-
- private static BasicRejectMethodHandler _instance = new BasicRejectMethodHandler();
-
- public static BasicRejectMethodHandler getInstance()
- {
- return _instance;
- }
-
- private BasicRejectMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, BasicRejectBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
-
-
-// if (_logger.isDebugEnabled())
-// {
-// _logger.debug("Rejecting:" + evt.getMethod().deliveryTag +
-// ": Requeue:" + evt.getMethod().requeue +
-//// ": Resend:" + evt.getMethod().resend +
-// " on channel:" + channelId);
-// }
-
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Rejecting:" + body.getDeliveryTag() +
- ": Requeue:" + body.getRequeue() +
- //": Resend:" + evt.getMethod().resend +
- " on channel:" + channel.debugIdentity());
- }
-
- long deliveryTag = body.getDeliveryTag();
-
- UnacknowledgedMessage message = channel.getUnacknowledgedMessageMap().get(deliveryTag);
-
- if (message == null)
- {
- _logger.warn("Dropping reject request as message is null for tag:" + deliveryTag);
-// throw evt.getMethod().getChannelException(AMQConstant.NOT_FOUND, "Delivery Tag(" + deliveryTag + ")not known");
- }
- else
- {
- if (message.isQueueDeleted() || message.getQueue().isDeleted())
- {
- _logger.warn("Message's Queue as already been purged, unable to Reject. " +
- "Dropping message should use Dead Letter Queue");
- //sendtoDeadLetterQueue(msg)
- return;
- }
-
- if (!message.getMessage().isReferenced())
- {
- _logger.warn("Message as already been purged, unable to Reject.");
- return;
- }
-
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Rejecting: DT:" + deliveryTag + "-" + message.getMessage().debugIdentity() +
- ": Requeue:" + body.getRequeue() +
- //": Resend:" + evt.getMethod().resend +
- " on channel:" + channel.debugIdentity());
- }
-
- // If we haven't requested message to be resent to this consumer then reject it from ever getting it.
- //if (!evt.getMethod().resend)
- {
- message.entry.reject();
- }
-
- if (body.getRequeue())
- {
- channel.requeue(deliveryTag);
- }
- else
- {
- _logger.warn("Dropping message as requeue not required and there is no dead letter queue");
- //sendtoDeadLetterQueue(AMQMessage message)
-// message.queue = channel.getDefaultDeadLetterQueue();
-// channel.requeue(deliveryTag);
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java
deleted file mode 100644
index 9133cce6b7..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.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.
- *
- */
-package org.apache.qpid.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.ChannelCloseBody;
-import org.apache.qpid.framing.ChannelCloseOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.AMQChannel;
-
-public class ChannelCloseHandler implements StateAwareMethodListener<ChannelCloseBody>
-{
- private static final Logger _logger = Logger.getLogger(ChannelCloseHandler.class);
-
- private static ChannelCloseHandler _instance = new ChannelCloseHandler();
-
- public static ChannelCloseHandler getInstance()
- {
- return _instance;
- }
-
- private ChannelCloseHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ChannelCloseBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- if (_logger.isInfoEnabled())
- {
- _logger.info("Received channel close for id " + channelId + " citing class " + body.getClassId() +
- " and method " + body.getMethodId());
- }
-
-
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getConnectionException(AMQConstant.CHANNEL_ERROR, "Trying to close unknown channel");
- }
-
- session.closeChannel(channelId);
- // Client requested closure so we don't wait for ok we send it
- stateManager.getProtocolSession().closeChannelOk(channelId);
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- ChannelCloseOkBody responseBody = methodRegistry.createChannelCloseOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseOkHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseOkHandler.java
deleted file mode 100644
index a857490e7e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseOkHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.ChannelCloseOkBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class ChannelCloseOkHandler implements StateAwareMethodListener<ChannelCloseOkBody>
-{
- private static final Logger _logger = Logger.getLogger(ChannelCloseOkHandler.class);
-
- private static ChannelCloseOkHandler _instance = new ChannelCloseOkHandler();
-
- public static ChannelCloseOkHandler getInstance()
- {
- return _instance;
- }
-
- private ChannelCloseOkHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ChannelCloseOkBody body, int channelId) throws AMQException
- {
-
- _logger.info("Received channel-close-ok for channel-id " + channelId);
-
- // Let the Protocol Session know the channel is now closed.
- stateManager.getProtocolSession().closeChannelOk(channelId);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
deleted file mode 100644
index 696ca8a63b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class ChannelFlowHandler implements StateAwareMethodListener<ChannelFlowBody>
-{
- private static final Logger _logger = Logger.getLogger(ChannelFlowHandler.class);
-
- private static ChannelFlowHandler _instance = new ChannelFlowHandler();
-
- public static ChannelFlowHandler getInstance()
- {
- return _instance;
- }
-
- private ChannelFlowHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ChannelFlowBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
-
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- channel.setSuspended(!body.getActive());
- _logger.debug("Channel.Flow for channel " + channelId + ", active=" + body.getActive());
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createChannelFlowOkBody(body.getActive());
- session.writeFrame(responseBody.generateFrame(channelId));
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java
deleted file mode 100644
index 054674aed4..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.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.server.handler;
-
-import java.util.UUID;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.framing.amqp_0_9.MethodRegistry_0_9;
-import org.apache.qpid.framing.amqp_8_0.MethodRegistry_8_0;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class ChannelOpenHandler implements StateAwareMethodListener<ChannelOpenBody>
-{
- private static ChannelOpenHandler _instance = new ChannelOpenHandler();
-
- public static ChannelOpenHandler getInstance()
- {
- return _instance;
- }
-
- private ChannelOpenHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ChannelOpenBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- VirtualHost virtualHost = session.getVirtualHost();
-
- final AMQChannel channel = new AMQChannel(session,channelId, virtualHost.getMessageStore()
- );
- session.addChannel(channel);
-
- ChannelOpenOkBody response;
-
- ProtocolVersion pv = session.getProtocolVersion();
-
- if(pv.equals(ProtocolVersion.v8_0))
- {
- MethodRegistry_8_0 methodRegistry = (MethodRegistry_8_0) MethodRegistry.getMethodRegistry(ProtocolVersion.v8_0);
- response = methodRegistry.createChannelOpenOkBody();
-
- }
- else if(pv.equals(ProtocolVersion.v0_9))
- {
- MethodRegistry_0_9 methodRegistry = (MethodRegistry_0_9) MethodRegistry.getMethodRegistry(ProtocolVersion.v0_9);
- UUID uuid = UUID.randomUUID();
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- DataOutputStream dataOut = new DataOutputStream(output);
- try
- {
- dataOut.writeLong(uuid.getMostSignificantBits());
- dataOut.writeLong(uuid.getLeastSignificantBits());
- dataOut.flush();
- dataOut.close();
- }
- catch (IOException e)
- {
- // This *really* shouldn't happen as we're not doing any I/O
- throw new RuntimeException("I/O exception when writing to byte array", e);
- }
-
- // should really associate this channelId to the session
- byte[] channelName = output.toByteArray();
-
- response = methodRegistry.createChannelOpenOkBody(channelName);
- }
- else
- {
- throw new AMQException(AMQConstant.INTERNAL_ERROR, "Got channel open for protocol version not catered for: " + pv, null);
- }
-
-
- session.writeFrame(response.generateFrame(channelId));
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java
deleted file mode 100644
index dade5d5f54..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.ConnectionCloseBody;
-import org.apache.qpid.framing.ConnectionCloseOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class ConnectionCloseMethodHandler implements StateAwareMethodListener<ConnectionCloseBody>
-{
- private static final Logger _logger = Logger.getLogger(ConnectionCloseMethodHandler.class);
-
- private static ConnectionCloseMethodHandler _instance = new ConnectionCloseMethodHandler();
-
- public static ConnectionCloseMethodHandler getInstance()
- {
- return _instance;
- }
-
- private ConnectionCloseMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ConnectionCloseBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- if (_logger.isInfoEnabled())
- {
- _logger.info("ConnectionClose received with reply code/reply text " + body.getReplyCode() + "/" +
- body.getReplyText() + " for " + session);
- }
- try
- {
- session.closeSession();
- }
- catch (Exception e)
- {
- _logger.error("Error closing protocol session: " + e, e);
- }
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- ConnectionCloseOkBody responseBody = methodRegistry.createConnectionCloseOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseOkMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseOkMethodHandler.java
deleted file mode 100644
index bc6e5ab403..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseOkMethodHandler.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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.ConnectionCloseOkBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQState;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class ConnectionCloseOkMethodHandler implements StateAwareMethodListener<ConnectionCloseOkBody>
-{
- private static final Logger _logger = Logger.getLogger(ConnectionCloseOkMethodHandler.class);
-
- private static ConnectionCloseOkMethodHandler _instance = new ConnectionCloseOkMethodHandler();
-
- public static ConnectionCloseOkMethodHandler getInstance()
- {
- return _instance;
- }
-
- private ConnectionCloseOkMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ConnectionCloseOkBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- //todo should this not do more than just log the method?
- _logger.info("Received Connection-close-ok");
-
- try
- {
- stateManager.changeState(AMQState.CONNECTION_CLOSED);
- session.closeSession();
- }
- catch (Exception e)
- {
- _logger.error("Error closing protocol session: " + e, e);
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java
deleted file mode 100644
index f99e650979..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.state.AMQState;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.log4j.Logger;
-
-public class ConnectionOpenMethodHandler implements StateAwareMethodListener<ConnectionOpenBody>
-{
- private static final Logger _logger = Logger.getLogger(ConnectionOpenMethodHandler.class);
-
- private static ConnectionOpenMethodHandler _instance = new ConnectionOpenMethodHandler();
-
- public static ConnectionOpenMethodHandler getInstance()
- {
- return _instance;
- }
-
- private ConnectionOpenMethodHandler()
- {
- }
-
- private static AMQShortString generateClientID()
- {
- return new AMQShortString(Long.toString(System.currentTimeMillis()));
- }
-
- public void methodReceived(AMQStateManager stateManager, ConnectionOpenBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
-
- //ignore leading '/'
- String virtualHostName;
- if ((body.getVirtualHost() != null) && body.getVirtualHost().charAt(0) == '/')
- {
- virtualHostName = new StringBuilder(body.getVirtualHost().subSequence(1, body.getVirtualHost().length())).toString();
- }
- else
- {
- virtualHostName = body.getVirtualHost() == null ? null : String.valueOf(body.getVirtualHost());
- }
-
- VirtualHost virtualHost = stateManager.getVirtualHostRegistry().getVirtualHost(virtualHostName);
-
- if (virtualHost == null)
- {
- throw body.getConnectionException(AMQConstant.NOT_FOUND, "Unknown virtual host: '" + virtualHostName + "'");
- }
- else
- {
- session.setVirtualHost(virtualHost);
-
- //Perform ACL
- virtualHost.getAccessManager().authorise(session, Permission.ACCESS ,body, virtualHost);
-
- // See Spec (0.8.2). Section 3.1.2 Virtual Hosts
- if (session.getContextKey() == null)
- {
- session.setContextKey(generateClientID());
- }
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createConnectionOpenOkBody(body.getVirtualHost());
-
- stateManager.changeState(AMQState.CONNECTION_OPEN);
-
- session.writeFrame(responseBody.generateFrame(channelId));
-
-
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
deleted file mode 100644
index 193c3a088b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.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.
- *
- */
-package org.apache.qpid.server.handler;
-
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.protocol.HeartbeatConfig;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.AuthenticationResult;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
-import org.apache.qpid.server.state.AMQState;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class ConnectionSecureOkMethodHandler implements StateAwareMethodListener<ConnectionSecureOkBody>
-{
- private static final Logger _logger = Logger.getLogger(ConnectionSecureOkMethodHandler.class);
-
- private static ConnectionSecureOkMethodHandler _instance = new ConnectionSecureOkMethodHandler();
-
- public static ConnectionSecureOkMethodHandler getInstance()
- {
- return _instance;
- }
-
- private ConnectionSecureOkMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ConnectionSecureOkBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
-
- //fixme Vhost not defined yet
- //session.getVirtualHost().getAuthenticationManager();
- AuthenticationManager authMgr = ApplicationRegistry.getInstance().getAuthenticationManager();
-
- SaslServer ss = session.getSaslServer();
- if (ss == null)
- {
- throw new AMQException("No SASL context set up in session");
- }
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AuthenticationResult authResult = authMgr.authenticate(ss, body.getResponse());
- switch (authResult.status)
- {
- case ERROR:
- // Can't do this as we violate protocol. Need to send Close
- // throw new AMQException(AMQConstant.NOT_ALLOWED.getCode(), AMQConstant.NOT_ALLOWED.getName());
- _logger.info("Authentication failed");
- stateManager.changeState(AMQState.CONNECTION_CLOSING);
-
-
- ConnectionCloseBody connectionCloseBody =
- methodRegistry.createConnectionCloseBody(AMQConstant.NOT_ALLOWED.getCode(),
- AMQConstant.NOT_ALLOWED.getName(),
- body.getClazz(),
- body.getMethod());
-
- session.writeFrame(connectionCloseBody.generateFrame(0) );
- disposeSaslServer(session);
- break;
- case SUCCESS:
- _logger.info("Connected as: " + ss.getAuthorizationID());
- stateManager.changeState(AMQState.CONNECTION_NOT_TUNED);
-
- ConnectionTuneBody tuneBody =
- methodRegistry.createConnectionTuneBody(0xFFFF,
- ConnectionStartOkMethodHandler.getConfiguredFrameSize(),
- HeartbeatConfig.getInstance().getDelay());
- session.writeFrame(tuneBody.generateFrame(0));
- session.setAuthorizedID(new UsernamePrincipal(ss.getAuthorizationID()));
- disposeSaslServer(session);
- break;
- case CONTINUE:
- stateManager.changeState(AMQState.CONNECTION_NOT_AUTH);
-
- ConnectionSecureBody secureBody = methodRegistry.createConnectionSecureBody(authResult.challenge);
- session.writeFrame(secureBody.generateFrame(0));
- }
- }
-
- private void disposeSaslServer(AMQProtocolSession ps)
- {
- SaslServer ss = ps.getSaslServer();
- if (ss != null)
- {
- ps.setSaslServer(null);
- try
- {
- ss.dispose();
- }
- catch (SaslException e)
- {
- _logger.error("Error disposing of Sasl server: " + e);
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java
deleted file mode 100644
index f02121c89f..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.protocol.HeartbeatConfig;
-import org.apache.qpid.server.protocol.AMQMinaProtocolSession;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.AuthenticationResult;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
-import org.apache.qpid.server.state.AMQState;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-
-public class ConnectionStartOkMethodHandler implements StateAwareMethodListener<ConnectionStartOkBody>
-{
- private static final Logger _logger = Logger.getLogger(ConnectionStartOkMethodHandler.class);
-
- private static ConnectionStartOkMethodHandler _instance = new ConnectionStartOkMethodHandler();
-
- private static final int DEFAULT_FRAME_SIZE = 65536;
-
- public static ConnectionStartOkMethodHandler getInstance()
- {
- return _instance;
- }
-
- private ConnectionStartOkMethodHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ConnectionStartOkBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- _logger.info("SASL Mechanism selected: " + body.getMechanism());
- _logger.info("Locale selected: " + body.getLocale());
-
- AuthenticationManager authMgr = ApplicationRegistry.getInstance().getAuthenticationManager();//session.getVirtualHost().getAuthenticationManager();
-
- SaslServer ss = null;
- try
- {
- ss = authMgr.createSaslServer(String.valueOf(body.getMechanism()), session.getLocalFQDN());
-
- if (ss == null)
- {
- throw body.getConnectionException(AMQConstant.RESOURCE_ERROR, "Unable to create SASL Server:" + body.getMechanism()
- );
- }
-
- session.setSaslServer(ss);
-
- AuthenticationResult authResult = authMgr.authenticate(ss, body.getResponse());
-
- //save clientProperties
- if (session.getClientProperties() == null)
- {
- session.setClientProperties(body.getClientProperties());
- }
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
-
- switch (authResult.status)
- {
- case ERROR:
- _logger.info("Authentication failed");
- stateManager.changeState(AMQState.CONNECTION_CLOSING);
-
- ConnectionCloseBody closeBody =
- methodRegistry.createConnectionCloseBody(AMQConstant.NOT_ALLOWED.getCode(), // replyCode
- AMQConstant.NOT_ALLOWED.getName(),
- body.getClazz(),
- body.getMethod());
-
- session.writeFrame(closeBody.generateFrame(0));
- disposeSaslServer(session);
- break;
-
- case SUCCESS:
- _logger.info("Connected as: " + ss.getAuthorizationID());
- session.setAuthorizedID(new UsernamePrincipal(ss.getAuthorizationID()));
-
- stateManager.changeState(AMQState.CONNECTION_NOT_TUNED);
-
- ConnectionTuneBody tuneBody = methodRegistry.createConnectionTuneBody(0xFFFF,
- getConfiguredFrameSize(),
- HeartbeatConfig.getInstance().getDelay());
- session.writeFrame(tuneBody.generateFrame(0));
- break;
- case CONTINUE:
- stateManager.changeState(AMQState.CONNECTION_NOT_AUTH);
-
- ConnectionSecureBody secureBody = methodRegistry.createConnectionSecureBody(authResult.challenge);
- session.writeFrame(secureBody.generateFrame(0));
- }
- }
- catch (SaslException e)
- {
- disposeSaslServer(session);
- throw new AMQException("SASL error: " + e, e);
- }
- }
-
- private void disposeSaslServer(AMQProtocolSession ps)
- {
- SaslServer ss = ps.getSaslServer();
- if (ss != null)
- {
- ps.setSaslServer(null);
- try
- {
- ss.dispose();
- }
- catch (SaslException e)
- {
- _logger.error("Error disposing of Sasl server: " + e);
- }
- }
- }
-
- static int getConfiguredFrameSize()
- {
- final Configuration config = ApplicationRegistry.getInstance().getConfiguration();
- final int framesize = config.getInt("advanced.framesize", DEFAULT_FRAME_SIZE);
- _logger.info("Framesize set to " + framesize);
- return framesize;
- }
-}
-
-
-
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionTuneOkMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionTuneOkMethodHandler.java
deleted file mode 100644
index 0fe8c5dc92..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionTuneOkMethodHandler.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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.ConnectionTuneOkBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQState;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class ConnectionTuneOkMethodHandler implements StateAwareMethodListener<ConnectionTuneOkBody>
-{
- private static final Logger _logger = Logger.getLogger(ConnectionTuneOkMethodHandler.class);
-
- private static ConnectionTuneOkMethodHandler _instance = new ConnectionTuneOkMethodHandler();
-
- public static ConnectionTuneOkMethodHandler getInstance()
- {
- return _instance;
- }
-
- public void methodReceived(AMQStateManager stateManager, ConnectionTuneOkBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug(body);
- }
- stateManager.changeState(AMQState.CONNECTION_NOT_OPENED);
- session.initHeartbeats(body.getHeartbeat());
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeBoundHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeBoundHandler.java
deleted file mode 100644
index 491a2f80db..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeBoundHandler.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.framing.amqp_8_0.MethodRegistry_8_0;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-/**
- * @author Apache Software Foundation
- *
- *
- */
-public class ExchangeBoundHandler implements StateAwareMethodListener<ExchangeBoundBody>
-{
- private static final ExchangeBoundHandler _instance = new ExchangeBoundHandler();
-
- 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;
-
- public static ExchangeBoundHandler getInstance()
- {
- return _instance;
- }
-
- private ExchangeBoundHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ExchangeBoundBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- VirtualHost virtualHost = session.getVirtualHost();
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
- MethodRegistry methodRegistry = session.getMethodRegistry();
-
-
-
-
- AMQShortString exchangeName = body.getExchange();
- AMQShortString queueName = body.getQueue();
- AMQShortString routingKey = body.getRoutingKey();
- if (exchangeName == null)
- {
- throw new AMQException("Exchange exchange must not be null");
- }
- Exchange exchange = virtualHost.getExchangeRegistry().getExchange(exchangeName);
- ExchangeBoundOkBody response;
- if (exchange == null)
- {
-
-
- response = methodRegistry.createExchangeBoundOkBody(EXCHANGE_NOT_FOUND,
- new AMQShortString("Exchange " + exchangeName + " not found"));
- }
- else if (routingKey == null)
- {
- if (queueName == null)
- {
- if (exchange.hasBindings())
- {
- response = methodRegistry.createExchangeBoundOkBody(OK, null);
- }
- else
- {
-
- response = methodRegistry.createExchangeBoundOkBody(NO_BINDINGS, // replyCode
- null); // replyText
- }
- }
- else
- {
-
- AMQQueue queue = queueRegistry.getQueue(queueName);
- if (queue == null)
- {
-
- response = methodRegistry.createExchangeBoundOkBody(QUEUE_NOT_FOUND, // replyCode
- new AMQShortString("Queue " + queueName + " not found")); // replyText
- }
- else
- {
- if (exchange.isBound(queue))
- {
-
- response = methodRegistry.createExchangeBoundOkBody(OK, // replyCode
- null); // replyText
- }
- else
- {
-
- response = methodRegistry.createExchangeBoundOkBody(QUEUE_NOT_BOUND, // replyCode
- new AMQShortString("Queue " + queueName + " not bound to exchange " + exchangeName)); // replyText
- }
- }
- }
- }
- else if (queueName != null)
- {
- AMQQueue queue = queueRegistry.getQueue(queueName);
- if (queue == null)
- {
-
- response = methodRegistry.createExchangeBoundOkBody(QUEUE_NOT_FOUND, // replyCode
- new AMQShortString("Queue " + queueName + " not found")); // replyText
- }
- else
- {
- if (exchange.isBound(body.getRoutingKey(), queue))
- {
-
- response = methodRegistry.createExchangeBoundOkBody(OK, // replyCode
- null); // replyText
- }
- else
- {
-
- response = methodRegistry.createExchangeBoundOkBody(SPECIFIC_QUEUE_NOT_BOUND_WITH_RK, // replyCode
- new AMQShortString("Queue " + queueName + " not bound with routing key " +
- body.getRoutingKey() + " to exchange " + exchangeName)); // replyText
- }
- }
- }
- else
- {
- if (exchange.isBound(body.getRoutingKey()))
- {
-
- response = methodRegistry.createExchangeBoundOkBody(OK, // replyCode
- null); // replyText
- }
- else
- {
-
- response = methodRegistry.createExchangeBoundOkBody(NO_QUEUE_BOUND_WITH_RK, // replyCode
- new AMQShortString("No queue bound with routing key " + body.getRoutingKey() +
- " to exchange " + exchangeName)); // replyText
- }
- }
- session.writeFrame(response.generateFrame(channelId));
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
deleted file mode 100644
index bc4476e969..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.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.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQUnknownExchangeType;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.exchange.ExchangeFactory;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class ExchangeDeclareHandler implements StateAwareMethodListener<ExchangeDeclareBody>
-{
- private static final Logger _logger = Logger.getLogger(ExchangeDeclareHandler.class);
-
- private static final ExchangeDeclareHandler _instance = new ExchangeDeclareHandler();
-
- public static ExchangeDeclareHandler getInstance()
- {
- return _instance;
- }
-
-
-
- private ExchangeDeclareHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ExchangeDeclareBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- VirtualHost virtualHost = session.getVirtualHost();
- ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
- ExchangeFactory exchangeFactory = virtualHost.getExchangeFactory();
-
- //Perform ACL
- virtualHost.getAccessManager().authorise(session, Permission.CREATE, body);
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Request to declare exchange of type " + body.getType() + " with name " + body.getExchange());
- }
- synchronized(exchangeRegistry)
- {
- Exchange exchange = exchangeRegistry.getExchange(body.getExchange());
-
-
-
- if (exchange == null)
- {
- if(body.getPassive() && ((body.getType() == null) || body.getType().length() ==0))
- {
- throw body.getChannelException(AMQConstant.NOT_FOUND, "Unknown exchange: " + body.getExchange());
- }
- else
- {
- try
- {
-
- exchange = exchangeFactory.createExchange(body.getExchange() == null ? null : body.getExchange().intern(),
- body.getType() == null ? null : body.getType().intern(),
- body.getDurable(),
- body.getPassive(), body.getTicket());
- exchangeRegistry.registerExchange(exchange);
- }
- catch(AMQUnknownExchangeType e)
- {
- throw body.getConnectionException(AMQConstant.COMMAND_INVALID, "Unknown exchange: " + body.getExchange(),e);
- }
- }
- }
- else if (!exchange.getType().equals(body.getType()))
- {
-
- throw new AMQConnectionException(AMQConstant.NOT_ALLOWED, "Attempt to redeclare exchange: " + body.getExchange() + " of type " + exchange.getType() + " to " + body.getType() +".",body.getClazz(), body.getMethod(),body.getMajor(),body.getMinor());
- }
-
- }
- if(!body.getNowait())
- {
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createExchangeDeclareOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
-
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeleteHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeleteHandler.java
deleted file mode 100644
index 888ffcb2e5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeleteHandler.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.ExchangeDeleteBody;
-import org.apache.qpid.framing.ExchangeDeleteOkBody;
-import org.apache.qpid.server.exchange.ExchangeInUseException;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class ExchangeDeleteHandler implements StateAwareMethodListener<ExchangeDeleteBody>
-{
- private static final ExchangeDeleteHandler _instance = new ExchangeDeleteHandler();
-
- public static ExchangeDeleteHandler getInstance()
- {
- return _instance;
- }
-
- private ExchangeDeleteHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, ExchangeDeleteBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- VirtualHost virtualHost = session.getVirtualHost();
- ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
-
- //Perform ACLs
- virtualHost.getAccessManager().authorise(session, Permission.DELETE,body,
- exchangeRegistry.getExchange(body.getExchange()));
-
- try
- {
- exchangeRegistry.unregisterExchange(body.getExchange(), body.getIfUnused());
-
- ExchangeDeleteOkBody responseBody = session.getMethodRegistry().createExchangeDeleteOkBody();
-
- session.writeFrame(responseBody.generateFrame(channelId));
- }
- catch (ExchangeInUseException e)
- {
- // TODO: sort out consistent channel close mechanism that does all clean up etc.
- }
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/OnCurrentThreadExecutor.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/OnCurrentThreadExecutor.java
deleted file mode 100644
index ac516b6133..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/OnCurrentThreadExecutor.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.server.handler;
-
-import java.util.concurrent.Executor;
-
-/**
- * An executor that executes the task on the current thread.
- */
-public class OnCurrentThreadExecutor implements Executor
-{
- public void execute(Runnable command)
- {
- command.run();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueBindHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueBindHandler.java
deleted file mode 100644
index 0f6dc7a19d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueBindHandler.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.
- *
- */
-package org.apache.qpid.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInvalidRoutingKeyException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-public class QueueBindHandler implements StateAwareMethodListener<QueueBindBody>
-{
- private static final Logger _log = Logger.getLogger(QueueBindHandler.class);
-
- private static final QueueBindHandler _instance = new QueueBindHandler();
-
- public static QueueBindHandler getInstance()
- {
- return _instance;
- }
-
- private QueueBindHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, QueueBindBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- VirtualHost virtualHost = session.getVirtualHost();
- ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
-
-
- final AMQQueue queue;
- final AMQShortString routingKey;
-
- if (body.getQueue() == null)
- {
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- queue = channel.getDefaultQueue();
-
- if (queue == null)
- {
- throw body.getChannelException(AMQConstant.NOT_FOUND, "No default queue defined on channel and queue was null");
- }
-
- if (body.getRoutingKey() == null)
- {
- routingKey = queue.getName();
- }
- else
- {
- routingKey = body.getRoutingKey().intern();
- }
- }
- else
- {
- queue = queueRegistry.getQueue(body.getQueue());
- routingKey = body.getRoutingKey() == null ? AMQShortString.EMPTY_STRING : body.getRoutingKey().intern();
- }
-
- if (queue == null)
- {
- throw body.getChannelException(AMQConstant.NOT_FOUND, "Queue " + body.getQueue() + " does not exist.");
- }
- final Exchange exch = exchangeRegistry.getExchange(body.getExchange());
- if (exch == null)
- {
- throw body.getChannelException(AMQConstant.NOT_FOUND, "Exchange " + body.getExchange() + " does not exist.");
- }
-
-
- try
- {
-
- //Perform ACLs
- virtualHost.getAccessManager().authorise(session, Permission.BIND, body, exch, queue, routingKey);
-
- if (!exch.isBound(routingKey, body.getArguments(), queue))
- {
- queue.bind(routingKey, body.getArguments(), exch);
- }
- }
- catch (AMQInvalidRoutingKeyException rke)
- {
- throw body.getChannelException(AMQConstant.INVALID_ROUTING_KEY, routingKey.toString());
- }
- catch (AMQException e)
- {
- throw body.getChannelException(AMQConstant.CHANNEL_ERROR, e.toString());
- }
-
- if (_log.isInfoEnabled())
- {
- _log.info("Binding queue " + queue + " to exchange " + exch + " with routing key " + routingKey);
- }
- if (!body.getNowait())
- {
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createQueueBindOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
-
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java
deleted file mode 100644
index 89a56b9a3c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.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.server.handler;
-
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.configuration.Configured;
-
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.commons.configuration.Configuration;
-
-public class QueueDeclareHandler implements StateAwareMethodListener<QueueDeclareBody>
-{
- private static final Logger _logger = Logger.getLogger(QueueDeclareHandler.class);
-
- private static final QueueDeclareHandler _instance = new QueueDeclareHandler();
-
- public static QueueDeclareHandler getInstance()
- {
- return _instance;
- }
-
- @Configured(path = "queue.auto_register", defaultValue = "false")
- public boolean autoRegister;
-
- private final AtomicInteger _counter = new AtomicInteger();
-
-
- protected QueueDeclareHandler()
- {
- Configurator.configure(this);
- }
-
- public void methodReceived(AMQStateManager stateManager, QueueDeclareBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- VirtualHost virtualHost = session.getVirtualHost();
- ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
- MessageStore store = virtualHost.getMessageStore();
-
- // Perform ACL on queue Creation
- virtualHost.getAccessManager().authorise(session, Permission.CREATE, body);
-
-
-
- final AMQShortString queueName;
-
- // if we aren't given a queue name, we create one which we return to the client
-
- if ((body.getQueue() == null) || (body.getQueue().length() == 0))
- {
- queueName = createName();
- }
- else
- {
- queueName = body.getQueue().intern();
- }
-
- AMQQueue queue;
- //TODO: do we need to check that the queue already exists with exactly the same "configuration"?
-
- synchronized (queueRegistry)
- {
-
-
-
- if (((queue = queueRegistry.getQueue(queueName)) == null))
- {
-
- if (body.getPassive())
- {
- String msg = "Queue: " + queueName + " not found on VirtualHost(" + virtualHost + ").";
- throw body.getChannelException(AMQConstant.NOT_FOUND, msg);
- }
- else
- {
- queue = createQueue(queueName, body, virtualHost, session);
- if (queue.isDurable() && !queue.isAutoDelete())
- {
- store.createQueue(queue);
- }
- queueRegistry.registerQueue(queue);
- if (autoRegister)
- {
- Exchange defaultExchange = exchangeRegistry.getDefaultExchange();
-
- // Perform ACL to control bindings
- virtualHost.getAccessManager().authorise(session, Permission.BIND, body,
- defaultExchange, queue, queueName);
-
- queue.bind(queueName, null, defaultExchange);
- _logger.info("Queue " + queueName + " bound to default exchange(" + defaultExchange.getName() + ")");
- }
- }
- }
- else if (queue.getOwner() != null && !session.getContextKey().equals(queue.getOwner()))
- {
- throw body.getChannelException(AMQConstant.ALREADY_EXISTS, "Cannot declare queue('" + queueName + "'),"
- + " as exclusive queue with same name "
- + "declared on another client ID('"
- + queue.getOwner() + "')");
- }
-
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- //set this as the default queue on the channel:
- channel.setDefaultQueue(queue);
- }
-
- if (!body.getNowait())
- {
- MethodRegistry methodRegistry = session.getMethodRegistry();
- QueueDeclareOkBody responseBody =
- methodRegistry.createQueueDeclareOkBody(queueName,
- queue.getMessageCount(),
- queue.getConsumerCount());
- session.writeFrame(responseBody.generateFrame(channelId));
-
- _logger.info("Queue " + queueName + " declared successfully");
- }
- }
-
- protected AMQShortString createName()
- {
- return new AMQShortString("tmp_" + UUID.randomUUID());
- }
-
- protected AMQQueue createQueue(final AMQShortString queueName,
- QueueDeclareBody body,
- VirtualHost virtualHost,
- final AMQProtocolSession session)
- throws AMQException
- {
- final QueueRegistry registry = virtualHost.getQueueRegistry();
- AMQShortString owner = body.getExclusive() ? session.getContextKey() : null;
- final AMQQueue queue = new AMQQueue(queueName, body.getDurable(), owner, body.getAutoDelete(), virtualHost);
-
-
- if (body.getExclusive() && !body.getDurable())
- {
- final AMQProtocolSession.Task deleteQueueTask =
- new AMQProtocolSession.Task()
- {
- public void doTask(AMQProtocolSession session) throws AMQException
- {
- if (registry.getQueue(queueName) == queue)
- {
- queue.delete();
- }
- }
- };
-
- session.addSessionCloseTask(deleteQueueTask);
-
- queue.addQueueDeleteTask(new AMQQueue.Task()
- {
- public void doTask(AMQQueue queue)
- {
- session.removeSessionCloseTask(deleteQueueTask);
- }
- });
- }// if exclusive and not durable
-
- Configuration virtualHostDefaultQueueConfiguration = VirtualHostConfiguration.getDefaultQueueConfiguration(queue);
- if (virtualHostDefaultQueueConfiguration != null)
- {
- Configurator.configure(queue, virtualHostDefaultQueueConfiguration);
- }
-
- return queue;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java
deleted file mode 100644
index 310a73ffeb..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.QueueDeleteBody;
-import org.apache.qpid.framing.QueueDeleteOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.security.access.Permission;
-
-public class QueueDeleteHandler implements StateAwareMethodListener<QueueDeleteBody>
-{
- private static final QueueDeleteHandler _instance = new QueueDeleteHandler();
-
- public static QueueDeleteHandler getInstance()
- {
- return _instance;
- }
-
- private final boolean _failIfNotFound;
-
- public QueueDeleteHandler()
- {
- this(true);
- }
-
- public QueueDeleteHandler(boolean failIfNotFound)
- {
- _failIfNotFound = failIfNotFound;
-
- }
-
- public void methodReceived(AMQStateManager stateManager, QueueDeleteBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- VirtualHost virtualHost = session.getVirtualHost();
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
- MessageStore store = virtualHost.getMessageStore();
-
- AMQQueue queue;
- if (body.getQueue() == null)
- {
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- //get the default queue on the channel:
- queue = channel.getDefaultQueue();
- }
- else
- {
- queue = queueRegistry.getQueue(body.getQueue());
- }
-
- if (queue == null)
- {
- if (_failIfNotFound)
- {
- throw body.getChannelException(AMQConstant.NOT_FOUND, "Queue " + body.getQueue() + " does not exist.");
- }
- }
- else
- {
- if (body.getIfEmpty() && !queue.isEmpty())
- {
- throw body.getChannelException(AMQConstant.IN_USE, "Queue: " + body.getQueue() + " is not empty.");
- }
- else if (body.getIfUnused() && !queue.isUnused())
- {
- // TODO - Error code
- throw body.getChannelException(AMQConstant.IN_USE, "Queue: " + body.getQueue() + " is still used.");
-
- }
- else
- {
-
- //Perform ACLs
- virtualHost.getAccessManager().authorise(session, Permission.DELETE, body, queue);
-
- int purged = queue.delete(body.getIfUnused(), body.getIfEmpty());
-
- if (queue.isDurable())
- {
- store.removeQueue(queue.getName());
- }
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- QueueDeleteOkBody responseBody = methodRegistry.createQueueDeleteOkBody(purged);
- session.writeFrame(responseBody.generateFrame(channelId));
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueuePurgeHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueuePurgeHandler.java
deleted file mode 100644
index cce49f13c7..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueuePurgeHandler.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.QueuePurgeBody;
-import org.apache.qpid.framing.QueuePurgeOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.security.access.Permission;
-
-public class QueuePurgeHandler implements StateAwareMethodListener<QueuePurgeBody>
-{
- private static final QueuePurgeHandler _instance = new QueuePurgeHandler();
-
- public static QueuePurgeHandler getInstance()
- {
- return _instance;
- }
-
- private final boolean _failIfNotFound;
-
- public QueuePurgeHandler()
- {
- this(true);
- }
-
- public QueuePurgeHandler(boolean failIfNotFound)
- {
- _failIfNotFound = failIfNotFound;
- }
-
- public void methodReceived(AMQStateManager stateManager, QueuePurgeBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- VirtualHost virtualHost = session.getVirtualHost();
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
-
- AMQChannel channel = session.getChannel(channelId);
-
-
- AMQQueue queue;
- if(body.getQueue() == null)
- {
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- //get the default queue on the channel:
- queue = channel.getDefaultQueue();
-
- if(queue == null)
- {
- if(_failIfNotFound)
- {
- throw body.getConnectionException(AMQConstant.NOT_ALLOWED,"No queue specified.");
- }
- }
- }
- else
- {
- queue = queueRegistry.getQueue(body.getQueue());
- }
-
- if(queue == null)
- {
- if(_failIfNotFound)
- {
- throw body.getChannelException(AMQConstant.NOT_FOUND, "Queue " + body.getQueue() + " does not exist.");
- }
- }
- else
- {
-
- //Perform ACLs
- virtualHost.getAccessManager().authorise(session, Permission.PURGE, body, queue);
-
- long purged = queue.clearQueue(channel.getStoreContext());
-
-
- if(!body.getNowait())
- {
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createQueuePurgeOkBody(purged);
- session.writeFrame(responseBody.generateFrame(channelId));
-
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueUnbindHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueUnbindHandler.java
deleted file mode 100644
index e758e315aa..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueUnbindHandler.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.apache.qpid.server.handler;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.framing.*;
-import org.apache.qpid.framing.amqp_0_9.MethodRegistry_0_9;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInvalidRoutingKeyException;
-import org.apache.qpid.protocol.AMQConstant;
-
-public class QueueUnbindHandler implements StateAwareMethodListener<QueueUnbindBody>
-{
- private static final Logger _log = Logger.getLogger(QueueUnbindHandler.class);
-
- private static final QueueUnbindHandler _instance = new QueueUnbindHandler();
-
- public static QueueUnbindHandler getInstance()
- {
- return _instance;
- }
-
- private QueueUnbindHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, QueueUnbindBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
- VirtualHost virtualHost = session.getVirtualHost();
- ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
- QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
-
-
- final AMQQueue queue;
- final AMQShortString routingKey;
-
- if (body.getQueue() == null)
- {
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- queue = channel.getDefaultQueue();
-
- if (queue == null)
- {
- throw body.getConnectionException(AMQConstant.NOT_FOUND, "No default queue defined on channel and queue was null");
- }
-
- routingKey = body.getRoutingKey() == null ? null : body.getRoutingKey().intern();
-
- }
- else
- {
- queue = queueRegistry.getQueue(body.getQueue());
- routingKey = body.getRoutingKey() == null ? null : body.getRoutingKey().intern();
- }
-
- if (queue == null)
- {
- throw body.getConnectionException(AMQConstant.NOT_FOUND, "Queue " + body.getQueue() + " does not exist.");
- }
- final Exchange exch = exchangeRegistry.getExchange(body.getExchange());
- if (exch == null)
- {
- throw body.getChannelException(AMQConstant.NOT_FOUND, "Exchange " + body.getExchange() + " does not exist.");
- }
-
- //Perform ACLs
- virtualHost.getAccessManager().authorise(session, Permission.UNBIND, body, queue);
-
- try
- {
- queue.unBind(routingKey, body.getArguments(), exch);
- }
- catch (AMQInvalidRoutingKeyException rke)
- {
- throw body.getChannelException(AMQConstant.INVALID_ROUTING_KEY, routingKey.toString());
- }
- catch (AMQException e)
- {
- if(e.getErrorCode() == AMQConstant.NOT_FOUND)
- {
- throw body.getConnectionException(AMQConstant.NOT_FOUND,e.getMessage(),e);
- }
- throw body.getChannelException(AMQConstant.CHANNEL_ERROR, e.toString());
- }
-
- if (_log.isInfoEnabled())
- {
- _log.info("Binding queue " + queue + " to exchange " + exch + " with routing key " + routingKey);
- }
-
- MethodRegistry_0_9 methodRegistry = (MethodRegistry_0_9) session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createQueueUnbindOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
-
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl.java
deleted file mode 100644
index 9475b83c8f..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import java.util.Map;
-import java.util.HashMap;
-
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.AMQException;
-
-public class ServerMethodDispatcherImpl implements MethodDispatcher
-{
- private final AMQStateManager _stateManager;
-
- private static interface DispatcherFactory
- {
- public MethodDispatcher createMethodDispatcher(AMQStateManager stateManager);
- }
-
- private static final Map<ProtocolVersion, DispatcherFactory> _dispatcherFactories =
- new HashMap<ProtocolVersion, DispatcherFactory>();
-
-
- static
- {
- _dispatcherFactories.put(ProtocolVersion.v8_0,
- new DispatcherFactory()
- {
- public MethodDispatcher createMethodDispatcher(AMQStateManager stateManager)
- {
- return new ServerMethodDispatcherImpl_8_0(stateManager);
- }
- });
-
- _dispatcherFactories.put(ProtocolVersion.v0_9,
- new DispatcherFactory()
- {
- public MethodDispatcher createMethodDispatcher(AMQStateManager stateManager)
- {
- return new ServerMethodDispatcherImpl_0_9(stateManager);
- }
- });
-
- }
-
-
- private static final AccessRequestHandler _accessRequestHandler = AccessRequestHandler.getInstance();
- private static final ChannelCloseHandler _channelCloseHandler = ChannelCloseHandler.getInstance();
- private static final ChannelOpenHandler _channelOpenHandler = ChannelOpenHandler.getInstance();
- private static final ChannelCloseOkHandler _channelCloseOkHandler = ChannelCloseOkHandler.getInstance();
- private static final ConnectionCloseMethodHandler _connectionCloseMethodHandler = ConnectionCloseMethodHandler.getInstance();
- private static final ConnectionCloseOkMethodHandler _connectionCloseOkMethodHandler = ConnectionCloseOkMethodHandler.getInstance();
- private static final ConnectionOpenMethodHandler _connectionOpenMethodHandler = ConnectionOpenMethodHandler.getInstance();
- private static final ConnectionTuneOkMethodHandler _connectionTuneOkMethodHandler = ConnectionTuneOkMethodHandler.getInstance();
- private static final ConnectionSecureOkMethodHandler _connectionSecureOkMethodHandler = ConnectionSecureOkMethodHandler.getInstance();
- private static final ConnectionStartOkMethodHandler _connectionStartOkMethodHandler = ConnectionStartOkMethodHandler.getInstance();
- private static final ExchangeDeclareHandler _exchangeDeclareHandler = ExchangeDeclareHandler.getInstance();
- private static final ExchangeDeleteHandler _exchangeDeleteHandler = ExchangeDeleteHandler.getInstance();
- private static final ExchangeBoundHandler _exchangeBoundHandler = ExchangeBoundHandler.getInstance();
- private static final BasicAckMethodHandler _basicAckMethodHandler = BasicAckMethodHandler.getInstance();
- private static final BasicRecoverMethodHandler _basicRecoverMethodHandler = BasicRecoverMethodHandler.getInstance();
- private static final BasicConsumeMethodHandler _basicConsumeMethodHandler = BasicConsumeMethodHandler.getInstance();
- private static final BasicGetMethodHandler _basicGetMethodHandler = BasicGetMethodHandler.getInstance();
- private static final BasicCancelMethodHandler _basicCancelMethodHandler = BasicCancelMethodHandler.getInstance();
- private static final BasicPublishMethodHandler _basicPublishMethodHandler = BasicPublishMethodHandler.getInstance();
- private static final BasicQosHandler _basicQosHandler = BasicQosHandler.getInstance();
- private static final QueueBindHandler _queueBindHandler = QueueBindHandler.getInstance();
- private static final QueueDeclareHandler _queueDeclareHandler = QueueDeclareHandler.getInstance();
- private static final QueueDeleteHandler _queueDeleteHandler = QueueDeleteHandler.getInstance();
- private static final QueuePurgeHandler _queuePurgeHandler = QueuePurgeHandler.getInstance();
- private static final ChannelFlowHandler _channelFlowHandler = ChannelFlowHandler.getInstance();
- private static final TxSelectHandler _txSelectHandler = TxSelectHandler.getInstance();
- private static final TxCommitHandler _txCommitHandler = TxCommitHandler.getInstance();
- private static final TxRollbackHandler _txRollbackHandler = TxRollbackHandler.getInstance();
- private static final BasicRejectMethodHandler _basicRejectMethodHandler = BasicRejectMethodHandler.getInstance();
-
-
-
- public static MethodDispatcher createMethodDispatcher(AMQStateManager stateManager, ProtocolVersion protocolVersion)
- {
- return _dispatcherFactories.get(protocolVersion).createMethodDispatcher(stateManager);
- }
-
-
- public ServerMethodDispatcherImpl(AMQStateManager stateManager)
- {
- _stateManager = stateManager;
- }
-
-
- protected AMQStateManager getStateManager()
- {
- return _stateManager;
- }
-
-
-
- public boolean dispatchAccessRequest(AccessRequestBody body, int channelId) throws AMQException
- {
- _accessRequestHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchBasicAck(BasicAckBody body, int channelId) throws AMQException
- {
- _basicAckMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchBasicCancel(BasicCancelBody body, int channelId) throws AMQException
- {
- _basicCancelMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchBasicConsume(BasicConsumeBody body, int channelId) throws AMQException
- {
- _basicConsumeMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchBasicGet(BasicGetBody body, int channelId) throws AMQException
- {
- _basicGetMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchBasicPublish(BasicPublishBody body, int channelId) throws AMQException
- {
- _basicPublishMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchBasicQos(BasicQosBody body, int channelId) throws AMQException
- {
- _basicQosHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchBasicRecover(BasicRecoverBody body, int channelId) throws AMQException
- {
- _basicRecoverMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchBasicReject(BasicRejectBody body, int channelId) throws AMQException
- {
- _basicRejectMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchChannelOpen(ChannelOpenBody body, int channelId) throws AMQException
- {
- _channelOpenHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
-
- public boolean dispatchAccessRequestOk(AccessRequestOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchBasicCancelOk(BasicCancelOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchBasicConsumeOk(BasicConsumeOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchBasicDeliver(BasicDeliverBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchBasicGetEmpty(BasicGetEmptyBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchBasicGetOk(BasicGetOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchBasicQosOk(BasicQosOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchBasicReturn(BasicReturnBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchChannelClose(ChannelCloseBody body, int channelId) throws AMQException
- {
- _channelCloseHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
-
- public boolean dispatchChannelCloseOk(ChannelCloseOkBody body, int channelId) throws AMQException
- {
- _channelCloseOkHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
-
- public boolean dispatchChannelFlow(ChannelFlowBody body, int channelId) throws AMQException
- {
- _channelFlowHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchChannelFlowOk(ChannelFlowOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchChannelOpenOk(ChannelOpenOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
-
- public boolean dispatchConnectionOpen(ConnectionOpenBody body, int channelId) throws AMQException
- {
- _connectionOpenMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
-
- public boolean dispatchConnectionClose(ConnectionCloseBody body, int channelId) throws AMQException
- {
- _connectionCloseMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
-
- public boolean dispatchConnectionCloseOk(ConnectionCloseOkBody body, int channelId) throws AMQException
- {
- _connectionCloseOkMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchConnectionOpenOk(ConnectionOpenOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchConnectionRedirect(ConnectionRedirectBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchConnectionSecure(ConnectionSecureBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchConnectionStart(ConnectionStartBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchConnectionTune(ConnectionTuneBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchDtxSelectOk(DtxSelectOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchDtxStartOk(DtxStartOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchExchangeBoundOk(ExchangeBoundOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchExchangeDeclareOk(ExchangeDeclareOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchExchangeDeleteOk(ExchangeDeleteOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchFileCancelOk(FileCancelOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchFileConsumeOk(FileConsumeOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchFileDeliver(FileDeliverBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchFileOpen(FileOpenBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchFileOpenOk(FileOpenOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchFileQosOk(FileQosOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchFileReturn(FileReturnBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchFileStage(FileStageBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchQueueBindOk(QueueBindOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchQueueDeclareOk(QueueDeclareOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchQueueDeleteOk(QueueDeleteOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchQueuePurgeOk(QueuePurgeOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchStreamCancelOk(StreamCancelOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchStreamConsumeOk(StreamConsumeOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchStreamDeliver(StreamDeliverBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchStreamQosOk(StreamQosOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchStreamReturn(StreamReturnBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchTxCommitOk(TxCommitOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchTxRollbackOk(TxRollbackOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchTxSelectOk(TxSelectOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
-
- public boolean dispatchConnectionSecureOk(ConnectionSecureOkBody body, int channelId) throws AMQException
- {
- _connectionSecureOkMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchConnectionStartOk(ConnectionStartOkBody body, int channelId) throws AMQException
- {
- _connectionStartOkMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchConnectionTuneOk(ConnectionTuneOkBody body, int channelId) throws AMQException
- {
- _connectionTuneOkMethodHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchDtxSelect(DtxSelectBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchDtxStart(DtxStartBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchExchangeBound(ExchangeBoundBody body, int channelId) throws AMQException
- {
- _exchangeBoundHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchExchangeDeclare(ExchangeDeclareBody body, int channelId) throws AMQException
- {
- _exchangeDeclareHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchExchangeDelete(ExchangeDeleteBody body, int channelId) throws AMQException
- {
- _exchangeDeleteHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchFileAck(FileAckBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchFileCancel(FileCancelBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchFileConsume(FileConsumeBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchFilePublish(FilePublishBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchFileQos(FileQosBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchFileReject(FileRejectBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchQueueBind(QueueBindBody body, int channelId) throws AMQException
- {
- _queueBindHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchQueueDeclare(QueueDeclareBody body, int channelId) throws AMQException
- {
- _queueDeclareHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchQueueDelete(QueueDeleteBody body, int channelId) throws AMQException
- {
- _queueDeleteHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchQueuePurge(QueuePurgeBody body, int channelId) throws AMQException
- {
- _queuePurgeHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchStreamCancel(StreamCancelBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchStreamConsume(StreamConsumeBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchStreamPublish(StreamPublishBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchStreamQos(StreamQosBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTunnelRequest(TunnelRequestBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTxCommit(TxCommitBody body, int channelId) throws AMQException
- {
- _txCommitHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchTxRollback(TxRollbackBody body, int channelId) throws AMQException
- {
- _txRollbackHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
- public boolean dispatchTxSelect(TxSelectBody body, int channelId) throws AMQException
- {
- _txSelectHandler.methodReceived(_stateManager, body, channelId);
- return true;
- }
-
-
-
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl_0_9.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl_0_9.java
deleted file mode 100644
index 8b1dca77ba..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl_0_9.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.server.handler;
-
-
-import org.apache.qpid.framing.amqp_0_9.MethodDispatcher_0_9;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.AMQException;
-
-
-
-public class ServerMethodDispatcherImpl_0_9
- extends ServerMethodDispatcherImpl
- implements MethodDispatcher_0_9
-
-{
-
- private static final BasicRecoverSyncMethodHandler _basicRecoverSyncMethodHandler =
- BasicRecoverSyncMethodHandler.getInstance();
- private static final QueueUnbindHandler _queueUnbindHandler =
- QueueUnbindHandler.getInstance();
-
-
- public ServerMethodDispatcherImpl_0_9(AMQStateManager stateManager)
- {
- super(stateManager);
- }
-
- public boolean dispatchBasicRecoverSync(BasicRecoverSyncBody body, int channelId) throws AMQException
- {
- _basicRecoverSyncMethodHandler.methodReceived(getStateManager(), body, channelId);
- return true;
- }
-
- public boolean dispatchBasicRecoverSyncOk(BasicRecoverSyncOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchChannelOk(ChannelOkBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchChannelPing(ChannelPingBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchChannelPong(ChannelPongBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchChannelResume(ChannelResumeBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageAppend(MessageAppendBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageCancel(MessageCancelBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageCheckpoint(MessageCheckpointBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageClose(MessageCloseBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageConsume(MessageConsumeBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageEmpty(MessageEmptyBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageGet(MessageGetBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageOffset(MessageOffsetBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageOk(MessageOkBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageOpen(MessageOpenBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageQos(MessageQosBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageRecover(MessageRecoverBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageReject(MessageRejectBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageResume(MessageResumeBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchMessageTransfer(MessageTransferBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchQueueUnbindOk(QueueUnbindOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchQueueUnbind(QueueUnbindBody body, int channelId) throws AMQException
- {
- _queueUnbindHandler.methodReceived(getStateManager(),body,channelId);
- return true;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl_8_0.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl_8_0.java
deleted file mode 100644
index d599ca3d4e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ServerMethodDispatcherImpl_8_0.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.handler;
-
-import org.apache.qpid.framing.amqp_8_0.MethodDispatcher_8_0;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.AMQException;
-
-public class ServerMethodDispatcherImpl_8_0
- extends ServerMethodDispatcherImpl
- implements MethodDispatcher_8_0
-{
- public ServerMethodDispatcherImpl_8_0(AMQStateManager stateManager)
- {
- super(stateManager);
- }
-
- public boolean dispatchBasicRecoverOk(BasicRecoverOkBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchChannelAlert(ChannelAlertBody body, int channelId) throws AMQException
- {
- throw new UnexpectedMethodException(body);
- }
-
- public boolean dispatchTestContent(TestContentBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTestContentOk(TestContentOkBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTestInteger(TestIntegerBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTestIntegerOk(TestIntegerOkBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTestString(TestStringBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTestStringOk(TestStringOkBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTestTable(TestTableBody body, int channelId) throws AMQException
- {
- return false;
- }
-
- public boolean dispatchTestTableOk(TestTableOkBody body, int channelId) throws AMQException
- {
- return false;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxCommitHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxCommitHandler.java
deleted file mode 100644
index 79cc722e0e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxCommitHandler.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.
- *
- */
-package org.apache.qpid.server.handler;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.TxCommitBody;
-import org.apache.qpid.framing.TxCommitOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class TxCommitHandler implements StateAwareMethodListener<TxCommitBody>
-{
- private static final Logger _log = Logger.getLogger(TxCommitHandler.class);
-
- private static TxCommitHandler _instance = new TxCommitHandler();
-
- public static TxCommitHandler getInstance()
- {
- return _instance;
- }
-
- private TxCommitHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, TxCommitBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- try
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Commit received on channel " + channelId);
- }
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- channel.commit();
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createTxCommitOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
-
- channel.processReturns(session);
- }
- catch (AMQException e)
- {
- throw body.getChannelException(e.getErrorCode(), "Failed to commit: " + e.getMessage());
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxRollbackHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxRollbackHandler.java
deleted file mode 100644
index 5f402f3fda..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxRollbackHandler.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.
- *
- */
-package org.apache.qpid.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.TxRollbackBody;
-import org.apache.qpid.framing.TxRollbackOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-
-public class TxRollbackHandler implements StateAwareMethodListener<TxRollbackBody>
-{
- private static TxRollbackHandler _instance = new TxRollbackHandler();
-
- public static TxRollbackHandler getInstance()
- {
- return _instance;
- }
-
- private TxRollbackHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, TxRollbackBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- try
- {
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- channel.rollback();
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- AMQMethodBody responseBody = methodRegistry.createTxRollbackOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
-
-
- //Now resend all the unacknowledged messages back to the original subscribers.
- //(Must be done after the TxnRollback-ok response).
- // Why, are we not allowed to send messages back to client before the ok method?
- channel.resend(false);
- }
- catch (AMQException e)
- {
- throw body.getChannelException(e.getErrorCode(), "Failed to rollback: " + e.getMessage());
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxSelectHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxSelectHandler.java
deleted file mode 100644
index 308f5b73cf..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/TxSelectHandler.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.server.handler;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.TxSelectBody;
-import org.apache.qpid.framing.TxSelectOkBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.state.StateAwareMethodListener;
-import org.apache.qpid.server.AMQChannel;
-
-public class TxSelectHandler implements StateAwareMethodListener<TxSelectBody>
-{
- private static TxSelectHandler _instance = new TxSelectHandler();
-
- public static TxSelectHandler getInstance()
- {
- return _instance;
- }
-
- private TxSelectHandler()
- {
- }
-
- public void methodReceived(AMQStateManager stateManager, TxSelectBody body, int channelId) throws AMQException
- {
- AMQProtocolSession session = stateManager.getProtocolSession();
-
- AMQChannel channel = session.getChannel(channelId);
-
- if (channel == null)
- {
- throw body.getChannelNotFoundException(channelId);
- }
-
- channel.setLocalTransactional();
-
- MethodRegistry methodRegistry = session.getMethodRegistry();
- TxSelectOkBody responseBody = methodRegistry.createTxSelectOkBody();
- session.writeFrame(responseBody.generateFrame(channelId));
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/UnexpectedMethodException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/UnexpectedMethodException.java
deleted file mode 100644
index fb18519fe1..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/UnexpectedMethodException.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.server.handler;
-
-
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.AMQException;
-
-public class UnexpectedMethodException extends AMQException
-{
- public UnexpectedMethodException(AMQMethodBody body)
- {
- super("Unexpected method recevied: " + body.getClass().getName());
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/jms/JmsConsumer.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/jms/JmsConsumer.java
deleted file mode 100644
index c08fae4e4e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/jms/JmsConsumer.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.jms;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-
-public class JmsConsumer
-{
- private int _prefetchValue;
-
- private PrefetchUnits _prefetchUnits;
-
- private boolean _noLocal;
-
- private boolean _autoAck;
-
- private boolean _exclusive;
-
- private AMQProtocolSession _protocolSession;
-
- public enum PrefetchUnits
- {
- OCTETS,
- MESSAGES
- }
-
- public int getPrefetchValue()
- {
- return _prefetchValue;
- }
-
- public void setPrefetchValue(int prefetchValue)
- {
- _prefetchValue = prefetchValue;
- }
-
- public PrefetchUnits getPrefetchUnits()
- {
- return _prefetchUnits;
- }
-
- public void setPrefetchUnits(PrefetchUnits prefetchUnits)
- {
- _prefetchUnits = prefetchUnits;
- }
-
- public boolean isNoLocal()
- {
- return _noLocal;
- }
-
- public void setNoLocal(boolean noLocal)
- {
- _noLocal = noLocal;
- }
-
- public boolean isAutoAck()
- {
- return _autoAck;
- }
-
- public void setAutoAck(boolean autoAck)
- {
- _autoAck = autoAck;
- }
-
- public boolean isExclusive()
- {
- return _exclusive;
- }
-
- public void setExclusive(boolean exclusive)
- {
- _exclusive = exclusive;
- }
-
- public AMQProtocolSession getProtocolSession()
- {
- return _protocolSession;
- }
-
- public void setProtocolSession(AMQProtocolSession protocolSession)
- {
- _protocolSession = protocolSession;
- }
-
- public void deliverMessage() throws AMQException
- {
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java
deleted file mode 100644
index a2c2bd62a2..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.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.server.management;
-
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanNotificationInfo;
-import javax.management.NotCompliantMBeanException;
-import javax.management.NotificationBroadcaster;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-
-/**
- * This class provides additinal feature of Notification Broadcaster to the
- * DefaultManagedObject.
- * @author Bhupendra Bhardwaj
- * @version 0.1
- */
-public abstract class AMQManagedObject extends DefaultManagedObject
- implements NotificationBroadcaster
-{
- /**
- * broadcaster support class
- */
- protected NotificationBroadcasterSupport _broadcaster = new NotificationBroadcasterSupport();
-
- /**
- * sequence number for notifications
- */
- protected long _notificationSequenceNumber = 0;
-
- protected MBeanInfo _mbeanInfo;
-
- protected AMQManagedObject(Class<?> managementInterface, String typeName)
- throws NotCompliantMBeanException
- {
- super(managementInterface, typeName);
- buildMBeanInfo();
- }
-
- @Override
- public MBeanInfo getMBeanInfo()
- {
- return _mbeanInfo;
- }
-
- private void buildMBeanInfo() throws NotCompliantMBeanException
- {
- _mbeanInfo = new MBeanInfo(this.getClass().getName(),
- MBeanIntrospector.getMBeanDescription(this.getClass()),
- MBeanIntrospector.getMBeanAttributesInfo(getManagementInterface()),
- MBeanIntrospector.getMBeanConstructorsInfo(this.getClass()),
- MBeanIntrospector.getMBeanOperationsInfo(getManagementInterface()),
- this.getNotificationInfo());
- }
-
-
-
- // notification broadcaster implementation
-
- public void addNotificationListener(NotificationListener listener,
- NotificationFilter filter,
- Object handback)
- {
- _broadcaster.addNotificationListener(listener, filter, handback);
- }
-
- public void removeNotificationListener(NotificationListener listener)
- throws ListenerNotFoundException
- {
- _broadcaster.removeNotificationListener(listener);
- }
-
- public MBeanNotificationInfo[] getNotificationInfo()
- {
- return null;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java
deleted file mode 100644
index 84526dbc11..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.management;
-
-import javax.management.JMException;
-import javax.management.MalformedObjectNameException;
-import javax.management.NotCompliantMBeanException;
-import javax.management.ObjectName;
-import javax.management.StandardMBean;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-
-/**
- * Provides implementation of the boilerplate ManagedObject interface. Most managed objects should find it useful
- * to extend this class rather than implementing ManagedObject from scratch.
- *
- */
-public abstract class DefaultManagedObject extends StandardMBean implements ManagedObject
-{
- private Class<?> _managementInterface;
-
- private String _typeName;
-
- protected DefaultManagedObject(Class<?> managementInterface, String typeName)
- throws NotCompliantMBeanException
- {
- super(managementInterface);
- _managementInterface = managementInterface;
- _typeName = typeName;
- }
-
- public String getType()
- {
- return _typeName;
- }
-
- public Class<?> getManagementInterface()
- {
- return _managementInterface;
- }
-
- public ManagedObject getParentObject()
- {
- return null;
- }
-
- public void register() throws AMQException
- {
- try
- {
- getManagedObjectRegistry().registerObject(this);
- }
- catch (JMException e)
- {
- throw new AMQException("Error registering managed object " + this + ": " + e, e);
- }
- }
-
- protected ManagedObjectRegistry getManagedObjectRegistry()
- {
- return ApplicationRegistry.getInstance().getManagedObjectRegistry();
- }
-
- public void unregister() throws AMQException
- {
- try
- {
- getManagedObjectRegistry().unregisterObject(this);
- }
- catch (JMException e)
- {
- throw new AMQException("Error unregistering managed object: " + this + ": " + e, e);
- }
- }
-
- public String toString()
- {
- return getObjectInstanceName() + "[" + getType() + "]";
- }
-
-
- /**
- * Created the ObjectName as per the JMX Specs
- * @return ObjectName
- * @throws MalformedObjectNameException
- */
- public ObjectName getObjectName() throws MalformedObjectNameException
- {
- String name = getObjectInstanceName();
- StringBuffer objectName = new StringBuffer(ManagedObject.DOMAIN);
-
- objectName.append(":type=");
- objectName.append(getHierarchicalType(this));
-
- objectName.append(",");
- objectName.append(getHierarchicalName(this));
- objectName.append("name=").append(name);
-
- return new ObjectName(objectName.toString());
- }
-
- protected ObjectName getObjectNameForSingleInstanceMBean() throws MalformedObjectNameException
- {
- StringBuffer objectName = new StringBuffer(ManagedObject.DOMAIN);
-
- objectName.append(":type=");
- objectName.append(getHierarchicalType(this));
-
- String hierarchyName = getHierarchicalName(this);
- if (hierarchyName != null)
- {
- objectName.append(",");
- objectName.append(hierarchyName.substring(0, hierarchyName.lastIndexOf(",")));
- }
-
- return new ObjectName(objectName.toString());
- }
-
- protected String getHierarchicalType(ManagedObject obj)
- {
- if (obj.getParentObject() != null)
- {
- String parentType = getHierarchicalType(obj.getParentObject()).toString();
- return parentType + "." + obj.getType();
- }
- else
- return obj.getType();
- }
-
- protected String getHierarchicalName(ManagedObject obj)
- {
- if (obj.getParentObject() != null)
- {
- String parentName = obj.getParentObject().getType() + "=" +
- obj.getParentObject().getObjectInstanceName() + ","+
- getHierarchicalName(obj.getParentObject());
-
- return parentName;
- }
- else
- return "";
- }
-
- protected static StringBuffer jmxEncode(StringBuffer jmxName, int attrPos)
- {
- for (int i = attrPos; i < jmxName.length(); i++)
- {
- if (jmxName.charAt(i) == ',')
- {
- jmxName.setCharAt(i, ';');
- }
- else if (jmxName.charAt(i) == ':')
- {
- jmxName.setCharAt(i, '-');
- }
- else if (jmxName.charAt(i) == '?' ||
- jmxName.charAt(i) == '*' ||
- jmxName.charAt(i) == '\\')
- {
- jmxName.insert(i, '\\');
- i++;
- }
- else if (jmxName.charAt(i) == '\n')
- {
- jmxName.insert(i, '\\');
- i++;
- jmxName.setCharAt(i, 'n');
- }
- }
- return jmxName;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java
deleted file mode 100644
index 4caae2b26f..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.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.server.management;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.IApplicationRegistry;
-import org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase;
-import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-import org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5HashedInitialiser;
-
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.remote.JMXConnectorServer;
-import javax.management.remote.JMXConnectorServerFactory;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.MBeanServerForwarder;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.AccountNotFoundException;
-import javax.security.sasl.AuthorizeCallback;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * This class starts up an MBeanserver. If out of the box agent is being used then there are no security features
- * implemented. To use the security features like user authentication, turn off the jmx options in the "QPID_OPTS" env
- * variable and use JMXMP connector server. If JMXMP connector is not available, then the standard JMXConnector will be
- * used, which again doesn't have user authentication.
- */
-public class JMXManagedObjectRegistry implements ManagedObjectRegistry
-{
- private static final Logger _log = Logger.getLogger(JMXManagedObjectRegistry.class);
-
- private final MBeanServer _mbeanServer;
- private Registry _rmiRegistry;
- private JMXServiceURL _jmxURL;
-
- public static final String MANAGEMENT_PORT_CONFIG_PATH = "management.jmxport";
- public static final int MANAGEMENT_PORT_DEFAULT = 8999;
-
- public JMXManagedObjectRegistry() throws AMQException
- {
- _log.info("Initialising managed object registry using platform MBean server");
- IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
-
- // Retrieve the config parameters
- boolean platformServer = appRegistry.getConfiguration().getBoolean("management.platform-mbeanserver", true);
-
- _mbeanServer =
- platformServer ? ManagementFactory.getPlatformMBeanServer()
- : MBeanServerFactory.createMBeanServer(ManagedObject.DOMAIN);
- }
-
-
- public void start() throws IOException
- {
- // Check if the "QPID_OPTS" is set to use Out of the Box JMXAgent
- if (areOutOfTheBoxJMXOptionsSet())
- {
- _log.info("JMX: Using the out of the box JMX Agent");
- return;
- }
-
- IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
-
- boolean security = appRegistry.getConfiguration().getBoolean("management.security-enabled", false);
- int port = appRegistry.getConfiguration().getInt(MANAGEMENT_PORT_CONFIG_PATH, MANAGEMENT_PORT_DEFAULT);
-
- if (security)
- {
- // For SASL using JMXMP
- _jmxURL = new JMXServiceURL("jmxmp", null, port);
-
- Map env = new HashMap();
- Map<String, PrincipalDatabase> map = appRegistry.getDatabaseManager().getDatabases();
- PrincipalDatabase db = null;
-
- for (Map.Entry<String, PrincipalDatabase> entry : map.entrySet())
- {
- if (entry.getValue() instanceof Base64MD5PasswordFilePrincipalDatabase)
- {
- db = entry.getValue();
- break;
- }
- else if (entry.getValue() instanceof PlainPasswordFilePrincipalDatabase)
- {
- db = entry.getValue();
- }
- }
-
- if (db instanceof Base64MD5PasswordFilePrincipalDatabase)
- {
- env.put("jmx.remote.profiles", "SASL/CRAM-MD5");
- CRAMMD5HashedInitialiser initialiser = new CRAMMD5HashedInitialiser();
- initialiser.initialise(db);
- env.put("jmx.remote.sasl.callback.handler", initialiser.getCallbackHandler());
- }
- else if (db instanceof PlainPasswordFilePrincipalDatabase)
- {
- env.put("jmx.remote.profiles", "SASL/PLAIN");
- env.put("jmx.remote.sasl.callback.handler", new UserCallbackHandler(db));
- }
-
- // Enable the SSL security and server authentication
- /*
- SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
- SslRMIServerSocketFactory ssf = new SslRMIServerSocketFactory();
- env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
- env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf);
- */
-
- JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(_jmxURL, env, _mbeanServer);
- MBeanServerForwarder mbsf = MBeanInvocationHandlerImpl.newProxyInstance();
- cs.setMBeanServerForwarder(mbsf);
- cs.start();
- _log.warn("JMX: Started JMXConnector server on port '" + port + "' with SASL");
-
- }
- else
- {
- startJMXConnectorServer(port);
- _log.warn("JMX: Started JMXConnector server on port '" + port + "' with security disabled");
- }
- }
-
- /**
- * Starts up an RMIRegistry at configured port and attaches a JMXConnectorServer to it.
- *
- * @param port
- *
- * @throws IOException
- */
- private void startJMXConnectorServer(int port) throws IOException
- {
- startRMIRegistry(port);
- _jmxURL = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + port + "/jmxrmi");
- JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(_jmxURL, null, _mbeanServer);
- cs.start();
- }
-
- public void registerObject(ManagedObject managedObject) throws JMException
- {
- _mbeanServer.registerMBean(managedObject, managedObject.getObjectName());
- }
-
- public void unregisterObject(ManagedObject managedObject) throws JMException
- {
- _mbeanServer.unregisterMBean(managedObject.getObjectName());
- }
-
- /**
- * Checks is the "QPID_OPTS" env variable is set to use the out of the box JMXAgent.
- *
- * @return
- */
- private boolean areOutOfTheBoxJMXOptionsSet()
- {
- if (System.getProperty("com.sun.management.jmxremote") != null)
- {
- return true;
- }
-
- if (System.getProperty("com.sun.management.jmxremote.port") != null)
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Starts the rmi registry at given port
- *
- * @param port
- *
- * @throws RemoteException
- */
- private void startRMIRegistry(int port) throws RemoteException
- {
- System.setProperty("java.rmi.server.randomIDs", "true");
- _rmiRegistry = LocateRegistry.createRegistry(port);
- }
-
- // stops the RMIRegistry, if it was running and bound to a port
- public void close() throws RemoteException
- {
- if (_rmiRegistry != null)
- {
- // Stopping the RMI registry
- UnicastRemoteObject.unexportObject(_rmiRegistry, true);
- }
- }
-
- /** This class is used for SASL enabled JMXConnector for performing user authentication. */
- private class UserCallbackHandler implements CallbackHandler
- {
- private final PrincipalDatabase _principalDatabase;
-
- protected UserCallbackHandler(PrincipalDatabase database)
- {
- _principalDatabase = database;
- }
-
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
- {
- // Retrieve callbacks
- NameCallback ncb = null;
- PasswordCallback pcb = null;
- for (int i = 0; i < callbacks.length; i++)
- {
- if (callbacks[i] instanceof NameCallback)
- {
- ncb = (NameCallback) callbacks[i];
- }
- else if (callbacks[i] instanceof PasswordCallback)
- {
- pcb = (PasswordCallback) callbacks[i];
- }
- else if (callbacks[i] instanceof AuthorizeCallback)
- {
- ((AuthorizeCallback) callbacks[i]).setAuthorized(true);
- }
- else
- {
- throw new UnsupportedCallbackException(callbacks[i]);
- }
- }
-
- boolean authorized = false;
- // Process retrieval of password; can get password if username is available in NameCallback
- if ((ncb != null) && (pcb != null))
- {
- String username = ncb.getDefaultName();
- try
- {
- authorized = _principalDatabase.verifyPassword(username, pcb.getPassword());
- }
- catch (AccountNotFoundException e)
- {
- IOException ioe = new IOException("User not authorized. " + e);
- ioe.initCause(e);
- throw ioe;
- }
- }
-
- if (!authorized)
- {
- throw new IOException("User not authorized.");
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanAttribute.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanAttribute.java
deleted file mode 100644
index 7d42297699..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanAttribute.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.server.management;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for MBean attributes. This should be used with getter or setter
- * methods of attributes.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Inherited
-public @interface MBeanAttribute
-{
- String name();
- String description();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanConstructor.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanConstructor.java
deleted file mode 100644
index 9138e03085..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanConstructor.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.server.management;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for MBean constructors.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.CONSTRUCTOR)
-@Inherited
-public @interface MBeanConstructor
-{
- String value();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanDescription.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanDescription.java
deleted file mode 100644
index 448fed3280..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanDescription.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.server.management;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for MBean class.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Inherited
-public @interface MBeanDescription {
- String value();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java
deleted file mode 100644
index 0c2ec2aebd..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.management;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanConstructorInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanParameterInfo;
-import javax.management.NotCompliantMBeanException;
-
-/**
- * This class is a utility class to introspect the MBean class and the management
- * interface class for various purposes.
- * @author Bhupendra Bhardwaj
- * @version 0.1
- */
-class MBeanIntrospector {
-
- private static final String _defaultAttributeDescription = "Management attribute";
- private static final String _defaultOerationDescription = "Management operation";
- private static final String _defaultConstructorDescription = "MBean constructor";
- private static final String _defaultMbeanDescription = "Management interface of the MBean";
-
- /**
- * Introspects the management interface class for MBean attributes.
- * @param interfaceClass
- * @return MBeanAttributeInfo[]
- * @throws NotCompliantMBeanException
- */
- static MBeanAttributeInfo[] getMBeanAttributesInfo(Class interfaceClass)
- throws NotCompliantMBeanException
- {
- List<MBeanAttributeInfo> attributesList = new ArrayList<MBeanAttributeInfo>();
-
- /**
- * Using reflection, all methods of the managemetn interface will be analysed,
- * and MBeanInfo will be created.
- */
- for (Method method : interfaceClass.getMethods())
- {
- String name = method.getName();
- Class<?> resultType = method.getReturnType();
- MBeanAttributeInfo attributeInfo = null;
-
- if (isAttributeGetterMethod(method))
- {
- String desc = getAttributeDescription(method);
- attributeInfo = new MBeanAttributeInfo(name.substring(3),
- resultType.getName(),
- desc,
- true,
- false,
- false);
- int index = getIndexIfAlreadyExists(attributeInfo, attributesList);
- if (index == -1)
- {
- attributesList.add(attributeInfo);
- }
- else
- {
- attributeInfo = new MBeanAttributeInfo(name.substring(3),
- resultType.getName(),
- desc,
- true,
- true,
- false);
- attributesList.set(index, attributeInfo);
- }
- }
- else if (isAttributeSetterMethod(method))
- {
- String desc = getAttributeDescription(method);
- attributeInfo = new MBeanAttributeInfo(name.substring(3),
- method.getParameterTypes()[0].getName(),
- desc,
- false,
- true,
- false);
- int index = getIndexIfAlreadyExists(attributeInfo, attributesList);
- if (index == -1)
- {
- attributesList.add(attributeInfo);
- }
- else
- {
- attributeInfo = new MBeanAttributeInfo(name.substring(3),
- method.getParameterTypes()[0].getName(),
- desc,
- true,
- true,
- false);
- attributesList.set(index, attributeInfo);
- }
- }
- else if (isAttributeBoolean(method))
- {
- attributeInfo = new MBeanAttributeInfo(name.substring(2),
- resultType.getName(),
- getAttributeDescription(method),
- true,
- false,
- true);
- attributesList.add(attributeInfo);
- }
- }
-
- return attributesList.toArray(new MBeanAttributeInfo[0]);
- }
-
- /**
- * Introspects the management interface class for management operations.
- * @param interfaceClass
- * @return MBeanOperationInfo[]
- */
- static MBeanOperationInfo[] getMBeanOperationsInfo(Class interfaceClass)
- {
- List<MBeanOperationInfo> operationsList = new ArrayList<MBeanOperationInfo>();
-
- for (Method method : interfaceClass.getMethods())
- {
- if (!isAttributeGetterMethod(method) &&
- !isAttributeSetterMethod(method) &&
- !isAttributeBoolean(method))
- {
- operationsList.add(getOperationInfo(method));
- }
- }
-
- return operationsList.toArray(new MBeanOperationInfo[0]);
- }
-
- /**
- * Checks if the method is an attribute getter method.
- * @param method
- * @return true if the method is an attribute getter method.
- */
- private static boolean isAttributeGetterMethod(Method method)
- {
- if (!(method.getName().equals("get")) &&
- method.getName().startsWith("get") &&
- method.getParameterTypes().length == 0 &&
- !method.getReturnType().equals(void.class))
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if the method is an attribute setter method.
- * @param method
- * @return true if the method is an attribute setter method.
- */
- private static boolean isAttributeSetterMethod(Method method)
- {
- if (!(method.getName().equals("set")) &&
- method.getName().startsWith("set") &&
- method.getParameterTypes().length == 1 &&
- method.getReturnType().equals(void.class))
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if the attribute is a boolean and the method is a isX kind og method.
- * @param method
- * @return true if the method is an attribute isX type of method
- */
- private static boolean isAttributeBoolean(Method method)
- {
- if (!(method.getName().equals("is")) &&
- method.getName().startsWith("is") &&
- method.getParameterTypes().length == 0 &&
- method.getReturnType().equals(boolean.class))
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Helper method to retrieve the attribute index from the list of attributes.
- * @param attribute
- * @param list
- * @return attribute index no. -1 if attribtue doesn't exist
- * @throws NotCompliantMBeanException
- */
- private static int getIndexIfAlreadyExists(MBeanAttributeInfo attribute,
- List<MBeanAttributeInfo> list)
- throws NotCompliantMBeanException
- {
- String exceptionMsg = "Conflicting attribute methods for attribute " + attribute.getName();
-
- for (MBeanAttributeInfo memberAttribute : list)
- {
- if (attribute.getName().equals(memberAttribute.getName()))
- {
- if (!attribute.getType().equals(memberAttribute.getType()))
- {
- throw new NotCompliantMBeanException(exceptionMsg);
- }
- if (attribute.isReadable() && memberAttribute.isReadable())
- {
- if (attribute.isIs() != memberAttribute.isIs())
- {
- throw new NotCompliantMBeanException(exceptionMsg);
- }
- }
-
- return list.indexOf(memberAttribute);
- }
- }
-
- return -1;
- }
-
- /**
- * Retrieves the attribute description from annotation
- * @param attributeMethod
- * @return attribute description
- */
- private static String getAttributeDescription(Method attributeMethod)
- {
- MBeanAttribute anno = attributeMethod.getAnnotation(MBeanAttribute.class);
- if (anno != null)
- {
- return anno.description();
- }
- return _defaultAttributeDescription;
- }
-
- /**
- * Introspects the method to retrieve the operation information.
- * @param operation
- * @return MBeanOperationInfo
- */
- private static MBeanOperationInfo getOperationInfo(Method operation)
- {
- MBeanOperationInfo operationInfo = null;
- Class<?> returnType = operation.getReturnType();
-
- MBeanParameterInfo[] paramsInfo = getParametersInfo(operation.getParameterAnnotations(),
- operation.getParameterTypes());
-
- String operationDesc = _defaultOerationDescription;
- int impact = MBeanOperationInfo.UNKNOWN;
-
- if (operation.getAnnotation(MBeanOperation.class) != null)
- {
- operationDesc = operation.getAnnotation(MBeanOperation.class).description();
- impact = operation.getAnnotation(MBeanOperation.class).impact();
- }
- operationInfo = new MBeanOperationInfo(operation.getName(),
- operationDesc,
- paramsInfo,
- returnType.getName(),
- impact);
-
- return operationInfo;
- }
-
- /**
- * Constructs the parameter info.
- * @param paramsAnno
- * @param paramTypes
- * @return MBeanParameterInfo[]
- */
- private static MBeanParameterInfo[] getParametersInfo(Annotation[][] paramsAnno,
- Class<?>[] paramTypes)
- {
- int noOfParams = paramsAnno.length;
-
- MBeanParameterInfo[] paramsInfo = new MBeanParameterInfo[noOfParams];
-
- for (int i = 0; i < noOfParams; i++)
- {
- MBeanParameterInfo paramInfo = null;
- String type = paramTypes[i].getName();
- for (Annotation anno : paramsAnno[i])
- {
- String name,desc;
- if (MBeanOperationParameter.class.isInstance(anno))
- {
- name = MBeanOperationParameter.class.cast(anno).name();
- desc = MBeanOperationParameter.class.cast(anno).description();
- paramInfo = new MBeanParameterInfo(name, type, desc);
- }
- }
-
-
- if (paramInfo == null)
- {
- paramInfo = new MBeanParameterInfo("p " + (i + 1), type, "parameter " + (i + 1));
- }
- if (paramInfo != null)
- paramsInfo[i] = paramInfo;
- }
-
- return paramsInfo;
- }
-
- /**
- * Introspects the MBean class for constructors
- * @param implClass
- * @return MBeanConstructorInfo[]
- */
- static MBeanConstructorInfo[] getMBeanConstructorsInfo(Class implClass)
- {
- List<MBeanConstructorInfo> constructors = new ArrayList<MBeanConstructorInfo>();
-
- for (Constructor cons : implClass.getConstructors())
- {
- MBeanConstructorInfo constructorInfo = getMBeanConstructorInfo(cons);
- //MBeanConstructorInfo constructorInfo = new MBeanConstructorInfo("desc", cons);
- if (constructorInfo != null)
- constructors.add(constructorInfo);
- }
-
- return constructors.toArray(new MBeanConstructorInfo[0]);
- }
-
- /**
- * Retrieves the constructor info from given constructor.
- * @param cons
- * @return MBeanConstructorInfo
- */
- private static MBeanConstructorInfo getMBeanConstructorInfo(Constructor cons)
- {
- String desc = null;
- Annotation anno = cons.getAnnotation(MBeanConstructor.class);
- if (anno != null && MBeanConstructor.class.isInstance(anno))
- {
- desc = MBeanConstructor.class.cast(anno).value();
- }
-
- //MBeanParameterInfo[] paramsInfo = getParametersInfo(cons.getParameterAnnotations(),
- // cons.getParameterTypes());
-
- return new MBeanConstructorInfo(cons.getName(),
- desc != null ? _defaultConstructorDescription : desc ,
- null);
- }
-
- /**
- * Retrieves the description from the annotations of given class
- * @param annotatedClass
- * @return class description
- */
- static String getMBeanDescription(Class annotatedClass)
- {
- Annotation anno = annotatedClass.getAnnotation(MBeanDescription.class);
- if (anno != null && MBeanDescription.class.isInstance(anno))
- {
- return MBeanDescription.class.cast(anno).value();
- }
- return _defaultMbeanDescription;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
deleted file mode 100644
index a0ecc2bd85..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.management;
-
-import org.apache.qpid.server.security.access.management.UserManagement;
-import org.apache.log4j.Logger;
-
-import javax.management.remote.MBeanServerForwarder;
-import javax.management.remote.JMXPrincipal;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.JMException;
-import javax.security.auth.Subject;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.AccessControlContext;
-import java.util.Set;
-import java.util.Properties;
-
-/**
- * This class can be used by the JMXConnectorServer as an InvocationHandler for the mbean operations. This implements
- * the logic for allowing the users to invoke MBean operations and implements the restrictions for readOnly, readWrite
- * and admin users.
- */
-public class MBeanInvocationHandlerImpl implements InvocationHandler
-{
- private static final Logger _logger = Logger.getLogger(MBeanInvocationHandlerImpl.class);
-
- public final static String ADMIN = "admin";
- public final static String READWRITE = "readwrite";
- public final static String READONLY = "readonly";
- private final static String DELEGATE = "JMImplementation:type=MBeanServerDelegate";
- private MBeanServer mbs;
- private static Properties _userRoles = new Properties();
-
- public static MBeanServerForwarder newProxyInstance()
- {
- final InvocationHandler handler = new MBeanInvocationHandlerImpl();
- final Class[] interfaces = new Class[]{MBeanServerForwarder.class};
-
- Object proxy = Proxy.newProxyInstance(MBeanServerForwarder.class.getClassLoader(), interfaces, handler);
- return MBeanServerForwarder.class.cast(proxy);
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- final String methodName = method.getName();
-
- if (methodName.equals("getMBeanServer"))
- {
- return mbs;
- }
-
- if (methodName.equals("setMBeanServer"))
- {
- if (args[0] == null)
- {
- throw new IllegalArgumentException("Null MBeanServer");
- }
- if (mbs != null)
- {
- throw new IllegalArgumentException("MBeanServer object already initialized");
- }
- mbs = (MBeanServer) args[0];
- return null;
- }
-
- // Retrieve Subject from current AccessControlContext
- AccessControlContext acc = AccessController.getContext();
- Subject subject = Subject.getSubject(acc);
-
- // Allow operations performed locally on behalf of the connector server itself
- if (subject == null)
- {
- return method.invoke(mbs, args);
- }
-
- if (args == null || DELEGATE.equals(args[0]))
- {
- return method.invoke(mbs, args);
- }
-
- // Restrict access to "createMBean" and "unregisterMBean" to any user
- if (methodName.equals("createMBean") || methodName.equals("unregisterMBean"))
- {
- _logger.debug("User trying to create or unregister an MBean");
- throw new SecurityException("Access denied");
- }
-
- // Retrieve JMXPrincipal from Subject
- Set<JMXPrincipal> principals = subject.getPrincipals(JMXPrincipal.class);
- if (principals == null || principals.isEmpty())
- {
- throw new SecurityException("Access denied");
- }
-
- Principal principal = principals.iterator().next();
- String identity = principal.getName();
-
- if (isAdminMethod(args))
- {
- if (isAdmin(identity))
- {
- return method.invoke(mbs, args);
- }
- else
- {
- throw new SecurityException("Access denied");
- }
- }
-
- // Following users can perform any operation other than "createMBean" and "unregisterMBean"
- if (isAllowedToModify(identity))
- {
- return method.invoke(mbs, args);
- }
-
- // These users can only call "getAttribute" on the MBeanServerDelegate MBean
- // Here we can add other fine grained permissions like specific method for a particular mbean
- if (isReadOnlyUser(identity) && isReadOnlyMethod(method, args))
- {
- return method.invoke(mbs, args);
- }
-
- throw new SecurityException("Access denied");
- }
-
- private boolean isAdminMethod(Object[] args)
- {
- if (args[0] instanceof ObjectName)
- {
- ObjectName object = (ObjectName) args[0];
- return UserManagement.TYPE.equals(object.getKeyProperty("type"));
- }
-
- return false;
- }
-
- // Initialises the user roles
- public static void setAccessRights(Properties accessRights)
- {
- _userRoles = accessRights;
- }
-
- private boolean isAdmin(String userName)
- {
- if (ADMIN.equals(_userRoles.getProperty(userName)))
- {
- return true;
- }
- return false;
- }
-
- private boolean isAllowedToModify(String userName)
- {
- if (ADMIN.equals(_userRoles.getProperty(userName))
- || READWRITE.equals(_userRoles.getProperty(userName)))
- {
- return true;
- }
- return false;
- }
-
- private boolean isReadOnlyUser(String userName)
- {
- if (READONLY.equals(_userRoles.getProperty(userName)))
- {
- return true;
- }
- return false;
- }
-
- private boolean isReadOnlyMethod(Method method, Object[] args)
- {
- String methodName = method.getName();
- if (methodName.startsWith("query") || methodName.startsWith("get"))
- {
- return true;
- }
- else if (methodName.startsWith("set"))
- {
- return false;
- }
-
- if ((args[0] instanceof ObjectName) && (methodName.equals("invoke")))
- {
- String mbeanMethod = (args.length > 1) ? (String) args[1] : null;
- if (mbeanMethod == null)
- {
- return false;
- }
-
- try
- {
- MBeanInfo mbeanInfo = mbs.getMBeanInfo((ObjectName) args[0]);
- if (mbeanInfo != null)
- {
- MBeanOperationInfo[] opInfos = mbeanInfo.getOperations();
- for (MBeanOperationInfo opInfo : opInfos)
- {
- if (opInfo.getName().equals(mbeanMethod) && (opInfo.getImpact() == MBeanOperationInfo.INFO))
- {
- return true;
- }
- }
- }
- }
- catch (JMException ex)
- {
- ex.printStackTrace();
- }
- }
-
- return false;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperation.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperation.java
deleted file mode 100644
index a2dca3e51d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperation.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.server.management;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.management.MBeanOperationInfo;
-
-/**
- * Annotation for MBean operations.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Inherited
-public @interface MBeanOperation
-{
- String name();
- String description();
- int impact() default MBeanOperationInfo.INFO;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperationParameter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperationParameter.java
deleted file mode 100644
index aba5ec70d8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperationParameter.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.server.management;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for MBean operation parameters.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.PARAMETER)
-public @interface MBeanOperationParameter {
- String name();
- String description();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/Managable.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/Managable.java
deleted file mode 100644
index 166a2a376d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/Managable.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.server.management;
-
-/**
- * Any object that can return a related MBean should implement this interface.
- *
- * This enables other classes to get the managed object, which in turn is useful when
- * constructing relationships between managed objects without having to maintain
- * separate data structures containing MBeans.
- *
- */
-public interface Managable
-{
- ManagedObject getManagedObject();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java
deleted file mode 100644
index 45e2e91ed7..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.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.server.management;
-
-import java.io.IOException;
-
-import javax.management.JMException;
-import javax.management.MBeanOperationInfo;
-
-import org.apache.qpid.server.exchange.ManagedExchange;
-import org.apache.qpid.server.queue.ManagedQueue;
-
-/**
- * The ManagedBroker is the management interface to expose management
- * features of the Broker.
- *
- * @author Bhupendra Bhardwaj
- * @version 0.1
- */
-public interface ManagedBroker
-{
- static final String TYPE = "VirtualHostManager";
-
- /**
- * Creates a new Exchange.
- * @param name
- * @param type
- * @param durable
- * @param passive
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="createNewExchange", description="Creates a new Exchange", impact= MBeanOperationInfo.ACTION)
- void createNewExchange(@MBeanOperationParameter(name="name", description="Name of the new exchange")String name,
- @MBeanOperationParameter(name="ExchangeType", description="Type of the exchange")String type,
- @MBeanOperationParameter(name="durable", description="true if the Exchang should be durable")boolean durable)
- throws IOException, JMException;
-
- /**
- * unregisters all the channels, queuebindings etc and unregisters
- * this exchange from managed objects.
- * @param exchange
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="unregisterExchange",
- description="Unregisters all the related channels and queuebindings of this exchange",
- impact= MBeanOperationInfo.ACTION)
- void unregisterExchange(@MBeanOperationParameter(name= ManagedExchange.TYPE, description="Exchange Name")String exchange)
- throws IOException, JMException;
-
- /**
- * Create a new Queue on the Broker server
- * @param queueName
- * @param durable
- * @param owner
- * @param autoDelete
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="createNewQueue", description="Create a new Queue on the Broker server", impact= MBeanOperationInfo.ACTION)
- void createNewQueue(@MBeanOperationParameter(name="queue name", description="Name of the new queue")String queueName,
- @MBeanOperationParameter(name="owner", description="Owner name")String owner,
- @MBeanOperationParameter(name="durable", description="true if the queue should be durable")boolean durable)
- throws IOException, JMException;
-
- /**
- * Unregisters the Queue bindings, removes the subscriptions and unregisters
- * from the managed objects.
- * @param queueName
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="deleteQueue",
- description="Unregisters the Queue bindings, removes the subscriptions and deletes the queue",
- impact= MBeanOperationInfo.ACTION)
- void deleteQueue(@MBeanOperationParameter(name= ManagedQueue.TYPE, description="Queue Name")String queueName)
- throws IOException, JMException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedObject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedObject.java
deleted file mode 100644
index 42ea8921a4..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedObject.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.server.management;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.qpid.AMQException;
-
-/**
- * This should be implemented by all Managable objects.
- */
-public interface ManagedObject
-{
- static final String DOMAIN = "org.apache.qpid";
-
- /**
- * @return the name that uniquely identifies this object instance. It must be
- * unique only among objects of this type at this level in the hierarchy so
- * the uniqueness should not be too difficult to ensure.
- */
- String getObjectInstanceName();
-
- String getType();
-
- Class<?> getManagementInterface();
-
- ManagedObject getParentObject();
-
- void register() throws AMQException;
-
- void unregister() throws AMQException;
-
- /**
- * Returns the ObjectName required for the mbeanserver registration.
- * @return ObjectName
- * @throws MalformedObjectNameException
- */
- ObjectName getObjectName() throws MalformedObjectNameException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedObjectRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedObjectRegistry.java
deleted file mode 100644
index d8d87ef881..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagedObjectRegistry.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.server.management;
-
-import javax.management.JMException;
-import java.rmi.RemoteException;
-import java.io.IOException;
-
-/**
- * Handles the registration (and unregistration and so on) of managed objects.
- *
- * Managed objects are responsible for exposting attributes, operations and notifications. They will expose
- * these outside the JVM therefore it is important not to use implementation objects directly as managed objects.
- * Instead, creating inner classes and exposing those is an effective way of exposing internal state in a
- * controlled way.
- *
- * Although we do not explictly use them while targetting Java 5, the enhanced MXBean approach in Java 6 will
- * be the obvious choice for managed objects.
- *
- */
-public interface ManagedObjectRegistry
-{
- void start() throws IOException;
-
- void registerObject(ManagedObject managedObject) throws JMException;
-
- void unregisterObject(ManagedObject managedObject) throws JMException;
-
- void close() throws RemoteException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagementConfiguration.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagementConfiguration.java
deleted file mode 100644
index 042f626e8b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/ManagementConfiguration.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.server.management;
-
-import org.apache.qpid.configuration.Configured;
-
-public class ManagementConfiguration
-{
- @Configured(path = "management.enabled",
- defaultValue = "true")
- public boolean enabled;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/NoopManagedObjectRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/NoopManagedObjectRegistry.java
deleted file mode 100644
index b4fbed6948..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/NoopManagedObjectRegistry.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.server.management;
-
-import javax.management.JMException;
-
-import org.apache.log4j.Logger;
-
-import java.rmi.RemoteException;
-
-/**
- * This managed object registry does not actually register MBeans. This can be used in tests when management is
- * not required or when management has been disabled.
- *
- */
-public class NoopManagedObjectRegistry implements ManagedObjectRegistry
-{
- private static final Logger _log = Logger.getLogger(NoopManagedObjectRegistry.class);
-
- public NoopManagedObjectRegistry()
- {
- _log.info("Management is disabled");
- }
-
- public void start()
- {
- //no-op
- }
-
- public void registerObject(ManagedObject managedObject) throws JMException
- {
- }
-
- public void unregisterObject(ManagedObject managedObject) throws JMException
- {
- }
-
- public void close() throws RemoteException
- {
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverter.java
deleted file mode 100644
index e01c5aabbf..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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:
- * 8-0
- */
-package org.apache.qpid.server.output;
-
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.AMQDataBlock;
-import org.apache.qpid.AMQException;
-
-public interface ProtocolOutputConverter
-{
- void confirmConsumerAutoClose(int channelId, AMQShortString consumerTag);
-
- interface Factory
- {
- ProtocolOutputConverter newInstance(AMQProtocolSession session);
- }
-
- void writeDeliver(AMQMessage message, int channelId, long deliveryTag, AMQShortString consumerTag)
- throws AMQException;
-
- void writeGetOk(AMQMessage message, int channelId, long deliveryTag, int queueSize) throws AMQException;
-
- byte getProtocolMinorVersion();
-
- byte getProtocolMajorVersion();
-
- void writeReturn(AMQMessage message, int channelId, int replyCode, AMQShortString replyText)
- throws AMQException;
-
- void writeFrame(AMQDataBlock block);
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverterRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverterRegistry.java
deleted file mode 100644
index 36e7e88fd6..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverterRegistry.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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:
- * 8-0
- */
-package org.apache.qpid.server.output;
-
-import org.apache.qpid.server.output.ProtocolOutputConverter.Factory;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.framing.ProtocolVersion;
-
-import java.util.Map;
-import java.util.HashMap;
-
-public class ProtocolOutputConverterRegistry
-{
-
- private static final Map<ProtocolVersion, Factory> _registry =
- new HashMap<ProtocolVersion, Factory>();
-
-
- static
- {
- register(ProtocolVersion.v8_0, org.apache.qpid.server.output.amqp0_8.ProtocolOutputConverterImpl.getInstanceFactory());
- register(ProtocolVersion.v0_9, org.apache.qpid.server.output.amqp0_9.ProtocolOutputConverterImpl.getInstanceFactory());
-
- }
-
- private static void register(ProtocolVersion version, Factory converter)
- {
-
- _registry.put(version,converter);
- }
-
-
- public static ProtocolOutputConverter getConverter(AMQProtocolSession session)
- {
- return _registry.get(session.getProtocolVersion()).newInstance(session);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java
deleted file mode 100644
index d7a879180a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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:
- * 8-0
- */
-package org.apache.qpid.server.output.amqp0_8;
-
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQMessageHandle;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.output.ProtocolOutputConverter;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.AMQException;
-
-import org.apache.mina.common.ByteBuffer;
-
-import java.util.Iterator;
-
-public class ProtocolOutputConverterImpl implements ProtocolOutputConverter
-{
-
-
- public static Factory getInstanceFactory()
- {
- return new Factory()
- {
-
- public ProtocolOutputConverter newInstance(AMQProtocolSession session)
- {
- return new ProtocolOutputConverterImpl(session);
- }
- };
- }
-
- private final AMQProtocolSession _protocolSession;
-
- private ProtocolOutputConverterImpl(AMQProtocolSession session)
- {
- _protocolSession = session;
- }
-
-
- public AMQProtocolSession getProtocolSession()
- {
- return _protocolSession;
- }
-
- public void writeDeliver(AMQMessage message, int channelId, long deliveryTag, AMQShortString consumerTag)
- throws AMQException
- {
- AMQDataBlock deliver = createEncodedDeliverFrame(message, channelId, deliveryTag, consumerTag);
- AMQDataBlock contentHeader = ContentHeaderBody.createAMQFrame(channelId,
- message.getContentHeaderBody());
-
- final AMQMessageHandle messageHandle = message.getMessageHandle();
- final StoreContext storeContext = message.getStoreContext();
- final Long messageId = message.getMessageId();
-
- final int bodyCount = messageHandle.getBodyCount(storeContext,messageId);
-
- if(bodyCount == 0)
- {
- SmallCompositeAMQDataBlock compositeBlock = new SmallCompositeAMQDataBlock(deliver,
- contentHeader);
-
- writeFrame(compositeBlock);
- }
- else
- {
-
-
- //
- // Optimise the case where we have a single content body. In that case we create a composite block
- // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
- //
- ContentChunk cb = messageHandle.getContentChunk(storeContext,messageId, 0);
-
- AMQDataBlock firstContentBody = new AMQFrame(channelId, getProtocolSession().getMethodRegistry().getProtocolVersionMethodConverter().convertToBody(cb));
- AMQDataBlock[] blocks = new AMQDataBlock[]{deliver, contentHeader, firstContentBody};
- CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(blocks);
- writeFrame(compositeBlock);
-
- //
- // Now start writing out the other content bodies
- //
- for(int i = 1; i < bodyCount; i++)
- {
- cb = messageHandle.getContentChunk(storeContext,messageId, i);
- writeFrame(new AMQFrame(channelId, getProtocolSession().getMethodRegistry().getProtocolVersionMethodConverter().convertToBody(cb)));
- }
-
-
- }
-
-
- }
-
-
- public void writeGetOk(AMQMessage message, int channelId, long deliveryTag, int queueSize) throws AMQException
- {
-
- final AMQMessageHandle messageHandle = message.getMessageHandle();
- final StoreContext storeContext = message.getStoreContext();
- final long messageId = message.getMessageId();
-
- AMQDataBlock deliver = createEncodedGetOkFrame(message, channelId, deliveryTag, queueSize);
-
-
- AMQDataBlock contentHeader = ContentHeaderBody.createAMQFrame(channelId,
- message.getContentHeaderBody());
-
- final int bodyCount = messageHandle.getBodyCount(storeContext,messageId);
- if(bodyCount == 0)
- {
- SmallCompositeAMQDataBlock compositeBlock = new SmallCompositeAMQDataBlock(deliver,
- contentHeader);
- writeFrame(compositeBlock);
- }
- else
- {
-
-
- //
- // Optimise the case where we have a single content body. In that case we create a composite block
- // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
- //
- ContentChunk cb = messageHandle.getContentChunk(storeContext,messageId, 0);
-
- AMQDataBlock firstContentBody = new AMQFrame(channelId, getProtocolSession().getMethodRegistry().getProtocolVersionMethodConverter().convertToBody(cb));
- AMQDataBlock[] blocks = new AMQDataBlock[]{deliver, contentHeader, firstContentBody};
- CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(blocks);
- writeFrame(compositeBlock);
-
- //
- // Now start writing out the other content bodies
- //
- for(int i = 1; i < bodyCount; i++)
- {
- cb = messageHandle.getContentChunk(storeContext, messageId, i);
- writeFrame(new AMQFrame(channelId, getProtocolSession().getMethodRegistry().getProtocolVersionMethodConverter().convertToBody(cb)));
- }
-
-
- }
-
-
- }
-
-
- private AMQDataBlock createEncodedDeliverFrame(AMQMessage message, int channelId, long deliveryTag, AMQShortString consumerTag)
- throws AMQException
- {
- final MessagePublishInfo pb = message.getMessagePublishInfo();
- final AMQMessageHandle messageHandle = message.getMessageHandle();
-
- MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(ProtocolVersion.v8_0);
- BasicDeliverBody deliverBody =
- methodRegistry.createBasicDeliverBody(consumerTag,
- deliveryTag,
- messageHandle.isRedelivered(),
- pb.getExchange(),
- pb.getRoutingKey());
- AMQFrame deliverFrame = deliverBody.generateFrame(channelId);
-
-
- return deliverFrame;
- }
-
- private AMQDataBlock createEncodedGetOkFrame(AMQMessage message, int channelId, long deliveryTag, int queueSize)
- throws AMQException
- {
- final MessagePublishInfo pb = message.getMessagePublishInfo();
- final AMQMessageHandle messageHandle = message.getMessageHandle();
-
- MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(ProtocolVersion.v8_0);
- BasicGetOkBody getOkBody =
- methodRegistry.createBasicGetOkBody(deliveryTag,
- messageHandle.isRedelivered(),
- pb.getExchange(),
- pb.getRoutingKey(),
- queueSize);
- AMQFrame getOkFrame = getOkBody.generateFrame(channelId);
-
- return getOkFrame;
- }
-
- public byte getProtocolMinorVersion()
- {
- return getProtocolSession().getProtocolMinorVersion();
- }
-
- public byte getProtocolMajorVersion()
- {
- return getProtocolSession().getProtocolMajorVersion();
- }
-
- private AMQDataBlock createEncodedReturnFrame(AMQMessage message, int channelId, int replyCode, AMQShortString replyText) throws AMQException
- {
- MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(ProtocolVersion.v8_0);
- BasicReturnBody basicReturnBody =
- methodRegistry.createBasicReturnBody(replyCode,
- replyText,
- message.getMessagePublishInfo().getExchange(),
- message.getMessagePublishInfo().getRoutingKey());
- AMQFrame returnFrame = basicReturnBody.generateFrame(channelId);
-
- return returnFrame;
- }
-
- public void writeReturn(AMQMessage message, int channelId, int replyCode, AMQShortString replyText)
- throws AMQException
- {
- AMQDataBlock returnFrame = createEncodedReturnFrame(message, channelId, replyCode, replyText);
-
- AMQDataBlock contentHeader = ContentHeaderBody.createAMQFrame(channelId,
- message.getContentHeaderBody());
-
- Iterator<AMQDataBlock> bodyFrameIterator = message.getBodyFrameIterator(getProtocolSession(), channelId);
- //
- // Optimise the case where we have a single content body. In that case we create a composite block
- // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
- //
- if (bodyFrameIterator.hasNext())
- {
- AMQDataBlock firstContentBody = bodyFrameIterator.next();
- AMQDataBlock[] blocks = new AMQDataBlock[]{returnFrame, contentHeader, firstContentBody};
- CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(blocks);
- writeFrame(compositeBlock);
- }
- else
- {
- CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(new AMQDataBlock[]{returnFrame, contentHeader});
-
- writeFrame(compositeBlock);
- }
-
- //
- // Now start writing out the other content bodies
- // TODO: MINA needs to be fixed so the the pending writes buffer is not unbounded
- //
- while (bodyFrameIterator.hasNext())
- {
- writeFrame(bodyFrameIterator.next());
- }
- }
-
-
- public void writeFrame(AMQDataBlock block)
- {
- getProtocolSession().writeFrame(block);
- }
-
-
- public void confirmConsumerAutoClose(int channelId, AMQShortString consumerTag)
- {
- MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(ProtocolVersion.v8_0);
- BasicCancelOkBody basicCancelOkBody = methodRegistry.createBasicCancelOkBody(consumerTag);
- writeFrame(basicCancelOkBody.generateFrame(channelId));
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java
deleted file mode 100644
index 646ef43826..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java
+++ /dev/null
@@ -1,372 +0,0 @@
-package org.apache.qpid.server.output.amqp0_9;
-
-import org.apache.mina.common.ByteBuffer;
-
-import java.util.Iterator;
-
-import org.apache.qpid.server.output.ProtocolOutputConverter;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQMessageHandle;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.framing.abstraction.ProtocolVersionMethodConverter;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
-
-public class ProtocolOutputConverterImpl implements ProtocolOutputConverter
-{
- private static final MethodRegistry METHOD_REGISTRY = MethodRegistry.getMethodRegistry(ProtocolVersion.v0_9);
- private static final ProtocolVersionMethodConverter PROTOCOL_METHOD_CONVERTER = METHOD_REGISTRY.getProtocolVersionMethodConverter();
-
-
- public static Factory getInstanceFactory()
- {
- return new Factory()
- {
-
- public ProtocolOutputConverter newInstance(AMQProtocolSession session)
- {
- return new ProtocolOutputConverterImpl(session);
- }
- };
- }
-
- private final AMQProtocolSession _protocolSession;
-
- private ProtocolOutputConverterImpl(AMQProtocolSession session)
- {
- _protocolSession = session;
- }
-
-
- public AMQProtocolSession getProtocolSession()
- {
- return _protocolSession;
- }
-
- public void writeDeliver(AMQMessage message, int channelId, long deliveryTag, AMQShortString consumerTag)
- throws AMQException
- {
- AMQBody deliverBody = createEncodedDeliverFrame(message, channelId, deliveryTag, consumerTag);
- final ContentHeaderBody contentHeaderBody = message.getContentHeaderBody();
-
-
- final AMQMessageHandle messageHandle = message.getMessageHandle();
- final StoreContext storeContext = message.getStoreContext();
- final Long messageId = message.getMessageId();
-
- final int bodyCount = messageHandle.getBodyCount(storeContext,messageId);
-
- if(bodyCount == 0)
- {
- SmallCompositeAMQBodyBlock compositeBlock = new SmallCompositeAMQBodyBlock(channelId, deliverBody,
- contentHeaderBody);
-
- writeFrame(compositeBlock);
- }
- else
- {
-
-
- //
- // Optimise the case where we have a single content body. In that case we create a composite block
- // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
- //
- ContentChunk cb = messageHandle.getContentChunk(storeContext,messageId, 0);
-
- AMQBody firstContentBody = PROTOCOL_METHOD_CONVERTER.convertToBody(cb);
-
- CompositeAMQBodyBlock compositeBlock = new CompositeAMQBodyBlock(channelId, deliverBody, contentHeaderBody, firstContentBody);
- writeFrame(compositeBlock);
-
- //
- // Now start writing out the other content bodies
- //
- for(int i = 1; i < bodyCount; i++)
- {
- cb = messageHandle.getContentChunk(storeContext,messageId, i);
- writeFrame(new AMQFrame(channelId, PROTOCOL_METHOD_CONVERTER.convertToBody(cb)));
- }
-
-
- }
-
-
- }
-
- private AMQDataBlock createContentHeaderBlock(final int channelId, final ContentHeaderBody contentHeaderBody)
- {
-
- AMQDataBlock contentHeader = ContentHeaderBody.createAMQFrame(channelId,
- contentHeaderBody);
- return contentHeader;
- }
-
-
- public void writeGetOk(AMQMessage message, int channelId, long deliveryTag, int queueSize) throws AMQException
- {
-
- final AMQMessageHandle messageHandle = message.getMessageHandle();
- final StoreContext storeContext = message.getStoreContext();
- final long messageId = message.getMessageId();
-
- AMQFrame deliver = createEncodedGetOkFrame(message, channelId, deliveryTag, queueSize);
-
-
- AMQDataBlock contentHeader = createContentHeaderBlock(channelId, message.getContentHeaderBody());
-
- final int bodyCount = messageHandle.getBodyCount(storeContext,messageId);
- if(bodyCount == 0)
- {
- SmallCompositeAMQDataBlock compositeBlock = new SmallCompositeAMQDataBlock(deliver,
- contentHeader);
- writeFrame(compositeBlock);
- }
- else
- {
-
-
- //
- // Optimise the case where we have a single content body. In that case we create a composite block
- // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
- //
- ContentChunk cb = messageHandle.getContentChunk(storeContext,messageId, 0);
-
- AMQDataBlock firstContentBody = new AMQFrame(channelId, PROTOCOL_METHOD_CONVERTER.convertToBody(cb));
- AMQDataBlock[] blocks = new AMQDataBlock[]{deliver, contentHeader, firstContentBody};
- CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(blocks);
- writeFrame(compositeBlock);
-
- //
- // Now start writing out the other content bodies
- //
- for(int i = 1; i < bodyCount; i++)
- {
- cb = messageHandle.getContentChunk(storeContext, messageId, i);
- writeFrame(new AMQFrame(channelId, PROTOCOL_METHOD_CONVERTER.convertToBody(cb)));
- }
-
-
- }
-
-
- }
-
-
- private AMQBody createEncodedDeliverFrame(AMQMessage message, final int channelId, final long deliveryTag, final AMQShortString consumerTag)
- throws AMQException
- {
- final MessagePublishInfo pb = message.getMessagePublishInfo();
- final AMQMessageHandle messageHandle = message.getMessageHandle();
-
-
- final boolean isRedelivered = messageHandle.isRedelivered();
- final AMQShortString exchangeName = pb.getExchange();
- final AMQShortString routingKey = pb.getRoutingKey();
-
- final AMQBody returnBlock = new AMQBody()
- {
-
- public AMQBody _underlyingBody;
-
- public AMQBody createAMQBody()
- {
- return METHOD_REGISTRY.createBasicDeliverBody(consumerTag,
- deliveryTag,
- isRedelivered,
- exchangeName,
- routingKey);
-
-
-
-
-
- }
-
- public byte getFrameType()
- {
- return AMQMethodBody.TYPE;
- }
-
- public int getSize()
- {
- if(_underlyingBody == null)
- {
- _underlyingBody = createAMQBody();
- }
- return _underlyingBody.getSize();
- }
-
- public void writePayload(ByteBuffer buffer)
- {
- if(_underlyingBody == null)
- {
- _underlyingBody = createAMQBody();
- }
- _underlyingBody.writePayload(buffer);
- }
-
- public void handle(final int channelId, final AMQVersionAwareProtocolSession amqMinaProtocolSession)
- throws AMQException
- {
- throw new AMQException("This block should never be dispatched!");
- }
- };
- return returnBlock;
- }
-
- private AMQFrame createEncodedGetOkFrame(AMQMessage message, int channelId, long deliveryTag, int queueSize)
- throws AMQException
- {
- final MessagePublishInfo pb = message.getMessagePublishInfo();
- final AMQMessageHandle messageHandle = message.getMessageHandle();
-
-
- BasicGetOkBody getOkBody =
- METHOD_REGISTRY.createBasicGetOkBody(deliveryTag,
- messageHandle.isRedelivered(),
- pb.getExchange(),
- pb.getRoutingKey(),
- queueSize);
- AMQFrame getOkFrame = getOkBody.generateFrame(channelId);
-
- return getOkFrame;
- }
-
- public byte getProtocolMinorVersion()
- {
- return getProtocolSession().getProtocolMinorVersion();
- }
-
- public byte getProtocolMajorVersion()
- {
- return getProtocolSession().getProtocolMajorVersion();
- }
-
- private AMQDataBlock createEncodedReturnFrame(AMQMessage message, int channelId, int replyCode, AMQShortString replyText) throws AMQException
- {
-
- BasicReturnBody basicReturnBody =
- METHOD_REGISTRY.createBasicReturnBody(replyCode,
- replyText,
- message.getMessagePublishInfo().getExchange(),
- message.getMessagePublishInfo().getRoutingKey());
- AMQFrame returnFrame = basicReturnBody.generateFrame(channelId);
-
- return returnFrame;
- }
-
- public void writeReturn(AMQMessage message, int channelId, int replyCode, AMQShortString replyText)
- throws AMQException
- {
- AMQDataBlock returnFrame = createEncodedReturnFrame(message, channelId, replyCode, replyText);
-
- AMQDataBlock contentHeader = createContentHeaderBlock(channelId, message.getContentHeaderBody());
-
- Iterator<AMQDataBlock> bodyFrameIterator = message.getBodyFrameIterator(getProtocolSession(), channelId);
- //
- // Optimise the case where we have a single content body. In that case we create a composite block
- // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
- //
- if (bodyFrameIterator.hasNext())
- {
- AMQDataBlock firstContentBody = bodyFrameIterator.next();
- AMQDataBlock[] blocks = new AMQDataBlock[]{returnFrame, contentHeader, firstContentBody};
- CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(blocks);
- writeFrame(compositeBlock);
- }
- else
- {
- CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(new AMQDataBlock[]{returnFrame, contentHeader});
-
- writeFrame(compositeBlock);
- }
-
- //
- // Now start writing out the other content bodies
- // TODO: MINA needs to be fixed so the the pending writes buffer is not unbounded
- //
- while (bodyFrameIterator.hasNext())
- {
- writeFrame(bodyFrameIterator.next());
- }
- }
-
-
- public void writeFrame(AMQDataBlock block)
- {
- getProtocolSession().writeFrame(block);
- }
-
-
- public void confirmConsumerAutoClose(int channelId, AMQShortString consumerTag)
- {
-
- BasicCancelOkBody basicCancelOkBody = METHOD_REGISTRY.createBasicCancelOkBody(consumerTag);
- writeFrame(basicCancelOkBody.generateFrame(channelId));
-
- }
-
-
- public static final class CompositeAMQBodyBlock extends AMQDataBlock
- {
- public static final int OVERHEAD = 3 * AMQFrame.getFrameOverhead();
-
- private final AMQBody _methodBody;
- private final AMQBody _headerBody;
- private final AMQBody _contentBody;
- private final int _channel;
-
-
- public CompositeAMQBodyBlock(int channel, AMQBody methodBody, AMQBody headerBody, AMQBody contentBody)
- {
- _channel = channel;
- _methodBody = methodBody;
- _headerBody = headerBody;
- _contentBody = contentBody;
-
- }
-
- public long getSize()
- {
- return OVERHEAD + _methodBody.getSize() + _headerBody.getSize() + _contentBody.getSize();
- }
-
- public void writePayload(ByteBuffer buffer)
- {
- AMQFrame.writeFrames(buffer, _channel, _methodBody, _headerBody, _contentBody);
- }
- }
-
- public static final class SmallCompositeAMQBodyBlock extends AMQDataBlock
- {
- public static final int OVERHEAD = 2 * AMQFrame.getFrameOverhead();
-
- private final AMQBody _methodBody;
- private final AMQBody _headerBody;
- private final int _channel;
-
-
- public SmallCompositeAMQBodyBlock(int channel, AMQBody methodBody, AMQBody headerBody)
- {
- _channel = channel;
- _methodBody = methodBody;
- _headerBody = headerBody;
-
- }
-
- public long getSize()
- {
- return OVERHEAD + _methodBody.getSize() + _headerBody.getSize() ;
- }
-
- public void writePayload(ByteBuffer buffer)
- {
- AMQFrame.writeFrames(buffer, _channel, _methodBody, _headerBody);
- }
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/Activator.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/Activator.java
deleted file mode 100644
index b0ebf197f9..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/Activator.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.server.plugins;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator
-{
-
- BundleContext _context = null;
-
- public void start(BundleContext ctx) throws Exception
- {
- _context = ctx;
- }
-
- public void stop(BundleContext ctx) throws Exception
- {
- start(null);
- }
-
- public BundleContext getContext()
- {
- return _context;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java
deleted file mode 100644
index 9191ecf6ed..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.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.
- */
-
-package org.apache.qpid.server.plugins;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.felix.framework.Felix;
-import org.apache.felix.framework.cache.BundleCache;
-import org.apache.felix.framework.util.FelixConstants;
-import org.apache.felix.framework.util.StringMap;
-import org.apache.qpid.server.exchange.ExchangeType;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleException;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- *
- * @author aidan
- *
- * Provides access to pluggable elements, such as exchanges
- */
-
-public class PluginManager
-{
-
- private Felix _felix = null;
- private ServiceTracker _exchangeTracker = null;
- private Activator _activator = null;
- private boolean _empty;
-
- public PluginManager(String plugindir) throws Exception
- {
- StringMap configMap = new StringMap(false);
-
- // Tell felix it's being embedded
- configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
- // Add the bundle provided service interface package and the core OSGi
- // packages to be exported from the class path via the system bundle.
- configMap.put(FelixConstants.FRAMEWORK_SYSTEMPACKAGES, "org.osgi.framework; version=1.3.0,"
- + "org.osgi.service.packageadmin; version=1.2.0," +
- "org.osgi.service.startlevel; version=1.0.0," +
- "org.osgi.service.url; version=1.0.0," +
- "org.apache.qpid.framing; version=0.2.1," +
- "org.apache.qpid.server.exchange; version=0.2.1," +
- "org.apache.qpid.server.management; version=0.2.1,"+
- "org.apache.qpid.protocol; version=0.2.1,"+
- "org.apache.qpid.server.virtualhost; version=0.2.1," +
- "org.apache.qpid; version=0.2.1," +
- "org.apache.qpid.server.queue; version=0.2.1," +
- "javax.management.openmbean; version=1.0.0,"+
- "javax.management; version=1.0.0,"+
- "org.apache.qpid.junit.extensions.util; version=0.6.1,"
- );
-
- if (plugindir == null)
- {
- _empty = true;
- return;
- }
-
- // Set the list of bundles to load
- File dir = new File(plugindir);
- if (!dir.exists())
- {
- _empty = true;
- return;
- }
- StringBuffer pluginJars = new StringBuffer();
-
- if (dir.isDirectory())
- {
- for (String child : dir.list())
- {
- if (child.endsWith("jar"))
- {
- pluginJars.append(String.format(" file:%s%s%s", plugindir,File.separator,child));
- }
- }
- }
- if (pluginJars.length() == 0)
- {
- _empty = true;
- return;
- }
-
- configMap.put(FelixConstants.AUTO_START_PROP + ".1", pluginJars.toString());
- configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, plugindir);
-
- List<BundleActivator> activators = new ArrayList<BundleActivator>();
- _activator = new Activator();
- activators.add(_activator);
-
- _felix = new Felix(configMap, activators);
- try
- {
- _felix.start();
- _exchangeTracker = new ServiceTracker(_activator.getContext(), ExchangeType.class.getName(), null);
- _exchangeTracker.open();
- }
- catch (BundleException e)
- {
- throw new Exception("Could not create bundle");
- }
- }
-
- public Map<String, ExchangeType<?>> getExchanges()
- {
- if (_empty)
- {
- return null;
- }
- Map<String, ExchangeType<?>>exchanges = new HashMap<String, ExchangeType<?>>();
- for (Object service : _exchangeTracker.getServices())
- {
- if (service instanceof ExchangeType<?>)
- {
- exchanges.put(service.getClass().getName(), (ExchangeType<?>) service);
- }
- }
-
- return exchanges;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
deleted file mode 100644
index 6f40594cb4..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.protocol;
-
-import org.apache.log4j.Logger;
-
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.IoServiceConfig;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.transport.vmpipe.VmPipeAddress;
-
-import org.apache.qpid.AMQChannelException;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.AMQCodecFactory;
-import org.apache.qpid.codec.AMQDecoder;
-import org.apache.qpid.common.ClientProperties;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.pool.ReadWriteThreadModel;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.protocol.AMQMethodListener;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.handler.ServerMethodDispatcherImpl;
-import org.apache.qpid.server.management.Managable;
-import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.server.output.ProtocolOutputConverter;
-import org.apache.qpid.server.output.ProtocolOutputConverterRegistry;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.state.AMQState;
-import org.apache.qpid.server.state.AMQStateManager;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-
-import javax.management.JMException;
-import javax.security.sasl.SaslServer;
-
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-public class AMQMinaProtocolSession implements AMQProtocolSession, Managable
-{
- private static final Logger _logger = Logger.getLogger(AMQProtocolSession.class);
-
- private static final String CLIENT_PROPERTIES_INSTANCE = ClientProperties.instance.toString();
-
- // to save boxing the channelId and looking up in a map... cache in an array the low numbered
- // channels. This value must be of the form 2^x - 1.
- private static final int CHANNEL_CACHE_SIZE = 0xff;
-
- private final IoSession _minaProtocolSession;
-
- private AMQShortString _contextKey;
-
- private AMQShortString _clientVersion = null;
-
- private VirtualHost _virtualHost;
-
- private final Map<Integer, AMQChannel> _channelMap = new HashMap<Integer, AMQChannel>();
-
- private final AMQChannel[] _cachedChannels = new AMQChannel[CHANNEL_CACHE_SIZE + 1];
-
- private final CopyOnWriteArraySet<AMQMethodListener> _frameListeners = new CopyOnWriteArraySet<AMQMethodListener>();
-
- private final AMQStateManager _stateManager;
-
- private AMQCodecFactory _codecFactory;
-
- private AMQProtocolSessionMBean _managedObject;
-
- private SaslServer _saslServer;
-
- private Object _lastReceived;
-
- private Object _lastSent;
-
- private boolean _closed;
- // maximum number of channels this session should have
- private long _maxNoOfChannels = 1000;
-
- /* AMQP Version for this session */
- private ProtocolVersion _protocolVersion = ProtocolVersion.getLatestSupportedVersion();
-
- private FieldTable _clientProperties;
- private final List<Task> _taskList = new CopyOnWriteArrayList<Task>();
-
- private List<Integer> _closingChannelsList = new CopyOnWriteArrayList<Integer>();
- private ProtocolOutputConverter _protocolOutputConverter;
- private Principal _authorizedID;
- private MethodDispatcher _dispatcher;
-
- public ManagedObject getManagedObject()
- {
- return _managedObject;
- }
-
- public AMQMinaProtocolSession(IoSession session, VirtualHostRegistry virtualHostRegistry, AMQCodecFactory codecFactory)
- throws AMQException
- {
- _stateManager = new AMQStateManager(virtualHostRegistry, this);
- _minaProtocolSession = session;
- session.setAttachment(this);
-
- _codecFactory = codecFactory;
-
- try
- {
- IoServiceConfig config = session.getServiceConfig();
- ReadWriteThreadModel threadModel = (ReadWriteThreadModel) config.getThreadModel();
- threadModel.getAsynchronousReadFilter().createNewJobForSession(session);
- threadModel.getAsynchronousWriteFilter().createNewJobForSession(session);
- }
- catch (RuntimeException e)
- {
- e.printStackTrace();
- // throw e;
-
- }
-
- // this(session, queueRegistry, exchangeRegistry, codecFactory, new AMQStateManager());
- }
-
- public AMQMinaProtocolSession(IoSession session, VirtualHostRegistry virtualHostRegistry, AMQCodecFactory codecFactory,
- AMQStateManager stateManager) throws AMQException
- {
- _stateManager = stateManager;
- _minaProtocolSession = session;
- session.setAttachment(this);
-
- _codecFactory = codecFactory;
-
- }
-
- private AMQProtocolSessionMBean createMBean() throws AMQException
- {
- try
- {
- return new AMQProtocolSessionMBean(this);
- }
- catch (JMException ex)
- {
- _logger.error("AMQProtocolSession MBean creation has failed ", ex);
- throw new AMQException("AMQProtocolSession MBean creation has failed ", ex);
- }
- }
-
- public IoSession getIOSession()
- {
- return _minaProtocolSession;
- }
-
- public static AMQProtocolSession getAMQProtocolSession(IoSession minaProtocolSession)
- {
- return (AMQProtocolSession) minaProtocolSession.getAttachment();
- }
-
- public void dataBlockReceived(AMQDataBlock message) throws Exception
- {
- _lastReceived = message;
- if (message instanceof ProtocolInitiation)
- {
- protocolInitiationReceived((ProtocolInitiation) message);
-
- }
- else if (message instanceof AMQFrame)
- {
- AMQFrame frame = (AMQFrame) message;
- frameReceived(frame);
-
- }
- else
- {
- throw new UnknnownMessageTypeException(message);
- }
- }
-
- private void frameReceived(AMQFrame frame) throws AMQException
- {
- int channelId = frame.getChannel();
- AMQBody body = frame.getBodyFrame();
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Frame Received: " + frame);
- }
-
- // Check that this channel is not closing
- if (channelAwaitingClosure(channelId))
- {
- if ((frame.getBodyFrame() instanceof ChannelCloseOkBody))
- {
- if (_logger.isInfoEnabled())
- {
- _logger.info("Channel[" + channelId + "] awaiting closure - processing close-ok");
- }
- }
- else
- {
- if (_logger.isInfoEnabled())
- {
- _logger.info("Channel[" + channelId + "] awaiting closure ignoring");
- }
-
- return;
- }
- }
-
-
-
- try
- {
- body.handle(channelId, this);
- }
- catch (AMQException e)
- {
- closeChannel(channelId);
- throw e;
- }
-
- }
-
- private void protocolInitiationReceived(ProtocolInitiation pi)
- {
- // this ensures the codec never checks for a PI message again
- ((AMQDecoder) _codecFactory.getDecoder()).setExpectProtocolInitiation(false);
- try
- {
- ProtocolVersion pv = pi.checkVersion(); // Fails if not correct
-
- // This sets the protocol version (and hence framing classes) for this session.
- setProtocolVersion(pv);
-
- String mechanisms = ApplicationRegistry.getInstance().getAuthenticationManager().getMechanisms();
-
- String locales = "en_US";
-
-
- AMQMethodBody responseBody = getMethodRegistry().createConnectionStartBody((short) getProtocolMajorVersion(),
- (short) getProtocolMinorVersion(),
- null,
- mechanisms.getBytes(),
- locales.getBytes());
- _minaProtocolSession.write(responseBody.generateFrame(0));
-
-
- }
- catch (AMQException e)
- {
- _logger.error("Received incorrect protocol initiation", e);
-
- _minaProtocolSession.write(new ProtocolInitiation(ProtocolVersion.getLatestSupportedVersion()));
-
- // TODO: Close connection (but how to wait until message is sent?)
- // ritchiem 2006-12-04 will this not do?
- // WriteFuture future = _minaProtocolSession.write(new ProtocolInitiation(pv[i][PROTOCOLgetProtocolMajorVersion()], pv[i][PROTOCOLgetProtocolMinorVersion()]));
- // future.join();
- // close connection
-
- }
- }
-
- public void methodFrameReceived(int channelId, AMQMethodBody methodBody)
- {
-
- final AMQMethodEvent<AMQMethodBody> evt = new AMQMethodEvent<AMQMethodBody>(channelId, methodBody);
-
- try
- {
- try
- {
-
- boolean wasAnyoneInterested = _stateManager.methodReceived(evt);
-
- if (!_frameListeners.isEmpty())
- {
- for (AMQMethodListener listener : _frameListeners)
- {
- wasAnyoneInterested = listener.methodReceived(evt) || wasAnyoneInterested;
- }
- }
-
- if (!wasAnyoneInterested)
- {
- throw new AMQNoMethodHandlerException(evt);
- }
- }
- catch (AMQChannelException e)
- {
- if (getChannel(channelId) != null)
- {
- if (_logger.isInfoEnabled())
- {
- _logger.info("Closing channel due to: " + e.getMessage());
- }
-
- writeFrame(e.getCloseFrame(channelId));
- closeChannel(channelId);
- }
- else
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("ChannelException occured on non-existent channel:" + e.getMessage());
- }
-
- if (_logger.isInfoEnabled())
- {
- _logger.info("Closing connection due to: " + e.getMessage());
- }
-
- closeSession();
-
- AMQConnectionException ce =
- evt.getMethod().getConnectionException(AMQConstant.CHANNEL_ERROR,
- AMQConstant.CHANNEL_ERROR.getName().toString());
-
- _stateManager.changeState(AMQState.CONNECTION_CLOSING);
- writeFrame(ce.getCloseFrame(channelId));
- }
- }
- catch (AMQConnectionException e)
- {
- if (_logger.isInfoEnabled())
- {
- _logger.info("Closing connection due to: " + e.getMessage());
- }
-
- markChannelawaitingCloseOk(channelId);
- closeSession();
- _stateManager.changeState(AMQState.CONNECTION_CLOSING);
- writeFrame(e.getCloseFrame(channelId));
- }
- }
- catch (Exception e)
- {
-
- for (AMQMethodListener listener : _frameListeners)
- {
- listener.error(e);
- }
-
- _minaProtocolSession.close();
- }
- }
-
- public void contentHeaderReceived(int channelId, ContentHeaderBody body) throws AMQException
- {
-
- AMQChannel channel = getAndAssertChannel(channelId);
-
- channel.publishContentHeader(body, this);
-
- }
-
- public void contentBodyReceived(int channelId, ContentBody body) throws AMQException
- {
- AMQChannel channel = getAndAssertChannel(channelId);
-
- channel.publishContentBody(body, this);
- }
-
- public void heartbeatBodyReceived(int channelId, HeartbeatBody body)
- {
- // NO - OP
- }
-
- /**
- * Convenience method that writes a frame to the protocol session. Equivalent to calling
- * getProtocolSession().write().
- *
- * @param frame the frame to write
- */
- public void writeFrame(AMQDataBlock frame)
- {
- _lastSent = frame;
- _minaProtocolSession.write(frame);
- }
-
- public AMQShortString getContextKey()
- {
- return _contextKey;
- }
-
- public void setContextKey(AMQShortString contextKey)
- {
- _contextKey = contextKey;
- }
-
- public List<AMQChannel> getChannels()
- {
- return new ArrayList<AMQChannel>(_channelMap.values());
- }
-
- public AMQChannel getAndAssertChannel(int channelId) throws AMQException
- {
- AMQChannel channel = getChannel(channelId);
- if (channel == null)
- {
- throw new AMQException(AMQConstant.NOT_FOUND, "Channel not found with id:" + channelId);
- }
-
- return channel;
- }
-
- public AMQChannel getChannel(int channelId) throws AMQException
- {
- final AMQChannel channel =
- ((channelId & CHANNEL_CACHE_SIZE) == channelId) ? _cachedChannels[channelId] : _channelMap.get(channelId);
- if ((channel == null) || channel.isClosing())
- {
- return null;
- }
- else
- {
- return channel;
- }
- }
-
- public boolean channelAwaitingClosure(int channelId)
- {
- return _closingChannelsList.contains(channelId);
- }
-
- public void addChannel(AMQChannel channel) throws AMQException
- {
- if (_closed)
- {
- throw new AMQException("Session is closed");
- }
-
- final int channelId = channel.getChannelId();
-
- if (_closingChannelsList.contains(channelId))
- {
- throw new AMQException("Session is marked awaiting channel close");
- }
-
- if (_channelMap.size() == _maxNoOfChannels)
- {
- String errorMessage =
- toString() + ": maximum number of channels has been reached (" + _maxNoOfChannels
- + "); can't create channel";
- _logger.error(errorMessage);
- throw new AMQException(AMQConstant.NOT_ALLOWED, errorMessage);
- }
- else
- {
- _channelMap.put(channel.getChannelId(), channel);
- }
-
- if (((channelId & CHANNEL_CACHE_SIZE) == channelId))
- {
- _cachedChannels[channelId] = channel;
- }
-
- checkForNotification();
- }
-
- private void checkForNotification()
- {
- int channelsCount = _channelMap.size();
- if (channelsCount >= _maxNoOfChannels)
- {
- _managedObject.notifyClients("Channel count (" + channelsCount + ") has reached the threshold value");
- }
- }
-
- public Long getMaximumNumberOfChannels()
- {
- return _maxNoOfChannels;
- }
-
- public void setMaximumNumberOfChannels(Long value)
- {
- _maxNoOfChannels = value;
- }
-
- public void commitTransactions(AMQChannel channel) throws AMQException
- {
- if ((channel != null) && channel.isTransactional())
- {
- channel.commit();
- }
- }
-
- public void rollbackTransactions(AMQChannel channel) throws AMQException
- {
- if ((channel != null) && channel.isTransactional())
- {
- channel.rollback();
- }
- }
-
- /**
- * Close a specific channel. This will remove any resources used by the channel, including: <ul><li>any queue
- * subscriptions (this may in turn remove queues if they are auto delete</li> </ul>
- *
- * @param channelId id of the channel to close
- *
- * @throws AMQException if an error occurs closing the channel
- * @throws IllegalArgumentException if the channel id is not valid
- */
- public void closeChannel(int channelId) throws AMQException
- {
- final AMQChannel channel = getChannel(channelId);
- if (channel == null)
- {
- throw new IllegalArgumentException("Unknown channel id");
- }
- else
- {
- try
- {
- channel.close(this);
- markChannelawaitingCloseOk(channelId);
- }
- finally
- {
- removeChannel(channelId);
- }
- }
- }
-
- public void closeChannelOk(int channelId)
- {
- removeChannel(channelId);
- _closingChannelsList.remove(new Integer(channelId));
- }
-
- private void markChannelawaitingCloseOk(int channelId)
- {
- _closingChannelsList.add(channelId);
- }
-
- /**
- * In our current implementation this is used by the clustering code.
- *
- * @param channelId The channel to remove
- */
- public void removeChannel(int channelId)
- {
- _channelMap.remove(channelId);
- if ((channelId & CHANNEL_CACHE_SIZE) == channelId)
- {
- _cachedChannels[channelId] = null;
- }
- }
-
- /**
- * Initialise heartbeats on the session.
- *
- * @param delay delay in seconds (not ms)
- */
- public void initHeartbeats(int delay)
- {
- if (delay > 0)
- {
- _minaProtocolSession.setIdleTime(IdleStatus.WRITER_IDLE, delay);
- _minaProtocolSession.setIdleTime(IdleStatus.READER_IDLE, HeartbeatConfig.getInstance().getTimeout(delay));
- }
- }
-
- /**
- * Closes all channels that were opened by this protocol session. This frees up all resources used by the channel.
- *
- * @throws AMQException if an error occurs while closing any channel
- */
- private void closeAllChannels() throws AMQException
- {
- for (AMQChannel channel : _channelMap.values())
- {
- channel.close(this);
- }
-
- _channelMap.clear();
- for (int i = 0; i <= CHANNEL_CACHE_SIZE; i++)
- {
- _cachedChannels[i] = null;
- }
- }
-
- /** This must be called when the session is _closed in order to free up any resources managed by the session. */
- public void closeSession() throws AMQException
- {
- if (!_closed)
- {
- _closed = true;
- closeAllChannels();
- if (_managedObject != null)
- {
- _managedObject.unregister();
- }
-
- for (Task task : _taskList)
- {
- task.doTask(this);
- }
- }
- }
-
- public String toString()
- {
- return "AMQProtocolSession(" + _minaProtocolSession.getRemoteAddress() + ")";
- }
-
- public String dump()
- {
- return this + " last_sent=" + _lastSent + " last_received=" + _lastReceived;
- }
-
- /** @return an object that can be used to identity */
- public Object getKey()
- {
- return _minaProtocolSession.getRemoteAddress();
- }
-
- /**
- * Get the fully qualified domain name of the local address to which this session is bound. Since some servers may
- * be bound to multiple addresses this could vary depending on the acceptor this session was created from.
- *
- * @return a String FQDN
- */
- public String getLocalFQDN()
- {
- SocketAddress address = _minaProtocolSession.getLocalAddress();
- // we use the vmpipe address in some tests hence the need for this rather ugly test. The host
- // information is used by SASL primary.
- if (address instanceof InetSocketAddress)
- {
- return ((InetSocketAddress) address).getHostName();
- }
- else if (address instanceof VmPipeAddress)
- {
- return "vmpipe:" + ((VmPipeAddress) address).getPort();
- }
- else
- {
- throw new IllegalArgumentException("Unsupported socket address class: " + address);
- }
- }
-
- public SaslServer getSaslServer()
- {
- return _saslServer;
- }
-
- public void setSaslServer(SaslServer saslServer)
- {
- _saslServer = saslServer;
- }
-
- public FieldTable getClientProperties()
- {
- return _clientProperties;
- }
-
- public void setClientProperties(FieldTable clientProperties)
- {
- _clientProperties = clientProperties;
- if (_clientProperties != null)
- {
- if (_clientProperties.getString(CLIENT_PROPERTIES_INSTANCE) != null)
- {
- setContextKey(new AMQShortString(_clientProperties.getString(CLIENT_PROPERTIES_INSTANCE)));
- }
-
- if (_clientProperties.getString(ClientProperties.version.toString()) != null)
- {
- _clientVersion = new AMQShortString(_clientProperties.getString(ClientProperties.version.toString()));
- }
- }
- }
-
- private void setProtocolVersion(ProtocolVersion pv)
- {
- _protocolVersion = pv;
-
- _protocolOutputConverter = ProtocolOutputConverterRegistry.getConverter(this);
- _dispatcher = ServerMethodDispatcherImpl.createMethodDispatcher(_stateManager, _protocolVersion);
- }
-
- public byte getProtocolMajorVersion()
- {
- return _protocolVersion.getMajorVersion();
- }
-
- public ProtocolVersion getProtocolVersion()
- {
- return _protocolVersion;
- }
-
- public byte getProtocolMinorVersion()
- {
- return _protocolVersion.getMinorVersion();
- }
-
- public boolean isProtocolVersion(byte major, byte minor)
- {
- return (getProtocolMajorVersion() == major) && (getProtocolMinorVersion() == minor);
- }
-
- public MethodRegistry getRegistry()
- {
- return getMethodRegistry();
- }
-
- public Object getClientIdentifier()
- {
- return _minaProtocolSession.getRemoteAddress();
- }
-
- public VirtualHost getVirtualHost()
- {
- return _virtualHost;
- }
-
- public void setVirtualHost(VirtualHost virtualHost) throws AMQException
- {
- _virtualHost = virtualHost;
- _managedObject = createMBean();
- _managedObject.register();
- }
-
- public void addSessionCloseTask(Task task)
- {
- _taskList.add(task);
- }
-
- public void removeSessionCloseTask(Task task)
- {
- _taskList.remove(task);
- }
-
- public ProtocolOutputConverter getProtocolOutputConverter()
- {
- return _protocolOutputConverter;
- }
-
- public void setAuthorizedID(Principal authorizedID)
- {
- _authorizedID = authorizedID;
- }
-
- public Principal getAuthorizedID()
- {
- return _authorizedID;
- }
-
- public MethodRegistry getMethodRegistry()
- {
- return MethodRegistry.getMethodRegistry(getProtocolVersion());
- }
-
- public MethodDispatcher getMethodDispatcher()
- {
- return _dispatcher;
- }
-
- public String getClientVersion()
- {
- return (_clientVersion == null) ? null : _clientVersion.toString();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQNoMethodHandlerException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQNoMethodHandlerException.java
deleted file mode 100644
index a7599a3e0d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQNoMethodHandlerException.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.server.protocol;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-
-/**
- * AMQNoMethodHandlerException represents the case where no method handler exists to handle an AQMP method.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represents failure to handle an AMQP method.
- * </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
- * @todo Missing method handler. Unlikely to ever happen, and if it does its a coding error. Consider replacing with a
- * Runtime.
- */
-public class AMQNoMethodHandlerException extends AMQException
-{
- public AMQNoMethodHandlerException(AMQMethodEvent<AMQMethodBody> evt)
- {
- super("AMQMethodEvent " + evt + " was not processed by any listener on Broker.");
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
deleted file mode 100644
index db5d882f51..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.protocol;
-
-import org.apache.log4j.Logger;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.IoFilterChain;
-import org.apache.mina.common.IoHandlerAdapter;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.ReadThrottleFilterBuilder;
-import org.apache.mina.filter.SSLFilter;
-import org.apache.mina.filter.WriteBufferLimitFilterBuilder;
-import org.apache.mina.filter.codec.ProtocolCodecFilter;
-import org.apache.mina.filter.codec.QpidProtocolCodecFilter;
-import org.apache.mina.filter.executor.ExecutorFilter;
-import org.apache.mina.transport.socket.nio.SocketSessionConfig;
-import org.apache.mina.util.SessionUtil;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.AMQCodecFactory;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.IApplicationRegistry;
-import org.apache.qpid.server.transport.ConnectorConfiguration;
-import org.apache.qpid.ssl.SSLContextFactory;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-
-/**
- * The protocol handler handles "protocol events" for all connections. The state
- * associated with an individual connection is accessed through the protocol session.
- *
- * We delegate all frame (message) processing to the AMQProtocolSession which wraps
- * the state for the connection.
- */
-public class AMQPFastProtocolHandler extends IoHandlerAdapter
-{
- private static final Logger _logger = Logger.getLogger(AMQPFastProtocolHandler.class);
-
- private final IApplicationRegistry _applicationRegistry;
-
-
- public AMQPFastProtocolHandler(Integer applicationRegistryInstance)
- {
- this(ApplicationRegistry.getInstance(applicationRegistryInstance));
- }
-
- public AMQPFastProtocolHandler(IApplicationRegistry applicationRegistry)
- {
- _applicationRegistry = applicationRegistry;
- _logger.debug("AMQPFastProtocolHandler created");
- }
-
- protected AMQPFastProtocolHandler(AMQPFastProtocolHandler handler)
- {
- this(handler._applicationRegistry);
- }
-
- public void sessionCreated(IoSession protocolSession) throws Exception
- {
- SessionUtil.initialize(protocolSession);
- final AMQCodecFactory codecFactory = new AMQCodecFactory(true);
-
- createSession(protocolSession, _applicationRegistry, codecFactory);
- _logger.info("Protocol session created for:" + protocolSession.getRemoteAddress());
-
- final QpidProtocolCodecFilter pcf = new QpidProtocolCodecFilter(codecFactory);
-
- ConnectorConfiguration connectorConfig = ApplicationRegistry.getInstance().
- getConfiguredObject(ConnectorConfiguration.class);
- if (connectorConfig.enableExecutorPool)
- {
- if (connectorConfig.enableSSL && isSSLClient(connectorConfig, protocolSession))
- {
- String keystorePath = connectorConfig.keystorePath;
- String keystorePassword = connectorConfig.keystorePassword;
- String certType = connectorConfig.certType;
- SSLContextFactory sslContextFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
- protocolSession.getFilterChain().addAfter("AsynchronousReadFilter", "sslFilter",
- new SSLFilter(sslContextFactory.buildServerContext()));
- }
- protocolSession.getFilterChain().addBefore("AsynchronousWriteFilter", "protocolFilter", pcf);
- }
- else
- {
- protocolSession.getFilterChain().addLast("protocolFilter", pcf);
- if (connectorConfig.enableSSL && isSSLClient(connectorConfig, protocolSession))
- {
- String keystorePath = connectorConfig.keystorePath;
- String keystorePassword = connectorConfig.keystorePassword;
- String certType = connectorConfig.certType;
- SSLContextFactory sslContextFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
- protocolSession.getFilterChain().addBefore("protocolFilter", "sslFilter",
- new SSLFilter(sslContextFactory.buildServerContext()));
- }
-
- }
-
- if (ApplicationRegistry.getInstance().getConfiguration().getBoolean("broker.connector.protectio", false))
- {
- try
- {
-// //Add IO Protection Filters
- IoFilterChain chain = protocolSession.getFilterChain();
-
- int buf_size = 32768;
- if (protocolSession.getConfig() instanceof SocketSessionConfig)
- {
- buf_size = ((SocketSessionConfig) protocolSession.getConfig()).getReceiveBufferSize();
- }
-
- protocolSession.getFilterChain().addLast("tempExecutorFilterForFilterBuilder", new ExecutorFilter());
-
- ReadThrottleFilterBuilder readfilter = new ReadThrottleFilterBuilder();
- readfilter.setMaximumConnectionBufferSize(buf_size);
- readfilter.attach(chain);
-
- WriteBufferLimitFilterBuilder writefilter = new WriteBufferLimitFilterBuilder();
- writefilter.setMaximumConnectionBufferSize(buf_size * 2);
- writefilter.attach(chain);
-
- protocolSession.getFilterChain().remove("tempExecutorFilterForFilterBuilder");
- _logger.info("Using IO Read/Write Filter Protection");
- }
- catch (Exception e)
- {
- _logger.error("Unable to attach IO Read/Write Filter Protection :" + e.getMessage());
- }
- }
- }
-
- /** Separated into its own, protected, method to allow easier reuse */
- protected void createSession(IoSession session, IApplicationRegistry applicationRegistry, AMQCodecFactory codec) throws AMQException
- {
- new AMQMinaProtocolSession(session, applicationRegistry.getVirtualHostRegistry(), codec);
- }
-
- public void sessionOpened(IoSession protocolSession) throws Exception
- {
- _logger.info("Session opened for:" + protocolSession.getRemoteAddress());
- }
-
- public void sessionClosed(IoSession protocolSession) throws Exception
- {
- _logger.info("Protocol Session closed for:" + protocolSession.getRemoteAddress());
- final AMQProtocolSession amqProtocolSession = AMQMinaProtocolSession.getAMQProtocolSession(protocolSession);
- //fixme -- this can be null
- if (amqProtocolSession != null)
- {
- try
- {
- amqProtocolSession.closeSession();
- }
- catch (AMQException e)
- {
- _logger.error("Caught AMQException whilst closingSession:" + e);
- }
- }
- }
-
- public void sessionIdle(IoSession session, IdleStatus status) throws Exception
- {
- _logger.debug("Protocol Session [" + this + "] idle: " + status + " :for:" + session.getRemoteAddress());
- if (IdleStatus.WRITER_IDLE.equals(status))
- {
- //write heartbeat frame:
- session.write(HeartbeatBody.FRAME);
- }
- else if (IdleStatus.READER_IDLE.equals(status))
- {
- //failover:
- throw new IOException("Timed out while waiting for heartbeat from peer.");
- }
-
- }
-
- public void exceptionCaught(IoSession protocolSession, Throwable throwable) throws Exception
- {
- AMQProtocolSession session = AMQMinaProtocolSession.getAMQProtocolSession(protocolSession);
- if (throwable instanceof AMQProtocolHeaderException)
- {
-
- protocolSession.write(new ProtocolInitiation(ProtocolVersion.getLatestSupportedVersion()));
-
- protocolSession.close();
-
- _logger.error("Error in protocol initiation " + session + ":" + protocolSession.getRemoteAddress() + " :" + throwable.getMessage(), throwable);
- }
- else if (throwable instanceof IOException)
- {
- _logger.error("IOException caught in" + session + ", session closed implictly: " + throwable);
- }
- else
- {
- _logger.error("Exception caught in" + session + ", closing session explictly: " + throwable, throwable);
-
-
- MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(session.getProtocolVersion());
- ConnectionCloseBody closeBody = methodRegistry.createConnectionCloseBody(200,new AMQShortString(throwable.getMessage()),0,0);
-
- protocolSession.write(closeBody.generateFrame(0));
-
- protocolSession.close();
- }
- }
-
- /**
- * Invoked when a message is received on a particular protocol session. Note that a
- * protocol session is directly tied to a particular physical connection.
- *
- * @param protocolSession the protocol session that received the message
- * @param message the message itself (i.e. a decoded frame)
- *
- * @throws Exception if the message cannot be processed
- */
- public void messageReceived(IoSession protocolSession, Object message) throws Exception
- {
- final AMQProtocolSession amqProtocolSession = AMQMinaProtocolSession.getAMQProtocolSession(protocolSession);
-
- if (message instanceof AMQDataBlock)
- {
- amqProtocolSession.dataBlockReceived((AMQDataBlock) message);
-
- }
- else if (message instanceof ByteBuffer)
- {
- throw new IllegalStateException("Handed undecoded ByteBuffer buf = " + message);
- }
- else
- {
- throw new IllegalStateException("Handed unhandled message. message.class = " + message.getClass() + " message = " + message);
- }
- }
-
- /**
- * Called after a message has been sent out on a particular protocol session
- *
- * @param protocolSession the protocol session (i.e. connection) on which this
- * message was sent
- * @param object the message (frame) that was encoded and sent
- *
- * @throws Exception if we want to indicate an error
- */
- public void messageSent(IoSession protocolSession, Object object) throws Exception
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Message sent: " + object);
- }
- }
-
- protected boolean isSSLClient(ConnectorConfiguration connectionConfig,
- IoSession protocolSession)
- {
- InetSocketAddress addr = (InetSocketAddress) protocolSession.getLocalAddress();
- return addr.getPort() == connectionConfig.sslPort;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPProtocolProvider.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPProtocolProvider.java
deleted file mode 100644
index 07c153bfe8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPProtocolProvider.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.server.protocol;
-
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.IApplicationRegistry;
-
-/**
- * The protocol provide's role is to encapsulate the initialisation of the protocol handler.
- *
- * The protocol handler (see AMQPFastProtocolHandler class) handles protocol events
- * such as connection closing or a frame being received. It can either do this directly
- * or pass off to the protocol session in the cases where state information is required to
- * deal with the event.
- *
- */
-public class AMQPProtocolProvider
-{
- /**
- * Handler for protocol events
- */
- private AMQPFastProtocolHandler _handler;
-
- public AMQPProtocolProvider()
- {
- IApplicationRegistry registry = ApplicationRegistry.getInstance();
- _handler = new AMQPFastProtocolHandler(registry);
- }
-
- public AMQPFastProtocolHandler getHandler()
- {
- return _handler;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java
deleted file mode 100644
index c9316f7405..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.protocol;
-
-import javax.security.sasl.SaslServer;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.output.ProtocolOutputConverter;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import java.security.Principal;
-
-
-public interface AMQProtocolSession extends AMQVersionAwareProtocolSession
-{
-
-
-
- public static interface Task
- {
- public void doTask(AMQProtocolSession session) throws AMQException;
- }
-
- /**
- * Called when a protocol data block is received
- *
- * @param message the data block that has been received
- *
- * @throws Exception if processing the datablock fails
- */
- void dataBlockReceived(AMQDataBlock message) throws Exception;
-
- /**
- * Get the context key associated with this session. Context key is described in the AMQ protocol specification (RFC
- * 6).
- *
- * @return the context key
- */
- AMQShortString getContextKey();
-
- /**
- * Set the context key associated with this session. Context key is described in the AMQ protocol specification (RFC
- * 6).
- *
- * @param contextKey the context key
- */
- void setContextKey(AMQShortString contextKey);
-
- /**
- * Get the channel for this session associated with the specified id. A channel id is unique per connection (i.e.
- * per session).
- *
- * @param channelId the channel id which must be valid
- *
- * @return null if no channel exists, the channel otherwise
- */
- AMQChannel getChannel(int channelId) throws AMQException;
-
- /**
- * Associate a channel with this session.
- *
- * @param channel the channel to associate with this session. It is an error to associate the same channel with more
- * than one session but this is not validated.
- */
- void addChannel(AMQChannel channel) throws AMQException;
-
- /**
- * Close a specific channel. This will remove any resources used by the channel, including: <ul><li>any queue
- * subscriptions (this may in turn remove queues if they are auto delete</li> </ul>
- *
- * @param channelId id of the channel to close
- *
- * @throws org.apache.qpid.AMQException if an error occurs closing the channel
- * @throws IllegalArgumentException if the channel id is not valid
- */
- void closeChannel(int channelId) throws AMQException;
-
- /**
- * Markes the specific channel as closed. This will release the lock for that channel id so a new channel can be
- * created on that id.
- *
- * @param channelId id of the channel to close
- */
- void closeChannelOk(int channelId);
-
- /**
- * Check to see if this chanel is closing
- *
- * @param channelId id to check
- * @return boolean with state of channel awaiting closure
- */
- boolean channelAwaitingClosure(int channelId);
-
- /**
- * Remove a channel from the session but do not close it.
- *
- * @param channelId
- */
- void removeChannel(int channelId);
-
- /**
- * Initialise heartbeats on the session.
- *
- * @param delay delay in seconds (not ms)
- */
- void initHeartbeats(int delay);
-
- /** This must be called when the session is _closed in order to free up any resources managed by the session. */
- void closeSession() throws AMQException;
-
- /** @return a key that uniquely identifies this session */
- Object getKey();
-
- /**
- * Get the fully qualified domain name of the local address to which this session is bound. Since some servers may
- * be bound to multiple addresses this could vary depending on the acceptor this session was created from.
- *
- * @return a String FQDN
- */
- String getLocalFQDN();
-
- /** @return the sasl server that can perform authentication for this session. */
- SaslServer getSaslServer();
-
- /**
- * Set the sasl server that is to perform authentication for this session.
- *
- * @param saslServer
- */
- void setSaslServer(SaslServer saslServer);
-
-
- FieldTable getClientProperties();
-
- void setClientProperties(FieldTable clientProperties);
-
- Object getClientIdentifier();
-
- VirtualHost getVirtualHost();
-
- void setVirtualHost(VirtualHost virtualHost) throws AMQException;
-
- void addSessionCloseTask(Task task);
-
- void removeSessionCloseTask(Task task);
-
- public ProtocolOutputConverter getProtocolOutputConverter();
-
- void setAuthorizedID(Principal authorizedID);
-
- /** @return a Principal that was used to authorized this session */
- Principal getAuthorizedID();
-
- public MethodRegistry getMethodRegistry();
-
- public MethodDispatcher getMethodDispatcher();
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
deleted file mode 100644
index bd072985c4..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.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.
- *
- */
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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.server.protocol;
-
-import java.security.Principal;
-import java.util.Date;
-import java.util.List;
-
-import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.NotCompliantMBeanException;
-import javax.management.Notification;
-import javax.management.monitor.MonitorNotification;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.ConnectionCloseBody;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.management.AMQManagedObject;
-import org.apache.qpid.server.management.MBeanConstructor;
-import org.apache.qpid.server.management.MBeanDescription;
-import org.apache.qpid.server.management.ManagedObject;
-
-/**
- * This MBean class implements the management interface. In order to make more attributes, operations and notifications
- * available over JMX simply augment the ManagedConnection interface and add the appropriate implementation here.
- */
-@MBeanDescription("Management Bean for an AMQ Broker Connection")
-public class AMQProtocolSessionMBean extends AMQManagedObject implements ManagedConnection
-{
- private AMQMinaProtocolSession _session = null;
- private String _name = null;
-
- // openmbean data types for representing the channel attributes
- private static final String[] _channelAtttibuteNames =
- { "Channel Id", "Transactional", "Default Queue", "Unacknowledged Message Count" };
- private static final String[] _indexNames = { _channelAtttibuteNames[0] };
- private static final OpenType[] _channelAttributeTypes =
- { SimpleType.INTEGER, SimpleType.BOOLEAN, SimpleType.STRING, SimpleType.INTEGER };
- private static CompositeType _channelType = null; // represents the data type for channel data
- private static TabularType _channelsType = null; // Data type for list of channels type
- private static final AMQShortString BROKER_MANAGEMENT_CONSOLE_HAS_CLOSED_THE_CONNECTION =
- new AMQShortString("Broker Management Console has closed the connection.");
-
- @MBeanConstructor("Creates an MBean exposing an AMQ Broker Connection")
- public AMQProtocolSessionMBean(AMQMinaProtocolSession session) throws NotCompliantMBeanException, OpenDataException
- {
- super(ManagedConnection.class, ManagedConnection.TYPE);
- _session = session;
- String remote = getRemoteAddress();
- remote = "anonymous".equals(remote) ? (remote + hashCode()) : remote;
- _name = jmxEncode(new StringBuffer(remote), 0).toString();
- init();
- }
-
- static
- {
- try
- {
- init();
- }
- catch (JMException ex)
- {
- // This is not expected to ever occur.
- throw new RuntimeException("Got JMException in static initializer.", ex);
- }
- }
-
- /**
- * initialises the openmbean data types
- */
- private static void init() throws OpenDataException
- {
- _channelType =
- new CompositeType("Channel", "Channel Details", _channelAtttibuteNames, _channelAtttibuteNames,
- _channelAttributeTypes);
- _channelsType = new TabularType("Channels", "Channels", _channelType, _indexNames);
- }
-
- public String getClientId()
- {
- return (_session.getContextKey() == null) ? null : _session.getContextKey().toString();
- }
-
- public String getAuthorizedId()
- {
- return (_session.getAuthorizedID() != null ) ? _session.getAuthorizedID().getName() : null;
- }
-
- public String getVersion()
- {
- return (_session.getClientVersion() == null) ? null : _session.getClientVersion().toString();
- }
-
- public Date getLastIoTime()
- {
- return new Date(_session.getIOSession().getLastIoTime());
- }
-
- public String getRemoteAddress()
- {
- return _session.getIOSession().getRemoteAddress().toString();
- }
-
- public ManagedObject getParentObject()
- {
- return _session.getVirtualHost().getManagedObject();
- }
-
- public Long getWrittenBytes()
- {
- return _session.getIOSession().getWrittenBytes();
- }
-
- public Long getReadBytes()
- {
- return _session.getIOSession().getReadBytes();
- }
-
- public Long getMaximumNumberOfChannels()
- {
- return _session.getMaximumNumberOfChannels();
- }
-
- public void setMaximumNumberOfChannels(Long value)
- {
- _session.setMaximumNumberOfChannels(value);
- }
-
- public String getObjectInstanceName()
- {
- return _name;
- }
-
- /**
- * commits transactions for a transactional channel
- *
- * @param channelId
- * @throws JMException if channel with given id doesn't exist or if commit fails
- */
- public void commitTransactions(int channelId) throws JMException
- {
- try
- {
- AMQChannel channel = _session.getChannel(channelId);
- if (channel == null)
- {
- throw new JMException("The channel (channel Id = " + channelId + ") does not exist");
- }
-
- _session.commitTransactions(channel);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex, ex.toString());
- }
- }
-
- /**
- * rollsback the transactions for a transactional channel
- *
- * @param channelId
- * @throws JMException if channel with given id doesn't exist or if rollback fails
- */
- public void rollbackTransactions(int channelId) throws JMException
- {
- try
- {
- AMQChannel channel = _session.getChannel(channelId);
- if (channel == null)
- {
- throw new JMException("The channel (channel Id = " + channelId + ") does not exist");
- }
-
- _session.rollbackTransactions(channel);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex, ex.toString());
- }
- }
-
- /**
- * Creates the list of channels in tabular form from the _channelMap.
- *
- * @return list of channels in tabular form.
- * @throws OpenDataException
- */
- public TabularData channels() throws OpenDataException
- {
- TabularDataSupport channelsList = new TabularDataSupport(_channelsType);
- List<AMQChannel> list = _session.getChannels();
-
- for (AMQChannel channel : list)
- {
- Object[] itemValues =
- {
- channel.getChannelId(), channel.isTransactional(),
- (channel.getDefaultQueue() != null) ? channel.getDefaultQueue().getName().asString() : null,
- channel.getUnacknowledgedMessageMap().size()
- };
-
- CompositeData channelData = new CompositeDataSupport(_channelType, _channelAtttibuteNames, itemValues);
- channelsList.put(channelData);
- }
-
- return channelsList;
- }
-
- /**
- * closes the connection. The administrator can use this management operation to close connection to free up
- * resources.
- * @throws JMException
- */
- public void closeConnection() throws JMException
- {
-
- MethodRegistry methodRegistry = _session.getMethodRegistry();
- ConnectionCloseBody responseBody =
- methodRegistry.createConnectionCloseBody(AMQConstant.REPLY_SUCCESS.getCode(),
- // replyCode
- BROKER_MANAGEMENT_CONSOLE_HAS_CLOSED_THE_CONNECTION,
- // replyText,
- 0,
- 0);
-
- _session.writeFrame(responseBody.generateFrame(0));
-
- try
- {
- _session.closeSession();
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex, ex.toString());
- }
- }
-
- @Override
- public MBeanNotificationInfo[] getNotificationInfo()
- {
- String[] notificationTypes = new String[] { MonitorNotification.THRESHOLD_VALUE_EXCEEDED };
- String name = MonitorNotification.class.getName();
- String description = "Channel count has reached threshold value";
- MBeanNotificationInfo info1 = new MBeanNotificationInfo(notificationTypes, name, description);
-
- return new MBeanNotificationInfo[] { info1 };
- }
-
- public void notifyClients(String notificationMsg)
- {
- Notification n =
- new Notification(MonitorNotification.THRESHOLD_VALUE_EXCEEDED, this, ++_notificationSequenceNumber,
- System.currentTimeMillis(), notificationMsg);
- _broadcaster.sendNotification(n);
- }
-
-} // End of MBean class
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.java
deleted file mode 100644
index 2abcecb6de..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.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.server.protocol;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.exchange.ExchangeFactory;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.exchange.ExchangeType;
-
-public class ExchangeInitialiser
-{
- public void initialise(ExchangeFactory factory, ExchangeRegistry registry) throws AMQException{
- for (ExchangeType<? extends Exchange> type : factory.getRegisteredTypes())
- {
- define (registry, factory, type.getDefaultExchangeName(), type.getName());
- }
-
- define(registry, factory, ExchangeDefaults.DEFAULT_EXCHANGE_NAME, ExchangeDefaults.DIRECT_EXCHANGE_CLASS);
- registry.setDefaultExchange(registry.getExchange(ExchangeDefaults.DEFAULT_EXCHANGE_NAME));
- }
-
- private void define(ExchangeRegistry r, ExchangeFactory f,
- AMQShortString name, AMQShortString type) throws AMQException
- {
- if(r.getExchange(name)== null)
- {
- r.registerExchange(f.createExchange(name, type, true, false, 0));
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/HeartbeatConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/HeartbeatConfig.java
deleted file mode 100644
index 310deaaf55..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/HeartbeatConfig.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.protocol;
-
-import org.apache.qpid.configuration.Configured;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-
-public class HeartbeatConfig
-{
- @Configured(path = "heartbeat.delay", defaultValue = "5")
- public int delay = 5;//in secs
- @Configured(path = "heartbeat.timeoutFactor", defaultValue = "2.0")
- public double timeoutFactor = 2;
-
- public double getTimeoutFactor()
- {
- return timeoutFactor;
- }
-
- public void setTimeoutFactor(double timeoutFactor)
- {
- this.timeoutFactor = timeoutFactor;
- }
-
- public int getDelay()
- {
- return delay;
- }
-
- public void setDelay(int delay)
- {
- this.delay = delay;
- }
-
- int getTimeout(int writeDelay)
- {
- return (int) (timeoutFactor * writeDelay);
- }
-
- public static HeartbeatConfig getInstance()
- {
- return ApplicationRegistry.getInstance().getConfiguredObject(HeartbeatConfig.class);
- }
-
- public String toString()
- {
- return "HeartBeatConfig{delay = " + delay + " timeoutFactor = " + timeoutFactor + "}";
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java
deleted file mode 100644
index e6e713ac6d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.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.server.protocol;
-
-import java.io.IOException;
-import java.util.Date;
-import java.security.Principal;
-
-import javax.management.JMException;
-import javax.management.MBeanOperationInfo;
-import javax.management.openmbean.TabularData;
-
-import org.apache.qpid.server.management.MBeanAttribute;
-import org.apache.qpid.server.management.MBeanOperation;
-import org.apache.qpid.server.management.MBeanOperationParameter;
-
-/**
- * The management interface exposed to allow management of Connections.
- * @author Bhupendra Bhardwaj
- * @version 0.1
- */
-public interface ManagedConnection
-{
- static final String TYPE = "Connection";
-
- @MBeanAttribute(name = "ClientId", description = "Client Id")
- String getClientId();
-
- @MBeanAttribute(name = "AuthorizedId", description = "User Name")
- String getAuthorizedId();
-
- @MBeanAttribute(name = "Version", description = "Client Version")
- String getVersion();
-
- /**
- * Tells the remote address of this connection.
- * @return remote address
- */
- @MBeanAttribute(name="RemoteAddress", description=TYPE + " Address")
- String getRemoteAddress();
-
- /**
- * Tells the last time, the IO operation was done.
- * @return last IO time.
- */
- @MBeanAttribute(name="LastIOTime", description="The last time, the IO operation was done")
- Date getLastIoTime();
-
- /**
- * Tells the total number of bytes written till now.
- * @return number of bytes written.
- *
- @MBeanAttribute(name="WrittenBytes", description="The total number of bytes written till now")
- Long getWrittenBytes();
- */
- /**
- * Tells the total number of bytes read till now.
- * @return number of bytes read.
- *
- @MBeanAttribute(name="ReadBytes", description="The total number of bytes read till now")
- Long getReadBytes();
- */
-
- /**
- * Threshold high value for no of channels. This is useful in setting notifications or
- * taking required action is there are more channels being created.
- * @return threshold limit for no of channels
- */
- Long getMaximumNumberOfChannels();
-
- /**
- * Sets the threshold high value for number of channels for a connection
- * @param value
- */
- @MBeanAttribute(name="MaximumNumberOfChannels", description="The threshold high value for number of channels for this connection")
- void setMaximumNumberOfChannels(Long value);
-
- //********** Operations *****************//
-
- /**
- * channel details of all the channels opened for this connection.
- * @return general channel details
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="channels", description="Channel details for this connection")
- TabularData channels() throws IOException, JMException;
-
- /**
- * Commits the transactions if the channel is transactional.
- * @param channelId
- * @throws JMException
- */
- @MBeanOperation(name="commitTransaction",
- description="Commits the transactions for given channel Id, if the channel is transactional",
- impact= MBeanOperationInfo.ACTION)
- void commitTransactions(@MBeanOperationParameter(name="channel Id", description="channel Id")int channelId) throws JMException;
-
- /**
- * Rollsback the transactions if the channel is transactional.
- * @param channelId
- * @throws JMException
- */
- @MBeanOperation(name="rollbackTransactions",
- description="Rollsback the transactions for given channel Id, if the channel is transactional",
- impact= MBeanOperationInfo.ACTION)
- void rollbackTransactions(@MBeanOperationParameter(name="channel Id", description="channel Id")int channelId) throws JMException;
-
- /**
- * Closes all the related channels and unregisters this connection from managed objects.
- */
- @MBeanOperation(name="closeConnection",
- description="Closes this connection and all related channels",
- impact= MBeanOperationInfo.ACTION)
- void closeConnection() throws Exception;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/UnknnownMessageTypeException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/UnknnownMessageTypeException.java
deleted file mode 100644
index 6e72aa062f..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/UnknnownMessageTypeException.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.server.protocol;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQDataBlock;
-
-/**
- * UnknnownMessageTypeException represents a failure when Mina passes an unexpected frame type.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represents failure to cast a frame to its expected type.
- * </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
- * @todo Seems like this exception was created to handle an unsafe type cast that will never happen in practice. Would
- * be better just to leave that as a ClassCastException. However, check the framing layer catches this error
- * first.
- */
-public class UnknnownMessageTypeException extends AMQException
-{
- public UnknnownMessageTypeException(AMQDataBlock message)
- {
- super("Unknown message type: " + message.getClass().getName() + ": " + message);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
deleted file mode 100644
index dcc2becbc5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
+++ /dev/null
@@ -1,719 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQBody;
-import org.apache.qpid.framing.AMQDataBlock;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.framing.abstraction.ProtocolVersionMethodConverter;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.txn.TransactionalContext;
-import org.apache.qpid.server.exchange.Exchange;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * A deliverable message.
- */
-public class AMQMessage
-{
- /** Used for debugging purposes. */
- private static final Logger _log = Logger.getLogger(AMQMessage.class);
-
- /** Used in clustering. @todo What for? */
- private Set<Object> _tokens;
-
- /** Only use in clustering. @todo What for? */
- private AMQProtocolSession _publisher;
-
- private final Long _messageId;
-
- private final AtomicInteger _referenceCount = new AtomicInteger(1);
-
- private AMQMessageHandle _messageHandle;
-
- /** Holds the transactional context in which this message is being processed. */
- private TransactionalContext _txnContext;
-
- /**
- * Flag to indicate whether this message has been delivered to a consumer. Used in implementing return functionality
- * for messages published with the 'immediate' flag.
- */
- private boolean _deliveredToConsumer;
-
- /** Flag to indicate that this message requires 'immediate' delivery. */
- private boolean _immediate;
-
- private TransientMessageData _transientMessageData = new TransientMessageData();
-
- private long _expiration;
-
-
-
-
- private Exchange _exchange;
- private static final boolean SYNCED_CLOCKS =
- ApplicationRegistry.getInstance().getConfiguration().getBoolean("advanced.synced-clocks", false);
-
-
- public String debugIdentity()
- {
- return "(HC:" + System.identityHashCode(this) + " ID:" + _messageId + " Ref:" + _referenceCount.get() + ")";
- }
-
- public void setExpiration()
- {
- long expiration =
- ((BasicContentHeaderProperties) _transientMessageData.getContentHeaderBody().properties).getExpiration();
- long timestamp =
- ((BasicContentHeaderProperties) _transientMessageData.getContentHeaderBody().properties).getTimestamp();
-
- if (SYNCED_CLOCKS)
- {
- _expiration = expiration;
- }
- else
- {
- // Update TTL to be in broker time.
- if (expiration != 0L)
- {
- if (timestamp != 0L)
- {
- // todo perhaps use arrival time
- long diff = (System.currentTimeMillis() - timestamp);
-
- if ((diff > 1000L) || (diff < 1000L))
- {
- _expiration = expiration + diff;
- }
- }
- }
- }
-
- }
-
- public boolean isReferenced()
- {
- return _referenceCount.get() > 0;
- }
-
- public void setExchange(final Exchange exchange)
- {
- _exchange = exchange;
- }
-
- public void route() throws AMQException
- {
- _exchange.route(this);
- }
-
- public void enqueue(final List<AMQQueue> queues)
- {
- _transientMessageData.setDestinationQueues(queues);
- }
-
- /**
- * Used to iterate through all the body frames associated with this message. Will not keep all the data in memory
- * therefore is memory-efficient.
- */
- private class BodyFrameIterator implements Iterator<AMQDataBlock>
- {
- private int _channel;
-
- private int _index = -1;
- private AMQProtocolSession _protocolSession;
-
- private BodyFrameIterator(AMQProtocolSession protocolSession, int channel)
- {
- _channel = channel;
- _protocolSession = protocolSession;
- }
-
- public boolean hasNext()
- {
- try
- {
- return _index < (_messageHandle.getBodyCount(getStoreContext(), _messageId) - 1);
- }
- catch (AMQException e)
- {
- _log.error("Unable to get body count: " + e, e);
-
- return false;
- }
- }
-
- public AMQDataBlock next()
- {
- try
- {
-
- AMQBody cb =
- getProtocolVersionMethodConverter().convertToBody(_messageHandle.getContentChunk(getStoreContext(),
- _messageId, ++_index));
-
- return new AMQFrame(_channel, cb);
- }
- catch (AMQException e)
- {
- // have no choice but to throw a runtime exception
- throw new RuntimeException("Error getting content body: " + e, e);
- }
-
- }
-
- private ProtocolVersionMethodConverter getProtocolVersionMethodConverter()
- {
- return _protocolSession.getMethodRegistry().getProtocolVersionMethodConverter();
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
-
- public StoreContext getStoreContext()
- {
- return _txnContext.getStoreContext();
- }
-
- private class BodyContentIterator implements Iterator<ContentChunk>
- {
-
- private int _index = -1;
-
- public boolean hasNext()
- {
- try
- {
- return _index < (_messageHandle.getBodyCount(getStoreContext(), _messageId) - 1);
- }
- catch (AMQException e)
- {
- _log.error("Error getting body count: " + e, e);
-
- return false;
- }
- }
-
- public ContentChunk next()
- {
- try
- {
- return _messageHandle.getContentChunk(getStoreContext(), _messageId, ++_index);
- }
- catch (AMQException e)
- {
- throw new RuntimeException("Error getting content body: " + e, e);
- }
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
-
- public AMQMessage(Long messageId, MessagePublishInfo info, TransactionalContext txnContext)
- {
- _messageId = messageId;
- _txnContext = txnContext;
- _immediate = info.isImmediate();
- _transientMessageData.setMessagePublishInfo(info);
-
- }
-
- /**
- * Used when recovering, i.e. when the message store is creating references to messages. In that case, the normal
- * enqueue/routingComplete is not done since the recovery process is responsible for routing the messages to
- * queues.
- *
- * @param messageId
- * @param store
- * @param factory
- *
- * @throws AMQException
- */
- public AMQMessage(Long messageId, MessageStore store, MessageHandleFactory factory, TransactionalContext txnConext)
- throws AMQException
- {
- _messageId = messageId;
- _messageHandle = factory.createMessageHandle(messageId, store, true);
- _txnContext = txnConext;
- _transientMessageData = null;
- }
-
- /**
- * Used in testing only. This allows the passing of the content header immediately on construction.
- *
- * @param messageId
- * @param info
- * @param txnContext
- * @param contentHeader
- */
- public AMQMessage(Long messageId, MessagePublishInfo info, TransactionalContext txnContext,
- ContentHeaderBody contentHeader) throws AMQException
- {
- this(messageId, info, txnContext);
- setContentHeaderBody(contentHeader);
- }
-
- /* *
- * Used in testing only. This allows the passing of the content header and some body fragments on construction.
- *
- * @param messageId
- * @param info
- * @param txnContext
- * @param contentHeader
- * @param destinationQueues
- * @param contentBodies
- *
- * @throws AMQException
- */ /*
- public AMQMessage(Long messageId, MessagePublishInfo info, TransactionalContext txnContext,
- ContentHeaderBody contentHeader, List<AMQQueue> destinationQueues, List<ContentChunk> contentBodies,
- MessageStore messageStore, StoreContext storeContext, MessageHandleFactory messageHandleFactory) throws AMQException
- {
- this(messageId, info, txnContext, contentHeader);
- _transientMessageData.setDestinationQueues(destinationQueues);
- routingComplete(messageStore, storeContext, messageHandleFactory);
- for (ContentChunk cb : contentBodies)
- {
- addContentBodyFrame(storeContext, cb);
- }
- }
- */
- protected AMQMessage(AMQMessage msg) throws AMQException
- {
- _messageId = msg._messageId;
- _messageHandle = msg._messageHandle;
- _txnContext = msg._txnContext;
- _deliveredToConsumer = msg._deliveredToConsumer;
- _transientMessageData = msg._transientMessageData;
- }
-
- public Iterator<AMQDataBlock> getBodyFrameIterator(AMQProtocolSession protocolSession, int channel)
- {
- return new BodyFrameIterator(protocolSession, channel);
- }
-
- public Iterator<ContentChunk> getContentBodyIterator()
- {
- return new BodyContentIterator();
- }
-
- public ContentHeaderBody getContentHeaderBody() throws AMQException
- {
- if (_transientMessageData != null)
- {
- return _transientMessageData.getContentHeaderBody();
- }
- else
- {
- return _messageHandle.getContentHeaderBody(getStoreContext(), _messageId);
- }
- }
-
- public void setContentHeaderBody(ContentHeaderBody contentHeaderBody) throws AMQException
- {
- _transientMessageData.setContentHeaderBody(contentHeaderBody);
- }
-
- public void routingComplete(MessageStore store, StoreContext storeContext, MessageHandleFactory factory)
- throws AMQException
- {
- final boolean persistent = isPersistent();
- _messageHandle = factory.createMessageHandle(_messageId, store, persistent);
- if (persistent)
- {
- _txnContext.beginTranIfNecessary();
- }
-
- // enqueuing the messages ensure that if required the destinations are recorded to a
- // persistent store
-
- for (AMQQueue q : _transientMessageData.getDestinationQueues())
- {
- _messageHandle.enqueue(storeContext, _messageId, q);
- }
-
- if (_transientMessageData.getContentHeaderBody().bodySize == 0)
- {
- deliver(storeContext);
- }
- }
-
- public boolean addContentBodyFrame(StoreContext storeContext, ContentChunk contentChunk) throws AMQException
- {
- _transientMessageData.addBodyLength(contentChunk.getSize());
- final boolean allContentReceived = isAllContentReceived();
- _messageHandle.addContentBodyFrame(storeContext, _messageId, contentChunk, allContentReceived);
- if (allContentReceived)
- {
- deliver(storeContext);
-
- return true;
- }
- else
- {
- return false;
- }
- }
-
- public boolean isAllContentReceived() throws AMQException
- {
- return _transientMessageData.isAllContentReceived();
- }
-
- public Long getMessageId()
- {
- return _messageId;
- }
-
- /**
- * Creates a long-lived reference to this message, and increments the count of such references, as an atomic
- * operation.
- */
- public AMQMessage takeReference()
- {
- incrementReference(); // _referenceCount.incrementAndGet();
-
- return this;
- }
-
- /** Threadsafe. Increment the reference count on the message. */
- public void incrementReference()
- {
- _referenceCount.incrementAndGet();
- // if (_log.isDebugEnabled())
- // {
- // _log.debug("Ref count on message " + debugIdentity() + " incremented " + Arrays.asList(Thread.currentThread().getStackTrace()).subList(3, 6));
- // }
- }
-
- /**
- * Threadsafe. This will decrement the reference count and when it reaches zero will remove the message from the
- * message store.
- *
- * @param storeContext
- *
- * @throws MessageCleanupException when an attempt was made to remove the message from the message store and that
- * failed
- */
- public void decrementReference(StoreContext storeContext) throws MessageCleanupException
- {
- int count = _referenceCount.decrementAndGet();
-
- // note that the operation of decrementing the reference count and then removing the message does not
- // have to be atomic since the ref count starts at 1 and the exchange itself decrements that after
- // the message has been passed to all queues. i.e. we are
- // not relying on the all the increments having taken place before the delivery manager decrements.
- if (count == 0)
- {
- try
- {
- // if (_log.isDebugEnabled())
- // {
- // _log.debug("Decremented ref count on message " + debugIdentity() + " is zero; removing message" + Arrays.asList(Thread.currentThread().getStackTrace()).subList(3, 6));
- // }
-
- // must check if the handle is null since there may be cases where we decide to throw away a message
- // and the handle has not yet been constructed
- if (_messageHandle != null)
- {
- _messageHandle.removeMessage(storeContext, _messageId);
- }
- }
- catch (AMQException e)
- {
- // to maintain consistency, we revert the count
- incrementReference();
- throw new MessageCleanupException(_messageId, e);
- }
- }
- else
- {
- if (count < 0)
- {
- throw new MessageCleanupException("Reference count for message id " + debugIdentity()
- + " has gone below 0.");
- }
- }
- }
-
- public void setPublisher(AMQProtocolSession publisher)
- {
- _publisher = publisher;
- }
-
- public AMQProtocolSession getPublisher()
- {
- return _publisher;
- }
-
- /**
- * Called selectors to determin if the message has already been sent
- *
- * @return _deliveredToConsumer
- */
- public boolean getDeliveredToConsumer()
- {
- return _deliveredToConsumer;
- }
-
-
- public boolean checkToken(Object token)
- {
-
- if (_tokens == null)
- {
- _tokens = new HashSet<Object>();
- }
-
- if (_tokens.contains(token))
- {
- return true;
- }
- else
- {
- _tokens.add(token);
-
- return false;
- }
- }
-
- /**
- * Registers a queue to which this message is to be delivered. This is called from the exchange when it is routing
- * the message. This will be called before any content bodies have been received so that the choice of
- * AMQMessageHandle implementation can be picked based on various criteria.
- *
- * @param queue the queue
- *
- * @throws org.apache.qpid.AMQException if there is an error enqueuing the message
- */
- public void enqueue(AMQQueue queue) throws AMQException
- {
- _transientMessageData.addDestinationQueue(queue);
- }
-
- /**
- * NOTE: Think about why you are using this method. Normal usages would want to do
- * AMQQueue.dequeue(StoreContext, AMQMessage)
- * This will keep the queue statistics up-to-date.
- * Currently this method is only called _correctly_ from AMQQueue dequeue.
- * Ideally we would have a better way for the queue to dequeue the message.
- * Especially since enqueue isn't the recipriocal of this method.
- * @deprecated
- * @param storeContext
- * @param queue
- * @throws AMQException
- */
- void dequeue(StoreContext storeContext, AMQQueue queue) throws AMQException
- {
- _messageHandle.dequeue(storeContext, _messageId, queue);
- }
-
- public boolean isPersistent() throws AMQException
- {
- if (_transientMessageData != null)
- {
- return _transientMessageData.isPersistent();
- }
- else
- {
- return _messageHandle.isPersistent(getStoreContext(), _messageId);
- }
- }
-
- /**
- * Called to enforce the 'immediate' flag.
- *
- * @throws NoConsumersException if the message is marked for immediate delivery but has not been marked as delivered
- * to a consumer
- */
- public void checkDeliveredToConsumer() throws NoConsumersException
- {
-
- if (_immediate && !_deliveredToConsumer)
- {
- throw new NoConsumersException(this);
- }
- }
-
- public MessagePublishInfo getMessagePublishInfo() throws AMQException
- {
- MessagePublishInfo pb;
- if (_transientMessageData != null)
- {
- pb = _transientMessageData.getMessagePublishInfo();
- }
- else
- {
- pb = _messageHandle.getMessagePublishInfo(getStoreContext(), _messageId);
- }
-
- return pb;
- }
-
- public boolean isRedelivered()
- {
- return _messageHandle.isRedelivered();
- }
-
- public void setRedelivered(boolean redelivered)
- {
- _messageHandle.setRedelivered(redelivered);
- }
-
- public long getArrivalTime()
- {
- return _messageHandle.getArrivalTime();
- }
-
- /**
- * Checks to see if the message has expired. If it has the message is dequeued.
- *
- * @param queue The queue to check the expiration against. (Currently not used)
- *
- * @return true if the message has expire
- *
- * @throws AMQException
- */
- public boolean expired(AMQQueue queue) throws AMQException
- {
-
- if (_expiration != 0L)
- {
- long now = System.currentTimeMillis();
-
- return (now > _expiration);
- }
-
- return false;
- }
-
- /**
- * Called when this message is delivered to a consumer. (used to implement the 'immediate' flag functionality).
- * And for selector efficiency.
- */
- public void setDeliveredToConsumer()
- {
- _deliveredToConsumer = true;
- }
-
- private void deliver(StoreContext storeContext) throws AMQException
- {
- // we get a reference to the destination queues now so that we can clear the
- // transient message data as quickly as possible
- List<AMQQueue> destinationQueues = _transientMessageData.getDestinationQueues();
- if (_log.isDebugEnabled())
- {
- _log.debug("Delivering message " + debugIdentity() + " to " + destinationQueues);
- }
-
- try
- {
- // first we allow the handle to know that the message has been fully received. This is useful if it is
- // maintaining any calculated values based on content chunks
- _messageHandle.setPublishAndContentHeaderBody(storeContext, _messageId,
- _transientMessageData.getMessagePublishInfo(), _transientMessageData.getContentHeaderBody());
-
- // we then allow the transactional context to do something with the message content
- // now that it has all been received, before we attempt delivery
- _txnContext.messageFullyReceived(isPersistent());
-
- _transientMessageData = null;
-
- for (AMQQueue q : destinationQueues)
- {
- // Increment the references to this message for each queue delivery.
- incrementReference();
- // normal deliver so add this message at the end.
- _txnContext.deliver(q.createEntry(this), false);
- }
- }
- finally
- {
-
- // Remove refence for routing process . Reference count should now == delivered queue count
- decrementReference(storeContext);
- }
- }
-
-
- public AMQMessageHandle getMessageHandle()
- {
- return _messageHandle;
- }
-
- public long getSize()
- {
- try
- {
- long size = getContentHeaderBody().bodySize;
-
- return size;
- }
- catch (AMQException e)
- {
- _log.error(e.toString(), e);
-
- return 0;
- }
-
- }
-
- public void restoreTransientMessageData() throws AMQException
- {
- TransientMessageData transientMessageData = new TransientMessageData();
- transientMessageData.setMessagePublishInfo(getMessagePublishInfo());
- transientMessageData.setContentHeaderBody(getContentHeaderBody());
- transientMessageData.addBodyLength(getContentHeaderBody().getSize());
- _transientMessageData = transientMessageData;
- }
-
-
- public String toString()
- {
- // return "Message[" + debugIdentity() + "]: " + _messageId + "; ref count: " + _referenceCount + "; taken : " +
- // _taken + " by :" + _takenBySubcription;
-
- return "Message[" + debugIdentity() + "]: " + _messageId + "; ref count: " + _referenceCount;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.java
deleted file mode 100644
index ede55b3bbf..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.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.server.queue;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-
-/**
- * A pluggable way of getting message data. Implementations can provide intelligent caching for example or
- * even no caching at all to minimise the broker memory footprint.
- *
- * The method all take a messageId to avoid having to store it in the instance - the AMQMessage container
- * must already keen the messageId so it is pointless storing it twice.
- */
-public interface AMQMessageHandle
-{
- ContentHeaderBody getContentHeaderBody(StoreContext context, Long messageId) throws AMQException;
-
- /**
- * @return the number of body frames associated with this message
- */
- int getBodyCount(StoreContext context, Long messageId) throws AMQException;
-
- /**
- * @return the size of the body
- */
- long getBodySize(StoreContext context, Long messageId) throws AMQException;
-
- /**
- * Get a particular content body
- * @param index the index of the body to retrieve, must be between 0 and getBodyCount() - 1
- * @return a content body
- * @throws IllegalArgumentException if the index is invalid
- */
- ContentChunk getContentChunk(StoreContext context, Long messageId, int index) throws IllegalArgumentException, AMQException;
-
- void addContentBodyFrame(StoreContext storeContext, Long messageId, ContentChunk contentBody, boolean isLastContentBody) throws AMQException;
-
- MessagePublishInfo getMessagePublishInfo(StoreContext context, Long messageId) throws AMQException;
-
- boolean isRedelivered();
-
- void setRedelivered(boolean redelivered);
-
- boolean isPersistent(StoreContext context, Long messageId) throws AMQException;
-
- void setPublishAndContentHeaderBody(StoreContext storeContext, Long messageId, MessagePublishInfo messagePublishInfo,
- ContentHeaderBody contentHeaderBody)
- throws AMQException;
-
- void removeMessage(StoreContext storeContext, Long messageId) throws AMQException;
-
- void enqueue(StoreContext storeContext, Long messageId, AMQQueue queue) throws AMQException;
-
- void dequeue(StoreContext storeContext, Long messageId, AMQQueue queue) throws AMQException;
-
- long getArrivalTime();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
deleted file mode 100644
index 4a0121700c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
+++ /dev/null
@@ -1,1022 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.configuration.Configured;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.management.Managable;
-import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import javax.management.JMException;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * This is an AMQ Queue, and should not be confused with a JMS queue or any other abstraction like that. It is described
- * fully in RFC 006.
- */
-public class AMQQueue implements Managable, Comparable
-{
-
- /**
- * ExistingExclusiveSubscription signals a failure to create a subscription, because an exclusive subscription
- * already exists.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represent failure to create a subscription, because an exclusive subscription already exists.
- * </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
- * @todo Move to top level, used outside this class.
- */
- public static final class ExistingExclusiveSubscription extends AMQException
- {
-
- public ExistingExclusiveSubscription()
- {
- super("");
- }
- }
-
- /**
- * ExistingSubscriptionPreventsExclusive signals a failure to create an exclusize subscription, as a subscription
- * already exists.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represent failure to create an exclusize subscription, as a subscription already exists.
- * </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
- * @todo Move to top level, used outside this class.
- */
- public static final class ExistingSubscriptionPreventsExclusive extends AMQException
- {
- public ExistingSubscriptionPreventsExclusive()
- {
- super("");
- }
- }
-
- private static final Logger _logger = Logger.getLogger(AMQQueue.class);
-
- private final AMQShortString _name;
-
- /** null means shared */
- private final AMQShortString _owner;
-
- private final boolean _durable;
-
- /** If true, this queue is deleted when the last subscriber is removed */
- private final boolean _autoDelete;
-
- /** Holds subscribers to the queue. */
- private final SubscriptionSet _subscribers;
-
- private final SubscriptionFactory _subscriptionFactory;
-
- private final AtomicInteger _subscriberCount = new AtomicInteger();
-
- private final AtomicBoolean _isExclusive = new AtomicBoolean();
-
- private final AtomicBoolean _deleted = new AtomicBoolean(false);
-
- private List<Task> _deleteTaskList = new CopyOnWriteArrayList<Task>();
-
- /** Manages message delivery. */
- private final DeliveryManager _deliveryMgr;
-
- /** Used to track bindings to exchanges so that on deletion they can easily be cancelled. */
- private final ExchangeBindings _bindings = new ExchangeBindings(this);
-
- /** Executor on which asynchronous delivery will be carriedout where required */
- private final Executor _asyncDelivery;
-
- private final AMQQueueMBean _managedObject;
-
- private final VirtualHost _virtualHost;
-
- /** max allowed size(KB) of a single message */
- @Configured(path = "maximumMessageSize", defaultValue = "0")
- public long _maximumMessageSize;
-
- /** max allowed number of messages on a queue. */
- @Configured(path = "maximumMessageCount", defaultValue = "0")
- public long _maximumMessageCount;
-
- /** max queue depth for the queue */
- @Configured(path = "maximumQueueDepth", defaultValue = "0")
- public long _maximumQueueDepth;
-
- /** maximum message age before alerts occur */
- @Configured(path = "maximumMessageAge", defaultValue = "0")
- public long _maximumMessageAge;
-
- /** the minimum interval between sending out consequetive alerts of the same type */
- @Configured(path = "minimumAlertRepeatGap", defaultValue = "0")
- public long _minimumAlertRepeatGap;
-
- /** total messages received by the queue since startup. */
- public AtomicLong _totalMessagesReceived = new AtomicLong();
-
-
- private final Set<NotificationCheck> _notificationChecks = EnumSet.noneOf(NotificationCheck.class);
-
-
- public AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, boolean autoDelete, VirtualHost virtualHost)
- throws AMQException
- {
- this(name, durable, owner, autoDelete, virtualHost, AsyncDeliveryConfig.getAsyncDeliveryExecutor(),
- new SubscriptionSet(), new SubscriptionImpl.Factory());
- }
-
- protected AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, boolean autoDelete,
- VirtualHost virtualHost, SubscriptionSet subscribers) throws AMQException
- {
- this(name, durable, owner, autoDelete, virtualHost, AsyncDeliveryConfig.getAsyncDeliveryExecutor(), subscribers,
- new SubscriptionImpl.Factory());
- }
-
- protected AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, boolean autoDelete,
- VirtualHost virtualHost, Executor asyncDelivery, SubscriptionSet subscribers,
- SubscriptionFactory subscriptionFactory) throws AMQException
- {
- if (name == null)
- {
- throw new IllegalArgumentException("Queue name must not be null");
- }
-
- if (virtualHost == null)
- {
- throw new IllegalArgumentException("Virtual Host must not be null");
- }
-
- _name = name;
- _durable = durable;
- _owner = owner;
- _autoDelete = autoDelete;
- _virtualHost = virtualHost;
- _asyncDelivery = asyncDelivery;
-
- _managedObject = createMBean();
- _managedObject.register();
-
- _subscribers = subscribers;
- _subscriptionFactory = subscriptionFactory;
- _deliveryMgr = new ConcurrentSelectorDeliveryManager(_subscribers, this);
-
- // This ensure that the notification checks for the configured alerts are created.
- setMaximumMessageAge(_maximumMessageAge);
- setMaximumMessageCount(_maximumMessageCount);
- setMaximumMessageSize(_maximumMessageSize);
- setMaximumQueueDepth(_maximumQueueDepth);
-
- }
-
- private AMQQueueMBean createMBean() throws AMQException
- {
- try
- {
- return new AMQQueueMBean(this);
- }
- catch (JMException ex)
- {
- throw new AMQException("AMQQueue MBean creation has failed ", ex);
- }
- }
-
- public final AMQShortString getName()
- {
- return _name;
- }
-
- public boolean isShared()
- {
- return _owner == null;
- }
-
- public boolean isDurable()
- {
- return _durable;
- }
-
- public AMQShortString getOwner()
- {
- return _owner;
- }
-
- public boolean isAutoDelete()
- {
- return _autoDelete;
- }
-
- public boolean isDeleted()
- {
- return _deleted.get();
- }
-
- /** @return no of messages(undelivered) on the queue. */
- public int getMessageCount()
- {
- return _deliveryMgr.getQueueMessageCount();
- }
-
- /** @return List of messages(undelivered) on the queue. */
- public List<QueueEntry> getMessagesOnTheQueue()
- {
- return _deliveryMgr.getMessages();
- }
-
- /**
- * Returns messages within the given range of message Ids.
- *
- * @param fromMessageId
- * @param toMessageId
- *
- * @return List of messages
- */
- public List<QueueEntry> getMessagesOnTheQueue(long fromMessageId, long toMessageId)
- {
- return _deliveryMgr.getMessages(fromMessageId, toMessageId);
- }
-
- public long getQueueDepth()
- {
- return _deliveryMgr.getTotalMessageSize();
- }
-
- /**
- * @param messageId
- *
- * @return QueueEntry with give id if exists. null if QueueEntry with given id doesn't exist.
- */
- public QueueEntry getMessageOnTheQueue(long messageId)
- {
- List<QueueEntry> list = getMessagesOnTheQueue(messageId, messageId);
- if ((list == null) || (list.size() == 0))
- {
- return null;
- }
-
- return list.get(0);
- }
-
- /**
- * Moves messages from this queue to another queue, and also commits the move on the message store. Delivery activity
- * on the queues being moved between is suspended during the move.
- *
- * @param fromMessageId The first message id to move.
- * @param toMessageId The last message id to move.
- * @param queueName The queue to move the messages to.
- * @param storeContext The context of the message store under which to perform the move. This is associated with
- * the stores transactional context.
- */
- public synchronized void moveMessagesToAnotherQueue(long fromMessageId, long toMessageId, String queueName,
- StoreContext storeContext)
- {
- AMQQueue toQueue = getVirtualHost().getQueueRegistry().getQueue(new AMQShortString(queueName));
-
- MessageStore fromStore = getVirtualHost().getMessageStore();
- MessageStore toStore = toQueue.getVirtualHost().getMessageStore();
-
- if (toStore != fromStore)
- {
- throw new RuntimeException("Can only move messages between queues on the same message store.");
- }
-
- try
- {
- // Obtain locks to prevent activity on the queues being moved between.
- startMovingMessages();
- toQueue.startMovingMessages();
-
- // Get the list of messages to move.
- List<QueueEntry> foundMessagesList = getMessagesOnTheQueue(fromMessageId, toMessageId);
-
- try
- {
- fromStore.beginTran(storeContext);
-
- // Move the messages in on the message store.
- for (QueueEntry entry : foundMessagesList)
- {
- AMQMessage message = entry.getMessage();
- fromStore.dequeueMessage(storeContext, _name, message.getMessageId());
- toStore.enqueueMessage(storeContext, toQueue._name, message.getMessageId());
- }
-
- // Commit and flush the move transcations.
- try
- {
- fromStore.commitTran(storeContext);
- }
- catch (AMQException e)
- {
- throw new RuntimeException("Failed to commit transaction whilst moving messages on message store.", e);
- }
-
- // Move the messages on the in-memory queues.
- toQueue.enqueueMovedMessages(storeContext, foundMessagesList);
- _deliveryMgr.removeMovedMessages(foundMessagesList);
- }
- // Abort the move transactions on move failures.
- catch (AMQException e)
- {
- try
- {
- fromStore.abortTran(storeContext);
- }
- catch (AMQException ae)
- {
- throw new RuntimeException("Failed to abort transaction whilst moving messages on message store.", ae);
- }
- }
- }
- // Release locks to allow activity on the queues being moved between to continue.
- finally
- {
- toQueue.stopMovingMessages();
- stopMovingMessages();
- }
- }
-
- /**
- * Copies messages on this queue to another queue, and also commits the move on the message store. Delivery activity
- * on the queues being moved between is suspended during the move.
- *
- * @param fromMessageId The first message id to move.
- * @param toMessageId The last message id to move.
- * @param queueName The queue to move the messages to.
- * @param storeContext The context of the message store under which to perform the move. This is associated with
- * the stores transactional context.
- */
- public synchronized void copyMessagesToAnotherQueue(long fromMessageId, long toMessageId, String queueName,
- StoreContext storeContext)
- {
- AMQQueue toQueue = getVirtualHost().getQueueRegistry().getQueue(new AMQShortString(queueName));
-
- MessageStore fromStore = getVirtualHost().getMessageStore();
- MessageStore toStore = toQueue.getVirtualHost().getMessageStore();
-
- if (toStore != fromStore)
- {
- throw new RuntimeException("Can only move messages between queues on the same message store.");
- }
-
- try
- {
- // Obtain locks to prevent activity on the queues being moved between.
- startMovingMessages();
- toQueue.startMovingMessages();
-
- // Get the list of messages to move.
- List<QueueEntry> foundMessagesList = getMessagesOnTheQueue(fromMessageId, toMessageId);
-
- try
- {
- fromStore.beginTran(storeContext);
-
- // Move the messages in on the message store.
- for (QueueEntry entry : foundMessagesList)
- {
- AMQMessage message = entry.getMessage();
- toStore.enqueueMessage(storeContext, toQueue._name, message.getMessageId());
- message.takeReference();
- }
-
- // Commit and flush the move transcations.
- try
- {
- fromStore.commitTran(storeContext);
- }
- catch (AMQException e)
- {
- throw new RuntimeException("Failed to commit transaction whilst moving messages on message store.", e);
- }
-
- // Move the messages on the in-memory queues.
- toQueue.enqueueMovedMessages(storeContext, foundMessagesList);
- }
- // Abort the move transactions on move failures.
- catch (AMQException e)
- {
- try
- {
- fromStore.abortTran(storeContext);
- }
- catch (AMQException ae)
- {
- throw new RuntimeException("Failed to abort transaction whilst moving messages on message store.", ae);
- }
- }
- }
- // Release locks to allow activity on the queues being moved between to continue.
- finally
- {
- toQueue.stopMovingMessages();
- stopMovingMessages();
- }
- }
-
- /**
- * Removes messages from this queue, and also commits the remove on the message store. Delivery activity
- * on the queues being moved between is suspended during the remove.
- *
- * @param fromMessageId The first message id to move.
- * @param toMessageId The last message id to move.
- * @param storeContext The context of the message store under which to perform the move. This is associated with
- * the stores transactional context.
- */
- public synchronized void removeMessagesFromQueue(long fromMessageId, long toMessageId, StoreContext storeContext)
- {
- MessageStore fromStore = getVirtualHost().getMessageStore();
-
- try
- {
- // Obtain locks to prevent activity on the queues being moved between.
- startMovingMessages();
-
- // Get the list of messages to move.
- List<QueueEntry> foundMessagesList = getMessagesOnTheQueue(fromMessageId, toMessageId);
-
- try
- {
- fromStore.beginTran(storeContext);
-
- // remove the messages in on the message store.
- for (QueueEntry entry : foundMessagesList)
- {
- AMQMessage message = entry.getMessage();
- fromStore.dequeueMessage(storeContext, _name, message.getMessageId());
- }
-
- // Commit and flush the move transcations.
- try
- {
- fromStore.commitTran(storeContext);
- }
- catch (AMQException e)
- {
- throw new RuntimeException("Failed to commit transaction whilst moving messages on message store.", e);
- }
-
- // remove the messages on the in-memory queues.
- _deliveryMgr.removeMovedMessages(foundMessagesList);
- }
- // Abort the move transactions on move failures.
- catch (AMQException e)
- {
- try
- {
- fromStore.abortTran(storeContext);
- }
- catch (AMQException ae)
- {
- throw new RuntimeException("Failed to abort transaction whilst moving messages on message store.", ae);
- }
- }
- }
- // Release locks to allow activity on the queues being moved between to continue.
- finally
- {
- stopMovingMessages();
- }
- }
-
- public void startMovingMessages()
- {
- _deliveryMgr.startMovingMessages();
- }
-
- private void enqueueMovedMessages(StoreContext storeContext, List<QueueEntry> messageList)
- {
- _deliveryMgr.enqueueMovedMessages(storeContext, messageList);
- _totalMessagesReceived.addAndGet(messageList.size());
- }
-
- public void stopMovingMessages()
- {
- _deliveryMgr.stopMovingMessages();
- _deliveryMgr.processAsync(_asyncDelivery);
- }
-
- /** @return MBean object associated with this Queue */
- public ManagedObject getManagedObject()
- {
- return _managedObject;
- }
-
- public long getMaximumMessageSize()
- {
- return _maximumMessageSize;
- }
-
- public void setMaximumMessageSize(final long maximumMessageSize)
- {
- _maximumMessageSize = maximumMessageSize;
- if(maximumMessageSize == 0L)
- {
- _notificationChecks.remove(NotificationCheck.MESSAGE_SIZE_ALERT);
- }
- else
- {
- _notificationChecks.add(NotificationCheck.MESSAGE_SIZE_ALERT);
- }
- }
-
- public int getConsumerCount()
- {
- return _subscribers.size();
- }
-
- public int getActiveConsumerCount()
- {
- return _subscribers.getWeight();
- }
-
- public long getReceivedMessageCount()
- {
- return _totalMessagesReceived.get();
- }
-
- public long getMaximumMessageCount()
- {
- return _maximumMessageCount;
- }
-
- public void setMaximumMessageCount(final long maximumMessageCount)
- {
- _maximumMessageCount = maximumMessageCount;
- if(maximumMessageCount == 0L)
- {
- _notificationChecks.remove(NotificationCheck.MESSAGE_COUNT_ALERT);
- }
- else
- {
- _notificationChecks.add(NotificationCheck.MESSAGE_COUNT_ALERT);
- }
-
-
-
- }
-
- public long getMaximumQueueDepth()
- {
- return _maximumQueueDepth;
- }
-
- // Sets the queue depth, the max queue size
- public void setMaximumQueueDepth(final long maximumQueueDepth)
- {
- _maximumQueueDepth = maximumQueueDepth;
- if(maximumQueueDepth == 0L)
- {
- _notificationChecks.remove(NotificationCheck.QUEUE_DEPTH_ALERT);
- }
- else
- {
- _notificationChecks.add(NotificationCheck.QUEUE_DEPTH_ALERT);
- }
-
- }
-
- public long getOldestMessageArrivalTime()
- {
- return _deliveryMgr.getOldestMessageArrival();
-
- }
-
- /** Removes the QueueEntry from the top of the queue. */
- public synchronized void deleteMessageFromTop(StoreContext storeContext) throws AMQException
- {
- _deliveryMgr.removeAMessageFromTop(storeContext, this);
- }
-
- /** removes all the messages from the queue. */
- public synchronized long clearQueue(StoreContext storeContext) throws AMQException
- {
- return _deliveryMgr.clearAllMessages(storeContext);
- }
-
- public void bind(AMQShortString routingKey, FieldTable arguments, Exchange exchange) throws AMQException
- {
- exchange.registerQueue(routingKey, this, arguments);
- if (isDurable() && exchange.isDurable())
- {
- _virtualHost.getMessageStore().bindQueue(exchange, routingKey, this, arguments);
- }
-
- _bindings.addBinding(routingKey, arguments, exchange);
- }
-
- public void unBind(AMQShortString routingKey, FieldTable arguments, Exchange exchange) throws AMQException
- {
- exchange.deregisterQueue(routingKey, this, arguments);
- if (isDurable() && exchange.isDurable())
- {
- _virtualHost.getMessageStore().unbindQueue(exchange, routingKey, this, arguments);
- }
-
- _bindings.remove(routingKey, arguments, exchange);
- }
-
- public void registerProtocolSession(AMQProtocolSession ps, int channel, AMQShortString consumerTag, boolean acks,
- FieldTable filters, boolean noLocal, boolean exclusive) throws AMQException
- {
- if (incrementSubscriberCount() > 1)
- {
- if (isExclusive())
- {
- decrementSubscriberCount();
- throw new ExistingExclusiveSubscription();
- }
- else if (exclusive)
- {
- decrementSubscriberCount();
- throw new ExistingSubscriptionPreventsExclusive();
- }
-
- }
- else if (exclusive)
- {
- setExclusive(true);
- }
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug(MessageFormat.format("Registering protocol session {0} with channel {1} and "
- + "consumer tag {2} with {3}", ps, channel, consumerTag, this));
- }
-
- Subscription subscription =
- _subscriptionFactory.createSubscription(channel, ps, consumerTag, acks, filters, noLocal, this);
-
- if (subscription.filtersMessages())
- {
- if (_deliveryMgr.hasQueuedMessages())
- {
- _deliveryMgr.populatePreDeliveryQueue(subscription);
- }
- }
-
- _subscribers.addSubscriber(subscription);
- if(exclusive)
- {
- _subscribers.setExclusive(true);
- }
- }
-
- private boolean isExclusive()
- {
- return _isExclusive.get();
- }
-
- private void setExclusive(boolean exclusive)
- {
- _isExclusive.set(exclusive);
- }
-
- private int incrementSubscriberCount()
- {
- return _subscriberCount.incrementAndGet();
- }
-
- private int decrementSubscriberCount()
- {
- return _subscriberCount.decrementAndGet();
- }
-
- public void unregisterProtocolSession(AMQProtocolSession ps, int channel, AMQShortString consumerTag) throws AMQException
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug(MessageFormat.format(
- "Unregistering protocol session {0} with channel {1} and consumer tag {2} from {3}",
- ps, channel, consumerTag, this));
- }
-
- _subscribers.setExclusive(false);
- Subscription removedSubscription;
- if ((removedSubscription = _subscribers.removeSubscriber(_subscriptionFactory.createSubscription(channel, ps,
- consumerTag)))
- == null)
- {
- throw new AMQException("Protocol session with channel " + channel + " and consumer tag " + consumerTag
- + " and protocol session key " + ps.getKey() + " not registered with queue " + this);
- }
-
- removedSubscription.close();
- setExclusive(false);
- decrementSubscriberCount();
-
- // if we are eligible for auto deletion, unregister from the queue registry
- if (_autoDelete && _subscribers.isEmpty())
- {
- if (_logger.isInfoEnabled())
- {
- _logger.info("Auto-deleteing queue:" + this);
- }
-
- autodelete();
- // we need to manually fire the event to the removed subscription (which was the last one left for this
- // queue. This is because the delete method uses the subscription set which has just been cleared
- removedSubscription.queueDeleted(this);
- }
- }
-
- public boolean isUnused()
- {
- return _subscribers.isEmpty();
- }
-
- public boolean isEmpty()
- {
- return !_deliveryMgr.hasQueuedMessages();
- }
-
- public int delete(boolean checkUnused, boolean checkEmpty) throws AMQException
- {
- if (checkUnused && !_subscribers.isEmpty())
- {
- _logger.info("Will not delete " + this + " as it is in use.");
-
- return 0;
- }
- else if (checkEmpty && _deliveryMgr.hasQueuedMessages())
- {
- _logger.info("Will not delete " + this + " as it is not empty.");
-
- return 0;
- }
- else
- {
- delete();
-
- return _deliveryMgr.getQueueMessageCount();
- }
- }
-
- public void delete() throws AMQException
- {
- if (!_deleted.getAndSet(true))
- {
- _subscribers.queueDeleted(this);
- _bindings.deregister();
- _virtualHost.getQueueRegistry().unregisterQueue(_name);
- _managedObject.unregister();
- for (Task task : _deleteTaskList)
- {
- task.doTask(this);
- }
-
- _deleteTaskList.clear();
- }
- }
-
- protected void autodelete() throws AMQException
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug(MessageFormat.format("autodeleting {0}", this));
- }
-
- delete();
- }
-
- /*public void processGet(StoreContext storeContext, AMQMessage msg, boolean deliverFirst) throws AMQException
- {
- // fixme not sure what this is doing. should we be passing deliverFirst through here?
- // This code is not used so when it is perhaps it should
- _deliveryMgr.deliver(storeContext, getName(), msg, deliverFirst);
- try
- {
- msg.checkDeliveredToConsumer();
- updateReceivedMessageCount(msg);
- }
- catch (NoConsumersException e)
- {
- // as this message will be returned, it should be removed
- // from the queue:
- dequeue(storeContext, msg);
- }
- }*/
-
- // public DeliveryManager getDeliveryManager()
- // {
- // return _deliveryMgr;
- // }
-
- public void process(StoreContext storeContext, QueueEntry entry, boolean deliverFirst) throws AMQException
- {
- AMQMessage msg = entry.getMessage();
- _deliveryMgr.deliver(storeContext, _name, entry, deliverFirst);
- try
- {
- msg.checkDeliveredToConsumer();
- updateReceivedMessageCount(entry);
- }
- catch (NoConsumersException e)
- {
- // as this message will be returned, it should be removed
- // from the queue:
- dequeue(storeContext, entry);
- }
- }
-
- public void dequeue(StoreContext storeContext, QueueEntry entry) throws FailedDequeueException
- {
- try
- {
- entry.getMessage().dequeue(storeContext, this);
- }
- catch (MessageCleanupException e)
- {
- // Message was dequeued, but could not then be deleted
- // though it is no longer referenced. This should be very
- // rare and can be detected and cleaned up on recovery or
- // done through some form of manual intervention.
- _logger.error(e, e);
- }
- catch (AMQException e)
- {
- throw new FailedDequeueException(_name.toString(), e);
- }
- }
-
- public void deliverAsync()
- {
- _deliveryMgr.processAsync(_asyncDelivery);
- }
-
- protected SubscriptionManager getSubscribers()
- {
- return _subscribers;
- }
-
- protected void updateReceivedMessageCount(QueueEntry entry) throws AMQException
- {
- AMQMessage msg = entry.getMessage();
-
- if (!msg.isRedelivered())
- {
- _totalMessagesReceived.incrementAndGet();
- }
-
- try
- {
- _managedObject.checkForNotification(msg);
- }
- catch (JMException e)
- {
- throw new AMQException("Unable to get notification from manage queue: " + e, e);
- }
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
-
- if ((o == null) || (getClass() != o.getClass()))
- {
- return false;
- }
-
- final AMQQueue amqQueue = (AMQQueue) o;
-
- return (_name.equals(amqQueue._name));
- }
-
- public int hashCode()
- {
- return _name.hashCode();
- }
-
- public String toString()
- {
- return "Queue(" + _name + ")@" + System.identityHashCode(this);
- }
-
- public boolean performGet(AMQProtocolSession session, AMQChannel channel, boolean acks) throws AMQException
- {
- return _deliveryMgr.performGet(session, channel, acks);
- }
-
- public QueueRegistry getQueueRegistry()
- {
- return _virtualHost.getQueueRegistry();
- }
-
- public VirtualHost getVirtualHost()
- {
- return _virtualHost;
- }
-
- public static interface Task
- {
- public void doTask(AMQQueue queue) throws AMQException;
- }
-
- public void addQueueDeleteTask(Task task)
- {
- _deleteTaskList.add(task);
- }
-
- public long getMinimumAlertRepeatGap()
- {
- return _minimumAlertRepeatGap;
- }
-
- public void setMinimumAlertRepeatGap(long minimumAlertRepeatGap)
- {
- _minimumAlertRepeatGap = minimumAlertRepeatGap;
- }
-
- public long getMaximumMessageAge()
- {
- return _maximumMessageAge;
- }
-
- public void setMaximumMessageAge(long maximumMessageAge)
- {
- _maximumMessageAge = maximumMessageAge;
- if(maximumMessageAge == 0L)
- {
- _notificationChecks.remove(NotificationCheck.MESSAGE_AGE_ALERT);
- }
- else
- {
- _notificationChecks.add(NotificationCheck.MESSAGE_AGE_ALERT);
- }
- }
-
- public void subscriberHasPendingResend(boolean hasContent, SubscriptionImpl subscription, QueueEntry entry)
- {
- _deliveryMgr.subscriberHasPendingResend(hasContent, subscription, entry);
- }
-
- public QueueEntry createEntry(AMQMessage amqMessage)
- {
- return new QueueEntry(this, amqMessage);
- }
-
- public int compareTo(Object o)
- {
- return _name.compareTo(((AMQQueue) o).getName());
- }
-
-
- public void removeExpiredIfNoSubscribers() throws AMQException
- {
- synchronized(_subscribers.getChangeLock())
- {
- if(_subscribers.isEmpty())
- {
- _deliveryMgr.removeExpired();
- }
- }
- }
-
- public final Set<NotificationCheck> getNotificationChecks()
- {
- return _notificationChecks;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java
deleted file mode 100644
index 348a136f9d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import org.apache.log4j.Logger;
-
-import org.apache.mina.common.ByteBuffer;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.CommonContentHeaderProperties;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.server.management.AMQManagedObject;
-import org.apache.qpid.server.management.MBeanConstructor;
-import org.apache.qpid.server.management.MBeanDescription;
-import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.server.store.StoreContext;
-
-import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.Notification;
-import javax.management.OperationsException;
-import javax.management.monitor.MonitorNotification;
-import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-/**
- * AMQQueueMBean is the management bean for an {@link AMQQueue}.
- *
- * <p/><tablse id="crc"><caption>CRC Caption</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * </table>
- */
-@MBeanDescription("Management Interface for AMQQueue")
-public class AMQQueueMBean extends AMQManagedObject implements ManagedQueue, QueueNotificationListener
-{
- /** Used for debugging purposes. */
- private static final Logger _logger = Logger.getLogger(AMQQueueMBean.class);
-
- private static final SimpleDateFormat _dateFormat = new SimpleDateFormat("MM-dd-yy HH:mm:ss.SSS z");
-
- /**
- * Since the MBean is not associated with a real channel we can safely create our own store context
- * for use in the few methods that require one.
- */
- private StoreContext _storeContext = new StoreContext();
-
- private AMQQueue _queue = null;
- private String _queueName = null;
- // OpenMBean data types for viewMessages method
- private static final String[] _msgAttributeNames = { "AMQ MessageId", "Header", "Size(bytes)", "Redelivered" };
- private static String[] _msgAttributeIndex = { _msgAttributeNames[0] };
- private static OpenType[] _msgAttributeTypes = new OpenType[4]; // AMQ message attribute types.
- private static CompositeType _messageDataType = null; // Composite type for representing AMQ Message data.
- private static TabularType _messagelistDataType = null; // Datatype for representing AMQ messages list.
-
- // OpenMBean data types for viewMessageContent method
- private static CompositeType _msgContentType = null;
- private static final String[] _msgContentAttributes = { "AMQ MessageId", "MimeType", "Encoding", "Content" };
- private static OpenType[] _msgContentAttributeTypes = new OpenType[4];
-
- private final long[] _lastNotificationTimes = new long[NotificationCheck.values().length];
- private Notification _lastNotification = null;
-
-
-
-
- @MBeanConstructor("Creates an MBean exposing an AMQQueue")
- public AMQQueueMBean(AMQQueue queue) throws JMException
- {
- super(ManagedQueue.class, ManagedQueue.TYPE);
- _queue = queue;
- _queueName = jmxEncode(new StringBuffer(queue.getName()), 0).toString();
- }
-
- public ManagedObject getParentObject()
- {
- return _queue.getVirtualHost().getManagedObject();
- }
-
- static
- {
- try
- {
- init();
- }
- catch (JMException ex)
- {
- // This is not expected to ever occur.
- throw new RuntimeException("Got JMException in static initializer.", ex);
- }
- }
-
- /**
- * initialises the openmbean data types
- */
- private static void init() throws OpenDataException
- {
- _msgContentAttributeTypes[0] = SimpleType.LONG; // For message id
- _msgContentAttributeTypes[1] = SimpleType.STRING; // For MimeType
- _msgContentAttributeTypes[2] = SimpleType.STRING; // For Encoding
- _msgContentAttributeTypes[3] = new ArrayType(1, SimpleType.BYTE); // For message content
- _msgContentType =
- new CompositeType("Message Content", "AMQ Message Content", _msgContentAttributes, _msgContentAttributes,
- _msgContentAttributeTypes);
-
- _msgAttributeTypes[0] = SimpleType.LONG; // For message id
- _msgAttributeTypes[1] = new ArrayType(1, SimpleType.STRING); // For header attributes
- _msgAttributeTypes[2] = SimpleType.LONG; // For size
- _msgAttributeTypes[3] = SimpleType.BOOLEAN; // For redelivered
-
- _messageDataType =
- new CompositeType("Message", "AMQ Message", _msgAttributeNames, _msgAttributeNames, _msgAttributeTypes);
- _messagelistDataType = new TabularType("Messages", "List of messages", _messageDataType, _msgAttributeIndex);
- }
-
- public String getObjectInstanceName()
- {
- return _queueName;
- }
-
- public String getName()
- {
- return _queueName;
- }
-
- public boolean isDurable()
- {
- return _queue.isDurable();
- }
-
- public String getOwner()
- {
- return String.valueOf(_queue.getOwner());
- }
-
- public boolean isAutoDelete()
- {
- return _queue.isAutoDelete();
- }
-
- public Integer getMessageCount()
- {
- return _queue.getMessageCount();
- }
-
- public Long getMaximumMessageSize()
- {
- return _queue.getMaximumMessageSize();
- }
-
- public Long getMaximumMessageAge()
- {
- return _queue.getMaximumMessageAge();
- }
-
- public void setMaximumMessageAge(Long maximumMessageAge)
- {
- _queue.setMaximumMessageAge(maximumMessageAge);
- }
-
- public void setMaximumMessageSize(Long value)
- {
- _queue.setMaximumMessageSize(value);
- }
-
- public Integer getConsumerCount()
- {
- return _queue.getConsumerCount();
- }
-
- public Integer getActiveConsumerCount()
- {
- return _queue.getActiveConsumerCount();
- }
-
- public Long getReceivedMessageCount()
- {
- return _queue.getReceivedMessageCount();
- }
-
- public Long getMaximumMessageCount()
- {
- return _queue.getMaximumMessageCount();
- }
-
- public void setMaximumMessageCount(Long value)
- {
- _queue.setMaximumMessageCount(value);
- }
-
- public Long getMaximumQueueDepth()
- {
- long queueDepthInBytes = _queue.getMaximumQueueDepth();
-
- return queueDepthInBytes >> 10;
- }
-
- public void setMaximumQueueDepth(Long value)
- {
- _queue.setMaximumQueueDepth(value);
- }
-
- /**
- * returns the size of messages(KB) in the queue.
- */
- public Long getQueueDepth() throws JMException
- {
- long queueBytesSize = _queue.getQueueDepth();
-
- return queueBytesSize >> 10;
- }
-
- /**
- * Checks if there is any notification to be send to the listeners
- */
- public void checkForNotification(AMQMessage msg) throws AMQException, JMException
- {
-
- final Set<NotificationCheck> notificationChecks = _queue.getNotificationChecks();
-
- if(!notificationChecks.isEmpty())
- {
- final long currentTime = System.currentTimeMillis();
- final long thresholdTime = currentTime - _queue.getMinimumAlertRepeatGap();
-
- for (NotificationCheck check : notificationChecks)
- {
- if (check.isMessageSpecific() || (_lastNotificationTimes[check.ordinal()] < thresholdTime))
- {
- if (check.notifyIfNecessary(msg, _queue, this))
- {
- _lastNotificationTimes[check.ordinal()] = currentTime;
- }
- }
- }
- }
-
- }
-
- /**
- * Sends the notification to the listeners
- */
- public void notifyClients(NotificationCheck notification, AMQQueue queue, String notificationMsg)
- {
- // important : add log to the log file - monitoring tools may be looking for this
- _logger.info(notification.name() + " On Queue " + queue.getName() + " - " + notificationMsg);
- notificationMsg = notification.name() + " " + notificationMsg;
-
- _lastNotification =
- new Notification(MonitorNotification.THRESHOLD_VALUE_EXCEEDED, this, ++_notificationSequenceNumber,
- System.currentTimeMillis(), notificationMsg);
-
- _broadcaster.sendNotification(_lastNotification);
- }
-
- public Notification getLastNotification()
- {
- return _lastNotification;
- }
-
- /**
- * @see org.apache.qpid.server.queue.AMQQueue#deleteMessageFromTop
- */
- public void deleteMessageFromTop() throws JMException
- {
- try
- {
- _queue.deleteMessageFromTop(_storeContext);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex, ex.toString());
- }
- }
-
- /**
- * @see org.apache.qpid.server.queue.AMQQueue#clearQueue
- */
- public void clearQueue() throws JMException
- {
- try
- {
- _queue.clearQueue(_storeContext);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex, ex.toString());
- }
- }
-
- /**
- * returns message content as byte array and related attributes for the given message id.
- */
- public CompositeData viewMessageContent(long msgId) throws JMException
- {
- QueueEntry entry = _queue.getMessageOnTheQueue(msgId);
-
- if (entry == null)
- {
- throw new OperationsException("AMQMessage with message id = " + msgId + " is not in the " + _queueName);
- }
-
- AMQMessage msg = entry.getMessage();
- // get message content
- Iterator<ContentChunk> cBodies = msg.getContentBodyIterator();
- List<Byte> msgContent = new ArrayList<Byte>();
- while (cBodies.hasNext())
- {
- ContentChunk body = cBodies.next();
- if (body.getSize() != 0)
- {
- if (body.getSize() != 0)
- {
- ByteBuffer slice = body.getData().slice();
- for (int j = 0; j < slice.limit(); j++)
- {
- msgContent.add(slice.get());
- }
- }
- }
- }
-
- try
- {
- // Create header attributes list
- CommonContentHeaderProperties headerProperties =
- (CommonContentHeaderProperties) msg.getContentHeaderBody().properties;
- String mimeType = null, encoding = null;
- if (headerProperties != null)
- {
- AMQShortString mimeTypeShortSting = headerProperties.getContentType();
- mimeType = (mimeTypeShortSting == null) ? null : mimeTypeShortSting.toString();
- encoding = (headerProperties.getEncoding() == null) ? "" : headerProperties.getEncoding().toString();
- }
-
- Object[] itemValues = { msgId, mimeType, encoding, msgContent.toArray(new Byte[0]) };
-
- return new CompositeDataSupport(_msgContentType, _msgContentAttributes, itemValues);
- }
- catch (AMQException e)
- {
- JMException jme = new JMException("Error creating header attributes list: " + e);
- jme.initCause(e);
- throw jme;
- }
- }
-
- /**
- * Returns the header contents of the messages stored in this queue in tabular form.
- */
- public TabularData viewMessages(int beginIndex, int endIndex) throws JMException
- {
- if ((beginIndex > endIndex) || (beginIndex < 1))
- {
- throw new OperationsException("From Index = " + beginIndex + ", To Index = " + endIndex
- + "\n\"From Index\" should be greater than 0 and less than \"To Index\"");
- }
-
- List<QueueEntry> list = _queue.getMessagesOnTheQueue();
- TabularDataSupport _messageList = new TabularDataSupport(_messagelistDataType);
-
- try
- {
- // Create the tabular list of message header contents
- for (int i = beginIndex; (i <= endIndex) && (i <= list.size()); i++)
- {
- AMQMessage msg = list.get(i - 1).getMessage();
- ContentHeaderBody headerBody = msg.getContentHeaderBody();
- // Create header attributes list
- String[] headerAttributes = getMessageHeaderProperties(headerBody);
- Object[] itemValues = { msg.getMessageId(), headerAttributes, headerBody.bodySize, msg.isRedelivered() };
- CompositeData messageData = new CompositeDataSupport(_messageDataType, _msgAttributeNames, itemValues);
- _messageList.put(messageData);
- }
- }
- catch (AMQException e)
- {
- JMException jme = new JMException("Error creating message contents: " + e);
- jme.initCause(e);
- throw jme;
- }
-
- return _messageList;
- }
-
- private String[] getMessageHeaderProperties(ContentHeaderBody headerBody)
- {
- List<String> list = new ArrayList<String>();
- BasicContentHeaderProperties headerProperties = (BasicContentHeaderProperties) headerBody.properties;
- list.add("reply-to = " + headerProperties.getReplyToAsString());
- list.add("propertyFlags = " + headerProperties.getPropertyFlags());
- list.add("ApplicationID = " + headerProperties.getAppIdAsString());
- list.add("ClusterID = " + headerProperties.getClusterIdAsString());
- list.add("UserId = " + headerProperties.getUserIdAsString());
- list.add("JMSMessageID = " + headerProperties.getMessageIdAsString());
- list.add("JMSCorrelationID = " + headerProperties.getCorrelationIdAsString());
-
- int delMode = headerProperties.getDeliveryMode();
- list.add("JMSDeliveryMode = " + ((delMode == 1) ? "Persistent" : "Non_Persistent"));
-
- list.add("JMSPriority = " + headerProperties.getPriority());
- list.add("JMSType = " + headerProperties.getType());
-
- long longDate = headerProperties.getExpiration();
- String strDate = (longDate != 0) ? _dateFormat.format(new Date(longDate)) : null;
- list.add("JMSExpiration = " + strDate);
-
- longDate = headerProperties.getTimestamp();
- strDate = (longDate != 0) ? _dateFormat.format(new Date(longDate)) : null;
- list.add("JMSTimestamp = " + strDate);
-
- return list.toArray(new String[list.size()]);
- }
-
- /**
- * @see ManagedQueue#moveMessages
- * @param fromMessageId
- * @param toMessageId
- * @param toQueueName
- * @throws JMException
- */
- public void moveMessages(long fromMessageId, long toMessageId, String toQueueName) throws JMException
- {
- if ((fromMessageId > toMessageId) || (fromMessageId < 1))
- {
- throw new OperationsException("\"From MessageId\" should be greater then 0 and less then \"To MessageId\"");
- }
-
- _queue.moveMessagesToAnotherQueue(fromMessageId, toMessageId, toQueueName, _storeContext);
- }
-
- /**
- * returns Notifications sent by this MBean.
- */
- @Override
- public MBeanNotificationInfo[] getNotificationInfo()
- {
- String[] notificationTypes = new String[] { MonitorNotification.THRESHOLD_VALUE_EXCEEDED };
- String name = MonitorNotification.class.getName();
- String description = "Either Message count or Queue depth or Message size has reached threshold high value";
- MBeanNotificationInfo info1 = new MBeanNotificationInfo(notificationTypes, name, description);
-
- return new MBeanNotificationInfo[] { info1 };
- }
-
-} // End of AMQQueueMBean class
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AsyncDeliveryConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AsyncDeliveryConfig.java
deleted file mode 100644
index 290fedcf7b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AsyncDeliveryConfig.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
-import org.apache.qpid.configuration.Configured;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-
-public class AsyncDeliveryConfig
-{
- private Executor _executor;
-
- @Configured(path = "delivery.poolsize", defaultValue = "0")
- public int poolSize;
-
- public Executor getExecutor()
- {
- if (_executor == null)
- {
- if (poolSize > 0)
- {
- _executor = Executors.newFixedThreadPool(poolSize);
- }
- else
- {
- _executor = Executors.newCachedThreadPool();
- }
- }
- return _executor;
- }
-
- public static Executor getAsyncDeliveryExecutor()
- {
- return ApplicationRegistry.getInstance().getConfiguredObject(AsyncDeliveryConfig.class).getExecutor();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java
deleted file mode 100644
index a61d41e33b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java
+++ /dev/null
@@ -1,1077 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.configuration.Configured;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.util.ConcurrentLinkedMessageQueueAtomicSize;
-import org.apache.qpid.util.MessageQueue;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Queue;
-import java.util.Set;
-import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.ReentrantLock;
-
-
-/** Manages delivery of messages on behalf of a queue */
-public class ConcurrentSelectorDeliveryManager implements DeliveryManager
-{
- private static final Logger _log = Logger.getLogger(ConcurrentSelectorDeliveryManager.class);
-
- @Configured(path = "advanced.compressBufferOnQueue",
- defaultValue = "false")
- public boolean compressBufferOnQueue;
- /** Holds any queued messages */
- private final MessageQueue<QueueEntry> _messages = new ConcurrentLinkedMessageQueueAtomicSize<QueueEntry>();
-
- /** Ensures that only one asynchronous task is running for this manager at any time. */
- private final AtomicBoolean _processing = new AtomicBoolean();
- /** The subscriptions on the queue to whom messages are delivered */
- private final SubscriptionManager _subscriptions;
-
- /**
- * A reference to the queue we are delivering messages for. We need this to be able to pass the code that handles
- * acknowledgements a handle on the queue.
- */
- private final AMQQueue _queue;
-
- /**
- * Flag used while moving messages from this queue to another. For moving messages the async delivery should also
- * stop. This flat should be set to true to stop async delivery and set to false to enable async delivery again.
- */
- private AtomicBoolean _movingMessages = new AtomicBoolean();
-
- /**
- * Lock used to ensure that an channel that becomes unsuspended during the start of the queueing process is forced
- * to wait till the first message is added to the queue. This will ensure that the _queue has messages to be
- * delivered via the async thread. <p/> Lock is used to control access to hasQueuedMessages() and over the addition
- * of messages to the queue.
- */
- private ReentrantLock _lock = new ReentrantLock();
- private AtomicLong _totalMessageSize = new AtomicLong();
- private AtomicInteger _extraMessages = new AtomicInteger();
- private Set<Subscription> _hasContent = Collections.synchronizedSet(new HashSet<Subscription>());
- private final Object _queueHeadLock = new Object();
- private String _processingThreadName = "";
-
-
- /** Used by any reaping thread to purge messages */
- private StoreContext _reapingStoreContext = new StoreContext();
-
- ConcurrentSelectorDeliveryManager(SubscriptionManager subscriptions, AMQQueue queue)
- {
-
- //Set values from configuration
- Configurator.configure(this);
-
- if (compressBufferOnQueue)
- {
- _log.warn("Compressing Buffers on queue.");
- }
-
- _subscriptions = subscriptions;
- _queue = queue;
- }
-
-
- private boolean addMessageToQueue(QueueEntry entry, boolean deliverFirst)
- {
- AMQMessage msg = entry.getMessage();
- // Shrink the ContentBodies to their actual size to save memory.
- if (compressBufferOnQueue)
- {
- Iterator<ContentChunk> it = msg.getContentBodyIterator();
- while (it.hasNext())
- {
- ContentChunk cb = it.next();
- cb.reduceToFit();
- }
- }
-
- if (deliverFirst)
- {
- synchronized (_queueHeadLock)
- {
- _messages.pushHead(entry);
- }
- }
- else
- {
- _messages.offer(entry);
- }
-
- _totalMessageSize.addAndGet(msg.getSize());
-
- return true;
- }
-
-
- public boolean hasQueuedMessages()
- {
- _lock.lock();
- try
- {
- return !(_messages.isEmpty() && _hasContent.isEmpty());
- }
- finally
- {
- _lock.unlock();
- }
- }
-
- public int getQueueMessageCount()
- {
- return getMessageCount();
- }
-
- /**
- * This is an EXPENSIVE opperation to perform with a ConcurrentLinkedQueue as it must run the queue to determine
- * size. The ConcurrentLinkedQueueAtomicSize uses an AtomicInteger to record the number of elements on the queue.
- *
- * @return int the number of messages in the delivery queue.
- */
- private int getMessageCount()
- {
- return _messages.size() + _extraMessages.get();
- }
-
-
- public long getTotalMessageSize()
- {
- return _totalMessageSize.get();
- }
-
- public long getOldestMessageArrival()
- {
- QueueEntry entry = _messages.peek();
- return entry == null ? Long.MAX_VALUE : entry.getMessage().getArrivalTime();
- }
-
- public void subscriberHasPendingResend(boolean hasContent, Subscription subscription, QueueEntry entry)
- {
- _lock.lock();
- try
- {
- if (hasContent)
- {
- _log.debug("Queue has adding subscriber content");
- _hasContent.add(subscription);
- _totalMessageSize.addAndGet(entry.getSize());
- _extraMessages.addAndGet(1);
- }
- else
- {
- _log.debug("Queue has removing subscriber content");
- if (entry == null)
- {
- _hasContent.remove(subscription);
- }
- else
- {
- _totalMessageSize.addAndGet(-entry.getSize());
- _extraMessages.addAndGet(-1);
- }
- }
- }
- finally
- {
- _lock.unlock();
- }
- }
-
- /**
- * NOTE : This method should only be called when there are no active subscribers
- */
- public void removeExpired() throws AMQException
- {
- _lock.lock();
-
-
- for(Iterator<QueueEntry> iter = _messages.iterator(); iter.hasNext();)
- {
- QueueEntry entry = iter.next();
- if(entry.expired())
- {
- // fixme: Currently we have to update the total byte size here for the data in the queue
- _totalMessageSize.addAndGet(-entry.getSize());
- _queue.dequeue(_reapingStoreContext,entry);
- iter.remove();
- }
- }
-
-
- _lock.unlock();
- }
-
- /** @return the state of the async processor. */
- public boolean isProcessingAsync()
- {
- return _processing.get();
- }
-
- /**
- * Returns all the messages in the Queue
- *
- * @return List of messages
- */
- public List<QueueEntry> getMessages()
- {
- _lock.lock();
- List<QueueEntry> list = new ArrayList<QueueEntry>();
-
- for (QueueEntry entry : _messages)
- {
- list.add(entry);
- }
- _lock.unlock();
-
- return list;
- }
-
- /**
- * Returns messages within the range of given messageIds
- *
- * @param fromMessageId
- * @param toMessageId
- *
- * @return
- */
- public List<QueueEntry> getMessages(long fromMessageId, long toMessageId)
- {
- if (fromMessageId <= 0 || toMessageId <= 0)
- {
- return null;
- }
-
- long maxMessageCount = toMessageId - fromMessageId + 1;
-
- _lock.lock();
-
- List<QueueEntry> foundMessagesList = new ArrayList<QueueEntry>();
-
- for (QueueEntry entry : _messages)
- {
- long msgId = entry.getMessage().getMessageId();
- if (msgId >= fromMessageId && msgId <= toMessageId)
- {
- foundMessagesList.add(entry);
- }
- // break if the no of messages are found
- if (foundMessagesList.size() == maxMessageCount)
- {
- break;
- }
- }
- _lock.unlock();
-
- return foundMessagesList;
- }
-
- public void populatePreDeliveryQueue(Subscription subscription)
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Populating PreDeliveryQueue for Subscription(" + System.identityHashCode(subscription) + ")");
- }
-
- Iterator<QueueEntry> currentQueue = _messages.iterator();
-
- while (currentQueue.hasNext())
- {
- QueueEntry entry = currentQueue.next();
-
- if (!entry.getDeliveredToConsumer())
- {
- if (subscription.hasInterest(entry))
- {
- subscription.enqueueForPreDelivery(entry, false);
- }
- }
- }
- }
-
- public boolean performGet(AMQProtocolSession protocolSession, AMQChannel channel, boolean acks) throws AMQException
- {
- QueueEntry entry = getNextMessage();
- if (entry == null)
- {
- return false;
- }
- else
- {
-
- try
- {
- // if we do not need to wait for client acknowledgements
- // we can decrement the reference count immediately.
-
- // By doing this _before_ the send we ensure that it
- // doesn't get sent if it can't be dequeued, preventing
- // duplicate delivery on recovery.
-
- // The send may of course still fail, in which case, as
- // the message is unacked, it will be lost.
- if (!acks)
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("No ack mode so dequeuing message immediately: " + entry.getMessage().getMessageId());
- }
- _queue.dequeue(channel.getStoreContext(), entry);
- }
- synchronized (channel)
- {
- long deliveryTag = channel.getNextDeliveryTag();
-
- if (acks)
- {
- channel.addUnacknowledgedMessage(entry, deliveryTag, null);
- }
-
- protocolSession.getProtocolOutputConverter().writeGetOk(entry.getMessage(), channel.getChannelId(),
- deliveryTag, _queue.getMessageCount());
-
- }
- _totalMessageSize.addAndGet(-entry.getSize());
-
- if (!acks)
- {
- entry.getMessage().decrementReference(channel.getStoreContext());
- }
- }
- finally
- {
- entry.setDeliveredToConsumer();
- }
- return true;
-
- }
- }
-
- /**
- * For feature of moving messages, this method is used. It sets the lock and sets the movingMessages flag, so that
- * the asyn delivery is also stopped.
- */
- public void startMovingMessages()
- {
- _movingMessages.set(true);
- }
-
- /**
- * Once moving messages to another queue is done or aborted, remove lock and unset the movingMessages flag, so that
- * the async delivery can start again.
- */
- public void stopMovingMessages()
- {
- _movingMessages.set(false);
- if (_lock.isHeldByCurrentThread())
- {
- _lock.unlock();
- }
- }
-
- /**
- * Messages will be removed from this queue and all preDeliveryQueues
- *
- * @param messageList
- */
- public void removeMovedMessages(List<QueueEntry> messageList)
- {
- // Remove from the
- boolean hasSubscribers = _subscriptions.hasActiveSubscribers();
- if (hasSubscribers)
- {
- for (Subscription sub : _subscriptions.getSubscriptions())
- {
- if (!sub.isSuspended() && sub.filtersMessages())
- {
- Queue<QueueEntry> preDeliveryQueue = sub.getPreDeliveryQueue();
- for (QueueEntry entry : messageList)
- {
- preDeliveryQueue.remove(entry);
- }
- }
- }
- }
-
- for (QueueEntry entry : messageList)
- {
- if (_messages.remove(entry))
- {
- _totalMessageSize.getAndAdd(-entry.getSize());
- }
- }
- }
-
- /**
- * Now with implementation of predelivery queues, this method will mark the message on the top as taken.
- *
- * @param storeContext
- *
- * @throws AMQException
- */
- public void removeAMessageFromTop(StoreContext storeContext, AMQQueue queue) throws AMQException
- {
- _lock.lock();
-
- QueueEntry entry = _messages.poll();
-
- if (entry != null)
- {
- queue.dequeue(storeContext, entry);
-
- _totalMessageSize.addAndGet(-entry.getSize());
-
- //If this causes ref count to hit zero then data will be purged so message.getSize() will NPE.
- entry.getMessage().decrementReference(storeContext);
-
- }
-
- _lock.unlock();
- }
-
- public long clearAllMessages(StoreContext storeContext) throws AMQException
- {
- long count = 0;
- _lock.lock();
-
- synchronized (_queueHeadLock)
- {
- QueueEntry entry = getNextMessage();
- while (entry != null)
- {
- //and remove it
- _messages.poll();
-
- _queue.dequeue(storeContext, entry);
-
- entry.getMessage().decrementReference(_reapingStoreContext);
-
- entry = getNextMessage();
- count++;
- }
- _totalMessageSize.set(0L);
- }
- _lock.unlock();
- return count;
- }
-
- /**
- * This can only be used to clear the _messages queue. Any subscriber resend queue will not be purged.
- *
- * @return the next message or null
- *
- * @throws org.apache.qpid.AMQException
- */
- private QueueEntry getNextMessage() throws AMQException
- {
- return getNextMessage(_messages, null, false);
- }
-
- private QueueEntry getNextMessage(Queue<QueueEntry> messages, Subscription sub, boolean purgeOnly) throws AMQException
- {
- QueueEntry entry = messages.peek();
-
- //while (we have a message) && ((The subscriber is not a browser or message is taken ) or we are clearing) && (Check message is taken.)
- while (purgeMessage(entry, sub, purgeOnly))
- {
- AMQMessage message = entry.getMessage();
- // if we are purging then ensure we mark this message taken for the current subscriber
- // the current subscriber may be null in the case of a get or a purge but this is ok.
-// boolean alreadyTaken = message.taken(_queue, sub);
-
- //remove the already taken message or expired
- QueueEntry removed = messages.poll();
-
- assert removed == entry;
-
- // if the message expired then the _totalMessageSize needs adjusting
- if (message.expired(_queue) && !entry.getDeliveredToConsumer())
- {
- _totalMessageSize.addAndGet(-entry.getSize());
-
- // Use the reapingStoreContext as any sub(if we have one) may be in a tx.
- _queue.dequeue(_reapingStoreContext, entry);
-
- message.decrementReference(_reapingStoreContext);
-
- if (_log.isInfoEnabled())
- {
- _log.info(debugIdentity() + " Doing clean up of the main _message queue.");
- }
- }
-
- //else the clean up is not required as the message has already been taken for this queue therefore
- // it was the responsibility of the code that took the message to ensure the _totalMessageSize was updated.
-
- if (_log.isDebugEnabled())
- {
- _log.debug("Removed taken message:" + message.debugIdentity());
- }
-
- // try the next message
- entry = messages.peek();
- }
-
- return entry;
- }
-
- /**
- * This method will return true if the message is to be purged from the queue.
- *
- *
- * SIDE-EFFECT: The message will be taken by the Subscription(sub) for the current Queue(_queue)
- *
- * @param message
- * @param sub
- *
- * @return
- *
- * @throws AMQException
- */
- private boolean purgeMessage(QueueEntry message, Subscription sub) throws AMQException
- {
- return purgeMessage(message, sub, false);
- }
-
- /**
- * This method will return true if the message is to be purged from the queue.
- * \
- * SIDE-EFFECT: The msg will be taken by the Subscription(sub) for the current Queue(_queue) when purgeOnly is false
- *
- * @param message
- * @param sub
- * @param purgeOnly When set to false the message will be taken by the given Subscription.
- *
- * @return if the msg should be purged
- *
- * @throws AMQException
- */
- private boolean purgeMessage(QueueEntry message, Subscription sub, boolean purgeOnly) throws AMQException
- {
- //Original.. complicated while loop control
-// (message != null
-// && (
-// ((sub != null && !sub.isBrowser()) || message.isTaken(_queue))
-// || sub == null)
-// && message.taken(_queue, sub));
-
- boolean purge = false;
-
- // if the message is null then don't purge as we have no messagse.
- if (message != null)
- {
- // Check that the message hasn't expired.
- if (message.expired())
- {
- return true;
- }
-
- // if we have a subscriber perform message checks
- if (sub != null)
- {
- // if we have a queue browser(we don't purge) so check mark the message as taken
- purge = ((!sub.isBrowser() || message.isTaken()));
- }
- else
- {
- // if there is no subscription we are doing
- // a get or purging so mark message as taken.
- message.isTaken();
- // and then ensure that it gets purged
- purge = true;
- }
- }
-
- if (purgeOnly)
- {
- // If we are simply purging the queue don't take the message
- // just purge up to the next non-taken msg.
- return purge && message.isTaken();
- }
- else
- {
- // if we are purging then ensure we mark this message taken for the current subscriber
- // the current subscriber may be null in the case of a get or a purge but this is ok.
- return purge && message.taken(sub);
- }
- }
-
- public void sendNextMessage(Subscription sub, AMQQueue queue)
- {
-
- Queue<QueueEntry> messageQueue = sub.getNextQueue(_messages);
-
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Async sendNextMessage for sub (" + System.identityHashCode(sub) +
- ") from queue (" + System.identityHashCode(messageQueue) +
- ") AMQQueue (" + System.identityHashCode(queue) + ")");
- }
-
- if (messageQueue == null)
- {
- // There is no queue with messages currently. This is ok... just means the queue has no msgs matching selector
- if (_log.isInfoEnabled())
- {
- _log.info(debugIdentity() + sub + ": asked to send messages but has none on given queue:" + queue);
- }
- return;
- }
-
- QueueEntry entry = null;
- QueueEntry removed = null;
- try
- {
- synchronized (_queueHeadLock)
- {
- entry = getNextMessage(messageQueue, sub, false);
-
- // message will be null if we have no messages in the messageQueue.
- if (entry == null)
- {
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "No messages for Subscriber(" + System.identityHashCode(sub) + ") from queue; (" + System.identityHashCode(messageQueue) + ")");
- }
- return;
- }
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Async Delivery Message :" + entry + "(" + System.identityHashCode(entry) +
- ") by :" + System.identityHashCode(this) +
- ") to :" + System.identityHashCode(sub));
- }
-
-
- if (messageQueue == _messages)
- {
- _totalMessageSize.addAndGet(-entry.getSize());
- }
-
- sub.send(entry, _queue);
-
- //remove sent message from our queue.
- removed = messageQueue.poll();
- //If we don't remove the message from _messages
- // Otherwise the Async send will never end
- }
-
- if (removed != entry)
- {
- _log.error("Just send message:" + entry.getMessage().debugIdentity() + " BUT removed this from queue:" + removed);
- }
-
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Async Delivered Message r:" + removed.getMessage().debugIdentity() + "d:" + entry +
- ") by :" + System.identityHashCode(this) +
- ") to :" + System.identityHashCode(sub));
- }
-
-
- if (messageQueue == sub.getResendQueue())
- {
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "All messages sent from resendQueue for " + sub);
- }
- if (messageQueue.isEmpty())
- {
- subscriberHasPendingResend(false, sub, null);
- //better to use the above method as this keeps all the tracking in one location.
- // _hasContent.remove(sub);
- }
-
- _extraMessages.decrementAndGet();
- }
- else if (messageQueue == sub.getPreDeliveryQueue() && !sub.isBrowser())
- {
- if (_log.isInfoEnabled())
- {
- //fixme - we should do the clean up as the message remains on the _message queue
- // this is resulting in the next consumer receiving the message and then attempting to purge it
- //
- cleanMainQueue(sub);
- }
- }
-
- }
- catch (AMQException e)
- {
- if (entry != null)
- {
- entry.release();
- }
- else
- {
- _log.error(debugIdentity() + "Unable to release message as it is null. " + e, e);
- }
- _log.error(debugIdentity() + "Unable to deliver message as dequeue failed: " + e, e);
- }
- }
-
- private void cleanMainQueue(Subscription sub)
- {
- try
- {
- getNextMessage(_messages, sub, true);
- }
- catch (AMQException e)
- {
- _log.warn("Problem during main queue purge:" + e.getMessage());
- }
- }
-
- /**
- * enqueues the messages in the list on the queue and all required predelivery queues
- *
- * @param storeContext
- * @param movedMessageList
- */
- public void enqueueMovedMessages(StoreContext storeContext, List<QueueEntry> movedMessageList)
- {
- _lock.lock();
- for (QueueEntry entry : movedMessageList)
- {
- addMessageToQueue(entry, false);
- }
-
- // enqueue on the pre delivery queues
- for (Subscription sub : _subscriptions.getSubscriptions())
- {
- for (QueueEntry entry : movedMessageList)
- {
- // Only give the message to those that want them.
- if (sub.hasInterest(entry))
- {
- sub.enqueueForPreDelivery(entry, true);
- }
- }
- }
- _lock.unlock();
- }
-
- /**
- * Only one thread should ever execute this method concurrently, but it can do so while other threads invoke
- * deliver().
- */
- private void processQueue()
- {
- //record thread name
- if (_log.isDebugEnabled())
- {
- _processingThreadName = Thread.currentThread().getName();
- }
-
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Running process Queue." + currentStatus());
- }
-
- // Continue to process delivery while we haveSubscribers and messages
- boolean hasSubscribers = _subscriptions.hasActiveSubscribers();
-
- while (hasSubscribers && hasQueuedMessages() && !_movingMessages.get())
- {
- hasSubscribers = false;
-
- for (Subscription sub : _subscriptions.getSubscriptions())
- {
- synchronized (sub.getSendLock())
- {
- if (!sub.isSuspended())
- {
- sendNextMessage(sub, _queue);
-
- hasSubscribers = true;
- }
- }
- }
- }
-
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Done process Queue." + currentStatus());
- }
-
- }
-
- public void deliver(StoreContext context, AMQShortString name, QueueEntry entry, boolean deliverFirst) throws AMQException
- {
-
- final boolean debugEnabled = _log.isDebugEnabled();
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + "deliver :first(" + deliverFirst + ") :" + entry);
- }
-
- //Check if we have someone to deliver the message to.
- _lock.lock();
- try
- {
- Subscription s = _subscriptions.nextSubscriber(entry);
-
- if (s == null || (!s.filtersMessages() && hasQueuedMessages())) //no-one can take the message right now or we're queueing
- {
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + "Testing Message(" + entry + ") for Queued Delivery:" + currentStatus());
- }
- if (!entry.getMessage().getMessagePublishInfo().isImmediate())
- {
- addMessageToQueue(entry, deliverFirst);
-
- //release lock now message is on queue.
- _lock.unlock();
-
- //Pre Deliver to all subscriptions
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + "We have " + _subscriptions.getSubscriptions().size() +
- " subscribers to give the message to:" + currentStatus());
- }
- for (Subscription sub : _subscriptions.getSubscriptions())
- {
-
- // stop if the message gets delivered whilst PreDelivering if we have a shared queue.
- if (_queue.isShared() && entry.getDeliveredToConsumer())
- {
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + "Stopping PreDelivery as message(" + System.identityHashCode(entry) +
- ") is already delivered.");
- }
- continue;
- }
-
- // Only give the message to those that want them.
- if (sub.hasInterest(entry))
- {
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + "Queuing message(" + System.identityHashCode(entry) +
- ") for PreDelivery for subscriber(" + System.identityHashCode(sub) + ")");
- }
- sub.enqueueForPreDelivery(entry, deliverFirst);
- }
- }
-
- //if we have a non-filtering subscriber but queued messages && we're not Async && we have other Active subs then something is wrong!
- if ((s != null && hasQueuedMessages()) && !isProcessingAsync() && _subscriptions.hasActiveSubscribers())
- {
- _queue.deliverAsync();
- }
-
- }
- }
- else
- {
-
- if (s.filtersMessages())
- {
- if (s.getPreDeliveryQueue().size() > 0)
- {
- _log.error("Direct delivery from PDQ with queued msgs:" + s.getPreDeliveryQueue().size());
- }
- }
- else if (_messages.size() > 0)
- {
- _log.error("Direct delivery from MainQueue queued msgs:" + _messages.size());
- }
-
- //release lock now
- _lock.unlock();
- synchronized (s.getSendLock())
- {
- if (!s.isSuspended())
- {
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + "Delivering Message:" + entry.getMessage().debugIdentity() + " to(" +
- System.identityHashCode(s) + ") :" + s);
- }
-
- if (entry.taken(s))
- {
- //Message has been delivered so don't redeliver.
- // This can currently occur because of the recursive call below
- // During unit tests the send can occur
- // client then rejects
- // this reject then releases the message by the time the
- // if(!msg.isTaken()) call is made below
- // the message has been released so that thread loops to send the message again
- // of course by the time it gets back to here. the thread that released the
- // message is now ready to send it. Here is a sample trace for reference
-//1192627162613:Thread[pool-917-thread-4,5,main]:CSDM:delivery:(true)message:Message[(HC:5529738 ID:145 Ref:1)]: 145; ref count: 1; taken for queues: {Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=false} by Subs:{Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=null}:sub:[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=41, session=anonymous(5050419), resendQueue=false]
-//1192627162613:Thread[pool-917-thread-4,5,main]:Msg:taken:Q:Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326:sub:[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=41, session=anonymous(5050419), resendQueue=false]:this:Message[(HC:5529738 ID:145 Ref:1)]: 145; ref count: 1; taken for queues: {Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=false} by Subs:{Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=null}
-//1192627162613:Thread[pool-917-thread-4,5,main]:28398657 Sent :dt:214 msg:(HC:5529738 ID:145 Ref:1)
-//1192627162613:Thread[pool-917-thread-2,5,main]:Reject message by:[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=41, session=anonymous(5050419), resendQueue=false]
-//1192627162613:Thread[pool-917-thread-2,5,main]:Releasing Message:(HC:5529738 ID:145 Ref:1)
-//1192627162613:Thread[pool-917-thread-2,5,main]:Msg:Release:Q:Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326:This:Message[(HC:5529738 ID:145 Ref:1)]: 145; ref count: 1; taken for queues: {Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=false} by Subs:{Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=41, session=anonymous(5050419), resendQueue=false]}
-//1192627162613:Thread[pool-917-thread-2,5,main]:CSDM:delivery:(true)message:Message[(HC:5529738 ID:145 Ref:1)]: 145; ref count: 1; taken for queues: {Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=false} by Subs:{Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=null}:sub:[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=33, session=anonymous(26960027), resendQueue=false]
-//1192627162629:Thread[pool-917-thread-4,5,main]:CSDM:suspended: Message((HC:5529738 ID:145 Ref:1)) has not been taken so recursing!: Subscriber:28398657
-//1192627162629:Thread[pool-917-thread-4,5,main]:CSDM:delivery:(true)message:Message[(HC:5529738 ID:145 Ref:1)]: 145; ref count: 1; taken for queues: {Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=false} by Subs:{Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=null}:sub:[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=33, session=anonymous(26960027), resendQueue=false]
-//1192627162629:Thread[pool-917-thread-2,5,main]:Msg:taken:Q:Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326:sub:[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=33, session=anonymous(26960027), resendQueue=false]:this:Message[(HC:5529738 ID:145 Ref:1)]: 145; ref count: 1; taken for queues: {Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=false} by Subs:{Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=null}
-//1192627162629:Thread[pool-917-thread-2,5,main]:25386607 Sent :dt:172 msg:(HC:5529738 ID:145 Ref:1)
-//1192627162629:Thread[pool-917-thread-4,5,main]:Msg:taken:Q:Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326:sub:[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=33, session=anonymous(26960027), resendQueue=false]:this:Message[(HC:5529738 ID:145 Ref:1)]: 145; ref count: 1; taken for queues: {Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=true} by Subs:{Queue(queue-596fb10e-2968-4e51-a751-1e6643bf9dd6)@16017326=[channel=Channel: id 1, transaction mode: true, prefetch marks: 2500/5000, consumerTag=33, session=anonymous(26960027), resendQueue=false]}
- // Note: In the last request to take the message from thread 4,5 the message has been
- // taken by the previous call done by thread 2,5
-
-
- return;
- }
- //Deliver the message
- s.send(entry, _queue);
- }
- else
- {
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + " Subscription(" + System.identityHashCode(s) + ") became " +
- "suspended between nextSubscriber and send for message:" + entry.getMessage().debugIdentity());
- }
- }
- }
-
- //
- // Why do we do this? What was the reasoning? We should have a better approach
- // than recursion and rejecting if someone else sends it before we do.
- //
- if (!entry.isTaken())
- {
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + " Message(" + entry.getMessage().debugIdentity() + ") has not been taken so recursing!:" +
- " Subscriber:" + System.identityHashCode(s));
- }
-
- deliver(context, name, entry, deliverFirst);
- }
- else
- {
- if (debugEnabled)
- {
- _log.debug(debugIdentity() + " Message(" + entry.toString() +
- ") has been taken so disregarding deliver request to Subscriber:" +
- System.identityHashCode(s));
- }
- }
- }
-
- }
- finally
- {
- //ensure lock is released
- if (_lock.isHeldByCurrentThread())
- {
- _lock.unlock();
- }
- }
- }
-
- private final String id = "(" + String.valueOf(System.identityHashCode(this)) + ")";
-
- private String debugIdentity()
- {
- return id;
- }
-
- final Runner _asyncDelivery = new Runner();
-
- private class Runner implements Runnable
- {
- public void run()
- {
- String startName = Thread.currentThread().getName();
- Thread.currentThread().setName("CSDM-AsyncDelivery:" + startName);
- boolean running = true;
- while (running && !_movingMessages.get())
- {
- processQueue();
-
- //Check that messages have not been added since we did our last peek();
- // Synchronize with the thread that adds to the queue.
- // If the queue is still empty then we can exit
- synchronized (_asyncDelivery)
- {
- if (!(hasQueuedMessages() && _subscriptions.hasActiveSubscribers()))
- {
- running = false;
- _processing.set(false);
- }
- }
- }
- Thread.currentThread().setName(startName);
- }
- }
-
- public void processAsync(Executor executor)
- {
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Processing Async." + currentStatus());
- }
-
- synchronized (_asyncDelivery)
- {
- if (hasQueuedMessages() && _subscriptions.hasActiveSubscribers())
- {
- //are we already running? if so, don't re-run
- if (_processing.compareAndSet(false, true))
- {
- if (_log.isDebugEnabled())
- {
- _log.debug(debugIdentity() + "Executing Async process.");
- }
- executor.execute(_asyncDelivery);
- }
- }
- }
- }
-
- private String currentStatus()
- {
- return " Queued:" + (_messages.isEmpty() ? "Empty " : "Contains(H:M)") +
- "(" + ((ConcurrentLinkedMessageQueueAtomicSize) _messages).headSize() +
- ":" + (_messages.size() - ((ConcurrentLinkedMessageQueueAtomicSize) _messages).headSize()) + ") " +
- " Extra: " + (_hasContent.isEmpty() ? "Empty " : "Contains") +
- "(" + _hasContent.size() + ":" + _extraMessages.get() + ") " +
- " Active:" + _subscriptions.hasActiveSubscribers() +
- " Processing:" + (_processing.get() ? " true : Processing Thread: " + _processingThreadName : " false");
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/DefaultQueueRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/DefaultQueueRegistry.java
deleted file mode 100644
index cbe9246f09..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/DefaultQueueRegistry.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import java.util.Collection;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-public class DefaultQueueRegistry implements QueueRegistry
-{
- private ConcurrentMap<AMQShortString, AMQQueue> _queueMap = new ConcurrentHashMap<AMQShortString, AMQQueue>();
-
- private final VirtualHost _virtualHost;
-
- public DefaultQueueRegistry(VirtualHost virtualHost)
- {
- _virtualHost = virtualHost;
- }
-
- public VirtualHost getVirtualHost()
- {
- return _virtualHost;
- }
-
- public void registerQueue(AMQQueue queue) throws AMQException
- {
- _queueMap.put(queue.getName(), queue);
- }
-
- public void unregisterQueue(AMQShortString name) throws AMQException
- {
- _queueMap.remove(name);
- }
-
- public AMQQueue getQueue(AMQShortString name)
- {
- return _queueMap.get(name);
- }
-
- public Collection<AMQShortString> getQueueNames()
- {
- return _queueMap.keySet();
- }
-
- public Collection<AMQQueue> getQueues()
- {
- return _queueMap.values();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/DeliveryManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/DeliveryManager.java
deleted file mode 100644
index 1568f58e2e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/DeliveryManager.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.server.queue;
-
-import java.util.List;
-import java.util.concurrent.Executor;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.store.StoreContext;
-
-interface DeliveryManager
-{
- /**
- * Determines whether there are queued messages. Sets _queueing to false if there are no queued messages. This needs
- * to be atomic.
- *
- * @return true if there are queued messages
- */
- boolean hasQueuedMessages();
-
- /**
- * This method should not be used to determin if there are messages in the queue.
- *
- * @return int The number of messages in the queue
- *
- * @use hasQueuedMessages() for all controls relating to having messages on the queue.
- */
- int getQueueMessageCount();
-
- /**
- * Requests that the delivery manager start processing the queue asynchronously if there is work that can be done
- * (i.e. there are messages queued up and subscribers that can receive them. <p/> This should be called when
- * subscribers are added, but only after the consume-ok message has been returned as message delivery may start
- * immediately. It should also be called after unsuspending a client. <p/>
- *
- * @param executor the executor on which the delivery should take place
- */
- void processAsync(Executor executor);
-
- /**
- * Handles message delivery. The delivery manager is always in one of two modes; it is either queueing messages for
- * asynchronous delivery or delivering directly.
- *
- * @param storeContext
- * @param name the name of the entity on whose behalf we are delivering the message
- * @param entry the message to deliver
- * @param deliverFirst
- *
- * @throws org.apache.qpid.server.queue.FailedDequeueException
- * if the message could not be dequeued
- */
- void deliver(StoreContext storeContext, AMQShortString name, QueueEntry entry, boolean deliverFirst) throws FailedDequeueException, AMQException;
-
- void removeAMessageFromTop(StoreContext storeContext, AMQQueue queue) throws AMQException;
-
- long clearAllMessages(StoreContext storeContext) throws AMQException;
-
- void startMovingMessages();
-
- void enqueueMovedMessages(StoreContext context, List<QueueEntry> messageList);
-
- void stopMovingMessages();
-
- void removeMovedMessages(List<QueueEntry> messageListToRemove);
-
- List<QueueEntry> getMessages();
-
- List<QueueEntry> getMessages(long fromMessageId, long toMessageId);
-
- void populatePreDeliveryQueue(Subscription subscription);
-
- boolean performGet(AMQProtocolSession session, AMQChannel channel, boolean acks) throws AMQException;
-
- long getTotalMessageSize();
-
- long getOldestMessageArrival();
-
- void subscriberHasPendingResend(boolean hasContent, Subscription subscription, QueueEntry msg);
-
- void removeExpired() throws AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExchangeBindings.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExchangeBindings.java
deleted file mode 100644
index e6377b33da..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExchangeBindings.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.server.queue;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.exchange.Exchange;
-
-/**
- * When a queue is deleted, it should be deregistered from any
- * exchange it has been bound to. This class assists in this task,
- * by keeping track of all bindings for a given queue.
- */
-class ExchangeBindings
-{
- private static final FieldTable EMPTY_ARGUMENTS = new FieldTable();
-
- static class ExchangeBinding
- {
- private final Exchange _exchange;
- private final AMQShortString _routingKey;
- private final FieldTable _arguments;
-
- ExchangeBinding(AMQShortString routingKey, Exchange exchange)
- {
- this(routingKey, exchange, EMPTY_ARGUMENTS);
- }
-
- ExchangeBinding(AMQShortString routingKey, Exchange exchange, FieldTable arguments)
- {
- _routingKey = routingKey == null ? AMQShortString.EMPTY_STRING : routingKey;
- _exchange = exchange;
- _arguments = arguments == null ? EMPTY_ARGUMENTS : arguments;
- }
-
- void unbind(AMQQueue queue) throws AMQException
- {
- _exchange.deregisterQueue(_routingKey, queue, _arguments);
- }
-
- public Exchange getExchange()
- {
- return _exchange;
- }
-
- public AMQShortString getRoutingKey()
- {
- return _routingKey;
- }
-
- public int hashCode()
- {
- return (_exchange == null ? 0 : _exchange.hashCode())
- + (_routingKey == null ? 0 : _routingKey.hashCode());
- }
-
- public boolean equals(Object o)
- {
- if (!(o instanceof ExchangeBinding))
- {
- return false;
- }
- ExchangeBinding eb = (ExchangeBinding) o;
- return _exchange.equals(eb._exchange)
- && _routingKey.equals(eb._routingKey);
- }
- }
-
- private final List<ExchangeBinding> _bindings = new CopyOnWriteArrayList<ExchangeBinding>();
- private final AMQQueue _queue;
-
- ExchangeBindings(AMQQueue queue)
- {
- _queue = queue;
- }
-
- /**
- * Adds the specified binding to those being tracked.
- * @param routingKey the routing key with which the queue whose bindings
- * are being tracked by the instance has been bound to the exchange
- * @param exchange the exchange bound to
- */
- void addBinding(AMQShortString routingKey, FieldTable arguments, Exchange exchange)
- {
- _bindings.add(new ExchangeBinding(routingKey, exchange, arguments));
- }
-
-
- public void remove(AMQShortString routingKey, FieldTable arguments, Exchange exchange)
- {
- _bindings.remove(new ExchangeBinding(routingKey, exchange, arguments));
- }
-
-
- /**
- * Deregisters this queue from any exchange it has been bound to
- */
- void deregister() throws AMQException
- {
- //remove duplicates at this point
- HashSet<ExchangeBinding> copy = new HashSet<ExchangeBinding>(_bindings);
- for (ExchangeBinding b : copy)
- {
- b.unbind(_queue);
- }
- }
-
- List<ExchangeBinding> getExchangeBindings()
- {
- return _bindings;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java
deleted file mode 100644
index 6466e81dd2..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.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.server.queue;
-
-import org.apache.qpid.AMQException;
-
-/**
- * Signals that the dequeue of a message from a queue failed.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Indicates the a message could not be dequeued from a queue.
- * <tr><td>
- * </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
- * @todo Happens as a consequence of a message store failure, or reference counting error. Both of which migh become
- * runtime exceptions, as unrecoverable conditions? In which case this one might be dropped too.
- */
-public class FailedDequeueException extends AMQException
-{
- public FailedDequeueException(String queue)
- {
- super("Failed to dequeue message from " + queue);
- }
-
- public FailedDequeueException(String queue, AMQException e)
- {
- super("Failed to dequeue message from " + queue, e);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.java
deleted file mode 100644
index 630186991b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.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.server.queue;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.server.store.StoreContext;
-
-/**
- */
-public class InMemoryMessageHandle implements AMQMessageHandle
-{
-
- private ContentHeaderBody _contentHeaderBody;
-
- private MessagePublishInfo _messagePublishInfo;
-
- private List<ContentChunk> _contentBodies = new LinkedList<ContentChunk>();
-
- private boolean _redelivered;
-
- private long _arrivalTime;
-
- public InMemoryMessageHandle()
- {
- }
-
- public ContentHeaderBody getContentHeaderBody(StoreContext context, Long messageId) throws AMQException
- {
- return _contentHeaderBody;
- }
-
- public int getBodyCount(StoreContext context, Long messageId)
- {
- return _contentBodies.size();
- }
-
- public long getBodySize(StoreContext context, Long messageId) throws AMQException
- {
- return getContentHeaderBody(context, messageId).bodySize;
- }
-
- public ContentChunk getContentChunk(StoreContext context, Long messageId, int index) throws AMQException, IllegalArgumentException
- {
- if (index > _contentBodies.size() - 1)
- {
- throw new IllegalArgumentException("Index " + index + " out of valid range 0 to " +
- (_contentBodies.size() - 1));
- }
- return _contentBodies.get(index);
- }
-
- public void addContentBodyFrame(StoreContext storeContext, Long messageId, ContentChunk contentBody, boolean isLastContentBody)
- throws AMQException
- {
- _contentBodies.add(contentBody);
- }
-
- public MessagePublishInfo getMessagePublishInfo(StoreContext context, Long messageId) throws AMQException
- {
- return _messagePublishInfo;
- }
-
- public boolean isRedelivered()
- {
- return _redelivered;
- }
-
-
- public void setRedelivered(boolean redelivered)
- {
- _redelivered = redelivered;
- }
-
- public boolean isPersistent(StoreContext context, Long messageId) throws AMQException
- {
- //todo remove literal values to a constant file such as AMQConstants in common
- ContentHeaderBody chb = getContentHeaderBody(context, messageId);
- return chb.properties instanceof BasicContentHeaderProperties &&
- ((BasicContentHeaderProperties) chb.properties).getDeliveryMode() == 2;
- }
-
- /**
- * This is called when all the content has been received.
- * @param messagePublishInfo
- * @param contentHeaderBody
- * @throws AMQException
- */
- public void setPublishAndContentHeaderBody(StoreContext storeContext, Long messageId, MessagePublishInfo messagePublishInfo,
- ContentHeaderBody contentHeaderBody)
- throws AMQException
- {
- _messagePublishInfo = messagePublishInfo;
- _contentHeaderBody = contentHeaderBody;
- _arrivalTime = System.currentTimeMillis();
- }
-
- public void removeMessage(StoreContext storeContext, Long messageId) throws AMQException
- {
- // NO OP
- }
-
- public void enqueue(StoreContext storeContext, Long messageId, AMQQueue queue) throws AMQException
- {
- // NO OP
- }
-
- public void dequeue(StoreContext storeContext, Long messageId, AMQQueue queue) throws AMQException
- {
- // NO OP
- }
-
- public long getArrivalTime()
- {
- return _arrivalTime;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ManagedQueue.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ManagedQueue.java
deleted file mode 100644
index 061ab56024..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ManagedQueue.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import java.io.IOException;
-
-import javax.management.JMException;
-import javax.management.MBeanOperationInfo;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.TabularData;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.management.MBeanAttribute;
-import org.apache.qpid.server.management.MBeanOperation;
-import org.apache.qpid.server.management.MBeanOperationParameter;
-
-/**
- * The management interface exposed to allow management of a queue.
- * @author Robert J. Greig
- * @author Bhupendra Bhardwaj
- * @version 0.1
- */
-public interface ManagedQueue
-{
- static final String TYPE = "Queue";
-
- /**
- * Returns the Name of the ManagedQueue.
- * @return the name of the managedQueue.
- * @throws IOException
- */
- @MBeanAttribute(name="Name", description = TYPE + " Name")
- String getName() throws IOException;
-
- /**
- * Total number of messages on the queue, which are yet to be delivered to the consumer(s).
- * @return number of undelivered message in the Queue.
- * @throws IOException
- */
- @MBeanAttribute(name="MessageCount", description = "Total number of undelivered messages on the queue")
- Integer getMessageCount() throws IOException;
-
- /**
- * Tells the total number of messages receieved by the queue since startup.
- * @return total number of messages received.
- * @throws IOException
- */
- @MBeanAttribute(name="ReceivedMessageCount", description="The total number of messages receieved by the queue since startup")
- Long getReceivedMessageCount() throws IOException;
-
- /**
- * Size of messages in the queue
- * @return
- * @throws IOException
- */
- @MBeanAttribute(name="QueueDepth", description="Size of messages(KB) in the queue")
- Long getQueueDepth() throws IOException, JMException;
-
- /**
- * Returns the total number of active subscribers to the queue.
- * @return the number of active subscribers
- * @throws IOException
- */
- @MBeanAttribute(name="ActiveConsumerCount", description="The total number of active subscribers to the queue")
- Integer getActiveConsumerCount() throws IOException;
-
- /**
- * Returns the total number of subscribers to the queue.
- * @return the number of subscribers.
- * @throws IOException
- */
- @MBeanAttribute(name="ConsumerCount", description="The total number of subscribers to the queue")
- Integer getConsumerCount() throws IOException;
-
- /**
- * Tells the Owner of the ManagedQueue.
- * @return the owner's name.
- * @throws IOException
- */
- @MBeanAttribute(name="Owner", description = "Owner")
- String getOwner() throws IOException;
-
- /**
- * Tells whether this ManagedQueue is durable or not.
- * @return true if this ManagedQueue is a durable queue.
- * @throws IOException
- */
- @MBeanAttribute(name="Durable", description = "true if the AMQQueue is durable")
- boolean isDurable() throws IOException;
-
- /**
- * Tells if the ManagedQueue is set to AutoDelete.
- * @return true if the ManagedQueue is set to AutoDelete.
- * @throws IOException
- */
- @MBeanAttribute(name="AutoDelete", description = "true if the AMQQueue is AutoDelete")
- boolean isAutoDelete() throws IOException;
-
- /**
- * Returns the maximum age of a message (expiration time)
- * @return the maximum age
- * @throws IOException
- */
- Long getMaximumMessageAge() throws IOException;
-
- /**
- * Sets the maximum age of a message
- * @param age maximum age of message.
- * @throws IOException
- */
- @MBeanAttribute(name="MaximumMessageAge", description="Threshold high value for message age on thr broker")
- void setMaximumMessageAge(Long age) throws IOException;
-
- /**
- * Returns the maximum size of a message (in kbytes) allowed to be accepted by the
- * ManagedQueue. This is useful in setting notifications or taking
- * appropriate action, if the size of the message received is more than
- * the allowed size.
- * @return the maximum size of a message allowed to be aceepted by the
- * ManagedQueue.
- * @throws IOException
- */
- Long getMaximumMessageSize() throws IOException;
-
- /**
- * Sets the maximum size of the message (in kbytes) that is allowed to be
- * accepted by the Queue.
- * @param size maximum size of message.
- * @throws IOException
- */
- @MBeanAttribute(name="MaximumMessageSize", description="Threshold high value(KB) for a message size")
- void setMaximumMessageSize(Long size) throws IOException;
-
- /**
- * Tells the maximum number of messages that can be stored in the queue.
- * This is useful in setting the notifications or taking required
- * action is the number of message increase this limit.
- * @return maximum muber of message allowed to be stored in the queue.
- * @throws IOException
- */
- Long getMaximumMessageCount() throws IOException;
-
- /**
- * Sets the maximum number of messages allowed to be stored in the queue.
- * @param value the maximum number of messages allowed to be stored in the queue.
- * @throws IOException
- */
- @MBeanAttribute(name="MaximumMessageCount", description="Threshold high value for number of undelivered messages in the queue")
- void setMaximumMessageCount(Long value) throws IOException;
-
- /**
- * This is useful for setting notifications or taking required action if the size of messages
- * stored in the queue increases over this limit.
- * @return threshold high value for Queue Depth
- * @throws IOException
- */
- Long getMaximumQueueDepth() throws IOException;
-
- /**
- * Sets the maximum size of all the messages together, that can be stored
- * in the queue.
- * @param value
- * @throws IOException
- */
- @MBeanAttribute(name="MaximumQueueDepth", description="The threshold high value(KB) for Queue Depth")
- void setMaximumQueueDepth(Long value) throws IOException;
-
-
-
- //********** Operations *****************//
-
-
- /**
- * Returns a subset of all the messages stored in the queue. The messages
- * are returned based on the given index numbers.
- * @param fromIndex
- * @param toIndex
- * @return
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="viewMessages",
- description="Message headers for messages in this queue within given index range. eg. from index 1 - 100")
- TabularData viewMessages(@MBeanOperationParameter(name="from index", description="from index")int fromIndex,
- @MBeanOperationParameter(name="to index", description="to index")int toIndex)
- throws IOException, JMException, AMQException;
-
- @MBeanOperation(name="viewMessageContent", description="The message content for given Message Id")
- CompositeData viewMessageContent(@MBeanOperationParameter(name="Message Id", description="Message Id")long messageId)
- throws IOException, JMException;
-
- /**
- * Deletes the first message from top.
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="deleteMessageFromTop", description="Deletes the first message from top",
- impact= MBeanOperationInfo.ACTION)
- void deleteMessageFromTop() throws IOException, JMException;
-
- /**
- * Clears the queue by deleting all the undelivered messages from the queue.
- * @throws IOException
- * @throws JMException
- */
- @MBeanOperation(name="clearQueue",
- description="Clears the queue by deleting all the undelivered messages from the queue",
- impact= MBeanOperationInfo.ACTION)
- void clearQueue() throws IOException, JMException;
-
- /**
- * Moves the messages in given range of message Ids to given Queue. QPID-170
- * @param fromMessageId first in the range of message ids
- * @param toMessageId last in the range of message ids
- * @param toQueue where the messages are to be moved
- * @throws IOException
- * @throws JMException
- * @throws AMQException
- */
- @MBeanOperation(name="moveMessages",
- description="You can move messages to another queue from this queue ",
- impact= MBeanOperationInfo.ACTION)
- void moveMessages(@MBeanOperationParameter(name="from MessageId", description="from MessageId")long fromMessageId,
- @MBeanOperationParameter(name="to MessageId", description="to MessageId")long toMessageId,
- @MBeanOperationParameter(name= ManagedQueue.TYPE, description="to Queue Name")String toQueue)
- throws IOException, JMException, AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java
deleted file mode 100644
index 090096d3c3..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.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.server.queue;
-
-import org.apache.qpid.AMQException;
-
-/**
- * MessageCleanupException represents the failure to perform reference counting on messages correctly. This should not
- * happen, but there may be programming errors giving race conditions that cause the reference counting to go wrong.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Signals that the reference count of a message has gone below zero.
- * <tr><td> Indicates that a message store has lost a message which is still referenced.
- * </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
- * @todo The race conditions leading to this error should be cleaned up, and a runtime exception used instead. If the
- * message store loses messages, then something is seriously wrong and it would be sensible to terminate the
- * broker. This may be disguising out of memory errors.
- */
-public class MessageCleanupException extends AMQException
-{
- public MessageCleanupException(long messageId, AMQException e)
- {
- super("Failed to cleanup message with id " + messageId, e);
- }
-
- public MessageCleanupException(String message)
- {
- super(message);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageHandleFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageHandleFactory.java
deleted file mode 100644
index 94ab935115..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageHandleFactory.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.server.queue;
-
-import org.apache.qpid.server.store.MessageStore;
-
-/**
- * Constructs a message handle based on the publish body, the content header and the queue to which the message
- * has been routed.
- *
- * @author Robert Greig (robert.j.greig@jpmorgan.com)
- */
-public class MessageHandleFactory
-{
-
- public AMQMessageHandle createMessageHandle(Long messageId, MessageStore store, boolean persistent)
- {
- // just hardcoded for now
- if (persistent)
- {
- return new WeakReferenceMessageHandle(store);
- }
- else
- {
- return new InMemoryMessageHandle();
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageMetaData.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageMetaData.java
deleted file mode 100644
index 6118a4c11f..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageMetaData.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.server.queue;
-
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-
-/**
- * Encapsulates a publish body and a content header. In the context of the message store these are treated as a
- * single unit.
- */
-public class MessageMetaData
-{
- private MessagePublishInfo _messagePublishInfo;
-
- private ContentHeaderBody _contentHeaderBody;
-
- private int _contentChunkCount;
-
- private long _arrivalTime;
-
- public MessageMetaData(MessagePublishInfo publishBody, ContentHeaderBody contentHeaderBody, int contentChunkCount)
- {
- this(publishBody,contentHeaderBody, contentChunkCount, System.currentTimeMillis());
- }
-
- public MessageMetaData(MessagePublishInfo publishBody, ContentHeaderBody contentHeaderBody, int contentChunkCount, long arrivalTime)
- {
- _contentHeaderBody = contentHeaderBody;
- _messagePublishInfo = publishBody;
- _contentChunkCount = contentChunkCount;
- _arrivalTime = arrivalTime;
- }
-
- public int getContentChunkCount()
- {
- return _contentChunkCount;
- }
-
- public void setContentChunkCount(int contentChunkCount)
- {
- _contentChunkCount = contentChunkCount;
- }
-
- public ContentHeaderBody getContentHeaderBody()
- {
- return _contentHeaderBody;
- }
-
- public void setContentHeaderBody(ContentHeaderBody contentHeaderBody)
- {
- _contentHeaderBody = contentHeaderBody;
- }
-
- public MessagePublishInfo getMessagePublishInfo()
- {
- return _messagePublishInfo;
- }
-
- public void setMessagePublishInfo(MessagePublishInfo messagePublishInfo)
- {
- _messagePublishInfo = messagePublishInfo;
- }
-
- public long getArrivalTime()
- {
- return _arrivalTime;
- }
-
- public void setArrivalTime(long arrivalTime)
- {
- _arrivalTime = arrivalTime;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java
deleted file mode 100644
index d6fd1eec89..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.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.server.queue;
-
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.RequiredDeliveryException;
-
-/**
- * NoConsumersException is a {@link RequiredDeliveryException} that represents the failure case where an immediate
- * message cannot be delivered because there are presently no consumers for the message. The AMQP status code, 313, is
- * always used to report this condition.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represent failure to deliver a message that must be delivered.
- * </table>
- */
-public class NoConsumersException extends RequiredDeliveryException
-{
- public NoConsumersException(AMQMessage message)
- {
- super("Immediate delivery is not possible.", message);
- }
-
- public AMQConstant getReplyCode()
- {
- return AMQConstant.NO_CONSUMERS;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NotificationCheck.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NotificationCheck.java
deleted file mode 100644
index 6f9efd3200..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NotificationCheck.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.server.queue;
-
-import org.apache.qpid.AMQException;
-
-public enum NotificationCheck
-{
-
- MESSAGE_COUNT_ALERT
- {
- boolean notifyIfNecessary(AMQMessage msg, AMQQueue queue, QueueNotificationListener listener)
- {
- int msgCount;
- final long maximumMessageCount = queue.getMaximumMessageCount();
- if (maximumMessageCount!= 0 && (msgCount = queue.getMessageCount()) >= maximumMessageCount)
- {
- listener.notifyClients(this, queue, msgCount + ": Maximum count on queue threshold ("+ maximumMessageCount +") breached.");
- return true;
- }
- return false;
- }
- },
- MESSAGE_SIZE_ALERT(true)
- {
- boolean notifyIfNecessary(AMQMessage msg, AMQQueue queue, QueueNotificationListener listener)
- {
- final long maximumMessageSize = queue.getMaximumMessageSize();
- if(maximumMessageSize != 0)
- {
- // Check for threshold message size
- long messageSize;
- try
- {
- messageSize = (msg == null) ? 0 : msg.getContentHeaderBody().bodySize;
- }
- catch (AMQException e)
- {
- messageSize = 0;
- }
-
-
- if (messageSize >= maximumMessageSize)
- {
- listener.notifyClients(this, queue, messageSize + "b : Maximum message size threshold ("+ maximumMessageSize +") breached. [Message ID=" + msg.getMessageId() + "]");
- return true;
- }
- }
- return false;
- }
-
- },
- QUEUE_DEPTH_ALERT
- {
- boolean notifyIfNecessary(AMQMessage msg, AMQQueue queue, QueueNotificationListener listener)
- {
- // Check for threshold queue depth in bytes
- final long maximumQueueDepth = queue.getMaximumQueueDepth();
-
- if(maximumQueueDepth != 0)
- {
- final long queueDepth = queue.getQueueDepth();
-
- if (queueDepth >= maximumQueueDepth)
- {
- listener.notifyClients(this, queue, (queueDepth>>10) + "Kb : Maximum queue depth threshold ("+(maximumQueueDepth>>10)+"Kb) breached.");
- return true;
- }
- }
- return false;
- }
-
- },
- MESSAGE_AGE_ALERT
- {
- boolean notifyIfNecessary(AMQMessage msg, AMQQueue queue, QueueNotificationListener listener)
- {
-
- final long maxMessageAge = queue.getMaximumMessageAge();
- if(maxMessageAge != 0)
- {
- final long currentTime = System.currentTimeMillis();
- final long thresholdTime = currentTime - maxMessageAge;
- final long firstArrivalTime = queue.getOldestMessageArrivalTime();
-
- if(firstArrivalTime < thresholdTime)
- {
- long oldestAge = currentTime - firstArrivalTime;
- listener.notifyClients(this, queue, (oldestAge/1000) + "s : Maximum age on queue threshold ("+(maxMessageAge /1000)+"s) breached.");
-
- return true;
- }
- }
- return false;
-
- }
-
- }
- ;
-
- private final boolean _messageSpecific;
-
- NotificationCheck()
- {
- this(false);
- }
-
- NotificationCheck(boolean messageSpecific)
- {
- _messageSpecific = messageSpecific;
- }
-
- public boolean isMessageSpecific()
- {
- return _messageSpecific;
- }
-
- abstract boolean notifyIfNecessary(AMQMessage msg, AMQQueue queue, QueueNotificationListener listener);
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueEntry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueEntry.java
deleted file mode 100644
index 8553db3e09..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueEntry.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.server.queue;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.log4j.Logger;
-
-import java.util.Set;
-import java.util.HashSet;
-import java.util.concurrent.atomic.AtomicReference;
-
-
-public class QueueEntry
-{
-
- /**
- * Used for debugging purposes.
- */
- private static final Logger _log = Logger.getLogger(QueueEntry.class);
-
- private final AMQQueue _queue;
- private final AMQMessage _message;
-
- private Set<Subscription> _rejectedBy = null;
-
- private AtomicReference<Object> _owner = new AtomicReference<Object>();
-
-
- public QueueEntry(AMQQueue queue, AMQMessage message)
- {
- _queue = queue;
- _message = message;
- }
-
-
- public AMQQueue getQueue()
- {
- return _queue;
- }
-
- public AMQMessage getMessage()
- {
- return _message;
- }
-
- public long getSize()
- {
- return getMessage().getSize();
- }
-
- public boolean getDeliveredToConsumer()
- {
- return getMessage().getDeliveredToConsumer();
- }
-
- public boolean expired() throws AMQException
- {
- return getMessage().expired(_queue);
- }
-
- public boolean isTaken()
- {
- return _owner.get() != null;
- }
-
- public boolean taken(Subscription sub)
- {
- return !(_owner.compareAndSet(null, sub == null ? this : sub));
- }
-
- public void setDeliveredToConsumer()
- {
- getMessage().setDeliveredToConsumer();
- }
-
- public void release()
- {
- _owner.set(null);
- }
-
- public String debugIdentity()
- {
- return getMessage().debugIdentity();
- }
-
- public void process(StoreContext storeContext, boolean deliverFirst) throws AMQException
- {
- _queue.process(storeContext, this, deliverFirst);
- }
-
- public void checkDeliveredToConsumer() throws NoConsumersException
- {
- _message.checkDeliveredToConsumer();
- }
-
- public void setRedelivered(boolean b)
- {
- getMessage().setRedelivered(b);
- }
-
- public Subscription getDeliveredSubscription()
- {
- synchronized (this)
- {
- Object owner = _owner.get();
- if (owner instanceof Subscription)
- {
- return (Subscription) owner;
- }
- else
- {
- return null;
- }
- }
- }
-
- public void reject()
- {
- reject(getDeliveredSubscription());
- }
-
- public void reject(Subscription subscription)
- {
- if (subscription != null)
- {
- if (_rejectedBy == null)
- {
- _rejectedBy = new HashSet<Subscription>();
- }
-
- _rejectedBy.add(subscription);
- }
- else
- {
- _log.warn("Requesting rejection by null subscriber:" + debugIdentity());
- }
- }
-
- public boolean isRejectedBy(Subscription subscription)
- {
- boolean rejected = _rejectedBy != null;
-
- if (rejected) // We have subscriptions that rejected this message
- {
- return _rejectedBy.contains(subscription);
- }
- else // This messasge hasn't been rejected yet.
- {
- return rejected;
- }
- }
-
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueNotificationListener.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueNotificationListener.java
deleted file mode 100644
index 959ca03c80..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueNotificationListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-
-public interface QueueNotificationListener
-{
- void notifyClients(NotificationCheck notification, AMQQueue queue, String notificationMsg);
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueRegistry.java
deleted file mode 100644
index 1210f0e97c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueRegistry.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.server.queue;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import java.util.Collection;
-
-public interface QueueRegistry
-{
- VirtualHost getVirtualHost();
-
- void registerQueue(AMQQueue queue) throws AMQException;
-
- void unregisterQueue(AMQShortString name) throws AMQException;
-
- AMQQueue getQueue(AMQShortString name);
-
- Collection<AMQShortString> getQueueNames();
-
- Collection<AMQQueue> getQueues();
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/Subscription.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/Subscription.java
deleted file mode 100644
index a706098b71..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/Subscription.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.server.queue;
-
-import java.util.Queue;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.AMQChannel;
-
-public interface Subscription
-{
- void send(QueueEntry msg, AMQQueue queue) throws AMQException;
-
- boolean isSuspended();
-
- void queueDeleted(AMQQueue queue) throws AMQException;
-
- boolean filtersMessages();
-
- boolean hasInterest(QueueEntry msg);
-
- Queue<QueueEntry> getPreDeliveryQueue();
-
- Queue<QueueEntry> getResendQueue();
-
- Queue<QueueEntry> getNextQueue(Queue<QueueEntry> messages);
-
- void enqueueForPreDelivery(QueueEntry msg, boolean deliverFirst);
-
- boolean isAutoClose();
-
- void close();
-
- boolean isClosed();
-
- boolean isBrowser();
-
- boolean wouldSuspend(QueueEntry msg);
-
- void addToResendQueue(QueueEntry msg);
-
- Object getSendLock();
-
- AMQChannel getChannel();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionFactory.java
deleted file mode 100644
index 917f7c4e97..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionFactory.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.server.queue;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-
-/**
- * Allows the customisation of the creation of a subscription. This is typically done within an AMQQueue. This factory
- * primarily assists testing although in future more sophisticated subscribers may need a different subscription
- * implementation.
- *
- * @see org.apache.qpid.server.queue.AMQQueue
- */
-public interface SubscriptionFactory
-{
- Subscription createSubscription(int channel, AMQProtocolSession protocolSession, AMQShortString consumerTag, boolean acks,
- FieldTable filters, boolean noLocal, AMQQueue queue) throws AMQException;
-
-
- Subscription createSubscription(int channel, AMQProtocolSession protocolSession, AMQShortString consumerTag)
- throws AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
deleted file mode 100644
index 6e68b5637e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import java.util.Queue;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.common.AMQPFilterTypes;
-import org.apache.qpid.common.ClientProperties;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.output.ProtocolOutputConverter;
-import org.apache.qpid.server.filter.FilterManager;
-import org.apache.qpid.server.filter.FilterManagerFactory;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.util.ConcurrentLinkedQueueAtomicSize;
-import org.apache.qpid.util.MessageQueue;
-import org.apache.qpid.util.ConcurrentLinkedMessageQueueAtomicSize;
-
-/**
- * Encapsulation of a supscription to a queue. <p/> Ties together the protocol session of a subscriber, the consumer tag
- * that was given out by the broker and the channel id. <p/>
- */
-public class SubscriptionImpl implements Subscription
-{
-
- private static final Logger _suspensionlogger = Logger.getLogger("Suspension");
- private static final Logger _logger = Logger.getLogger(SubscriptionImpl.class);
-
- public final AMQChannel channel;
-
- public final AMQProtocolSession protocolSession;
-
- public final AMQShortString consumerTag;
-
- private final Object _sessionKey;
-
- private MessageQueue<QueueEntry> _messages;
-
- private Queue<QueueEntry> _resendQueue;
-
- private final boolean _noLocal;
-
- /** True if messages need to be acknowledged */
- private final boolean _acks;
- private FilterManager _filters;
- private final boolean _isBrowser;
- private final Boolean _autoClose;
- private boolean _sentClose = false;
-
- private static final String CLIENT_PROPERTIES_INSTANCE = ClientProperties.instance.toString();
-
- private AMQQueue _queue;
- private final AtomicBoolean _sendLock = new AtomicBoolean(false);
-
-
- public static class Factory implements SubscriptionFactory
- {
- public Subscription createSubscription(int channel, AMQProtocolSession protocolSession,
- AMQShortString consumerTag, boolean acks, FieldTable filters,
- boolean noLocal, AMQQueue queue) throws AMQException
- {
- return new SubscriptionImpl(channel, protocolSession, consumerTag, acks, filters, noLocal, queue);
- }
-
- public SubscriptionImpl createSubscription(int channel, AMQProtocolSession protocolSession, AMQShortString consumerTag)
- throws AMQException
- {
- return new SubscriptionImpl(channel, protocolSession, consumerTag, false, null, false, null);
- }
- }
-
- public SubscriptionImpl(int channelId, AMQProtocolSession protocolSession,
- AMQShortString consumerTag, boolean acks)
- throws AMQException
- {
- this(channelId, protocolSession, consumerTag, acks, null, false, null);
- }
-
- public SubscriptionImpl(int channelId, AMQProtocolSession protocolSession,
- AMQShortString consumerTag, boolean acks, FieldTable filters,
- boolean noLocal, AMQQueue queue)
- throws AMQException
- {
- AMQChannel channel = protocolSession.getChannel(channelId);
- if (channel == null)
- {
- throw new AMQException(AMQConstant.NOT_FOUND, "channel :" + channelId + " not found in protocol session");
- }
-
- this.channel = channel;
- this.protocolSession = protocolSession;
- this.consumerTag = consumerTag;
- _sessionKey = protocolSession.getKey();
- _acks = acks;
- _noLocal = noLocal;
- _queue = queue;
-
- _filters = FilterManagerFactory.createManager(filters);
-
-
- if (_filters != null)
- {
- Object isBrowser = filters.get(AMQPFilterTypes.NO_CONSUME.getValue());
- if (isBrowser != null)
- {
- _isBrowser = (Boolean) isBrowser;
- }
- else
- {
- _isBrowser = false;
- }
- }
- else
- {
- _isBrowser = false;
- }
-
-
- if (_filters != null)
- {
- Object autoClose = filters.get(AMQPFilterTypes.AUTO_CLOSE.getValue());
- if (autoClose != null)
- {
- _autoClose = (Boolean) autoClose;
- }
- else
- {
- _autoClose = false;
- }
- }
- else
- {
- _autoClose = false;
- }
-
-
- if (filtersMessages())
- {
- _messages = new ConcurrentLinkedMessageQueueAtomicSize<QueueEntry>();
- }
- else
- {
- // Reference the DeliveryManager
- _messages = null;
- }
- }
-
-
- public SubscriptionImpl(int channel, AMQProtocolSession protocolSession,
- AMQShortString consumerTag)
- throws AMQException
- {
- this(channel, protocolSession, consumerTag, false);
- }
-
- public boolean equals(Object o)
- {
- return (o instanceof SubscriptionImpl) && equals((SubscriptionImpl) o);
- }
-
- /**
- * Equality holds if the session matches and the channel and consumer tag are the same.
- *
- * @param psc The subscriptionImpl to compare
- *
- * @return equality
- */
- private boolean equals(SubscriptionImpl psc)
- {
- return _sessionKey.equals(psc._sessionKey)
- && psc.channel == channel
- && psc.consumerTag.equals(consumerTag);
- }
-
- public int hashCode()
- {
- return _sessionKey.hashCode();
- }
-
- public String toString()
- {
- String subscriber = "[channel=" + channel +
- ", consumerTag=" + consumerTag +
- ", session=" + protocolSession.getKey() +
- ", resendQueue=" + (_resendQueue != null);
-
- if (_resendQueue != null)
- {
- subscriber += ", resendSize=" + _resendQueue.size();
- }
-
-
- return subscriber + "]";
- }
-
- /**
- * This method can be called by each of the publisher threads. As a result all changes to the channel object must be
- * thread safe.
- *
- * @param msg The message to send
- * @param queue the Queue it has been sent from
- *
- * @throws AMQException
- */
- public void send(QueueEntry msg, AMQQueue queue) throws AMQException
- {
- if (msg != null)
- {
- if (_isBrowser)
- {
- sendToBrowser(msg, queue);
- }
- else
- {
- sendToConsumer(channel.getStoreContext(), msg, queue);
- }
- }
- else
- {
- _logger.error("Attempt to send Null message", new NullPointerException());
- }
- }
-
- private void sendToBrowser(QueueEntry msg, AMQQueue queue) throws AMQException
- {
- // We don't decrement the reference here as we don't want to consume the message
- // but we do want to send it to the client.
-
- synchronized (channel)
- {
- long deliveryTag = channel.getNextDeliveryTag();
-
- // We don't need to add the message to the unacknowledgedMap as we don't need to know if the client
- // received the message. If it is lost in transit that is not important.
-// if (_acks)
-// {
-// channel.addUnacknowledgedBrowsedMessage(msg, deliveryTag, consumerTag, queue);
-// }
-
- if (_sendLock.get())
- {
- _logger.error("Sending " + msg + " when subscriber(" + this + ") is closed!");
- }
-
- protocolSession.getProtocolOutputConverter().writeDeliver(msg.getMessage(), channel.getChannelId(), deliveryTag, consumerTag);
- }
- }
-
- private void sendToConsumer(StoreContext storeContext, QueueEntry entry, AMQQueue queue)
- throws AMQException
- {
- try
- { // if we do not need to wait for client acknowledgements
- // we can decrement the reference count immediately.
-
- // By doing this _before_ the send we ensure that it
- // doesn't get sent if it can't be dequeued, preventing
- // duplicate delivery on recovery.
-
- // The send may of course still fail, in which case, as
- // the message is unacked, it will be lost.
- if (!_acks)
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("No ack mode so dequeuing message immediately: " + entry.getMessage().getMessageId());
- }
- queue.dequeue(storeContext, entry);
- }
-
-/*
- if (_sendLock.get())
- {
- _logger.error("Sending " + entry + " when subscriber(" + this + ") is closed!");
- }
-*/
-
- synchronized (channel)
- {
- long deliveryTag = channel.getNextDeliveryTag();
-
-
- if (_acks)
- {
- channel.addUnacknowledgedMessage(entry, deliveryTag, consumerTag);
- }
-
- protocolSession.getProtocolOutputConverter().writeDeliver(entry.getMessage(), channel.getChannelId(), deliveryTag, consumerTag);
-
-
- }
- if (!_acks)
- {
- entry.getMessage().decrementReference(storeContext);
- }
- }
- finally
- {
- //Only set delivered if it actually was writen successfully..
- // using a try->finally would set it even if an error occured.
- // Is this what we want?
-
- entry.setDeliveredToConsumer();
- }
- }
-
- public boolean isSuspended()
- {
-// if (_suspensionlogger.isInfoEnabled())
-// {
-// if (channel.isSuspended())
-// {
-// _suspensionlogger.debug("Subscription(" + debugIdentity() + ") channel's is susupended");
-// }
-// if (_sendLock.get())
-// {
-// _suspensionlogger.debug("Subscription(" + debugIdentity() + ") has sendLock set so closing.");
-// }
-// }
- return channel.isSuspended() || _sendLock.get();
- }
-
- /**
- * Callback indicating that a queue has been deleted.
- *
- * @param queue The queue to delete
- */
- public void queueDeleted(AMQQueue queue) throws AMQException
- {
- channel.queueDeleted(queue);
- }
-
- public boolean filtersMessages()
- {
- return _filters != null || _noLocal;
- }
-
- public boolean hasInterest(QueueEntry entry)
- {
- //check that the message hasn't been rejected
- if (entry.isRejectedBy(this))
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Subscription:" + debugIdentity() + " rejected message:" + entry.debugIdentity());
- }
-// return false;
- }
-
-
-
- //todo - client id should be recoreded and this test removed but handled below
- if (_noLocal)
- {
-
- final AMQProtocolSession publisher = entry.getMessage().getPublisher();
- if(publisher != null)
-
- {
- // We don't want local messages so check to see if message is one we sent
- Object localInstance;
- Object msgInstance;
-
- if ((protocolSession.getClientProperties() != null) &&
- (localInstance = protocolSession.getClientProperties().getObject(CLIENT_PROPERTIES_INSTANCE)) != null)
- {
-
- if ((publisher.getClientProperties() != null) &&
- (msgInstance = publisher.getClientProperties().getObject(CLIENT_PROPERTIES_INSTANCE)) != null)
- {
- if (localInstance == msgInstance || localInstance.equals(msgInstance))
- {
- // if (_logger.isTraceEnabled())
- // {
- // _logger.trace("(" + debugIdentity() + ") has no interest as it is a local message(" +
- // msg.debugIdentity() + ")");
- // }
- return false;
- }
- }
- }
- else
- {
-
- localInstance = protocolSession.getClientIdentifier();
- //todo - client id should be recoreded and this test removed but handled here
-
- msgInstance = publisher.getClientIdentifier();
- if (localInstance == msgInstance || ((localInstance != null) && localInstance.equals(msgInstance)))
- {
- // if (_logger.isTraceEnabled())
- // {
- // _logger.trace("(" + debugIdentity() + ") has no interest as it is a local message(" +
- // msg.debugIdentity() + ")");
- // }
- return false;
- }
- }
-
- }
- }
-
-
- return checkFilters(entry);
-
- }
-
- private String id = String.valueOf(System.identityHashCode(this));
-
- private String debugIdentity()
- {
- return id;
- }
-
- private boolean checkFilters(QueueEntry msg)
- {
- return (_filters == null) || _filters.allAllow(msg.getMessage());
- }
-
- public Queue<QueueEntry> getPreDeliveryQueue()
- {
- return _messages;
- }
-
- public void enqueueForPreDelivery(QueueEntry msg, boolean deliverFirst)
- {
- if (_messages != null)
- {
- if (deliverFirst)
- {
- _messages.pushHead(msg);
- }
- else
- {
- _messages.offer(msg);
- }
- }
- }
-
- public boolean isAutoClose()
- {
- return _autoClose;
- }
-
- public void close()
- {
- boolean closed = false;
- synchronized (_sendLock)
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Setting SendLock true:" + debugIdentity());
- }
-
- closed = _sendLock.getAndSet(true);
- }
-
- if (closed)
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Called close() on a closed subscription");
- }
-
- return;
- }
-
- if (_logger.isInfoEnabled())
- {
- _logger.info("Closing subscription (" + debugIdentity() + "):" + this);
- }
-
- if (_resendQueue != null && !_resendQueue.isEmpty())
- {
- if (_logger.isInfoEnabled())
- {
- _logger.info("Requeuing closing subscription (" + debugIdentity() + "):" + this);
- }
- requeue();
- }
-
- //remove references in PDQ
- if (_messages != null)
- {
- if (_logger.isInfoEnabled())
- {
- _logger.info("Clearing PDQ (" + debugIdentity() + "):" + this);
- }
-
- _messages.clear();
- }
- }
-
- private void autoclose()
- {
- close();
-
- if (_autoClose && !_sentClose)
- {
- _logger.info("Closing autoclose subscription (" + debugIdentity() + "):" + this);
-
- ProtocolOutputConverter converter = protocolSession.getProtocolOutputConverter();
- converter.confirmConsumerAutoClose(channel.getChannelId(), consumerTag);
- _sentClose = true;
-
- //fixme JIRA do this better
- try
- {
- channel.unsubscribeConsumer(protocolSession, consumerTag);
- }
- catch (AMQException e)
- {
- // Occurs if we cannot find the subscriber in the channel with protocolSession and consumerTag.
- }
- }
- }
-
- private void requeue()
- {
- if (_queue != null)
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Requeuing :" + _resendQueue.size() + " messages");
- }
-
- while (!_resendQueue.isEmpty())
- {
- QueueEntry resent = _resendQueue.poll();
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Removed for resending:" + resent.debugIdentity());
- }
-
- resent.release();
- _queue.subscriberHasPendingResend(false, this, resent);
-
- try
- {
- channel.getTransactionalContext().deliver(resent, true);
- }
- catch (AMQException e)
- {
- _logger.error("MESSAGE LOSS : Unable to re-deliver messages", e);
- }
- }
-
- if (!_resendQueue.isEmpty())
- {
- _logger.error("[MESSAGES LOST]Unable to re-deliver messages as queue is null.");
- }
-
- _queue.subscriberHasPendingResend(false, this, null);
- }
- else
- {
- if (!_resendQueue.isEmpty())
- {
- _logger.error("Unable to re-deliver messages as queue is null.");
- }
- }
-
- // Clear the messages
- _resendQueue = null;
- }
-
-
- public boolean isClosed()
- {
- return _sendLock.get(); // This rather than _close is used to signify the subscriber is now closed.
- }
-
- public boolean isBrowser()
- {
- return _isBrowser;
- }
-
- public boolean wouldSuspend(QueueEntry msg)
- {
- return _acks && channel.wouldSuspend(msg.getMessage());
- }
-
- public Queue<QueueEntry> getResendQueue()
- {
- if (_resendQueue == null)
- {
- _resendQueue = new ConcurrentLinkedQueueAtomicSize<QueueEntry>();
- }
- return _resendQueue;
- }
-
-
- public Queue<QueueEntry> getNextQueue(Queue<QueueEntry> messages)
- {
- if (_resendQueue != null && !_resendQueue.isEmpty())
- {
- return _resendQueue;
- }
-
- if (filtersMessages())
- {
- if (isAutoClose())
- {
- if (_messages.isEmpty())
- {
- autoclose();
- return null;
- }
- }
- return _messages;
- }
- else // we want the DM queue
- {
- return messages;
- }
- }
-
- public void addToResendQueue(QueueEntry msg)
- {
- // add to our resend queue
- getResendQueue().add(msg);
-
- // Mark Queue has having content.
- if (_queue == null)
- {
- _logger.error("Queue is null won't be able to resend messages");
- }
- else
- {
- _queue.subscriberHasPendingResend(true, this, msg);
- }
- }
-
- public Object getSendLock()
- {
- return _sendLock;
- }
-
- public AMQChannel getChannel()
- {
- return channel;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionManager.java
deleted file mode 100644
index bc17bcca9c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionManager.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.server.queue;
-
-import java.util.List;
-
-/**
- * Abstraction of actor that will determine the subscriber to whom
- * a message will be sent.
- */
-public interface SubscriptionManager
-{
- public List<Subscription> getSubscriptions();
- public boolean hasActiveSubscribers();
- public Subscription nextSubscriber(QueueEntry entry);
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionSet.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionSet.java
deleted file mode 100644
index 882efd380d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionSet.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import java.util.List;
-import java.util.ListIterator;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-
-/** Holds a set of subscriptions for a queue and manages the round robin-ing of deliver etc. */
-class SubscriptionSet implements WeightedSubscriptionManager
-{
- private static final Logger _log = Logger.getLogger(SubscriptionSet.class);
-
- /** List of registered subscribers */
- private List<Subscription> _subscriptions = new CopyOnWriteArrayList<Subscription>();
-
- /** Used to control the round robin delivery of content */
- private int _currentSubscriber;
-
- private final Object _changeLock = new Object();
- private volatile boolean _exclusive;
-
-
- /** Accessor for unit tests. */
- int getCurrentSubscriber()
- {
- return _currentSubscriber;
- }
-
- public void addSubscriber(Subscription subscription)
- {
- synchronized (_changeLock)
- {
- _subscriptions.add(subscription);
- }
- }
-
- /**
- * Remove the subscription, returning it if it was found
- *
- * @param subscription
- *
- * @return null if no match was found
- */
- public Subscription removeSubscriber(Subscription subscription)
- {
- // TODO: possibly need O(1) operation here.
-
- Subscription sub = null;
- synchronized (_changeLock)
- {
- int subIndex = _subscriptions.indexOf(subscription);
-
- if (subIndex != -1)
- {
- //we can't just return the passed in subscription as it is a new object
- // and doesn't contain the stored state we need.
- //NOTE while this may be removed now anyone with an iterator will still have it in the list!!
- sub = _subscriptions.remove(subIndex);
- }
- else
- {
- _log.error("Unable to remove from index(" + subIndex + ")subscription:" + subscription);
- }
- }
- if (sub != null)
- {
- return sub;
- }
- else
- {
- debugDumpSubscription(subscription);
- return null;
- }
- }
-
- private void debugDumpSubscription(Subscription subscription)
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Subscription " + subscription + " not found. Dumping subscriptions:");
- for (Subscription s : _subscriptions)
- {
- _log.debug("Subscription: " + s);
- }
- _log.debug("Subscription dump complete");
- }
- }
-
- /**
- * Return the next unsuspended subscription or null if not found. <p/> Performance note: This method can scan all
- * items twice when looking for a subscription that is not suspended. The worst case occcurs when all subscriptions
- * are suspended. However, it is does this without synchronisation and subscriptions may be added and removed
- * concurrently. Also note that because of race conditions and when subscriptions are removed between calls to
- * nextSubscriber, the IndexOutOfBoundsException also causes the scan to start at the beginning.
- */
- public Subscription nextSubscriber(QueueEntry msg)
- {
-
-
- try
- {
- final Subscription result = nextSubscriberImpl(msg);
- if (result == null)
- {
- _currentSubscriber = 0;
- return nextSubscriberImpl(msg);
- }
- else
- {
- return result;
- }
- }
- catch (IndexOutOfBoundsException e)
- {
- _currentSubscriber = 0;
- return nextSubscriber(msg);
- }
- }
-
- private Subscription nextSubscriberImpl(QueueEntry msg)
- {
- if(_exclusive)
- {
- try
- {
- Subscription subscription = _subscriptions.get(0);
- subscriberScanned();
-
- if (!(subscription.isSuspended() || subscription.wouldSuspend(msg)))
- {
- if (subscription.hasInterest(msg))
- {
- // if the queue is not empty then this client is ready to receive a message.
- //FIXME the queue could be full of sent messages.
- // Either need to clean all PDQs after sending a message
- // OR have a clean up thread that runs the PDQs expunging the messages.
- if (!subscription.filtersMessages() || subscription.getPreDeliveryQueue().isEmpty())
- {
- return subscription;
- }
- }
- }
- }
- catch(IndexOutOfBoundsException e)
- {
- }
- return null;
- }
- else
- {
- if (_subscriptions.isEmpty())
- {
- return null;
- }
- final ListIterator<Subscription> iterator = _subscriptions.listIterator(_currentSubscriber);
- while (iterator.hasNext())
- {
- Subscription subscription = iterator.next();
- ++_currentSubscriber;
- subscriberScanned();
-
- if (!(subscription.isSuspended() || subscription.wouldSuspend(msg)))
- {
- if (subscription.hasInterest(msg))
- {
- // if the queue is not empty then this client is ready to receive a message.
- //FIXME the queue could be full of sent messages.
- // Either need to clean all PDQs after sending a message
- // OR have a clean up thread that runs the PDQs expunging the messages.
- if (!subscription.filtersMessages() || subscription.getPreDeliveryQueue().isEmpty())
- {
- return subscription;
- }
- }
- }
- }
-
- return null;
- }
- }
-
- /** Overridden in test classes. */
- protected void subscriberScanned()
- {
- }
-
- public boolean isEmpty()
- {
- return _subscriptions.isEmpty();
- }
-
- public List<Subscription> getSubscriptions()
- {
- return _subscriptions;
- }
-
- public boolean hasActiveSubscribers()
- {
- for (Subscription s : _subscriptions)
- {
- if (!s.isSuspended())
- {
- return true;
- }
- }
- return false;
- }
-
- public int getWeight()
- {
- int count = 0;
- for (Subscription s : _subscriptions)
- {
- if (!s.isSuspended())
- {
- count++;
- }
- }
- return count;
- }
-
- /**
- * Notification that a queue has been deleted. This is called so that the subscription can inform the channel, which
- * in turn can update its list of unacknowledged messages.
- *
- * @param queue
- */
- public void queueDeleted(AMQQueue queue) throws AMQException
- {
- for (Subscription s : _subscriptions)
- {
- s.queueDeleted(queue);
- }
- }
-
- int size()
- {
- return _subscriptions.size();
- }
-
-
- public Object getChangeLock()
- {
- return _changeLock;
- }
-
- public void setExclusive(final boolean exclusive)
- {
- _exclusive = exclusive;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/TransientMessageData.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/TransientMessageData.java
deleted file mode 100644
index 9b91c71a1d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/TransientMessageData.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.server.queue;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collections;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.ContentHeaderBody;
-
-/**
- * Contains data that is only used in AMQMessage transiently, e.g. while the content
- * body fragments are arriving.
- *
- * Having this data stored in a separate class means that the AMQMessage class avoids
- * the small overhead of numerous guaranteed-null references.
- *
- * @author Apache Software Foundation
- */
-public class TransientMessageData
-{
- /**
- * Stored temporarily until the header has been received at which point it is used when
- * constructing the handle
- */
- private MessagePublishInfo _messagePublishInfo;
-
- /**
- * Also stored temporarily.
- */
- private ContentHeaderBody _contentHeaderBody;
-
- /**
- * Keeps a track of how many bytes we have received in body frames
- */
- private long _bodyLengthReceived = 0;
-
- /**
- * This is stored during routing, to know the queues to which this message should immediately be
- * delivered. It is <b>cleared after delivery has been attempted</b>. Any persistent record of destinations is done
- * by the message handle.
- */
- private List<AMQQueue> _destinationQueues;
-
- public MessagePublishInfo getMessagePublishInfo()
- {
- return _messagePublishInfo;
- }
-
- public void setMessagePublishInfo(MessagePublishInfo messagePublishInfo)
- {
- _messagePublishInfo = messagePublishInfo;
- }
-
- public List<AMQQueue> getDestinationQueues()
- {
- return _destinationQueues == null ? (List<AMQQueue>) Collections.EMPTY_LIST : _destinationQueues;
- }
-
- public void setDestinationQueues(List<AMQQueue> destinationQueues)
- {
- _destinationQueues = destinationQueues;
- }
-
- public ContentHeaderBody getContentHeaderBody()
- {
- return _contentHeaderBody;
- }
-
- public void setContentHeaderBody(ContentHeaderBody contentHeaderBody)
- {
- _contentHeaderBody = contentHeaderBody;
- }
-
- public long getBodyLengthReceived()
- {
- return _bodyLengthReceived;
- }
-
- public void addBodyLength(int value)
- {
- _bodyLengthReceived += value;
- }
-
- public boolean isAllContentReceived() throws AMQException
- {
- return _bodyLengthReceived == _contentHeaderBody.bodySize;
- }
-
- public void addDestinationQueue(AMQQueue queue)
- {
- if(_destinationQueues == null)
- {
- _destinationQueues = new ArrayList<AMQQueue>();
- }
- _destinationQueues.add(queue);
- }
-
- public boolean isPersistent()
- {
- //todo remove literal values to a constant file such as AMQConstants in common
- return _contentHeaderBody.properties instanceof BasicContentHeaderProperties &&
- ((BasicContentHeaderProperties) _contentHeaderBody.properties).getDeliveryMode() == 2;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.java
deleted file mode 100644
index 373a64e2eb..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.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.server.queue;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.StoreContext;
-
-/**
- * @author Robert Greig (robert.j.greig@jpmorgan.com)
- */
-public class WeakReferenceMessageHandle implements AMQMessageHandle
-{
- private WeakReference<ContentHeaderBody> _contentHeaderBody;
-
- private WeakReference<MessagePublishInfo> _messagePublishInfo;
-
- private List<WeakReference<ContentChunk>> _contentBodies;
-
- private boolean _redelivered;
-
- private final MessageStore _messageStore;
-
- private long _arrivalTime;
-
-
- public WeakReferenceMessageHandle(MessageStore messageStore)
- {
- _messageStore = messageStore;
- }
-
- public ContentHeaderBody getContentHeaderBody(StoreContext context, Long messageId) throws AMQException
- {
- ContentHeaderBody chb = (_contentHeaderBody != null ? _contentHeaderBody.get() : null);
- if (chb == null)
- {
- MessageMetaData mmd = loadMessageMetaData(context, messageId);
- chb = mmd.getContentHeaderBody();
- }
- return chb;
- }
-
- private MessageMetaData loadMessageMetaData(StoreContext context, Long messageId)
- throws AMQException
- {
- MessageMetaData mmd = _messageStore.getMessageMetaData(context, messageId);
- populateFromMessageMetaData(mmd);
- return mmd;
- }
-
- private void populateFromMessageMetaData(MessageMetaData mmd)
- {
- _arrivalTime = mmd.getArrivalTime();
- _contentHeaderBody = new WeakReference<ContentHeaderBody>(mmd.getContentHeaderBody());
- _messagePublishInfo = new WeakReference<MessagePublishInfo>(mmd.getMessagePublishInfo());
- }
-
- public int getBodyCount(StoreContext context, Long messageId) throws AMQException
- {
- if (_contentBodies == null)
- {
- MessageMetaData mmd = _messageStore.getMessageMetaData(context, messageId);
- int chunkCount = mmd.getContentChunkCount();
- _contentBodies = new ArrayList<WeakReference<ContentChunk>>(chunkCount);
- for (int i = 0; i < chunkCount; i++)
- {
- _contentBodies.add(new WeakReference<ContentChunk>(null));
- }
- }
- return _contentBodies.size();
- }
-
- public long getBodySize(StoreContext context, Long messageId) throws AMQException
- {
- return getContentHeaderBody(context, messageId).bodySize;
- }
-
- public ContentChunk getContentChunk(StoreContext context, Long messageId, int index) throws AMQException, IllegalArgumentException
- {
- if (index > _contentBodies.size() - 1)
- {
- throw new IllegalArgumentException("Index " + index + " out of valid range 0 to " +
- (_contentBodies.size() - 1));
- }
- WeakReference<ContentChunk> wr = _contentBodies.get(index);
- ContentChunk cb = wr.get();
- if (cb == null)
- {
- cb = _messageStore.getContentBodyChunk(context, messageId, index);
- _contentBodies.set(index, new WeakReference<ContentChunk>(cb));
- }
- return cb;
- }
-
- /**
- * Content bodies are set <i>before</i> the publish and header frames
- *
- * @param storeContext
- * @param messageId
- * @param contentChunk
- * @param isLastContentBody
- * @throws AMQException
- */
- public void addContentBodyFrame(StoreContext storeContext, Long messageId, ContentChunk contentChunk, boolean isLastContentBody) throws AMQException
- {
- if (_contentBodies == null && isLastContentBody)
- {
- _contentBodies = new ArrayList<WeakReference<ContentChunk>>(1);
- }
- else
- {
- if (_contentBodies == null)
- {
- _contentBodies = new LinkedList<WeakReference<ContentChunk>>();
- }
- }
- _contentBodies.add(new WeakReference<ContentChunk>(contentChunk));
- _messageStore.storeContentBodyChunk(storeContext, messageId, _contentBodies.size() - 1,
- contentChunk, isLastContentBody);
- }
-
- public MessagePublishInfo getMessagePublishInfo(StoreContext context, Long messageId) throws AMQException
- {
- MessagePublishInfo bpb = (_messagePublishInfo != null ? _messagePublishInfo.get() : null);
- if (bpb == null)
- {
- MessageMetaData mmd = loadMessageMetaData(context, messageId);
-
- bpb = mmd.getMessagePublishInfo();
- }
- return bpb;
- }
-
- public boolean isRedelivered()
- {
- return _redelivered;
- }
-
- public void setRedelivered(boolean redelivered)
- {
- _redelivered = redelivered;
- }
-
- public boolean isPersistent(StoreContext context, Long messageId) throws AMQException
- {
- //todo remove literal values to a constant file such as AMQConstants in common
- ContentHeaderBody chb = getContentHeaderBody(context, messageId);
- return chb.properties instanceof BasicContentHeaderProperties &&
- ((BasicContentHeaderProperties) chb.properties).getDeliveryMode() == 2;
- }
-
- /**
- * This is called when all the content has been received.
- *
- * @param publishBody
- * @param contentHeaderBody
- * @throws AMQException
- */
- public void setPublishAndContentHeaderBody(StoreContext storeContext, Long messageId, MessagePublishInfo publishBody,
- ContentHeaderBody contentHeaderBody)
- throws AMQException
- {
- // if there are no content bodies the list will be null so we must
- // create en empty list here
- if (contentHeaderBody.bodySize == 0)
- {
- _contentBodies = new LinkedList<WeakReference<ContentChunk>>();
- }
-
- final long arrivalTime = System.currentTimeMillis();
-
-
- MessageMetaData mmd = new MessageMetaData(publishBody, contentHeaderBody, _contentBodies.size(), arrivalTime);
-
- _messageStore.storeMessageMetaData(storeContext, messageId, mmd);
-
- populateFromMessageMetaData(mmd);
- }
-
- public void removeMessage(StoreContext storeContext, Long messageId) throws AMQException
- {
- _messageStore.removeMessage(storeContext, messageId);
- }
-
- public void enqueue(StoreContext storeContext, Long messageId, AMQQueue queue) throws AMQException
- {
- _messageStore.enqueueMessage(storeContext, queue.getName(), messageId);
- }
-
- public void dequeue(StoreContext storeContext, Long messageId, AMQQueue queue) throws AMQException
- {
- _messageStore.dequeueMessage(storeContext, queue.getName(), messageId);
- }
-
- public long getArrivalTime()
- {
- return _arrivalTime;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/WeightedSubscriptionManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/WeightedSubscriptionManager.java
deleted file mode 100644
index 6c71571807..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/WeightedSubscriptionManager.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.server.queue;
-
-public interface WeightedSubscriptionManager extends SubscriptionManager
-{
- public int getWeight();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
deleted file mode 100644
index 455983c6d8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.registry;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.log4j.Logger;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * An abstract application registry that provides access to configuration information and handles the
- * construction and caching of configurable objects.
- * <p/>
- * Subclasses should handle the construction of the "registered objects" such as the exchange registry.
- */
-public abstract class ApplicationRegistry implements IApplicationRegistry
-{
- private static final Logger _logger = Logger.getLogger(ApplicationRegistry.class);
-
- private static Map<Integer, IApplicationRegistry> _instanceMap = new HashMap<Integer, IApplicationRegistry>();
-
- private final Map<Class<?>, Object> _configuredObjects = new HashMap<Class<?>, Object>();
-
- protected final Configuration _configuration;
-
- public static final int DEFAULT_INSTANCE = 1;
- public static final String DEFAULT_APPLICATION_REGISTRY = "org.apache.qpid.server.util.NullApplicationRegistry";
- public static String _APPLICATION_REGISTRY = DEFAULT_APPLICATION_REGISTRY;
-
- static
- {
- Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownService()));
- }
-
- private static class ShutdownService implements Runnable
- {
- public void run()
- {
- _logger.info("Shutting down application registries...");
- removeAll();
- }
- }
-
- public static void initialise(IApplicationRegistry instance) throws Exception
- {
- initialise(instance, DEFAULT_INSTANCE);
- }
-
- public static void initialise(IApplicationRegistry instance, int instanceID) throws Exception
- {
- if (instance != null)
- {
- _logger.info("Initialising Application Registry:" + instanceID);
- _instanceMap.put(instanceID, instance);
-
- try
- {
- instance.initialise();
- }
- catch (Exception e)
- {
- _instanceMap.remove(instanceID);
- throw e;
- }
- }
- else
- {
- remove(instanceID);
- }
- }
-
- public static void remove(int instanceID)
- {
- try
- {
- _instanceMap.get(instanceID).close();
- }
- catch (Exception e)
- {
- _logger.error("Error shutting down message store: " + e, e);
-
- }
- finally
- {
- _instanceMap.remove(instanceID);
- }
- }
-
- public static void removeAll()
- {
- Object[] keys = _instanceMap.keySet().toArray();
- for (Object k : keys)
- {
- remove((Integer) k);
- }
- }
-
- protected ApplicationRegistry(Configuration configuration)
- {
- _configuration = configuration;
- }
-
- public static IApplicationRegistry getInstance()
- {
- return getInstance(DEFAULT_INSTANCE);
- }
-
- public static IApplicationRegistry getInstance(int instanceID)
- {
- synchronized (IApplicationRegistry.class)
- {
- IApplicationRegistry instance = _instanceMap.get(instanceID);
-
- if (instance == null)
- {
- try
- {
- _logger.info("Creating DEFAULT_APPLICATION_REGISTRY: " + _APPLICATION_REGISTRY + " : Instance:" + instanceID);
- IApplicationRegistry registry = (IApplicationRegistry) Class.forName(_APPLICATION_REGISTRY).getConstructor((Class[]) null).newInstance((Object[]) null);
- ApplicationRegistry.initialise(registry, instanceID);
- _logger.info("Initialised Application Registry:" + instanceID);
- return registry;
- }
- catch (Exception e)
- {
- _logger.error("Error configuring application: " + e, e);
- //throw new AMQBrokerCreationException(instanceID, "Unable to create Application Registry instance " + instanceID);
- throw new RuntimeException("Unable to create Application Registry", e);
- }
- }
- else
- {
- return instance;
- }
- }
- }
-
- public void close() throws Exception
- {
- for (VirtualHost virtualHost : getVirtualHostRegistry().getVirtualHosts())
- {
- virtualHost.close();
- }
-
- // close the rmi registry(if any) started for management
- if (getInstance().getManagedObjectRegistry() != null)
- {
- getInstance().getManagedObjectRegistry().close();
- }
- }
-
- public Configuration getConfiguration()
- {
- return _configuration;
- }
-
- public <T> T getConfiguredObject(Class<T> instanceType)
- {
- T instance = (T) _configuredObjects.get(instanceType);
- if (instance == null)
- {
- try
- {
- instance = instanceType.newInstance();
- }
- catch (Exception e)
- {
- _logger.error("Unable to instantiate configuration class " + instanceType + " - ensure it has a public default constructor");
- throw new IllegalArgumentException("Unable to instantiate configuration class " + instanceType + " - ensure it has a public default constructor", e);
- }
- Configurator.configure(instance);
- _configuredObjects.put(instanceType, instance);
- }
- return instance;
- }
-
-
- public static void setDefaultApplicationRegistry(String clazz)
- {
- _APPLICATION_REGISTRY = clazz;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java
deleted file mode 100644
index e0fcaa208d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.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.server.registry;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.SystemConfiguration;
-import org.apache.commons.configuration.XMLConfiguration;
-import org.apache.qpid.server.management.JMXManagedObjectRegistry;
-import org.apache.qpid.server.management.ManagedObjectRegistry;
-import org.apache.qpid.server.management.ManagementConfiguration;
-import org.apache.qpid.server.management.NoopManagedObjectRegistry;
-import org.apache.qpid.server.plugins.PluginManager;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.database.ConfigurationFilePrincipalDatabaseManager;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabaseManager;
-import org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.security.access.ACLManager;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-import org.apache.qpid.AMQException;
-
-public class ConfigurationFileApplicationRegistry extends ApplicationRegistry
-{
-
- private ManagedObjectRegistry _managedObjectRegistry;
-
- private AuthenticationManager _authenticationManager;
-
- private ACLPlugin _accessManager;
-
- private PrincipalDatabaseManager _databaseManager;
-
- private VirtualHostRegistry _virtualHostRegistry;
-
-
- //fixme Why is this not used.
- private final Map<String, VirtualHost> _virtualHosts = new ConcurrentHashMap<String, VirtualHost>();
-
- private PluginManager _pluginManager;
-
-
- public ConfigurationFileApplicationRegistry(File configurationURL) throws ConfigurationException
- {
- super(config(configurationURL));
- }
-
- // Our configuration class needs to make the interpolate method
- // public so it can be called below from the config method.
- private static class MyConfiguration extends CompositeConfiguration
- {
- public String interpolate(String obj)
- {
- return super.interpolate(obj);
- }
- }
-
- private static final Configuration config(File url) throws ConfigurationException
- {
- // We have to override the interpolate methods so that
- // interpolation takes place accross the entirety of the
- // composite configuration. Without doing this each
- // configuration object only interpolates variables defined
- // inside itself.
- final MyConfiguration conf = new MyConfiguration();
- conf.addConfiguration(new SystemConfiguration()
- {
- protected String interpolate(String o)
- {
- return conf.interpolate(o);
- }
- });
- conf.addConfiguration(new XMLConfiguration(url)
- {
- protected String interpolate(String o)
- {
- return conf.interpolate(o);
- }
- });
- return conf;
- }
-
- public void initialise() throws Exception
- {
- initialiseManagedObjectRegistry();
-
- _virtualHostRegistry = new VirtualHostRegistry();
-
- _accessManager = ACLManager.loadACLManager("default", _configuration);
-
- _databaseManager = new ConfigurationFilePrincipalDatabaseManager();
-
- _authenticationManager = new PrincipalDatabaseAuthenticationManager(null, null);
-
- _databaseManager.initialiseManagement(_configuration);
-
- _managedObjectRegistry.start();
-
- _pluginManager = new PluginManager(_configuration.getString("plugin-directory"));
-
- initialiseVirtualHosts();
-
- }
-
- private void initialiseVirtualHosts() throws Exception
- {
- for (String name : getVirtualHostNames())
- {
-
- _virtualHostRegistry.registerVirtualHost(new VirtualHost(name, getConfiguration().subset("virtualhosts.virtualhost." + name)));
- }
- }
-
- private void initialiseManagedObjectRegistry() throws AMQException
- {
- ManagementConfiguration config = getConfiguredObject(ManagementConfiguration.class);
- if (config.enabled)
- {
- _managedObjectRegistry = new JMXManagedObjectRegistry();
- }
- else
- {
- _managedObjectRegistry = new NoopManagedObjectRegistry();
- }
- }
-
-
- public VirtualHostRegistry getVirtualHostRegistry()
- {
- return _virtualHostRegistry;
- }
-
- public ACLPlugin getAccessManager()
- {
- return _accessManager;
- }
-
- public ManagedObjectRegistry getManagedObjectRegistry()
- {
- return _managedObjectRegistry;
- }
-
- public PrincipalDatabaseManager getDatabaseManager()
- {
- return _databaseManager;
- }
-
- public AuthenticationManager getAuthenticationManager()
- {
- return _authenticationManager;
- }
-
- public Collection<String> getVirtualHostNames()
- {
- return getConfiguration().getList("virtualhosts.virtualhost.name");
- }
-
- public PluginManager getPluginManager()
- {
- return _pluginManager;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java
deleted file mode 100644
index ca10fbdba2..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.registry;
-
-import java.util.Collection;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.server.management.ManagedObjectRegistry;
-import org.apache.qpid.server.plugins.PluginManager;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabaseManager;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-
-public interface IApplicationRegistry
-{
- /**
- * Initialise the application registry. All initialisation must be done in this method so that any components
- * that need access to the application registry itself for initialisation are able to use it. Attempting to
- * initialise in the constructor will lead to failures since the registry reference will not have been set.
- */
- void initialise() throws Exception;
-
- void close() throws Exception;
-
- /**
- * This gets access to a "configured object". A configured object has fields populated from a the configuration
- * object (Commons Configuration) automatically, where it has the appropriate attributes defined on fields.
- * Application registry implementations can choose the refresh strategy or caching approach.
- * @param instanceType the type of object you want initialised. This must be unique - i.e. you can only
- * have a single object of this type in the system.
- * @return the configured object
- */
- <T> T getConfiguredObject(Class<T> instanceType);
-
- /**
- * Get the low level configuration. For use cases where the configured object approach is not required
- * you can get the complete configuration information.
- * @return a Commons Configuration instance
- */
- Configuration getConfiguration();
-
- ManagedObjectRegistry getManagedObjectRegistry();
-
- PrincipalDatabaseManager getDatabaseManager();
-
- AuthenticationManager getAuthenticationManager();
-
- Collection<String> getVirtualHostNames();
-
- VirtualHostRegistry getVirtualHostRegistry();
-
- ACLPlugin getAccessManager();
-
- PluginManager getPluginManager();
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java
deleted file mode 100644
index 539f32a732..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.access.plugins.DenyAll;
-import org.apache.qpid.configuration.PropertyUtils;
-import org.apache.log4j.Logger;
-
-import java.util.List;
-import java.lang.reflect.Method;
-
-public class ACLManager
-{
- private static final Logger _logger = Logger.getLogger(ACLManager.class);
-
- public static ACLPlugin loadACLManager(String name, Configuration hostConfig) throws ConfigurationException
- {
- ACLPlugin aclPlugin = ApplicationRegistry.getInstance().getAccessManager();
-
- if (hostConfig == null)
- {
- _logger.warn("No Configuration specified. Using default ACLPlugin '" + aclPlugin.getPluginName()
- + "' for VirtualHost:'" + name + "'");
- return aclPlugin;
- }
-
- String accessClass = hostConfig.getString("security.access.class");
- if (accessClass == null)
- {
-
- _logger.warn("No ACL Plugin specified. Using default ACL Plugin '" + aclPlugin.getPluginName() +
- "' for VirtualHost:'" + name + "'");
- return aclPlugin;
- }
-
- Object o;
- try
- {
- o = Class.forName(accessClass).newInstance();
- }
- catch (Exception e)
- {
- throw new ConfigurationException("Error initialising ACL: " + e, e);
- }
-
- if (!(o instanceof ACLPlugin))
- {
- throw new ConfigurationException("ACL Plugins must implement the ACLPlugin interface");
- }
-
- initialiseAccessControl((ACLPlugin) o, hostConfig);
-
- aclPlugin = getManager((ACLPlugin) o);
- if (_logger.isInfoEnabled())
- {
- _logger.info("Initialised ACL Plugin '" + aclPlugin.getPluginName()
- + "' for virtualhost '" + name + "' successfully");
- }
-
- return aclPlugin;
- }
-
-
- private static void initialiseAccessControl(ACLPlugin accessManager, Configuration config)
- throws ConfigurationException
- {
- //First provide the ACLPlugin with the host configuration
-
- accessManager.setConfiguaration(config);
-
- //Provide additional attribute customisation.
- String baseName = "security.access.attributes.attribute.";
- List<String> argumentNames = config.getList(baseName + "name");
- List<String> argumentValues = config.getList(baseName + "value");
- for (int i = 0; i < argumentNames.size(); i++)
- {
- String argName = argumentNames.get(i);
- if (argName == null || argName.length() == 0)
- {
- throw new ConfigurationException("Access Control argument names must have length >= 1 character");
- }
- if (Character.isLowerCase(argName.charAt(0)))
- {
- argName = Character.toUpperCase(argName.charAt(0)) + argName.substring(1);
- }
- String methodName = "set" + argName;
- Method method = null;
- try
- {
- method = accessManager.getClass().getMethod(methodName, String.class);
- }
- catch (NoSuchMethodException e)
- {
- //do nothing as method will be null
- }
-
- if (method == null)
- {
- throw new ConfigurationException("No method " + methodName + " found in class " + accessManager.getClass() +
- " hence unable to configure access control. The method must be public and " +
- "have a single String argument with a void return type");
- }
- try
- {
- method.invoke(accessManager, PropertyUtils.replaceProperties(argumentValues.get(i)));
- }
- catch (Exception e)
- {
- ConfigurationException ce = new ConfigurationException(e.getMessage(), e.getCause());
- ce.initCause(e);
- throw ce;
- }
- }
- }
-
-
- private static ACLPlugin getManager(ACLPlugin manager)
- {
- if (manager == null)
- {
- if (ApplicationRegistry.getInstance().getAccessManager() == null)
- {
- return new DenyAll();
- }
- else
- {
- return ApplicationRegistry.getInstance().getAccessManager();
- }
- }
- else
- {
- return manager;
- }
- }
-
- public static Logger getLogger()
- {
- return _logger;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLPlugin.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLPlugin.java
deleted file mode 100644
index 7855f147b4..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLPlugin.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.server.security.access;
-
-import org.apache.qpid.framing.AMQMethodBody;
-
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.commons.configuration.Configuration;
-
-
-public interface ACLPlugin
-{
- /**
- * Pseudo-Code:
- * Identify requested RighConnectiont
- * Lookup users ability for that right.
- * if rightsExists
- * Validate right on object
- * Return result
- * e.g
- * User, CONSUME , Queue
- * User, CONSUME , Exchange + RoutingKey
- * User, PUBLISH , Exchange + RoutingKey
- * User, CREATE , Exchange || Queue
- * User, BIND , Exchange + RoutingKey + Queue
- *
- * @param session - The session requesting access
- * @param permission - The permission requested
- * @param parameters - The above objects that are used to authorise the request.
- * @return The AccessResult decision
- */
- //todo potential refactor this ConnectionException Out of here
- AccessResult authorise(AMQProtocolSession session, Permission permission, AMQMethodBody body, Object... parameters) throws AMQConnectionException;
-
- String getPluginName();
-
- void setConfiguaration(Configuration config);
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/AccessResult.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/AccessResult.java
deleted file mode 100644
index 89cead69b3..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/AccessResult.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access;
-
-public class AccessResult
-{
- public enum AccessStatus
- {
- GRANTED, REFUSED
- }
-
- StringBuilder _authorizer;
- AccessStatus _status;
-
- public AccessResult(ACLPlugin authorizer, AccessStatus status)
- {
- _status = status;
- _authorizer = new StringBuilder(authorizer.getPluginName());
- }
-
- public void setAuthorizer(ACLPlugin authorizer)
- {
- _authorizer.append(authorizer.getPluginName());
- }
-
- public String getAuthorizer()
- {
- return _authorizer.toString();
- }
-
- public void setStatus(AccessStatus status)
- {
- _status = status;
- }
-
- public AccessStatus getStatus()
- {
- return _status;
- }
-
- public void addAuthorizer(ACLPlugin accessManager)
- {
- _authorizer.insert(0, "->");
- _authorizer.insert(0, accessManager.getPluginName());
- }
-
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/AccessRights.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/AccessRights.java
deleted file mode 100644
index 1b79a5a0e0..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/AccessRights.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.server.security.access;
-
-public class AccessRights
-{
- public enum Rights
- {
- ANY,
- READ,
- WRITE,
- READWRITE
- }
-
- Rights _right;
-
- public AccessRights(Rights right)
- {
- _right = right;
- }
-
- public boolean allows(Rights rights)
- {
- switch (_right)
- {
- case ANY:
- return (rights.equals(Rights.WRITE)
- || rights.equals(Rights.READ)
- || rights.equals(Rights.READWRITE)
- || rights.equals(Rights.ANY));
- case READ:
- return rights.equals(Rights.READ) || rights.equals(Rights.ANY);
- case WRITE:
- return rights.equals(Rights.WRITE) || rights.equals(Rights.ANY);
- case READWRITE:
- return true;
- }
- return false;
- }
-
- public Rights getRights()
- {
- return _right;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/Accessable.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/Accessable.java
deleted file mode 100644
index f51cf24caa..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/Accessable.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access;
-
-public interface Accessable
-{
- void setAccessableName(String name);
- String getAccessableName();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/Permission.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/Permission.java
deleted file mode 100644
index 5d439a99eb..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/Permission.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.server.security.access;
-
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.queue.AMQQueue;
-
-public enum Permission
-{
- CONSUME,
- PUBLISH,
- CREATE,
- ACCESS,
- BIND,
- UNBIND,
- DELETE,
- PURGE
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/PrincipalPermissions.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/PrincipalPermissions.java
deleted file mode 100755
index 22f1cf25a8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/PrincipalPermissions.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access;
-
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.QueueBindBody;
-import org.apache.qpid.framing.QueueDeclareBody;
-import org.apache.qpid.framing.ExchangeDeclareBody;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.exchange.Exchange;
-
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class PrincipalPermissions
-{
-
- private static final int CONSUME_QUEUES_KEY = 0;
- private static final int CONSUME_TEMPORARY_KEY = 1;
- private static final int CONSUME_OWN_QUEUES_ONLY_KEY = 2;
-
- private static final int CREATE_QUEUES_KEY = 0;
- private static final int CREATE_EXCHANGES_KEY = 1;
-
- private static final int CREATE_QUEUE_TEMPORARY_KEY = 2;
- private static final int CREATE_QUEUE_QUEUES_KEY = 1;
- private static final int CREATE_QUEUE_EXCHANGES_KEY = 0;
-
- private static final int CREATE_QUEUE_EXCHANGES_TEMPORARY_KEY = 0;
- private static final int CREATE_QUEUE_EXCHANGES_ROUTINGKEYS_KEY = 1;
-
- private static final int PUBLISH_EXCHANGES_KEY = 0;
-
- private Map _permissions;
-
- private String _user;
-
-
- public PrincipalPermissions(String user)
- {
- _user = user;
- _permissions = new ConcurrentHashMap();
- }
-
- public void grant(Permission permission, Object... parameters)
- {
- switch (permission)
- {
- case ACCESS:
- break; // This is a no-op as the existence of this PrincipalPermission object is scoped per VHost for ACCESS
- case BIND:
- break; // All the details are currently included in the create setup.
- case CONSUME: // Parameters : AMQShortString queueName, Boolean Temporary, Boolean ownQueueOnly
- Map consumeRights = (Map) _permissions.get(permission);
-
- if (consumeRights == null)
- {
- consumeRights = new ConcurrentHashMap();
- _permissions.put(permission, consumeRights);
- }
-
- //if we have parametsre
- if (parameters.length > 0)
- {
- AMQShortString queueName = (AMQShortString) parameters[0];
- Boolean temporary = (Boolean) parameters[1];
- Boolean ownQueueOnly = (Boolean) parameters[2];
-
- if (temporary)
- {
- consumeRights.put(CONSUME_TEMPORARY_KEY, true);
- }
- else
- {
- consumeRights.put(CONSUME_TEMPORARY_KEY, false);
- }
-
- if (ownQueueOnly)
- {
- consumeRights.put(CONSUME_OWN_QUEUES_ONLY_KEY, true);
- }
- else
- {
- consumeRights.put(CONSUME_OWN_QUEUES_ONLY_KEY, false);
- }
-
-
- LinkedList queues = (LinkedList) consumeRights.get(CONSUME_QUEUES_KEY);
- if (queues == null)
- {
- queues = new LinkedList();
- consumeRights.put(CONSUME_QUEUES_KEY, queues);
- }
-
- if (queueName != null)
- {
- queues.add(queueName);
- }
- }
-
-
- break;
- case CREATE: // Parameters : Boolean temporary, AMQShortString queueName
- // , AMQShortString exchangeName , AMQShortString routingKey
- // || AMQShortString exchangeName , AMQShortString Class
-
- Map createRights = (Map) _permissions.get(permission);
-
- if (createRights == null)
- {
- createRights = new ConcurrentHashMap();
- _permissions.put(permission, createRights);
-
- }
-
- //The existence of the empty map mean permission to all.
- if (parameters.length == 0)
- {
- return;
- }
-
-
- if (parameters[0] instanceof Boolean) //Create Queue :
- // Boolean temporary, [AMQShortString queueName, AMQShortString exchangeName , AMQShortString routingKey]
- {
- Boolean temporary = (Boolean) parameters[0];
-
- AMQShortString queueName = parameters.length > 1 ? (AMQShortString) parameters[1] : null;
- AMQShortString exchangeName = parameters.length > 2 ? (AMQShortString) parameters[2] : null;
- //Set the routingkey to the specified value or the queueName if present
- AMQShortString routingKey = parameters.length > 3 ? (AMQShortString) parameters[3] : queueName;
-
- // Get the queues map
- Map create_queues = (Map) createRights.get(CREATE_QUEUES_KEY);
-
- if (create_queues == null)
- {
- create_queues = new ConcurrentHashMap();
- createRights.put(CREATE_QUEUES_KEY, create_queues);
- }
-
- //Allow all temp queues to be created
- create_queues.put(CREATE_QUEUE_TEMPORARY_KEY, temporary);
-
- //Create empty list of queues
- Map create_queues_queues = (Map) create_queues.get(CREATE_QUEUE_QUEUES_KEY);
-
- if (create_queues_queues == null)
- {
- create_queues_queues = new ConcurrentHashMap();
- create_queues.put(CREATE_QUEUE_QUEUES_KEY, create_queues_queues);
- }
-
- // We are granting CREATE rights to all temporary queues only
- if (parameters.length == 1)
- {
- return;
- }
-
- // if we have a queueName then we need to store any associated exchange / rk bindings
- if (queueName != null)
- {
- Map queue = (Map) create_queues_queues.get(queueName);
- if (queue == null)
- {
- queue = new ConcurrentHashMap();
- create_queues_queues.put(queueName, queue);
- }
-
- if (exchangeName != null)
- {
- queue.put(exchangeName, routingKey);
- }
-
- //If no exchange is specified then the presence of the queueName in the map says any exchange is ok
- }
-
- // Store the exchange that we are being granted rights to. This will be used as part of binding
-
- //Lookup the list of exchanges
- Map create_queues_exchanges = (Map) create_queues.get(CREATE_QUEUE_EXCHANGES_KEY);
-
- if (create_queues_exchanges == null)
- {
- create_queues_exchanges = new ConcurrentHashMap();
- create_queues.put(CREATE_QUEUE_EXCHANGES_KEY, create_queues_exchanges);
- }
-
- //if we have an exchange
- if (exchangeName != null)
- {
- //Retrieve the list of permitted exchanges.
- Map exchanges = (Map) create_queues_exchanges.get(exchangeName);
-
- if (exchanges == null)
- {
- exchanges = new ConcurrentHashMap();
- create_queues_exchanges.put(exchangeName, exchanges);
- }
-
- //Store the temporary setting CREATE_QUEUE_EXCHANGES_ROUTINGKEYS_KEY
- exchanges.put(CREATE_QUEUE_EXCHANGES_TEMPORARY_KEY, temporary);
-
- //Store the binding details of queue/rk for this exchange.
- if (queueName != null)
- {
- //Retrieve the list of permitted routingKeys.
- Map rKeys = (Map) exchanges.get(exchangeName);
-
- if (rKeys == null)
- {
- rKeys = new ConcurrentHashMap();
- exchanges.put(CREATE_QUEUE_EXCHANGES_ROUTINGKEYS_KEY, rKeys);
- }
-
- rKeys.put(queueName, routingKey);
- }
- }
- }
- else // Create Exchange : AMQShortString exchangeName , AMQShortString Class
- {
- Map create_exchanges = (Map) createRights.get(CREATE_EXCHANGES_KEY);
-
- if (create_exchanges == null)
- {
- create_exchanges = new ConcurrentHashMap();
- createRights.put(CREATE_EXCHANGES_KEY, create_exchanges);
- }
-
- //Should perhaps error if parameters[0] is null;
- AMQShortString exchangeName = parameters.length > 0 ? (AMQShortString) parameters[0] : null;
- AMQShortString className = parameters.length > 1 ? (AMQShortString) parameters[1] : null;
-
- //Store the exchangeName / class mapping if the mapping is null
- createRights.put(exchangeName, className);
- }
- break;
- case DELETE:
- break;
-
- case PUBLISH: // Parameters : Exchange exchange, AMQShortString routingKey
- Map publishRights = (Map) _permissions.get(permission);
-
- if (publishRights == null)
- {
- publishRights = new ConcurrentHashMap();
- _permissions.put(permission, publishRights);
- }
-
- if (parameters == null || parameters.length == 0)
- {
- //If we have no parameters then allow publish to all destinations
- // this is signified by having a null value for publish_exchanges
- }
- else
- {
- Map publish_exchanges = (Map) publishRights.get(PUBLISH_EXCHANGES_KEY);
-
- if (publish_exchanges == null)
- {
- publish_exchanges = new ConcurrentHashMap();
- publishRights.put(PUBLISH_EXCHANGES_KEY, publish_exchanges);
- }
-
-
- HashSet routingKeys = (HashSet) publish_exchanges.get(parameters[0]);
-
- // Check to see if we have a routing key
- if (parameters.length == 2)
- {
- if (routingKeys == null)
- {
- routingKeys = new HashSet<AMQShortString>();
- }
- //Add routing key to permitted publish destinations
- routingKeys.add(parameters[1]);
- }
-
- // Add the updated routingkey list or null if all values allowed
- publish_exchanges.put(parameters[0], routingKeys);
- }
- break;
- case PURGE:
- break;
- case UNBIND:
- break;
- }
-
- }
-
- public boolean authorise(Permission permission, Object... parameters)
- {
-
- switch (permission)
- {
- case ACCESS:
- return true; // This is here for completeness but the SimpleXML ACLManager never calls it.
- // The existence of this user specific PP can be validated in the map SimpleXML maintains.
- case BIND: // Parameters : QueueBindMethod , Exchange , AMQQueue, AMQShortString routingKey
-
-// QueueDeclareBody body = (QueueDeclareBody) parameters[0];
-
- Exchange exchange = (Exchange) parameters[1];
-
- if (exchange.getName().equals("<<default>>"))
- {
- // Binding to <<default>> can not be programmed via ACLs due to '<','>' unable to be used in the XML
- System.err.println("Binding on exchange <<default>> not alowed via ACLs");
- }
-
- AMQQueue bind_queueName = (AMQQueue) parameters[2];
- AMQShortString routingKey = (AMQShortString) parameters[3];
-
- //Get all Create Rights for this user
- Map bindCreateRights = (Map) _permissions.get(Permission.CREATE);
-
- //Look up the Queue Creation Rights
- Map bind_create_queues = (Map) bindCreateRights.get(CREATE_QUEUES_KEY);
-
- //Lookup the list of queues
- Map bind_create_queues_queues = (Map) bindCreateRights.get(CREATE_QUEUE_QUEUES_KEY);
-
- // Check and see if we have a queue white list to check
- if (bind_create_queues_queues != null)
- {
- //There a white list for queues
- Map exchangeDetails = (Map) bind_create_queues_queues.get(bind_queueName);
-
- if (exchangeDetails == null) //Then all queue can be bound to all exchanges.
- {
- return true;
- }
-
- // Check to see if we have a white list of routingkeys to check
- Map rkeys = (Map) exchangeDetails.get(exchange.getName());
-
- // if keys is null then any rkey is allowed on this exchange
- if (rkeys == null)
- {
- // There is no routingkey white list
- return true;
- }
- else
- {
- // We have routingKeys so a match must be found to allowed binding
- Iterator keys = rkeys.keySet().iterator();
-
- boolean matched = false;
- while (keys.hasNext() && !matched)
- {
- AMQShortString rkey = (AMQShortString) keys.next();
- if (rkey.endsWith("*"))
- {
- matched = routingKey.startsWith(rkey.subSequence(0, rkey.length() - 1).toString());
- }
- else
- {
- matched = routingKey.equals(rkey);
- }
- }
-
-
- return matched;
- }
-
-
- }
- else
- {
- //There a is no white list for queues
-
- // So can allow all queues to be bound
- // but we should first check and see if we have a temp queue and validate that we are allowed
- // to bind temp queues.
-
- //Check to see if we have a temporary queue
- if (bind_queueName.isAutoDelete())
- {
- // Check and see if we have an exchange white list.
- Map bind_exchanges = (Map) bind_create_queues.get(CREATE_QUEUE_EXCHANGES_KEY);
-
- // If the exchange exists then we must check to see if temporary queues are allowed here
- if (bind_exchanges != null)
- {
- // Check to see if the requested exchange is allowed.
- Map exchangeDetails = (Map) bind_exchanges.get(exchange.getName());
-
- return (Boolean) exchangeDetails.get(CREATE_QUEUE_EXCHANGES_TEMPORARY_KEY);
- }
-
- //no white list so all allowed, drop through to return true below.
- }
-
- // not a temporary queue and no white list so all allowed.
- return true;
- }
-
- case CREATE:// Paramters : QueueDeclareBody || ExchangeDeclareBody
-
- Map createRights = (Map) _permissions.get(permission);
-
- // If there are no create rights then deny request
- if (createRights == null)
- {
- return false;
- }
-
- if (parameters.length == 1)
- {
- if (parameters[0] instanceof QueueDeclareBody)
- {
- QueueDeclareBody body = (QueueDeclareBody) parameters[0];
-
- //Look up the Queue Creation Rights
- Map create_queues = (Map) createRights.get(CREATE_QUEUES_KEY);
-
- //Lookup the list of queues allowed to be created
- Map create_queues_queues = (Map) create_queues.get(CREATE_QUEUE_QUEUES_KEY);
-
-
- AMQShortString queueName = body.getQueue();
-
-
- if (body.getAutoDelete())// we have a temporary queue
- {
- return (Boolean) create_queues.get(CREATE_QUEUE_TEMPORARY_KEY);
- }
- else
- {
- // If there is a white list then check
- return create_queues_queues == null || create_queues_queues.containsKey(queueName);
- }
-
- }
- else if (parameters[0] instanceof ExchangeDeclareBody)
- {
- ExchangeDeclareBody body = (ExchangeDeclareBody) parameters[0];
-
- AMQShortString exchangeName = body.getExchange();
-
- Map create_exchanges = (Map) createRights.get(CREATE_EXCHANGES_KEY);
-
- // If the exchange list is doesn't exist then all is allowed else check the valid exchanges
- return create_exchanges == null || create_exchanges.containsKey(exchangeName);
- }
- }
- break;
- case CONSUME: // Parameters : AMQQueue
-
- if (parameters.length == 1 && parameters[0] instanceof AMQQueue)
- {
- AMQQueue queue = ((AMQQueue) parameters[0]);
- Map queuePermissions = (Map) _permissions.get(permission);
-
- List queues = (List) queuePermissions.get(CONSUME_QUEUES_KEY);
-
- Boolean temporayQueues = (Boolean) queuePermissions.get(CONSUME_TEMPORARY_KEY);
- Boolean ownQueuesOnly = (Boolean) queuePermissions.get(CONSUME_OWN_QUEUES_ONLY_KEY);
-
- // If user is allowed to publish to temporary queues and this is a temp queue then allow it.
- if (temporayQueues)
- {
- if (queue.isAutoDelete())
- // This will allow consumption from any temporary queue including ones not owned by this user.
- // Of course the exclusivity will not be broken.
- {
- // if not limited to ownQueuesOnly then ok else check queue Owner.
- return !ownQueuesOnly || queue.getOwner().equals(_user);
- }
- else
- {
- return false;
- }
- }
-
- // if queues are white listed then ensure it is ok
- if (queues != null)
- {
- // if no queues are listed then ALL are ok othereise it must be specified.
- if (ownQueuesOnly)
- {
- if (queue.getOwner().equals(_user))
- {
- return queues.size() == 0 || queues.contains(queue.getName());
- }
- else
- {
- return false;
- }
- }
-
- // If we are
- return queues.size() == 0 || queues.contains(queue.getName());
- }
- }
-
- // Can't authenticate without the right parameters
- return false;
- case DELETE:
- break;
-
- case PUBLISH: // Parameters : Exchange exchange, AMQShortString routingKey
- Map publishRights = (Map) _permissions.get(permission);
-
- if (publishRights == null)
- {
- return false;
- }
-
- Map exchanges = (Map) publishRights.get(PUBLISH_EXCHANGES_KEY);
-
- // Having no exchanges listed gives full publish rights to all exchanges
- if (exchanges == null)
- {
- return true;
- }
- // Otherwise exchange must be listed in the white list
-
- // If the map doesn't have the exchange then it isn't allowed
- if (!exchanges.containsKey(parameters[0]))
- {
- return false;
- }
- else
- {
-
- // Get valid routing keys
- HashSet routingKeys = (HashSet) exchanges.get(parameters[0]);
-
- // Having no routingKeys in the map then all are allowed.
- if (routingKeys == null)
- {
- return true;
- }
- else
- {
- // We have routingKeys so a match must be found to allowed binding
- Iterator keys = routingKeys.iterator();
-
-
- AMQShortString publishRKey = (AMQShortString)parameters[1];
-
- boolean matched = false;
- while (keys.hasNext() && !matched)
- {
- AMQShortString rkey = (AMQShortString) keys.next();
-
- if (rkey.endsWith("*"))
- {
- matched = publishRKey.startsWith(rkey.subSequence(0, rkey.length() - 1));
- }
- else
- {
- matched = publishRKey.equals(rkey);
- }
- }
- return matched;
- }
- }
- case PURGE:
- break;
- case UNBIND:
- break;
-
- }
-
- return false;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/VirtualHostAccess.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/VirtualHostAccess.java
deleted file mode 100644
index 13151a66b8..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/VirtualHostAccess.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access;
-
-public class VirtualHostAccess
-{
- private String _vhost;
- private AccessRights _rights;
-
- public VirtualHostAccess(String vhostaccess)
- {
- //format <vhost>(<rights>)
- int hostend = vhostaccess.indexOf('(');
-
- if (hostend == -1)
- {
- throw new IllegalArgumentException("VirtualHostAccess format string contains no access _rights");
- }
-
- _vhost = vhostaccess.substring(0, hostend);
-
- String rights = vhostaccess.substring(hostend);
-
- if (rights.indexOf('r') != -1)
- {
- if (rights.indexOf('w') != -1)
- {
- _rights = new AccessRights(AccessRights.Rights.READWRITE);
- }
- else
- {
- _rights = new AccessRights(AccessRights.Rights.READ);
- }
- }
- else if (rights.indexOf('w') != -1)
- {
- _rights = new AccessRights(AccessRights.Rights.WRITE);
- }
- }
-
- public AccessRights getAccessRights()
- {
- return _rights;
- }
-
- public String getVirtualHost()
- {
- return _vhost;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java
deleted file mode 100644
index a8ae03cc5d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access.management;
-
-import org.apache.qpid.server.management.MBeanDescription;
-import org.apache.qpid.server.management.AMQManagedObject;
-import org.apache.qpid.server.management.MBeanOperation;
-import org.apache.qpid.server.management.MBeanInvocationHandlerImpl;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
-import org.apache.qpid.server.security.access.management.UserManagement;
-import org.apache.log4j.Logger;
-import org.apache.commons.configuration.ConfigurationException;
-
-import javax.management.JMException;
-import javax.management.remote.JMXPrincipal;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.security.auth.login.AccountNotFoundException;
-import javax.security.auth.Subject;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.FileOutputStream;
-import java.util.Properties;
-import java.util.List;
-import java.util.Enumeration;
-import java.util.Set;
-import java.util.concurrent.locks.ReentrantLock;
-import java.security.Principal;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-
-/** MBean class for AMQUserManagementMBean. It implements all the management features exposed for managing users. */
-@MBeanDescription("User Management Interface")
-public class AMQUserManagementMBean extends AMQManagedObject implements UserManagement
-{
-
- private static final Logger _logger = Logger.getLogger(AMQUserManagementMBean.class);
-
- private PrincipalDatabase _principalDatabase;
- private String _accessFileName;
- private Properties _accessRights;
- // private File _accessFile;
- private ReentrantLock _accessRightsUpdate = new ReentrantLock();
-
- // Setup for the TabularType
- static TabularType _userlistDataType; // Datatype for representing User Lists
-
- static CompositeType _userDataType; // Composite type for representing User
- static String[] _userItemNames = {"Username", "read", "write", "admin"};
-
- static
- {
- String[] userItemDesc = {"Broker Login username", "Management Console Read Permission",
- "Management Console Write Permission", "Management Console Admin Permission"};
-
- OpenType[] userItemTypes = new OpenType[4]; // User item types.
- userItemTypes[0] = SimpleType.STRING; // For Username
- userItemTypes[1] = SimpleType.BOOLEAN; // For Rights - Read
- userItemTypes[2] = SimpleType.BOOLEAN; // For Rights - Write
- userItemTypes[3] = SimpleType.BOOLEAN; // For Rights - Admin
- String[] userDataIndex = {_userItemNames[0]};
-
- try
- {
- _userDataType =
- new CompositeType("User", "User Data", _userItemNames, userItemDesc, userItemTypes);
-
- _userlistDataType = new TabularType("Users", "List of users", _userDataType, userDataIndex);
- }
- catch (OpenDataException e)
- {
- _logger.error("Tabular data setup for viewing users incorrect.");
- _userlistDataType = null;
- }
- }
-
-
- public AMQUserManagementMBean() throws JMException
- {
- super(UserManagement.class, UserManagement.TYPE);
- }
-
- public String getObjectInstanceName()
- {
- return UserManagement.TYPE;
- }
-
- public boolean setPassword(String username, char[] password)
- {
- try
- {
- //delegate password changes to the Principal Database
- return _principalDatabase.updatePassword(new UsernamePrincipal(username), password);
- }
- catch (AccountNotFoundException e)
- {
- _logger.warn("Attempt to set password of non-existant user'" + username + "'");
- return false;
- }
- }
-
- public boolean setRights(String username, boolean read, boolean write, boolean admin)
- {
-
- if (_accessRights.get(username) == null)
- {
- // If the user doesn't exist in the user rights file check that they at least have an account.
- if (_principalDatabase.getUser(username) == null)
- {
- return false;
- }
- }
-
- try
- {
-
- _accessRightsUpdate.lock();
-
- // Update the access rights
- if (admin)
- {
- _accessRights.put(username, MBeanInvocationHandlerImpl.ADMIN);
- }
- else
- {
- if (read | write)
- {
- if (read)
- {
- _accessRights.put(username, MBeanInvocationHandlerImpl.READONLY);
- }
- if (write)
- {
- _accessRights.put(username, MBeanInvocationHandlerImpl.READWRITE);
- }
- }
- else
- {
- _accessRights.remove(username);
- }
- }
-
- saveAccessFile();
- }
- finally
- {
- if (_accessRightsUpdate.isHeldByCurrentThread())
- {
- _accessRightsUpdate.unlock();
- }
- }
-
- return true;
- }
-
- public boolean createUser(String username, char[] password, boolean read, boolean write, boolean admin)
- {
- if (_principalDatabase.createPrincipal(new UsernamePrincipal(username), password))
- {
- _accessRights.put(username, "");
-
- return setRights(username, read, write, admin);
- }
-
- return false;
- }
-
- public boolean deleteUser(String username)
- {
-
- try
- {
- if (_principalDatabase.deletePrincipal(new UsernamePrincipal(username)))
- {
- try
- {
- _accessRightsUpdate.lock();
-
- _accessRights.remove(username);
- saveAccessFile();
- }
- finally
- {
- if (_accessRightsUpdate.isHeldByCurrentThread())
- {
- _accessRightsUpdate.unlock();
- }
- }
- return true;
- }
- }
- catch (AccountNotFoundException e)
- {
- _logger.warn("Attempt to delete user (" + username + ") that doesn't exist");
- }
-
- return false;
- }
-
- public boolean reloadData()
- {
- try
- {
- try
- {
- loadAccessFile();
- }
- catch (ConfigurationException e)
- {
- _logger.info("Reload failed due to:" + e);
- return false;
- }
-
- // Reload successful
- return true;
- }
- catch (IOException e)
- {
- _logger.info("Reload failed due to:" + e);
- // Reload unsuccessful
- return false;
- }
- }
-
-
- @MBeanOperation(name = "viewUsers", description = "All users with access rights to the system.")
- public TabularData viewUsers()
- {
- // Table of users
- // Username(string), Access rights Read,Write,Admin(bool,bool,bool)
-
- if (_userlistDataType == null)
- {
- _logger.warn("TabluarData not setup correctly");
- return null;
- }
-
- List<Principal> users = _principalDatabase.getUsers();
-
- TabularDataSupport userList = new TabularDataSupport(_userlistDataType);
-
- try
- {
- // Create the tabular list of message header contents
- for (Principal user : users)
- {
- // Create header attributes list
-
- String rights = (String) _accessRights.get(user.getName());
-
- Boolean read = false;
- Boolean write = false;
- Boolean admin = false;
-
- if (rights != null)
- {
- read = rights.equals(MBeanInvocationHandlerImpl.READONLY)
- || rights.equals(MBeanInvocationHandlerImpl.READWRITE);
- write = rights.equals(MBeanInvocationHandlerImpl.READWRITE);
- admin = rights.equals(MBeanInvocationHandlerImpl.ADMIN);
- }
-
- Object[] itemData = {user.getName(), read, write, admin};
- CompositeData messageData = new CompositeDataSupport(_userDataType, _userItemNames, itemData);
- userList.put(messageData);
- }
- }
- catch (OpenDataException e)
- {
- _logger.warn("Unable to create user list due to :" + e);
- return null;
- }
-
- return userList;
- }
-
- /*** Broker Methods **/
-
- /**
- * setPrincipalDatabase
- *
- * @param database set The Database to use for user lookup
- */
- public void setPrincipalDatabase(PrincipalDatabase database)
- {
- _principalDatabase = database;
- }
-
- /**
- * setAccessFile
- *
- * @param accessFile the file to use for updating.
- *
- * @throws java.io.IOException If the file cannot be accessed
- * @throws org.apache.commons.configuration.ConfigurationException
- * if checks on the file fail.
- */
- public void setAccessFile(String accessFile) throws IOException, ConfigurationException
- {
- _accessFileName = accessFile;
-
- if (_accessFileName != null)
- {
- loadAccessFile();
- }
- else
- {
- _logger.warn("Access rights file specified is null. Access rights not changed.");
- }
- }
-
- private void loadAccessFile() throws IOException, ConfigurationException
- {
- try
- {
- _accessRightsUpdate.lock();
-
- Properties accessRights = new Properties();
-
- File accessFile = new File(_accessFileName);
-
- if (!accessFile.exists())
- {
- throw new ConfigurationException("'" + _accessFileName + "' does not exist");
- }
-
- if (!accessFile.canRead())
- {
- throw new ConfigurationException("Cannot read '" + _accessFileName + "'.");
- }
-
- if (!accessFile.canWrite())
- {
- _logger.warn("Unable to write to access file '" + _accessFileName + "' changes will not be preserved.");
- }
-
- accessRights.load(new FileInputStream(accessFile));
- checkAccessRights(accessRights);
- setAccessRights(accessRights);
- }
- finally
- {
- if (_accessRightsUpdate.isHeldByCurrentThread())
- {
- _accessRightsUpdate.unlock();
- }
- }
- }
-
- private void checkAccessRights(Properties accessRights)
- {
- Enumeration values = accessRights.propertyNames();
-
- while (values.hasMoreElements())
- {
- String user = (String) values.nextElement();
-
- if (_principalDatabase.getUser(user) == null)
- {
- _logger.warn("Access rights contains user '" + user + "' but there is no authentication data for that user");
- }
- }
- }
-
- private void saveAccessFile()
- {
- try
- {
- _accessRightsUpdate.lock();
- try
- {
- // remove old temporary file
- File tmp = new File(_accessFileName + ".tmp");
- if (tmp.exists())
- {
- tmp.delete();
- }
-
- //remove old backup
- File old = new File(_accessFileName + ".old");
- if (old.exists())
- {
- old.delete();
- }
-
- // Rename current file
- File rights = new File(_accessFileName);
- rights.renameTo(old);
-
- FileOutputStream output = new FileOutputStream(tmp);
- _accessRights.store(output, "Generated by AMQUserManagementMBean Console : Last edited by user:" + getCurrentJMXUser());
- output.close();
-
- // Rename new file to main file
- tmp.renameTo(rights);
-
- // delete tmp
- tmp.delete();
- }
- catch (IOException e)
- {
- _logger.warn("Problem occured saving '" + _accessFileName + "' changes may not be preserved. :" + e);
- }
- }
- finally
- {
- if (_accessRightsUpdate.isHeldByCurrentThread())
- {
- _accessRightsUpdate.unlock();
- }
- }
- }
-
- private String getCurrentJMXUser()
- {
- AccessControlContext acc = AccessController.getContext();
- Subject subject = Subject.getSubject(acc);
-
- // Retrieve JMXPrincipal from Subject
- Set<JMXPrincipal> principals = subject.getPrincipals(JMXPrincipal.class);
- if (principals == null || principals.isEmpty())
- {
- return "Unknown user principals were null";
- }
-
- Principal principal = principals.iterator().next();
- return principal.getName();
- }
-
- /**
- * user=read user=write user=readwrite user=admin
- *
- * @param accessRights The properties list of access rights to process
- */
- private void setAccessRights(Properties accessRights)
- {
- _logger.debug("Setting Access Rights:" + accessRights);
- _accessRights = accessRights;
- MBeanInvocationHandlerImpl.setAccessRights(_accessRights);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/management/UserManagement.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/management/UserManagement.java
deleted file mode 100644
index 658d7ebbd3..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/management/UserManagement.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access.management;
-
-import org.apache.qpid.server.management.MBeanOperation;
-import org.apache.qpid.server.management.MBeanOperationParameter;
-import org.apache.qpid.server.management.MBeanAttribute;
-import org.apache.qpid.AMQException;
-
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.CompositeData;
-import javax.management.JMException;
-import javax.management.MBeanOperationInfo;
-import java.io.IOException;
-
-public interface UserManagement
-{
- String TYPE = "UserManagement";
-
- //********** Operations *****************//
- /**
- * set password for user
- *
- * @param username The username to create
- * @param password The password for the user
- *
- * @return The result of the operation
- */
- @MBeanOperation(name = "setPassword", description = "Set password for user.",
- impact = MBeanOperationInfo.ACTION)
- boolean setPassword(@MBeanOperationParameter(name = "username", description = "Username")String username,
- @MBeanOperationParameter(name = "password", description = "Password")char[] password);
-
- /**
- * set rights for users with given details
- *
- * @param username The username to create
- * @param read The set of permission to give the new user
- * @param write The set of permission to give the new user
- * @param admin The set of permission to give the new user
- *
- * @return The result of the operation
- */
- @MBeanOperation(name = "setRights", description = "Set access rights for user.",
- impact = MBeanOperationInfo.ACTION)
- boolean setRights(@MBeanOperationParameter(name = "username", description = "Username")String username,
- @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
- @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
- @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
-
- /**
- * Create users with given details
- *
- * @param username The username to create
- * @param password The password for the user
- * @param read The set of permission to give the new user
- * @param write The set of permission to give the new user
- * @param admin The set of permission to give the new user
- *
- * @return The result of the operation
- */
- @MBeanOperation(name = "createUser", description = "Create new user from system.",
- impact = MBeanOperationInfo.ACTION)
- boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
- @MBeanOperationParameter(name = "password", description = "Password")char[] password,
- @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
- @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
- @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
-
- /**
- * View users returns all the users that are currently available to the system.
- *
- * @param username The user to delete
- *
- * @return The result of the operation
- */
- @MBeanOperation(name = "deleteUser", description = "Delete user from system.",
- impact = MBeanOperationInfo.ACTION)
- boolean deleteUser(@MBeanOperationParameter(name = "username", description = "Username")String username);
-
-
- /**
- * Reload the date from disk
- *
- * @return The result of the operation
- */
- @MBeanOperation(name = "reloadData", description = "Reload the authentication file from disk.",
- impact = MBeanOperationInfo.ACTION)
- boolean reloadData();
-
- /**
- * View users returns all the users that are currently available to the system.
- *
- * @return a table of users data (Username, read, write, admin)
- */
- @MBeanOperation(name = "viewUsers", description = "All users with access rights to the system.",
- impact = MBeanOperationInfo.INFO)
- TabularData viewUsers();
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/AllowAll.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/AllowAll.java
deleted file mode 100644
index a51061aa0d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/AllowAll.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access.plugins;
-
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.security.access.ACLManager;
-import org.apache.qpid.server.security.access.AccessResult;
-import org.apache.qpid.server.security.access.Accessable;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.commons.configuration.Configuration;
-
-public class AllowAll implements ACLPlugin
-{
- public AccessResult authorise(AMQProtocolSession session, Permission permission, AMQMethodBody body, Object... parameters)
- {
- if (ACLManager.getLogger().isInfoEnabled())
- {
- ACLManager.getLogger().info("Allowing user:" + session.getAuthorizedID() + " for :" + permission.toString()
- + " on " + body.getClass().getSimpleName()
- + (parameters == null || parameters.length == 0 ? "" : "-" + accessablesToString(parameters)));
- }
-
- return new AccessResult(this, AccessResult.AccessStatus.GRANTED);
- }
-
- public static String accessablesToString(Object[] accessObject)
- {
- StringBuilder sb = new StringBuilder();
-
- for (Object access : accessObject)
- {
- sb.append(access.getClass().getSimpleName() + ":" + access.toString() + ", ");
- }
-
- return sb.delete(sb.length() - 2, sb.length()).toString();
- }
-
- public String getPluginName()
- {
- return "AllowAll";
- }
-
- public void setConfiguaration(Configuration config)
- {
- //no-op
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/DenyAll.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/DenyAll.java
deleted file mode 100644
index 80c125e737..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/DenyAll.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.access.plugins;
-
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.security.access.ACLManager;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.security.access.AccessResult;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.commons.configuration.Configuration;
-
-public class DenyAll implements ACLPlugin
-{
- public AccessResult authorise(AMQProtocolSession session, Permission permission, AMQMethodBody body, Object... parameters) throws AMQConnectionException
- {
-
- if (ACLManager.getLogger().isInfoEnabled())
- {
- }
- ACLManager.getLogger().info("Denying user:" + session.getAuthorizedID() + " for :" + permission.toString()
- + " on " + body.getClass().getSimpleName()
- + (parameters == null || parameters.length == 0 ? "" : "-" + AllowAll.accessablesToString(parameters)));
-
- throw body.getConnectionException(AMQConstant.ACCESS_REFUSED, "DenyAll Plugin");
- }
-
- public String getPluginName()
- {
- return "DenyAll";
- }
-
- public void setConfiguaration(Configuration config)
- {
- //no-op
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/SimpleXML.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/SimpleXML.java
deleted file mode 100644
index c09cdc33f5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/SimpleXML.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.server.security.access.plugins;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.BasicConsumeBody;
-import org.apache.qpid.framing.BasicPublishBody;
-
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.security.access.ACLManager;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.security.access.AccessResult;
-import org.apache.qpid.server.security.access.Permission;
-import org.apache.qpid.server.security.access.PrincipalPermissions;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * This uses the default
- */
-public class SimpleXML implements ACLPlugin
-{
- private static final Logger _logger = ACLManager.getLogger();
-
- private Map<String, PrincipalPermissions> _users;
-
- public SimpleXML()
- {
- _users = new ConcurrentHashMap<String, PrincipalPermissions>();
- }
-
- public void setConfiguaration(Configuration config)
- {
- _logger.info("SimpleXML Configuration");
-
- processConfig(config);
- }
-
- private void processConfig(Configuration config)
- {
- processPublish(config);
-
- processConsume(config);
-
- processCreate(config);
- }
-
- /**
- * Publish format takes
- * Exchange + Routing Key Pairs
- *
- * @param config XML Configuration
- */
- private void processPublish(Configuration config)
- {
- Configuration publishConfig = config.subset("security.access_control_list.publish");
-
- //Process users that have full publish permission
- String[] users = publishConfig.getStringArray("users.user");
-
- for (String user : users)
- {
- grant(Permission.PUBLISH, user);
- _logger.info("PUBLISH:GRANTED:USER:" + user + " for all destinations");
- }
-
- // Process exchange limited users
- int exchangeCount = 0;
- Configuration exchangeConfig = publishConfig.subset("exchanges.exchange(" + exchangeCount + ")");
-
- while (!exchangeConfig.isEmpty())
- {
- //Get Exchange Name
- AMQShortString exchangeName = new AMQShortString(exchangeConfig.getString("name"));
-
- //Get Routing Keys
- int keyCount = 0;
- Configuration routingkeyConfig = exchangeConfig.subset("routing_keys.routing_key(" + keyCount + ")");
-
- while (!routingkeyConfig.isEmpty())
- {
- //Get RoutingKey Value
- AMQShortString routingKeyValue = new AMQShortString(routingkeyConfig.getString("value"));
-
- //Apply Exchange + RoutingKey permissions to Users
- users = routingkeyConfig.getStringArray("users.user");
- for (String user : users)
- {
- grant(Permission.PUBLISH, user, exchangeName, routingKeyValue);
- _logger.info("PUBLISH:GRANTED:USER:" + user + " on Exchange '" + exchangeName + "' for key '" + routingKeyValue + "'");
- }
-
- //Apply permissions to Groups
-
- // Check for more configs
- keyCount++;
- routingkeyConfig = exchangeConfig.subset("routing_keys.routing_key(" + keyCount + ")");
- }
-
- //Apply Exchange wide permissions to Users
- users = exchangeConfig.getStringArray("exchange(" + exchangeCount + ").users.user");
-
- for (String user : users)
- {
- grant(Permission.PUBLISH, user, exchangeName);
- _logger.info("PUBLISH:GRANTED:USER:" + user + " on Exchange:" + exchangeName);
- }
-
- //Apply permissions to Groups
- exchangeCount++;
- exchangeConfig = publishConfig.subset("exchanges.exchange(" + exchangeCount + ")");
- }
- }
-
- private void grant(Permission permission, String user, Object... parameters)
- {
- PrincipalPermissions permissions = _users.get(user);
-
- if (permissions == null)
- {
- permissions = new PrincipalPermissions(user);
- }
-
- _users.put(user, permissions);
- permissions.grant(permission, parameters);
- }
-
- private void processConsume(Configuration config)
- {
- Configuration consumeConfig = config.subset("security.access_control_list.consume");
-
- // Process queue limited users
- int queueCount = 0;
- Configuration queueConfig = consumeConfig.subset("queues.queue(" + queueCount + ")");
-
- while (!queueConfig.isEmpty())
- {
- //Get queue Name
- AMQShortString queueName = new AMQShortString(queueConfig.getString("name"));
- // if there is no name then there may be a temporary element
- boolean temporary = queueConfig.containsKey("temporary");
- boolean ownQueues = queueConfig.containsKey("own_queues");
-
- //Process permissions for this queue
- String[] users = queueConfig.getStringArray("users.user");
- for (String user : users)
- {
- grant(Permission.CONSUME, user, queueName, temporary, ownQueues);
- if (temporary)
- {
- if (ownQueues)
- {
- _logger.info("CONSUME:GRANTED:USER:" + user + " on temporary queues owned by user.");
- }
- else
- {
- _logger.info("CONSUME:GRANTED:USER:" + user + " on all temporary queues.");
- }
- }
- else
- {
- _logger.info("CONSUME:GRANTED:USER:" + user + " on queue '" + queueName + "'");
- }
- }
-
- //See if we have another config
- queueCount++;
- queueConfig = consumeConfig.subset("queues.queue(" + queueCount + ")");
- }
-
- // Process users that have full consume permission
- String[] users = consumeConfig.getStringArray("users.user");
-
- for (String user : users)
- {
- grant(Permission.CONSUME, user);
- _logger.info("CONSUME:GRANTED:USER:" + user + " from all queues.");
- }
- }
-
- private void processCreate(Configuration config)
- {
- Configuration createConfig = config.subset("security.access_control_list.create");
-
- // Process create permissions for queue creation
- int queueCount = 0;
- Configuration queueConfig = createConfig.subset("queues.queue(" + queueCount + ")");
-
- while (!queueConfig.isEmpty())
- {
- //Get queue Name
- AMQShortString queueName = new AMQShortString(queueConfig.getString("name"));
-
- // if there is no name then there may be a temporary element
- boolean temporary = queueConfig.containsKey("temporary");
-
- int exchangeCount = 0;
- Configuration exchangeConfig = queueConfig.subset("exchanges.exchange(" + exchangeCount + ")");
-
- while (!exchangeConfig.isEmpty())
- {
-
- AMQShortString exchange = new AMQShortString(exchangeConfig.getString("name"));
- AMQShortString routingKey = new AMQShortString(exchangeConfig.getString("routing_key"));
-
- //Process permissions for this queue
- String[] users = exchangeConfig.getStringArray("users.user");
- for (String user : users)
- {
- grant(Permission.CREATE, user, temporary,
- (queueName.equals("") ? null : queueName),
- (exchange.equals("") ? null : exchange),
- (routingKey.equals("") ? null : routingKey));
-
- _logger.info("CREATE :GRANTED:USER:" + user + " for "
- + (queueName.equals("") ? "" : "queue '" + queueName + "' ")
- + (exchange.equals("") ? "" : "exchange '" + exchange + "' ")
- + (routingKey.equals("") ? "" : " rk '" + routingKey + "' ")
- + (temporary ? " temporary:" + temporary : ""));
- }
-
- //See if we have another config
- exchangeCount++;
- exchangeConfig = queueConfig.subset("exchanges.exchange(" + exchangeCount + ")");
- }
-
- // Process users that are not bound to an exchange
- String[] users = queueConfig.getStringArray("users.user");
-
- for (String user : users)
- {
- grant(Permission.CREATE, user, temporary, queueName);
- if (temporary)
- {
- _logger.info("CREATE :GRANTED:USER:" + user + " from temporary queues on any exchange.");
- }
- else
- {
- _logger.info("CREATE :GRANTED:USER:" + user + " from queue '" + queueName + "' on any exchange.");
- }
- }
-
- //See if we have another config
- queueCount++;
- queueConfig = createConfig.subset("queues.queue(" + queueCount + ")");
- }
-
- // Process create permissions for exchange creation
- int exchangeCount = 0;
- Configuration exchangeConfig = createConfig.subset("exchanges.exchange(" + exchangeCount + ")");
-
- while (!exchangeConfig.isEmpty())
- {
- AMQShortString exchange = new AMQShortString(exchangeConfig.getString("name"));
- AMQShortString clazz = new AMQShortString(exchangeConfig.getString("class"));
-
- //Process permissions for this queue
- String[] users = exchangeConfig.getStringArray("users.user");
- for (String user : users)
- {
- grant(Permission.CREATE, user, exchange, clazz);
- _logger.info("CREATE:GRANTED:USER:" + user + " for exchange '" + exchange + ":class:'" + clazz);
- }
-
- //See if we have another config
- exchangeCount++;
- exchangeConfig = queueConfig.subset("exchanges.exchange(" + exchangeCount + ")");
- }
-
- // Process users that have full create permission
- String[] users = createConfig.getStringArray("users.user");
-
- for (String user : users)
- {
- grant(Permission.CREATE, user);
- _logger.info("CREATE:GRANTED:USER:" + user + " from all queues & exchanges.");
- }
-
-
- }
-
- public String getPluginName()
- {
- return "Simple";
- }
-
- public AccessResult authorise(AMQProtocolSession session, Permission permission, AMQMethodBody body, Object... parameters) throws AMQConnectionException
- {
- String error = "";
-
- if (ACLManager.getLogger().isInfoEnabled())
- {
- ACLManager.getLogger().info("Simple Authorisation processing user:" + session.getAuthorizedID() + " for :" + permission.toString()
- + " on " + body.getClass().getSimpleName()
- + (parameters == null || parameters.length == 0 ? "" : "-" + AllowAll.accessablesToString(parameters)));
- }
-
- String username = session.getAuthorizedID().getName();
-
- //Get the Users Permissions
- PrincipalPermissions permissions = _users.get(username);
-
- _logger.warn("Processing :" + permission + " for:" + username + ":" + permissions+":"+parameters.length);
-
- if (permissions != null)
- {
- switch (permission)
- {
- case ACCESS:
- _logger.warn("GRANTED:"+permission);
- return new AccessResult(this, AccessResult.AccessStatus.GRANTED);
- case BIND: // Body QueueDeclareBody - Parameters : Exchange, Queue, QueueName
- // Body QueueBindBody - Paramters : Exchange, Queue, QueueName
- if (parameters.length == 3)
- {
- // Parameters : Exchange, Queue, RoutingKey
- if (permissions.authorise(Permission.BIND, body, parameters[0], parameters[1], parameters[2]))
- {
- _logger.warn("GRANTED:"+permission);
- return new AccessResult(this, AccessResult.AccessStatus.GRANTED);
- }
- }
- break;
- case CONSUME: // Parameters : none
- if (parameters.length == 1 && permissions.authorise(Permission.CONSUME, parameters[0]))
- {
- _logger.warn("GRANTED:"+permission);
- return new AccessResult(this, AccessResult.AccessStatus.GRANTED);
- }
- break;
- case CREATE: // Body : QueueDeclareBody | ExchangeDeclareBody - Parameters : none
- if (permissions.authorise(Permission.CREATE, body))
- {
- _logger.warn("GRANTED:"+permission);
- return new AccessResult(this, AccessResult.AccessStatus.GRANTED);
- }
- break;
- case PUBLISH: // Body : BasicPublishBody Parameters : exchange
- if (parameters.length == 1 && parameters[0] instanceof Exchange)
- {
- if (permissions.authorise(Permission.PUBLISH, ((Exchange) parameters[0]).getName(),
- ((BasicPublishBody) body).getRoutingKey()))
- {
- _logger.warn("GRANTED:"+permission);
- return new AccessResult(this, AccessResult.AccessStatus.GRANTED);
- }
- }
- break;
- case PURGE:
- break;
- case DELETE:
- break;
- case UNBIND:
- break;
- }
- }
-
- _logger.warn("Access Denied for :" + permission + " for:" + username + ":" + permissions);
- //todo potential refactor this ConnectionException Out of here
- throw body.getConnectionException(AMQConstant.ACCESS_REFUSED, error);
- }
-
-//todo use or lose
-// if (accessObject instanceof VirtualHost)
-// {
-// VirtualHostAccess[] hosts = lookupVirtualHost(user.getName());
-//
-// if (hosts != null)
-// {
-// for (VirtualHostAccess host : hosts)
-// {
-// if (accessObject.getAccessableName().equals(host.getVirtualHost()))
-// {
-// if (host.getAccessRights().allows(rights))
-// {
-// return new AccessResult(this, AccessResult.AccessStatus.GRANTED);
-// }
-// else
-// {
-// return new AccessResult(this, AccessResult.AccessStatus.REFUSED);
-// }
-// }
-// }
-// }
-// }
-// else if (accessObject instanceof AMQQueue)
-// {
-// String[] queues = lookupQueue(username, ((AMQQueue) accessObject).getVirtualHost());
-//
-// if (queues != null)
-// {
-// for (String queue : queues)
-// {
-// if (accessObject.getAccessableName().equals(queue))
-// {
-// return new AccessResult(this, AccessResult.AccessStatus.GRANTED);
-// }
-// }
-// }
-// }
-
-// return new AccessResult(this, AccessResult.AccessStatus.REFUSED);
-// }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java
deleted file mode 100644
index 0e3aea4de0..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.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.server.security.auth;
-
-public class AuthenticationResult
-{
- public enum AuthenticationStatus
- {
- SUCCESS, CONTINUE, ERROR
- }
-
- public AuthenticationStatus status;
- public byte[] challenge;
-
- public AuthenticationResult(byte[] challenge, AuthenticationStatus status)
- {
- this.status = status;
- this.challenge = challenge;
- }
-
- public AuthenticationResult(AuthenticationStatus status)
- {
- this.status = status;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java
deleted file mode 100644
index 348bccb4e9..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.auth.database;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.server.security.auth.sasl.AuthenticationProviderInitialiser;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
-import org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5HashedInitialiser;
-import org.apache.qpid.server.security.access.management.AMQUserManagementMBean;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.codec.EncoderException;
-
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.login.AccountNotFoundException;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.UnsupportedEncodingException;
-import java.io.PrintStream;
-import java.util.regex.Pattern;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.concurrent.locks.ReentrantLock;
-import java.security.Principal;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * Represents a user database where the account information is stored in a simple flat file.
- *
- * The file is expected to be in the form: username:password username1:password1 ... usernamen:passwordn
- *
- * where a carriage return separates each username/password pair. Passwords are assumed to be in plain text.
- */
-public class Base64MD5PasswordFilePrincipalDatabase implements PrincipalDatabase
-{
- private static final Logger _logger = Logger.getLogger(Base64MD5PasswordFilePrincipalDatabase.class);
-
- private File _passwordFile;
-
- private Pattern _regexp = Pattern.compile(":");
-
- private Map<String, AuthenticationProviderInitialiser> _saslServers;
-
- AMQUserManagementMBean _mbean;
- private static final String DEFAULT_ENCODING = "utf-8";
- private Map<String, User> _users = new HashMap<String, User>();
- private ReentrantLock _userUpdate = new ReentrantLock();
-
- public Base64MD5PasswordFilePrincipalDatabase()
- {
- _saslServers = new HashMap<String, AuthenticationProviderInitialiser>();
-
- /**
- * Create Authenticators for MD5 Password file.
- */
-
- // Accept Plain incomming and hash it for comparison to the file.
- CRAMMD5HashedInitialiser cram = new CRAMMD5HashedInitialiser();
- cram.initialise(this);
- _saslServers.put(cram.getMechanismName(), cram);
-
- //fixme The PDs should setup a PD Mangement MBean
-// try
-// {
-// _mbean = new AMQUserManagementMBean();
-// _mbean.setPrincipalDatabase(this);
-// }
-// catch (JMException e)
-// {
-// _logger.warn("User management disabled as unable to create MBean:" + e);
-// }
- }
-
- public void setPasswordFile(String passwordFile) throws IOException
- {
- File f = new File(passwordFile);
- _logger.info("PasswordFilePrincipalDatabase using file " + f.getAbsolutePath());
- _passwordFile = f;
- if (!f.exists())
- {
- throw new FileNotFoundException("Cannot find password file " + f);
- }
- if (!f.canRead())
- {
- throw new FileNotFoundException("Cannot read password file " + f +
- ". Check permissions.");
- }
-
- loadPasswordFile();
- }
-
- /**
- * SASL Callback Mechanism - sets the Password in the PasswordCallback based on the value in the PasswordFile
- *
- * @param principal The Principal to set the password for
- * @param callback The PasswordCallback to call setPassword on
- *
- * @throws AccountNotFoundException If the Principal cannont be found in this Database
- */
- public void setPassword(Principal principal, PasswordCallback callback) throws AccountNotFoundException
- {
- if (_passwordFile == null)
- {
- throw new AccountNotFoundException("Unable to locate principal since no password file was specified during initialisation");
- }
- if (principal == null)
- {
- throw new IllegalArgumentException("principal must not be null");
- }
-
- char[] pwd = lookupPassword(principal.getName());
-
- if (pwd != null)
- {
- callback.setPassword(pwd);
- }
- else
- {
- throw new AccountNotFoundException("No account found for principal " + principal);
- }
- }
-
- /**
- * Used to verify that the presented Password is correct. Currently only used by Management Console
- *
- * @param principal The principal to authenticate
- * @param password The password to check
- *
- * @return true if password is correct
- *
- * @throws AccountNotFoundException if the principal cannot be found
- */
- public boolean verifyPassword(String principal, char[] password) throws AccountNotFoundException
- {
- char[] pwd = lookupPassword(principal);
-
- int index = 0;
- boolean verified = true;
-
- while (verified & index < password.length)
- {
- verified = (pwd[index] == password[index]);
- index++;
- }
- return verified;
- }
-
- public boolean updatePassword(Principal principal, char[] password) throws AccountNotFoundException
- {
- User user = _users.get(principal.getName());
-
- if (user == null)
- {
- throw new AccountNotFoundException(principal.getName());
- }
-
- try
- {
- try
- {
- _userUpdate.lock();
- char[] orig = user.getPassword();
- user.setPassword(password);
-
- try
- {
- savePasswordFile();
- }
- catch (IOException e)
- {
- _logger.error("Unable to save password file, password change for user'"
- + principal + "' will revert at restart");
- //revert the password change
- user.setPassword(orig);
- return false;
- }
- return true;
- }
- finally
- {
- if (_userUpdate.isHeldByCurrentThread())
- {
- _userUpdate.unlock();
- }
- }
- }
- catch (Exception e)
- {
- return false;
- }
- }
-
- public boolean createPrincipal(Principal principal, char[] password)
- {
- if (_users.get(principal.getName()) != null)
- {
- return false;
- }
-
- User user = new User(principal.getName(), password);
-
- try
- {
- _userUpdate.lock();
- _users.put(user.getName(), user);
-
- try
- {
- savePasswordFile();
- return true;
- }
- catch (IOException e)
- {
- //remove the use on failure.
- _users.remove(user.getName());
- return false;
- }
- }
- finally
- {
- if (_userUpdate.isHeldByCurrentThread())
- {
- _userUpdate.unlock();
- }
- }
- }
-
- public boolean deletePrincipal(Principal principal) throws AccountNotFoundException
- {
- User user = _users.get(principal.getName());
-
- if (user == null)
- {
- throw new AccountNotFoundException(principal.getName());
- }
-
- try
- {
- _userUpdate.lock();
- user.delete();
-
- try
- {
- savePasswordFile();
- }
- catch (IOException e)
- {
- _logger.warn("Unable to remove user '" + user.getName() + "' from password file.");
- return false;
- }
-
- _users.remove(user.getName());
- }
- finally
- {
- if (_userUpdate.isHeldByCurrentThread())
- {
- _userUpdate.unlock();
- }
- }
-
- return true;
- }
-
-
- public Map<String, AuthenticationProviderInitialiser> getMechanisms()
- {
- return _saslServers;
- }
-
- public List<Principal> getUsers()
- {
- return new LinkedList<Principal>(_users.values());
- }
-
- public Principal getUser(String username)
- {
- if (_users.containsKey(username))
- {
- return new UsernamePrincipal(username);
- }
- return null;
- }
-
- /**
- * Looks up the password for a specified user in the password file. Note this code is <b>not</b> secure since it
- * creates strings of passwords. It should be modified to create only char arrays which get nulled out.
- *
- * @param name The principal name to lookup
- *
- * @return a char[] for use in SASL.
- */
- private char[] lookupPassword(String name)
- {
- User user = _users.get(name);
- if (user == null)
- {
- return null;
- }
- else
- {
- return user.getPassword();
- }
- }
-
-
- private void loadPasswordFile() throws IOException
- {
- try
- {
- _userUpdate.lock();
- _users.clear();
-
- BufferedReader reader = null;
- try
- {
- reader = new BufferedReader(new FileReader(_passwordFile));
- String line;
-
- while ((line = reader.readLine()) != null)
- {
- String[] result = _regexp.split(line);
- if (result == null || result.length < 2 || result[0].startsWith("#"))
- {
- continue;
- }
-
- User user = new User(result);
- _logger.info("Created user:" + user);
- _users.put(user.getName(), user);
- }
- }
- finally
- {
- if (reader != null)
- {
- reader.close();
- }
- }
- }
- finally
- {
- if (_userUpdate.isHeldByCurrentThread())
- {
- _userUpdate.unlock();
- }
- }
- }
-
- private void savePasswordFile() throws IOException
- {
- try
- {
- _userUpdate.lock();
-
- BufferedReader reader = null;
- PrintStream writer = null;
- File tmp = new File(_passwordFile.getAbsolutePath() + ".tmp");
- if (tmp.exists())
- {
- tmp.delete();
- }
- try
- {
- writer = new PrintStream(tmp);
- reader = new BufferedReader(new FileReader(_passwordFile));
- String line;
-
- while ((line = reader.readLine()) != null)
- {
- String[] result = _regexp.split(line);
- if (result == null || result.length < 2 || result[0].startsWith("#"))
- {
- writer.write(line.getBytes(DEFAULT_ENCODING));
- continue;
- }
-
- User user = _users.get(result[0]);
-
- if (user == null)
- {
- writer.write(line.getBytes(DEFAULT_ENCODING));
- writer.println();
- }
- else if (!user.isDeleted())
- {
- if (!user.isModified())
- {
- writer.write(line.getBytes(DEFAULT_ENCODING));
- writer.println();
- }
- else
- {
- try
- {
- byte[] encodedPassword = user.getEncodePassword();
-
- writer.write((user.getName() + ":").getBytes(DEFAULT_ENCODING));
- writer.write(encodedPassword);
- writer.println();
-
- user.saved();
- }
- catch (Exception e)
- {
- _logger.warn("Unable to encode new password reverting to old password.");
- writer.write(line.getBytes(DEFAULT_ENCODING));
- writer.println();
- }
- }
- }
- }
-
- for (User user : _users.values())
- {
- if (user.isModified())
- {
- byte[] encodedPassword;
- try
- {
- encodedPassword = user.getEncodePassword();
- writer.write((user.getName() + ":").getBytes(DEFAULT_ENCODING));
- writer.write(encodedPassword);
- writer.println();
- user.saved();
- }
- catch (Exception e)
- {
- _logger.warn("Unable to get Encoded password for user'" + user.getName() + "' password not saved");
- }
- }
- }
- }
- finally
- {
- if (reader != null)
- {
- reader.close();
- }
-
- if (writer != null)
- {
- writer.close();
- }
-
- // Swap temp file to main password file.
- File old = new File(_passwordFile.getAbsoluteFile() + ".old");
- if (old.exists())
- {
- old.delete();
- }
- _passwordFile.renameTo(old);
- tmp.renameTo(_passwordFile);
- tmp.delete();
- }
- }
- finally
- {
- if (_userUpdate.isHeldByCurrentThread())
- {
- _userUpdate.unlock();
- }
- }
- }
-
- private class User implements Principal
- {
- String _name;
- char[] _password;
- byte[] _encodedPassword = null;
- private boolean _modified = false;
- private boolean _deleted = false;
-
- User(String[] data) throws UnsupportedEncodingException
- {
- if (data.length != 2)
- {
- throw new IllegalArgumentException("User Data should be lenght 2, username, password");
- }
-
- _name = data[0];
-
- byte[] encoded_password = data[1].getBytes(DEFAULT_ENCODING);
-
- Base64 b64 = new Base64();
- byte[] decoded = b64.decode(encoded_password);
-
- _encodedPassword = encoded_password;
-
- _password = new char[decoded.length];
-
- int index = 0;
- for (byte c : decoded)
- {
- _password[index++] = (char) c;
- }
- }
-
- public User(String name, char[] password)
- {
- _name = name;
- setPassword(password);
- }
-
- public String getName()
- {
- return _name;
- }
-
- public String toString()
- {
- if (_logger.isDebugEnabled())
- {
- return getName() + ((_encodedPassword == null) ? "" : ":" + new String(_encodedPassword));
- }
- else
- {
- return _name;
- }
- }
-
- char[] getPassword()
- {
- return _password;
- }
-
- void setPassword(char[] password)
- {
- _password = password;
- _modified = true;
- _encodedPassword = null;
- }
-
-
- byte[] getEncodePassword() throws EncoderException, UnsupportedEncodingException, NoSuchAlgorithmException
- {
- if (_encodedPassword == null)
- {
- encodePassword();
- }
- return _encodedPassword;
- }
-
- private void encodePassword() throws EncoderException, UnsupportedEncodingException, NoSuchAlgorithmException
- {
- byte[] byteArray = new byte[_password.length];
- int index = 0;
- for (char c : _password)
- {
- byteArray[index++] = (byte) c;
- }
- _encodedPassword = (new Base64()).encode(byteArray);
- }
-
- public boolean isModified()
- {
- return _modified;
- }
-
- public boolean isDeleted()
- {
- return _deleted;
- }
-
- public void delete()
- {
- _deleted = true;
- }
-
- public void saved()
- {
- _modified = false;
- }
-
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/ConfigurationFilePrincipalDatabaseManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/ConfigurationFilePrincipalDatabaseManager.java
deleted file mode 100644
index c417d7e244..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/ConfigurationFilePrincipalDatabaseManager.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.server.security.auth.database;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.configuration.PropertyUtils;
-import org.apache.qpid.configuration.PropertyException;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabaseManager;
-import org.apache.qpid.server.security.access.management.AMQUserManagementMBean;
-import org.apache.qpid.AMQException;
-
-import javax.management.JMException;
-
-public class ConfigurationFilePrincipalDatabaseManager implements PrincipalDatabaseManager
-{
- private static final Logger _logger = Logger.getLogger(ConfigurationFilePrincipalDatabaseManager.class);
-
- private static final String _base = "security.principal-databases.principal-database";
-
- Map<String, PrincipalDatabase> _databases;
-
- public ConfigurationFilePrincipalDatabaseManager() throws Exception
- {
- _logger.info("Initialising PrincipleDatabase authentication manager");
- _databases = initialisePrincipalDatabases();
- }
-
- private Map<String, PrincipalDatabase> initialisePrincipalDatabases() throws Exception
- {
- Configuration config = ApplicationRegistry.getInstance().getConfiguration();
- List<String> databaseNames = config.getList(_base + ".name");
- List<String> databaseClasses = config.getList(_base + ".class");
- Map<String, PrincipalDatabase> databases = new HashMap<String, PrincipalDatabase>();
-
- if (databaseNames.size() == 0)
- {
- _logger.warn("No Principal databases specified. Broker running with NO AUTHENTICATION");
- }
-
- for (int i = 0; i < databaseNames.size(); i++)
- {
- Object o;
- try
- {
- o = Class.forName(databaseClasses.get(i)).newInstance();
- }
- catch (Exception e)
- {
- throw new Exception("Error initialising principal database: " + e, e);
- }
-
- if (!(o instanceof PrincipalDatabase))
- {
- throw new Exception("Principal databases must implement the PrincipalDatabase interface");
- }
-
- initialisePrincipalDatabase((PrincipalDatabase) o, config, i);
-
- String name = databaseNames.get(i);
- if ((name == null) || (name.length() == 0))
- {
- throw new Exception("Principal database names must have length greater than or equal to one character");
- }
-
- PrincipalDatabase pd = databases.get(name);
- if (pd != null)
- {
- throw new Exception("Duplicate principal database name not provided");
- }
-
- _logger.info("Initialised principal database '" + name + "' successfully");
- databases.put(name, (PrincipalDatabase) o);
- }
-
- return databases;
- }
-
- private void initialisePrincipalDatabase(PrincipalDatabase principalDatabase, Configuration config, int index)
- throws FileNotFoundException, ConfigurationException
- {
- String baseName = _base + "(" + index + ").attributes.attribute.";
- List<String> argumentNames = config.getList(baseName + "name");
- List<String> argumentValues = config.getList(baseName + "value");
- for (int i = 0; i < argumentNames.size(); i++)
- {
- String argName = argumentNames.get(i);
- if ((argName == null) || (argName.length() == 0))
- {
- throw new ConfigurationException("Argument names must have length >= 1 character");
- }
-
- if (Character.isLowerCase(argName.charAt(0)))
- {
- argName = Character.toUpperCase(argName.charAt(0)) + argName.substring(1);
- }
-
- String methodName = "set" + argName;
- Method method = null;
- try
- {
- method = principalDatabase.getClass().getMethod(methodName, String.class);
- }
- catch (Exception e)
- {
- // do nothing.. as on error method will be null
- }
-
- if (method == null)
- {
- throw new ConfigurationException("No method " + methodName + " found in class "
- + principalDatabase.getClass()
- + " hence unable to configure principal database. The method must be public and "
- + "have a single String argument with a void return type");
- }
-
- try
- {
- method.invoke(principalDatabase, PropertyUtils.replaceProperties(argumentValues.get(i)));
- }
- catch (Exception ite)
- {
- if (ite instanceof ConfigurationException)
- {
- throw(ConfigurationException) ite;
- }
- else
- {
- throw new ConfigurationException(ite.getMessage(), ite);
- }
- }
- }
- }
-
- public Map<String, PrincipalDatabase> getDatabases()
- {
- return _databases;
- }
-
- public void initialiseManagement(Configuration config) throws ConfigurationException
- {
- try
- {
- AMQUserManagementMBean _mbean = new AMQUserManagementMBean();
-
- String baseSecurity = "security.jmx";
- List<String> principalDBs = config.getList(baseSecurity + ".principal-database");
-
- if (principalDBs.size() == 0)
- {
- throw new ConfigurationException("No principal-database specified for jmx security(" + baseSecurity + ".principal-database)");
- }
-
- String databaseName = principalDBs.get(0);
-
- PrincipalDatabase database = getDatabases().get(databaseName);
-
- if (database == null)
- {
- throw new ConfigurationException("Principal-database '" + databaseName + "' not found");
- }
-
- _mbean.setPrincipalDatabase(database);
-
- List<String> jmxaccesslist = config.getList(baseSecurity + ".access");
-
- if (jmxaccesslist.size() == 0)
- {
- throw new ConfigurationException("No access control files specified for jmx security(" + baseSecurity + ".access)");
- }
-
- String jmxaccesssFile = null;
-
- try
- {
- jmxaccesssFile = PropertyUtils.replaceProperties(jmxaccesslist.get(0));
- }
- catch (PropertyException e)
- {
- throw new ConfigurationException("Unable to parse access control filename '" + jmxaccesssFile + "'");
- }
-
- try
- {
- _mbean.setAccessFile(jmxaccesssFile);
- }
- catch (IOException e)
- {
- _logger.warn("Unable to load access file:" + jmxaccesssFile);
- }
-
- try
- {
- _mbean.register();
- }
- catch (AMQException e)
- {
- _logger.warn("Unable to register user management MBean");
- }
- }
- catch (JMException e)
- {
- _logger.warn("User management disabled as unable to create MBean:" + e);
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java
deleted file mode 100644
index 352d41a0ba..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.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.server.security.auth.database;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.server.security.auth.sasl.AuthenticationProviderInitialiser;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
-import org.apache.qpid.server.security.auth.sasl.amqplain.AmqPlainInitialiser;
-import org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5Initialiser;
-import org.apache.qpid.server.security.auth.sasl.plain.PlainInitialiser;
-
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.login.AccountNotFoundException;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-/**
- * Represents a user database where the account information is stored in a simple flat file.
- *
- * The file is expected to be in the form: username:password username1:password1 ... usernamen:passwordn
- *
- * where a carriage return separates each username/password pair. Passwords are assumed to be in plain text.
- */
-public class PlainPasswordFilePrincipalDatabase implements PrincipalDatabase
-{
- private static final Logger _logger = Logger.getLogger(PlainPasswordFilePrincipalDatabase.class);
-
- protected File _passwordFile;
-
- protected Pattern _regexp = Pattern.compile(":");
-
- protected Map<String, AuthenticationProviderInitialiser> _saslServers;
-
- public PlainPasswordFilePrincipalDatabase()
- {
- _saslServers = new HashMap<String, AuthenticationProviderInitialiser>();
-
- /**
- * Create Authenticators for Plain Password file.
- */
-
- // Accept AMQPlain incomming and compare it to the file.
- AmqPlainInitialiser amqplain = new AmqPlainInitialiser();
- amqplain.initialise(this);
-
- // Accept Plain incomming and compare it to the file.
- PlainInitialiser plain = new PlainInitialiser();
- plain.initialise(this);
-
- // Accept MD5 incomming and Hash file value for comparison
- CRAMMD5Initialiser cram = new CRAMMD5Initialiser();
- cram.initialise(this);
-
- _saslServers.put(amqplain.getMechanismName(), amqplain);
- _saslServers.put(plain.getMechanismName(), plain);
- _saslServers.put(cram.getMechanismName(), cram);
- }
-
- public void setPasswordFile(String passwordFile) throws FileNotFoundException
- {
- File f = new File(passwordFile);
- _logger.info("PlainPasswordFile using file " + f.getAbsolutePath());
- _passwordFile = f;
- if (!f.exists())
- {
- throw new FileNotFoundException("Cannot find password file " + f);
- }
- if (!f.canRead())
- {
- throw new FileNotFoundException("Cannot read password file " + f +
- ". Check permissions.");
- }
- }
-
- public void setPassword(Principal principal, PasswordCallback callback) throws IOException,
- AccountNotFoundException
- {
- if (_passwordFile == null)
- {
- throw new AccountNotFoundException("Unable to locate principal since no password file was specified during initialisation");
- }
- if (principal == null)
- {
- throw new IllegalArgumentException("principal must not be null");
- }
- char[] pwd = lookupPassword(principal.getName());
- if (pwd != null)
- {
- callback.setPassword(pwd);
- }
- else
- {
- throw new AccountNotFoundException("No account found for principal " + principal);
- }
- }
-
- public boolean verifyPassword(String principal, char[] password) throws AccountNotFoundException
- {
- try
- {
- char[] pwd = lookupPassword(principal);
-
- return compareCharArray(pwd, password);
- }
- catch (IOException e)
- {
- return false;
- }
- }
-
- public boolean updatePassword(Principal principal, char[] password) throws AccountNotFoundException
- {
- return false; // updates denied
- }
-
- public boolean createPrincipal(Principal principal, char[] password)
- {
- return false; // updates denied
- }
-
- public boolean deletePrincipal(Principal principal) throws AccountNotFoundException
- {
- return false; // updates denied
- }
-
- public Map<String, AuthenticationProviderInitialiser> getMechanisms()
- {
- return _saslServers;
- }
-
- public List<Principal> getUsers()
- {
- return new LinkedList<Principal>(); //todo
- }
-
- public Principal getUser(String username)
- {
- try
- {
- if (lookupPassword(username) != null)
- {
- return new UsernamePrincipal(username);
- }
- }
- catch (IOException e)
- {
- //fall through to null return
- }
- return null;
- }
-
- private boolean compareCharArray(char[] a, char[] b)
- {
- boolean equal = false;
- if (a.length == b.length)
- {
- equal = true;
- int index = 0;
- while (equal && index < a.length)
- {
- equal = a[index] == b[index];
- index++;
- }
- }
- return equal;
- }
-
-
- /**
- * Looks up the password for a specified user in the password file. Note this code is <b>not</b> secure since it
- * creates strings of passwords. It should be modified to create only char arrays which get nulled out.
- *
- * @param name the name of the principal to lookup
- *
- * @return char[] of the password
- *
- * @throws java.io.IOException whilst accessing the file
- */
- private char[] lookupPassword(String name) throws IOException
- {
- BufferedReader reader = null;
- try
- {
- reader = new BufferedReader(new FileReader(_passwordFile));
- String line;
-
- while ((line = reader.readLine()) != null)
- {
- if (!line.startsWith("#"))
- {
- String[] result = _regexp.split(line);
- if (result == null || result.length < 2)
- {
- continue;
- }
-
- if (name.equals(result[0]))
- {
- return result[1].toCharArray();
- }
- }
- }
- return null;
- }
- finally
- {
- if (reader != null)
- {
- reader.close();
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabase.java
deleted file mode 100644
index a82f9ed40b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabase.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.server.security.auth.database;
-
-import org.apache.qpid.server.security.auth.sasl.AuthenticationProviderInitialiser;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.Principal;
-import java.util.Map;
-import java.util.List;
-
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.login.AccountNotFoundException;
-
-/** Represents a "user database" which is really a way of storing principals (i.e. usernames) and passwords. */
-public interface PrincipalDatabase
-{
- /**
- * Set the password for a given principal in the specified callback. This is used for certain SASL providers. The
- * user database implementation should look up the password in any way it chooses and set it in the callback by
- * calling its setPassword method.
- *
- * @param principal the principal
- * @param callback the password callback that wants to receive the password
- *
- * @throws AccountNotFoundException if the account for specified principal could not be found
- * @throws IOException if there was an error looking up the principal
- */
- void setPassword(Principal principal, PasswordCallback callback)
- throws IOException, AccountNotFoundException;
-
- /**
- * Used to verify that the presented Password is correct. Currently only used by Management Console
- * @param principal The principal to authenticate
- * @param password The password to check
- * @return true if password is correct
- * @throws AccountNotFoundException if the principal cannot be found
- */
- boolean verifyPassword(String principal, char[] password)
- throws AccountNotFoundException;
-
- /**
- * Update(Change) the password for the given principal
- * @param principal Who's password is to be changed
- * @param password The new password to use
- * @return True if change was successful
- * @throws AccountNotFoundException If the given principal doesn't exist in the Database
- */
- boolean updatePassword(Principal principal, char[] password)
- throws AccountNotFoundException;
-
- /**
- * Create a new principal in the database
- * @param principal The principal to create
- * @param password The password to set for the principal
- * @return True on a successful creation
- */
- boolean createPrincipal(Principal principal, char[] password);
-
- /**
- * Delete a principal
- * @param principal The principal to delete
- * @return True on a successful creation
- * @throws AccountNotFoundException If the given principal doesn't exist in the Database
- */
- boolean deletePrincipal(Principal principal)
- throws AccountNotFoundException;
-
- /**
- * Get the principal from the database with the given username
- * @param username of the principal to lookup
- * @return The Principal object for the given username or null if not found.
- */
- Principal getUser(String username);
-
-
- public Map<String, AuthenticationProviderInitialiser> getMechanisms();
-
-
- List<Principal> getUsers();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabaseManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabaseManager.java
deleted file mode 100644
index 2c553ae76a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabaseManager.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.server.security.auth.database;
-
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-
-import java.util.Map;
-
-public interface PrincipalDatabaseManager
-{
- public Map<String, PrincipalDatabase> getDatabases();
-
- public void initialiseManagement(Configuration config) throws ConfigurationException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java
deleted file mode 100644
index 73d58ca489..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.auth.database;
-
-import org.apache.qpid.server.security.auth.sasl.AuthenticationProviderInitialiser;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
-import org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5Initialiser;
-import org.apache.qpid.server.security.auth.sasl.plain.PlainInitialiser;
-
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.login.AccountNotFoundException;
-import java.util.Properties;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
-import java.util.LinkedList;
-import java.security.Principal;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-public class PropertiesPrincipalDatabase implements PrincipalDatabase
-{
- private Properties _users;
-
- private Map<String, AuthenticationProviderInitialiser> _saslServers;
-
- public PropertiesPrincipalDatabase(Properties users)
- {
- _users = users;
-
- _saslServers = new HashMap<String, AuthenticationProviderInitialiser>();
-
- /**
- * Create Authenticators for Properties Principal Database.
- */
-
- // Accept MD5 incomming and use plain comparison with the file
- PlainInitialiser cram = new PlainInitialiser();
- cram.initialise(this);
- // Accept Plain incomming and hash it for comparison to the file.
- CRAMMD5Initialiser plain = new CRAMMD5Initialiser();
- plain.initialise(this, CRAMMD5Initialiser.HashDirection.INCOMMING);
-
- _saslServers.put(plain.getMechanismName(), cram);
- _saslServers.put(cram.getMechanismName(), plain);
- }
-
- public void setPassword(Principal principal, PasswordCallback callback) throws IOException, AccountNotFoundException
- {
- if (principal == null)
- {
- throw new IllegalArgumentException("principal must not be null");
- }
- char[] pwd = _users.getProperty(principal.getName()).toCharArray();
- if (pwd != null)
- {
- callback.setPassword(pwd);
- }
- else
- {
- throw new AccountNotFoundException("No account found for principal " + principal);
- }
- }
-
- public boolean verifyPassword(String principal, char[] password) throws AccountNotFoundException
- {
- //fixme this is not correct as toCharArray is not safe based on the type of string.
- char[] pwd = _users.getProperty(principal).toCharArray();
-
- return compareCharArray(pwd, password);
- }
-
- public boolean updatePassword(Principal principal, char[] password) throws AccountNotFoundException
- {
- return false; // updates denied
- }
-
- public boolean createPrincipal(Principal principal, char[] password)
- {
- return false; // updates denied
- }
-
- public boolean deletePrincipal(Principal principal) throws AccountNotFoundException
- {
- return false; // updates denied
- }
-
- private boolean compareCharArray(char[] a, char[] b)
- {
- boolean equal = false;
- if (a.length == b.length)
- {
- equal = true;
- int index = 0;
- while (equal && index < a.length)
- {
- equal = a[index] == b[index];
- index++;
- }
- }
- return equal;
- }
-
- private char[] convertPassword(String password) throws UnsupportedEncodingException
- {
- byte[] passwdBytes = password.getBytes("utf-8");
-
- char[] passwd = new char[passwdBytes.length];
-
- int index = 0;
-
- for (byte b : passwdBytes)
- {
- passwd[index++] = (char) b;
- }
-
- return passwd;
- }
-
-
- public Map<String, AuthenticationProviderInitialiser> getMechanisms()
- {
- return _saslServers;
- }
-
- public List<Principal> getUsers()
- {
- return new LinkedList<Principal>(); //todo
- }
-
- public Principal getUser(String username)
- {
- if (_users.getProperty(username) != null)
- {
- return new UsernamePrincipal(username);
- }
- else
- {
- return null;
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabaseManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabaseManager.java
deleted file mode 100644
index 6b86a46bd2..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabaseManager.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.server.security.auth.database;
-
-import org.apache.commons.configuration.Configuration;
-
-import java.util.Map;
-import java.util.Properties;
-import java.util.HashMap;
-
-public class PropertiesPrincipalDatabaseManager implements PrincipalDatabaseManager
-{
-
- Map<String, PrincipalDatabase> _databases = new HashMap<String, PrincipalDatabase>();
-
- public PropertiesPrincipalDatabaseManager(String name, Properties users)
- {
- _databases.put(name, new PropertiesPrincipalDatabase(users));
- }
-
- public Map<String, PrincipalDatabase> getDatabases()
- {
- return _databases;
- }
-
- public void initialiseManagement(Configuration config)
- {
- //todo
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java
deleted file mode 100644
index bb94e0b7bf..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.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.server.security.auth.manager;
-
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.security.auth.AuthenticationResult;
-
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-
-public interface AuthenticationManager
-{
- String getMechanisms();
-
- SaslServer createSaslServer(String mechanism, String localFQDN) throws SaslException;
-
- AuthenticationResult authenticate(SaslServer server, byte[] response);
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
deleted file mode 100644
index f589140e8e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.auth.manager;
-
-import org.apache.log4j.Logger;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.SubsetConfiguration;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-import org.apache.qpid.server.security.auth.sasl.JCAProvider;
-import org.apache.qpid.server.security.auth.sasl.AuthenticationProviderInitialiser;
-import org.apache.qpid.server.security.auth.AuthenticationResult;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.sasl.SaslServerFactory;
-import javax.security.sasl.SaslServer;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.Sasl;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.TreeMap;
-import java.security.Security;
-
-public class PrincipalDatabaseAuthenticationManager implements AuthenticationManager
-{
- private static final Logger _logger = Logger.getLogger(PrincipalDatabaseAuthenticationManager.class);
-
- /** The list of mechanisms, in the order in which they are configured (i.e. preferred order) */
- private String _mechanisms;
-
- /** Maps from the mechanism to the callback handler to use for handling those requests */
- private Map<String, CallbackHandler> _callbackHandlerMap = new HashMap<String, CallbackHandler>();
-
- /**
- * Maps from the mechanism to the properties used to initialise the server. See the method Sasl.createSaslServer for
- * details of the use of these properties. This map is populated during initialisation of each provider.
- */
- private Map<String, Map<String, ?>> _serverCreationProperties = new HashMap<String, Map<String, ?>>();
-
- private AuthenticationManager _default = null;
-
- public PrincipalDatabaseAuthenticationManager(String name, Configuration hostConfig) throws Exception
- {
- _logger.info("Initialising " + (name == null ? "Default" : "'" + name + "'")
- + " PrincipleDatabase authentication manager.");
-
- // Fixme This should be done per Vhost but allowing global hack isn't right but ...
- // required as authentication is done before Vhost selection
-
- Map<String, Class<? extends SaslServerFactory>> providerMap = new TreeMap<String, Class<? extends SaslServerFactory>>();
-
-
- if (name == null || hostConfig == null)
- {
- initialiseAuthenticationMechanisms(providerMap, ApplicationRegistry.getInstance().getDatabaseManager().getDatabases());
- }
- else
- {
- String databaseName = hostConfig.getString("security.authentication.name");
-
- if (databaseName == null)
- {
-
- _default = ApplicationRegistry.getInstance().getAuthenticationManager();
- return;
- }
- else
- {
- PrincipalDatabase database = ApplicationRegistry.getInstance().getDatabaseManager().getDatabases().get(databaseName);
-
- if (database == null)
- {
- throw new ConfigurationException("Requested database:" + databaseName + " was not found");
- }
-
- initialiseAuthenticationMechanisms(providerMap, database);
- }
- }
-
- if (providerMap.size() > 0)
- {
- // Ensure we are used before the defaults
- if (Security.insertProviderAt(new JCAProvider(providerMap), 1) == -1)
- {
- _logger.warn("Unable to set order of providers.");
- }
- }
- else
- {
- _logger.warn("No additional SASL providers registered.");
- }
-
- }
-
-
- private void initialiseAuthenticationMechanisms(Map<String, Class<? extends SaslServerFactory>> providerMap, Map<String, PrincipalDatabase> databases) throws Exception
- {
-// Configuration config = ApplicationRegistry.getInstance().getConfiguration();
-// List<String> mechanisms = config.getList("security.sasl.mechanisms.mechanism.initialiser.class");
-//
-// // Maps from the mechanism to the properties used to initialise the server. See the method
-// // Sasl.createSaslServer for details of the use of these properties. This map is populated during initialisation
-// // of each provider.
-
-
- if (databases.size() > 1)
- {
- _logger.warn("More than one principle database provided currently authentication mechanism will override each other.");
- }
-
- for (Map.Entry<String, PrincipalDatabase> entry : databases.entrySet())
- {
-
- // fixme As the database now provide the mechanisms they support, they will ...
- // overwrite each other in the map. There should only be one database per vhost.
- // But currently we must have authentication before vhost definition.
- initialiseAuthenticationMechanisms(providerMap, entry.getValue());
- }
-
- }
-
- private void initialiseAuthenticationMechanisms(Map<String, Class<? extends SaslServerFactory>> providerMap, PrincipalDatabase database) throws Exception
- {
- if (database == null || database.getMechanisms().size() == 0)
- {
- _logger.warn("No Database or no mechanisms to initialise authentication");
- return;
- }
-
- for (Map.Entry<String, AuthenticationProviderInitialiser> mechanism : database.getMechanisms().entrySet())
- {
- initialiseAuthenticationMechanism(mechanism.getKey(), mechanism.getValue(), providerMap);
- }
- }
-
- private void initialiseAuthenticationMechanism(String mechanism, AuthenticationProviderInitialiser initialiser,
- Map<String, Class<? extends SaslServerFactory>> providerMap)
- throws Exception
- {
- if (_mechanisms == null)
- {
- _mechanisms = mechanism;
- }
- else
- {
- // simple append should be fine since the number of mechanisms is small and this is a one time initialisation
- _mechanisms = _mechanisms + " " + mechanism;
- }
- _callbackHandlerMap.put(mechanism, initialiser.getCallbackHandler());
- _serverCreationProperties.put(mechanism, initialiser.getProperties());
- Class<? extends SaslServerFactory> factory = initialiser.getServerFactoryClassForJCARegistration();
- if (factory != null)
- {
- providerMap.put(mechanism, factory);
- }
- _logger.info("Initialised " + mechanism + " SASL provider successfully");
- }
-
- public String getMechanisms()
- {
- if (_default != null)
- {
- // Use the default AuthenticationManager if present
- return _default.getMechanisms();
- }
- else
- {
- return _mechanisms;
- }
- }
-
- public SaslServer createSaslServer(String mechanism, String localFQDN) throws SaslException
- {
- if (_default != null)
- {
- // Use the default AuthenticationManager if present
- return _default.createSaslServer(mechanism, localFQDN);
- }
- else
- {
- return Sasl.createSaslServer(mechanism, "AMQP", localFQDN, _serverCreationProperties.get(mechanism),
- _callbackHandlerMap.get(mechanism));
- }
-
- }
-
- public AuthenticationResult authenticate(SaslServer server, byte[] response)
- {
- // Use the default AuthenticationManager if present
- if (_default != null)
- {
- return _default.authenticate(server, response);
- }
-
-
- try
- {
- // Process response from the client
- byte[] challenge = server.evaluateResponse(response != null ? response : new byte[0]);
-
- if (server.isComplete())
- {
- return new AuthenticationResult(challenge, AuthenticationResult.AuthenticationStatus.SUCCESS);
- }
- else
- {
- return new AuthenticationResult(challenge, AuthenticationResult.AuthenticationStatus.CONTINUE);
- }
- }
- catch (SaslException e)
- {
- return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR);
- }
- }
-
- public AuthenticationResult isAuthorize(VirtualHost vhost, String username)
- {
- return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/AuthenticationProviderInitialiser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/AuthenticationProviderInitialiser.java
deleted file mode 100644
index 89e545d6f5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/AuthenticationProviderInitialiser.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.auth.sasl;
-
-import java.util.Map;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.sasl.SaslServerFactory;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-
-public interface AuthenticationProviderInitialiser
-{
- /**
- * @return the mechanism's name. This will be used in the list of mechanism's advertised to the
- * client.
- */
- String getMechanismName();
-
- /**
- * Initialise the authentication provider.
- * @param baseConfigPath the path in the config file that points to any config options for this provider. Each
- * provider can have its own set of configuration options
- * @param configuration the Apache Commons Configuration instance used to configure this provider
- * @param principalDatabases the set of principal databases that are available
- * @throws Exception needs refined Exception is too broad.
- */
- void initialise(String baseConfigPath, Configuration configuration,
- Map<String, PrincipalDatabase> principalDatabases) throws Exception;
-
- /**
- * Initialise the authentication provider.
- * @param db The principal database to initialise with
- */
- void initialise(PrincipalDatabase db);
-
-
- /**
- * @return the callback handler that should be used to process authentication requests for this mechanism. This will
- * be called after initialise and will be stored by the authentication manager. The callback handler <b>must</b> be
- * fully threadsafe.
- */
- CallbackHandler getCallbackHandler();
-
- /**
- * Get the properties that must be passed in to the Sasl.createSaslServer method.
- * @return the properties, which may be null
- */
- Map<String, ?> getProperties();
-
- /**
- * Get the class that is the server factory. This is used for the JCA registration.
- * @return null if no JCA registration is required, otherwise return the class
- * that will be used in JCA registration
- */
- Class<? extends SaslServerFactory> getServerFactoryClassForJCARegistration();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/JCAProvider.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/JCAProvider.java
deleted file mode 100644
index fd4ad86055..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/JCAProvider.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.server.security.auth.sasl;
-
-import java.security.Provider;
-import java.security.Security;
-import java.util.Map;
-
-import javax.security.sasl.SaslServerFactory;
-
-public final class JCAProvider extends Provider
-{
- public JCAProvider(Map<String, Class<? extends SaslServerFactory>> providerMap)
- {
- super("AMQSASLProvider", 1.0, "A JCA provider that registers all " +
- "AMQ SASL providers that want to be registered");
- register(providerMap);
- //Security.addProvider(this);
- }
-
- private void register(Map<String, Class<? extends SaslServerFactory>> providerMap)
- {
- for (Map.Entry<String, Class<? extends SaslServerFactory>> me :
- providerMap.entrySet())
- {
- put("SaslServerFactory." + me.getKey(), me.getValue().getName());
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/UsernamePasswordInitialiser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/UsernamePasswordInitialiser.java
deleted file mode 100644
index dd0bd096c3..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/UsernamePasswordInitialiser.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.server.security.auth.sasl;
-
-import java.io.IOException;
-import java.security.Principal;
-import java.util.Map;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.AccountNotFoundException;
-import javax.security.sasl.AuthorizeCallback;
-
-import org.apache.commons.configuration.Configuration;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-import org.apache.qpid.server.security.auth.sasl.AuthenticationProviderInitialiser;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
-
-public abstract class UsernamePasswordInitialiser implements AuthenticationProviderInitialiser
-{
- protected static final Logger _logger = Logger.getLogger(UsernamePasswordInitialiser.class);
-
- private ServerCallbackHandler _callbackHandler;
-
- private class ServerCallbackHandler implements CallbackHandler
- {
- private final PrincipalDatabase _principalDatabase;
-
- protected ServerCallbackHandler(PrincipalDatabase database)
- {
- _principalDatabase = database;
- }
-
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
- {
- Principal username = null;
- for (Callback callback : callbacks)
- {
- if (callback instanceof NameCallback)
- {
- username = new UsernamePrincipal(((NameCallback) callback).getDefaultName());
- }
- else if (callback instanceof PasswordCallback)
- {
- try
- {
- _principalDatabase.setPassword(username, (PasswordCallback) callback);
- }
- catch (AccountNotFoundException e)
- {
- // very annoyingly the callback handler does not throw anything more appropriate than
- // IOException
- IOException ioe = new IOException("Error looking up user " + e);
- ioe.initCause(e);
- throw ioe;
- }
- }
- else if (callback instanceof AuthorizeCallback)
- {
- ((AuthorizeCallback) callback).setAuthorized(true);
- }
- else
- {
- throw new UnsupportedCallbackException(callback);
- }
- }
- }
- }
-
- public void initialise(String baseConfigPath, Configuration configuration,
- Map<String, PrincipalDatabase> principalDatabases) throws Exception
- {
- String principalDatabaseName = configuration.getString(baseConfigPath + ".principal-database");
- PrincipalDatabase db = principalDatabases.get(principalDatabaseName);
-
- initialise(db);
- }
-
- public void initialise(PrincipalDatabase db)
- {
- if (db == null)
- {
- throw new NullPointerException("Cannot initialise with a null Principal database.");
- }
-
- _callbackHandler = new ServerCallbackHandler(db);
- }
-
- public CallbackHandler getCallbackHandler()
- {
- return _callbackHandler;
- }
-
- public Map<String, ?> getProperties()
- {
- // there are no properties required for the CRAM-MD5 implementation
- return null;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/UsernamePrincipal.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/UsernamePrincipal.java
deleted file mode 100644
index d7c8383690..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/UsernamePrincipal.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.server.security.auth.sasl;
-
-import java.security.Principal;
-
-/** A principal that is just a wrapper for a simple username. */
-public class UsernamePrincipal implements Principal
-{
- private String _name;
-
- public UsernamePrincipal(String name)
- {
- _name = name;
- }
-
- public String getName()
- {
- return _name;
- }
-
- public String toString()
- {
- return _name;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainInitialiser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainInitialiser.java
deleted file mode 100644
index 7acc6322d1..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainInitialiser.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.server.security.auth.sasl.amqplain;
-
-import javax.security.sasl.SaslServerFactory;
-
-import org.apache.qpid.server.security.auth.sasl.UsernamePasswordInitialiser;
-
-public class AmqPlainInitialiser extends UsernamePasswordInitialiser
-{
- public String getMechanismName()
- {
- return "AMQPLAIN";
- }
-
- public Class<? extends SaslServerFactory> getServerFactoryClassForJCARegistration()
- {
- return AmqPlainSaslServerFactory.class;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainSaslServer.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainSaslServer.java
deleted file mode 100644
index 7842f376fb..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainSaslServer.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.auth.sasl.amqplain;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.sasl.AuthorizeCallback;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-
-import org.apache.mina.common.ByteBuffer;
-import org.apache.qpid.framing.AMQFrameDecodingException;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.FieldTableFactory;
-
-public class AmqPlainSaslServer implements SaslServer
-{
- public static final String MECHANISM = "AMQPLAIN";
-
- private CallbackHandler _cbh;
-
- private String _authorizationId;
-
- private boolean _complete = false;
-
- public AmqPlainSaslServer(CallbackHandler cbh)
- {
- _cbh = cbh;
- }
-
- public String getMechanismName()
- {
- return MECHANISM;
- }
-
- public byte[] evaluateResponse(byte[] response) throws SaslException
- {
- try
- {
- final FieldTable ft = FieldTableFactory.newFieldTable(ByteBuffer.wrap(response), response.length);
- String username = (String) ft.getString("LOGIN");
- // we do not care about the prompt but it throws if null
- NameCallback nameCb = new NameCallback("prompt", username);
- // we do not care about the prompt but it throws if null
- PasswordCallback passwordCb = new PasswordCallback("prompt", false);
- // TODO: should not get pwd as a String but as a char array...
- String pwd = (String) ft.getString("PASSWORD");
- passwordCb.setPassword(pwd.toCharArray());
- AuthorizeCallback authzCb = new AuthorizeCallback(username, username);
- Callback[] callbacks = new Callback[]{nameCb, passwordCb, authzCb};
- _cbh.handle(callbacks);
- _complete = true;
- if (authzCb.isAuthorized())
- {
- _authorizationId = authzCb.getAuthenticationID();
- return null;
- }
- else
- {
- throw new SaslException("Authentication failed");
- }
- }
- catch (AMQFrameDecodingException e)
- {
- throw new SaslException("Unable to decode response: " + e, e);
- }
- catch (IOException e)
- {
- throw new SaslException("Error processing data: " + e, e);
- }
- catch (UnsupportedCallbackException e)
- {
- throw new SaslException("Unable to obtain data from callback handler: " + e, e);
- }
- }
-
- public boolean isComplete()
- {
- return _complete;
- }
-
- public String getAuthorizationID()
- {
- return _authorizationId;
- }
-
- public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
- {
- throw new SaslException("Unsupported operation");
- }
-
- public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException
- {
- throw new SaslException("Unsupported operation");
- }
-
- public Object getNegotiatedProperty(String propName)
- {
- return null;
- }
-
- public void dispose() throws SaslException
- {
- _cbh = null;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainSaslServerFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainSaslServerFactory.java
deleted file mode 100644
index 67d20136bf..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/amqplain/AmqPlainSaslServerFactory.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.server.security.auth.sasl.amqplain;
-
-import java.util.Map;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.sasl.Sasl;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-import javax.security.sasl.SaslServerFactory;
-
-public class AmqPlainSaslServerFactory implements SaslServerFactory
-{
- public SaslServer createSaslServer(String mechanism, String protocol, String serverName, Map props,
- CallbackHandler cbh) throws SaslException
- {
- if (AmqPlainSaslServer.MECHANISM.equals(mechanism))
- {
- return new AmqPlainSaslServer(cbh);
- }
- else
- {
- return null;
- }
- }
-
- public String[] getMechanismNames(Map props)
- {
- if (props.containsKey(Sasl.POLICY_NOPLAINTEXT) ||
- props.containsKey(Sasl.POLICY_NODICTIONARY) ||
- props.containsKey(Sasl.POLICY_NOACTIVE))
- {
- // returned array must be non null according to interface documentation
- return new String[0];
- }
- else
- {
- return new String[]{AmqPlainSaslServer.MECHANISM};
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedInitialiser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedInitialiser.java
deleted file mode 100644
index 97f9a4e91a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedInitialiser.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.server.security.auth.sasl.crammd5;
-
-import org.apache.qpid.server.security.auth.sasl.UsernamePasswordInitialiser;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-
-import javax.security.sasl.SaslServerFactory;
-import java.util.Map;
-
-public class CRAMMD5HashedInitialiser extends UsernamePasswordInitialiser
-{
- public String getMechanismName()
- {
- return CRAMMD5HashedSaslServer.MECHANISM;
- }
-
- public Class<? extends SaslServerFactory> getServerFactoryClassForJCARegistration()
- {
- return CRAMMD5HashedServerFactory.class;
- }
-
- public void initialise(PrincipalDatabase passwordFile)
- {
- super.initialise(passwordFile);
- }
-
- public Map<String, ?> getProperties()
- {
- return null;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java
deleted file mode 100644
index f6cab084ea..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.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.server.security.auth.sasl.crammd5;
-
-import javax.security.sasl.SaslServer;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.Sasl;
-import javax.security.sasl.SaslServerFactory;
-import javax.security.auth.callback.CallbackHandler;
-import java.util.Enumeration;
-import java.util.Map;
-
-public class CRAMMD5HashedSaslServer implements SaslServer
-{
- public static final String MECHANISM = "CRAM-MD5-HASHED";
-
- private SaslServer _realServer;
-
- public CRAMMD5HashedSaslServer(String mechanism, String protocol, String serverName, Map<String, ?> props,
- CallbackHandler cbh) throws SaslException
- {
- Enumeration factories = Sasl.getSaslServerFactories();
-
- while (factories.hasMoreElements())
- {
- SaslServerFactory factory = (SaslServerFactory) factories.nextElement();
-
- if (factory instanceof CRAMMD5HashedServerFactory)
- {
- continue;
- }
-
- String[] mechs = factory.getMechanismNames(props);
-
- for (String mech : mechs)
- {
- if (mech.equals("CRAM-MD5"))
- {
- _realServer = factory.createSaslServer("CRAM-MD5", protocol, serverName, props, cbh);
- return;
- }
- }
- }
-
- throw new RuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
- }
-
- public String getMechanismName()
- {
- return MECHANISM;
- }
-
- public byte[] evaluateResponse(byte[] response) throws SaslException
- {
- return _realServer.evaluateResponse(response);
- }
-
- public boolean isComplete()
- {
- return _realServer.isComplete();
- }
-
- public String getAuthorizationID()
- {
- return _realServer.getAuthorizationID();
- }
-
- public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
- {
- return _realServer.unwrap(incoming, offset, len);
- }
-
- public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException
- {
- return _realServer.wrap(outgoing, offset, len);
- }
-
- public Object getNegotiatedProperty(String propName)
- {
- return _realServer.getNegotiatedProperty(propName);
- }
-
- public void dispose() throws SaslException
- {
- _realServer.dispose();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedServerFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedServerFactory.java
deleted file mode 100644
index 5298b5cc63..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedServerFactory.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.auth.sasl.crammd5;
-
-import java.util.Map;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.sasl.Sasl;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-import javax.security.sasl.SaslServerFactory;
-
-public class CRAMMD5HashedServerFactory implements SaslServerFactory
-{
- public SaslServer createSaslServer(String mechanism, String protocol, String serverName, Map<String, ?> props,
- CallbackHandler cbh) throws SaslException
- {
- if (mechanism.equals(CRAMMD5HashedSaslServer.MECHANISM))
- {
- return new CRAMMD5HashedSaslServer(mechanism, protocol, serverName, props, cbh);
- }
- else
- {
- return null;
- }
- }
-
- public String[] getMechanismNames(Map props)
- {
- if (props != null)
- {
- if (props.containsKey(Sasl.POLICY_NOPLAINTEXT) ||
- props.containsKey(Sasl.POLICY_NODICTIONARY) ||
- props.containsKey(Sasl.POLICY_NOACTIVE))
- {
- // returned array must be non null according to interface documentation
- return new String[0];
- }
- }
-
- return new String[]{CRAMMD5HashedSaslServer.MECHANISM};
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5Initialiser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5Initialiser.java
deleted file mode 100644
index 264832888d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5Initialiser.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.security.auth.sasl.crammd5;
-
-import org.apache.qpid.server.security.auth.sasl.UsernamePasswordInitialiser;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-
-import javax.security.sasl.SaslServerFactory;
-
-public class CRAMMD5Initialiser extends UsernamePasswordInitialiser
-{
- private HashDirection _hashDirection;
-
- public enum HashDirection
- {
- INCOMMING, PASSWORD_FILE
- }
-
-
- public String getMechanismName()
- {
- return "CRAM-MD5";
- }
-
- public Class<? extends SaslServerFactory> getServerFactoryClassForJCARegistration()
- {
- // since the CRAM-MD5 provider is registered as part of the JDK, we do not
- // return the factory class here since we do not need to register it ourselves.
- if (_hashDirection == HashDirection.PASSWORD_FILE)
- {
- return null;
- }
- else
- {
- //fixme we need a server that will correctly has the incomming plain text for comparison to file.
- _logger.warn("we need a server that will correctly convert the incomming plain text for comparison to file.");
- return null;
- }
- }
-
- public void initialise(PrincipalDatabase passwordFile)
- {
- initialise(passwordFile, HashDirection.PASSWORD_FILE);
- }
-
- public void initialise(PrincipalDatabase passwordFile, HashDirection direction)
- {
- super.initialise(passwordFile);
-
- _hashDirection = direction;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainInitialiser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainInitialiser.java
deleted file mode 100644
index 1d16cd8755..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainInitialiser.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.server.security.auth.sasl.plain;
-
-import javax.security.sasl.SaslServerFactory;
-
-import org.apache.qpid.server.security.auth.sasl.UsernamePasswordInitialiser;
-
-public class PlainInitialiser extends UsernamePasswordInitialiser
-{
- public String getMechanismName()
- {
- return "PLAIN";
- }
-
- public Class<? extends SaslServerFactory> getServerFactoryClassForJCARegistration()
- {
- return PlainSaslServerFactory.class;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServer.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServer.java
deleted file mode 100644
index 36aeb77fe1..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServer.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.server.security.auth.sasl.plain;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.sasl.AuthorizeCallback;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-
-public class PlainSaslServer implements SaslServer
-{
- public static final String MECHANISM = "PLAIN";
-
- private CallbackHandler _cbh;
-
- private String _authorizationId;
-
- private boolean _complete = false;
-
- public PlainSaslServer(CallbackHandler cbh)
- {
- _cbh = cbh;
- }
-
- public String getMechanismName()
- {
- return MECHANISM;
- }
-
- public byte[] evaluateResponse(byte[] response) throws SaslException
- {
- try
- {
- int authzidNullPosition = findNullPosition(response, 0);
- if (authzidNullPosition < 0)
- {
- throw new SaslException("Invalid PLAIN encoding, authzid null terminator not found");
- }
- int authcidNullPosition = findNullPosition(response, authzidNullPosition + 1);
- if (authcidNullPosition < 0)
- {
- throw new SaslException("Invalid PLAIN encoding, authcid null terminator not found");
- }
-
- // we do not currently support authcid in any meaningful way
- // String authcid = new String(response, 0, authzidNullPosition, "utf8");
- String authzid = new String(response, authzidNullPosition + 1, authcidNullPosition - 1, "utf8");
-
- // we do not care about the prompt but it throws if null
- NameCallback nameCb = new NameCallback("prompt", authzid);
- // we do not care about the prompt but it throws if null
- PasswordCallback passwordCb = new PasswordCallback("prompt", false);
- // TODO: should not get pwd as a String but as a char array...
- int passwordLen = response.length - authcidNullPosition - 1;
- String pwd = new String(response, authcidNullPosition + 1, passwordLen, "utf8");
- passwordCb.setPassword(pwd.toCharArray());
- AuthorizeCallback authzCb = new AuthorizeCallback(authzid, authzid);
- Callback[] callbacks = new Callback[]{nameCb, passwordCb, authzCb};
- _cbh.handle(callbacks);
- _complete = true;
- if (authzCb.isAuthorized())
- {
- _authorizationId = authzCb.getAuthenticationID();
- return null;
- }
- else
- {
- throw new SaslException("Authentication failed");
- }
- }
- catch (IOException e)
- {
- throw new SaslException("Error processing data: " + e, e);
- }
- catch (UnsupportedCallbackException e)
- {
- throw new SaslException("Unable to obtain data from callback handler: " + e, e);
- }
- }
-
- private int findNullPosition(byte[] response, int startPosition)
- {
- int position = startPosition;
- while (position < response.length)
- {
- if (response[position] == (byte) 0)
- {
- return position;
- }
- position++;
- }
- return -1;
- }
-
- public boolean isComplete()
- {
- return _complete;
- }
-
- public String getAuthorizationID()
- {
- return _authorizationId;
- }
-
- public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
- {
- throw new SaslException("Unsupported operation");
- }
-
- public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException
- {
- throw new SaslException("Unsupported operation");
- }
-
- public Object getNegotiatedProperty(String propName)
- {
- return null;
- }
-
- public void dispose() throws SaslException
- {
- _cbh = null;
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServerFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServerFactory.java
deleted file mode 100644
index f0dd9eeb6d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServerFactory.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.server.security.auth.sasl.plain;
-
-import java.util.Map;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.sasl.Sasl;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-import javax.security.sasl.SaslServerFactory;
-
-public class PlainSaslServerFactory implements SaslServerFactory
-{
- public SaslServer createSaslServer(String mechanism, String protocol, String serverName, Map props,
- CallbackHandler cbh) throws SaslException
- {
- if (PlainSaslServer.MECHANISM.equals(mechanism))
- {
- return new PlainSaslServer(cbh);
- }
- else
- {
- return null;
- }
- }
-
- public String[] getMechanismNames(Map props)
- {
- if (props.containsKey(Sasl.POLICY_NOPLAINTEXT) ||
- props.containsKey(Sasl.POLICY_NODICTIONARY) ||
- props.containsKey(Sasl.POLICY_NOACTIVE))
- {
- // returned array must be non null according to interface documentation
- return new String[0];
- }
- else
- {
- return new String[]{PlainSaslServer.MECHANISM};
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQState.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQState.java
deleted file mode 100644
index f427cc7206..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQState.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.server.state;
-
-/**
- * States used in the AMQ protocol. Used by the finite state machine to determine
- * valid responses.
- */
-public enum AMQState
-{
- CONNECTION_NOT_STARTED,
- CONNECTION_NOT_AUTH,
- CONNECTION_NOT_TUNED,
- CONNECTION_NOT_OPENED,
- CONNECTION_OPEN,
- CONNECTION_CLOSING,
- CONNECTION_CLOSED
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java
deleted file mode 100644
index c5b3099f58..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.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.server.state;
-
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.protocol.AMQMethodListener;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.handler.BasicAckMethodHandler;
-import org.apache.qpid.server.handler.BasicCancelMethodHandler;
-import org.apache.qpid.server.handler.BasicConsumeMethodHandler;
-import org.apache.qpid.server.handler.BasicGetMethodHandler;
-import org.apache.qpid.server.handler.BasicPublishMethodHandler;
-import org.apache.qpid.server.handler.BasicQosHandler;
-import org.apache.qpid.server.handler.BasicRecoverMethodHandler;
-import org.apache.qpid.server.handler.BasicRejectMethodHandler;
-import org.apache.qpid.server.handler.ChannelCloseHandler;
-import org.apache.qpid.server.handler.ChannelCloseOkHandler;
-import org.apache.qpid.server.handler.ChannelFlowHandler;
-import org.apache.qpid.server.handler.ChannelOpenHandler;
-import org.apache.qpid.server.handler.ConnectionCloseMethodHandler;
-import org.apache.qpid.server.handler.ConnectionCloseOkMethodHandler;
-import org.apache.qpid.server.handler.ConnectionOpenMethodHandler;
-import org.apache.qpid.server.handler.ConnectionSecureOkMethodHandler;
-import org.apache.qpid.server.handler.ConnectionStartOkMethodHandler;
-import org.apache.qpid.server.handler.ConnectionTuneOkMethodHandler;
-import org.apache.qpid.server.handler.ExchangeBoundHandler;
-import org.apache.qpid.server.handler.ExchangeDeclareHandler;
-import org.apache.qpid.server.handler.ExchangeDeleteHandler;
-import org.apache.qpid.server.handler.QueueBindHandler;
-import org.apache.qpid.server.handler.QueueDeclareHandler;
-import org.apache.qpid.server.handler.QueueDeleteHandler;
-import org.apache.qpid.server.handler.QueuePurgeHandler;
-import org.apache.qpid.server.handler.TxCommitHandler;
-import org.apache.qpid.server.handler.TxRollbackHandler;
-import org.apache.qpid.server.handler.TxSelectHandler;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-
-/**
- * The state manager is responsible for managing the state of the protocol session. <p/> For each AMQProtocolHandler
- * there is a separate state manager.
- */
-public class AMQStateManager implements AMQMethodListener
-{
- private static final Logger _logger = Logger.getLogger(AMQStateManager.class);
-
- private final VirtualHostRegistry _virtualHostRegistry;
- private final AMQProtocolSession _protocolSession;
- /** The current state */
- private AMQState _currentState;
-
- /**
- * Maps from an AMQState instance to a Map from Class to StateTransitionHandler. The class must be a subclass of
- * AMQFrame.
- */
-/* private final EnumMap<AMQState, Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>> _state2HandlersMap =
- new EnumMap<AMQState, Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>>(
- AMQState.class);
- */
-
-
- private CopyOnWriteArraySet<StateListener> _stateListeners = new CopyOnWriteArraySet<StateListener>();
-
- public AMQStateManager(VirtualHostRegistry virtualHostRegistry, AMQProtocolSession protocolSession)
- {
-
- _virtualHostRegistry = virtualHostRegistry;
- _protocolSession = protocolSession;
- _currentState = AMQState.CONNECTION_NOT_STARTED;
-
- }
-
- /*
- protected void registerListeners()
- {
- Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>> frame2handlerMap;
-
- frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>();
- _state2HandlersMap.put(AMQState.CONNECTION_NOT_STARTED, frame2handlerMap);
-
- frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>();
- _state2HandlersMap.put(AMQState.CONNECTION_NOT_AUTH, frame2handlerMap);
-
- frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>();
- _state2HandlersMap.put(AMQState.CONNECTION_NOT_TUNED, frame2handlerMap);
-
- frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>();
- frame2handlerMap.put(ConnectionOpenBody.class, ConnectionOpenMethodHandler.getInstance());
- _state2HandlersMap.put(AMQState.CONNECTION_NOT_OPENED, frame2handlerMap);
-
- //
- // ConnectionOpen handlers
- //
- frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>();
- ChannelOpenHandler.getInstance();
- ChannelCloseHandler.getInstance();
- ChannelCloseOkHandler.getInstance();
- ConnectionCloseMethodHandler.getInstance();
- ConnectionCloseOkMethodHandler.getInstance();
- ConnectionTuneOkMethodHandler.getInstance();
- ConnectionSecureOkMethodHandler.getInstance();
- ConnectionStartOkMethodHandler.getInstance();
- ExchangeDeclareHandler.getInstance();
- ExchangeDeleteHandler.getInstance();
- ExchangeBoundHandler.getInstance();
- BasicAckMethodHandler.getInstance();
- BasicRecoverMethodHandler.getInstance();
- BasicConsumeMethodHandler.getInstance();
- BasicGetMethodHandler.getInstance();
- BasicCancelMethodHandler.getInstance();
- BasicPublishMethodHandler.getInstance();
- BasicQosHandler.getInstance();
- QueueBindHandler.getInstance();
- QueueDeclareHandler.getInstance();
- QueueDeleteHandler.getInstance();
- QueuePurgeHandler.getInstance();
- ChannelFlowHandler.getInstance();
- TxSelectHandler.getInstance();
- TxCommitHandler.getInstance();
- TxRollbackHandler.getInstance();
- BasicRejectMethodHandler.getInstance();
-
- _state2HandlersMap.put(AMQState.CONNECTION_OPEN, frame2handlerMap);
-
- frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>();
-
- _state2HandlersMap.put(AMQState.CONNECTION_CLOSING, frame2handlerMap);
-
- } */
-
- public AMQState getCurrentState()
- {
- return _currentState;
- }
-
- public void changeState(AMQState newState) throws AMQException
- {
- _logger.debug("State changing to " + newState + " from old state " + _currentState);
- final AMQState oldState = _currentState;
- _currentState = newState;
-
- for (StateListener l : _stateListeners)
- {
- l.stateChanged(oldState, newState);
- }
- }
-
- public void error(Exception e)
- {
- _logger.error("State manager received error notification[Current State:" + _currentState + "]: " + e, e);
- for (StateListener l : _stateListeners)
- {
- l.error(e);
- }
- }
-
- public <B extends AMQMethodBody> boolean methodReceived(AMQMethodEvent<B> evt) throws AMQException
- {
- MethodDispatcher dispatcher = _protocolSession.getMethodDispatcher();
-
- final int channelId = evt.getChannelId();
- B body = evt.getMethod();
-
- if(channelId != 0 && _protocolSession.getChannel(channelId)== null)
- {
-
- if(! ((body instanceof ChannelOpenBody)
- || (body instanceof ChannelCloseOkBody)
- || (body instanceof ChannelCloseBody)))
- {
- throw body.getConnectionException(AMQConstant.CHANNEL_ERROR, "channel is closed");
- }
-
- }
-
- return body.execute(dispatcher, channelId);
-
- }
-
- private <B extends AMQMethodBody> void checkChannel(AMQMethodEvent<B> evt, AMQProtocolSession protocolSession)
- throws AMQException
- {
- if ((evt.getChannelId() != 0) && !(evt.getMethod() instanceof ChannelOpenBody)
- && (protocolSession.getChannel(evt.getChannelId()) == null)
- && !protocolSession.channelAwaitingClosure(evt.getChannelId()))
- {
- throw evt.getMethod().getChannelNotFoundException(evt.getChannelId());
- }
- }
-
-/*
- protected <B extends AMQMethodBody> StateAwareMethodListener<B> findStateTransitionHandler(AMQState currentState,
- B frame)
- // throws IllegalStateTransitionException
- {
- final Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>> classToHandlerMap =
- _state2HandlersMap.get(currentState);
-
- final StateAwareMethodListener<B> handler =
- (classToHandlerMap == null) ? null : (StateAwareMethodListener<B>) classToHandlerMap.get(frame.getClass());
-
- if (handler == null)
- {
- _logger.debug("No state transition handler defined for receiving frame " + frame);
-
- return null;
- }
- else
- {
- return handler;
- }
- }
-*/
-
- public void addStateListener(StateListener listener)
- {
- _logger.debug("Adding state listener");
- _stateListeners.add(listener);
- }
-
- public void removeStateListener(StateListener listener)
- {
- _stateListeners.remove(listener);
- }
-
- public VirtualHostRegistry getVirtualHostRegistry()
- {
- return _virtualHostRegistry;
- }
-
- public AMQProtocolSession getProtocolSession()
- {
- return _protocolSession;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/IllegalStateTransitionException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/state/IllegalStateTransitionException.java
deleted file mode 100644
index cec67a8a6d..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/IllegalStateTransitionException.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.server.state;
-
-import org.apache.qpid.AMQException;
-
-/**
- * @todo Not an AMQP exception as no status code.
- *
- * @todo Not used! Delete.
- */
-public class IllegalStateTransitionException extends AMQException
-{
- private AMQState _originalState;
-
- private Class _frame;
-
- public IllegalStateTransitionException(AMQState originalState, Class frame)
- {
- super("No valid state transition defined for receiving frame " + frame + " from state " + originalState);
- _originalState = originalState;
- _frame = frame;
- }
-
- public AMQState getOriginalState()
- {
- return _originalState;
- }
-
- public Class getFrameClass()
- {
- return _frame;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/StateAwareMethodListener.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/state/StateAwareMethodListener.java
deleted file mode 100644
index 3c11bb8a9c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/StateAwareMethodListener.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.server.state;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.protocol.AMQMethodEvent;
-
-/**
- * A frame listener that is informed of the protocol state when invoked and has
- * the opportunity to update state.
- *
- */
-public interface StateAwareMethodListener<B extends AMQMethodBody>
-{
- void methodReceived(AMQStateManager stateManager, B evt, int channelId) throws AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/StateListener.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/state/StateListener.java
deleted file mode 100644
index 00fc09867b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/state/StateListener.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.server.state;
-
-import org.apache.qpid.AMQException;
-
-public interface StateListener
-{
- void stateChanged(AMQState oldState, AMQState newState) throws AMQException;
-
- void error(Throwable t);
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java
deleted file mode 100644
index 7a6e0b011f..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.store;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.MessageMetaData;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-/** A simple message store that stores the messages in a threadsafe structure in memory. */
-public class MemoryMessageStore implements MessageStore
-{
- private static final Logger _log = Logger.getLogger(MemoryMessageStore.class);
-
- private static final int DEFAULT_HASHTABLE_CAPACITY = 50000;
-
- private static final String HASHTABLE_CAPACITY_CONFIG = "hashtable-capacity";
-
- protected ConcurrentMap<Long, MessageMetaData> _metaDataMap;
-
- protected ConcurrentMap<Long, List<ContentChunk>> _contentBodyMap;
-
- private final AtomicLong _messageId = new AtomicLong(1);
- private AtomicBoolean _closed = new AtomicBoolean(false);
-
- public void configure()
- {
- _log.info("Using capacity " + DEFAULT_HASHTABLE_CAPACITY + " for hash tables");
- _metaDataMap = new ConcurrentHashMap<Long, MessageMetaData>(DEFAULT_HASHTABLE_CAPACITY);
- _contentBodyMap = new ConcurrentHashMap<Long, List<ContentChunk>>(DEFAULT_HASHTABLE_CAPACITY);
- }
-
- public void configure(String base, Configuration config)
- {
- int hashtableCapacity = config.getInt(base + "." + HASHTABLE_CAPACITY_CONFIG, DEFAULT_HASHTABLE_CAPACITY);
- _log.info("Using capacity " + hashtableCapacity + " for hash tables");
- _metaDataMap = new ConcurrentHashMap<Long, MessageMetaData>(hashtableCapacity);
- _contentBodyMap = new ConcurrentHashMap<Long, List<ContentChunk>>(hashtableCapacity);
- }
-
- public void configure(VirtualHost virtualHost, String base, Configuration config) throws Exception
- {
- configure(base, config);
- }
-
- public void close() throws Exception
- {
- _closed.getAndSet(true);
- if (_metaDataMap != null)
- {
- _metaDataMap.clear();
- _metaDataMap = null;
- }
- if (_contentBodyMap != null)
- {
- _contentBodyMap.clear();
- _contentBodyMap = null;
- }
- }
-
- public void removeMessage(StoreContext context, Long messageId) throws AMQException
- {
- checkNotClosed();
- if (_log.isDebugEnabled())
- {
- _log.debug("Removing message with id " + messageId);
- }
- _metaDataMap.remove(messageId);
- _contentBodyMap.remove(messageId);
- }
-
- public void createExchange(Exchange exchange) throws AMQException
- {
-
- }
-
- public void removeExchange(Exchange exchange) throws AMQException
- {
-
- }
-
- public void bindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
-
- }
-
- public void unbindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
-
- }
-
- public void createQueue(AMQQueue queue) throws AMQException
- {
- // Not required to do anything
- }
-
- public void removeQueue(AMQShortString name) throws AMQException
- {
- // Not required to do anything
- }
-
- public void enqueueMessage(StoreContext context, AMQShortString name, Long messageId) throws AMQException
- {
- // Not required to do anything
- }
-
- public void dequeueMessage(StoreContext context, AMQShortString name, Long messageId) throws AMQException
- {
- // Not required to do anything
- }
-
- public void beginTran(StoreContext context) throws AMQException
- {
- // Not required to do anything
- }
-
- public void commitTran(StoreContext context) throws AMQException
- {
- // Not required to do anything
- }
-
- public void abortTran(StoreContext context) throws AMQException
- {
- // Not required to do anything
- }
-
- public boolean inTran(StoreContext context)
- {
- return false;
- }
-
- public List<AMQQueue> createQueues() throws AMQException
- {
- return null;
- }
-
- public Long getNewMessageId()
- {
- return _messageId.getAndIncrement();
- }
-
- public void storeContentBodyChunk(StoreContext context, Long messageId, int index, ContentChunk contentBody, boolean lastContentBody)
- throws AMQException
- {
- checkNotClosed();
- List<ContentChunk> bodyList = _contentBodyMap.get(messageId);
-
- if (bodyList == null && lastContentBody)
- {
- _contentBodyMap.put(messageId, Collections.singletonList(contentBody));
- }
- else
- {
- if (bodyList == null)
- {
- bodyList = new ArrayList<ContentChunk>();
- _contentBodyMap.put(messageId, bodyList);
- }
-
- bodyList.add(index, contentBody);
- }
- }
-
- public void storeMessageMetaData(StoreContext context, Long messageId, MessageMetaData messageMetaData)
- throws AMQException
- {
- checkNotClosed();
- _metaDataMap.put(messageId, messageMetaData);
- }
-
- public MessageMetaData getMessageMetaData(StoreContext context, Long messageId) throws AMQException
- {
- checkNotClosed();
- return _metaDataMap.get(messageId);
- }
-
- public ContentChunk getContentBodyChunk(StoreContext context, Long messageId, int index) throws AMQException
- {
- checkNotClosed();
- List<ContentChunk> bodyList = _contentBodyMap.get(messageId);
- return bodyList.get(index);
- }
-
- private void checkNotClosed() throws MessageStoreClosedException
- {
- if (_closed.get())
- {
- throw new MessageStoreClosedException();
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStore.java
deleted file mode 100644
index 2a83d9b649..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStore.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.server.store;
-
-import org.apache.commons.configuration.Configuration;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.MessageMetaData;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-/**
- * MessageStore defines the interface to a storage area, which can be used to preserve the state of messages, queues
- * and exchanges in a transactional manner.
- *
- * <p/>All message store, remove, enqueue and dequeue operations are carried out against a {@link StoreContext} which
- * encapsulates the transactional context they are performed in. Many such operations can be carried out in a single
- * transaction.
- *
- * <p/>The storage and removal of queues and exchanges, are not carried out in a transactional context.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Accept transaction boundary demarcations: Begin, Commit, Abort.
- * <tr><td> Store and remove queues.
- * <tr><td> Store and remove exchanges.
- * <tr><td> Store and remove messages.
- * <tr><td> Bind and unbind queues to exchanges.
- * <tr><td> Enqueue and dequeue messages to queues.
- * <tr><td> Generate message identifiers.
- * </table>
- */
-public interface MessageStore
-{
- /**
- * Called after instantiation in order to configure the message store. A particular implementation can define
- * whatever parameters it wants.
- *
- * @param virtualHost The virtual host using by this store
- * @param base The base element identifier from which all configuration items are relative. For example, if
- * the base element is "store", the all elements used by concrete classes will be "store.foo" etc.
- * @param config The apache commons configuration object.
- *
- * @throws Exception If any error occurs that means the store is unable to configure itself.
- */
- void configure(VirtualHost virtualHost, String base, Configuration config) throws Exception;
-
- /**
- * Called to close and cleanup any resources used by the message store.
- *
- * @throws Exception If the close fails.
- */
- void close() throws Exception;
-
- /**
- * Removes the specified message from the store in the given transactional store context.
- *
- * @param storeContext The transactional context to remove the message in.
- * @param messageId Identifies the message to remove.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void removeMessage(StoreContext storeContext, Long messageId) throws AMQException;
-
- /**
- * Makes the specified exchange persistent.
- *
- * @param exchange The exchange to persist.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void createExchange(Exchange exchange) throws AMQException;
-
- /**
- * Removes the specified persistent exchange.
- *
- * @param exchange The exchange to remove.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void removeExchange(Exchange exchange) throws AMQException;
-
- /**
- * Binds the specified queue to an exchange with a routing key.
- *
- * @param exchange The exchange to bind to.
- * @param routingKey The routing key to bind by.
- * @param queue The queue to bind.
- * @param args Additional parameters.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void bindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException;
-
- /**
- * Unbinds the specified from an exchange under a particular routing key.
- *
- * @param exchange The exchange to unbind from.
- * @param routingKey The routing key to unbind.
- * @param queue The queue to unbind.
- * @param args Additonal parameters.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void unbindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException;
-
- /**
- * Makes the specified queue persistent.
- *
- * @param queue The queue to store.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void createQueue(AMQQueue queue) throws AMQException;
-
- /**
- * Removes the specified queue from the persistent store.
- *
- * @param name The queue to remove.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void removeQueue(AMQShortString name) throws AMQException;
-
- /**
- * Places a message onto a specified queue, in a given transactional context.
- *
- * @param context The transactional context for the operation.
- * @param name The name of the queue to place the message on.
- * @param messageId The message to enqueue.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void enqueueMessage(StoreContext context, AMQShortString name, Long messageId) throws AMQException;
-
- /**
- * Extracts a message from a specified queue, in a given transactional context.
- *
- * @param context The transactional context for the operation.
- * @param name The name of the queue to take the message from.
- * @param messageId The message to dequeue.
- *
- * @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
- */
- void dequeueMessage(StoreContext context, AMQShortString name, Long messageId) throws AMQException;
-
- /**
- * Begins a transactional context.
- *
- * @param context The transactional context to begin.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void beginTran(StoreContext context) throws AMQException;
-
- /**
- * Commits all operations performed within a given transactional context.
- *
- * @param context The transactional context to commit all operations for.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void commitTran(StoreContext context) throws AMQException;
-
- /**
- * Abandons all operations performed within a given transactional context.
- *
- * @param context The transactional context to abandon.
- *
- * @throws AMQException If the operation fails for any reason.
- */
- void abortTran(StoreContext context) throws AMQException;
-
- /**
- * Tests a transactional context to see if it has been begun but not yet committed or aborted.
- *
- * @param context The transactional context to test.
- *
- * @return <tt>true</tt> if the transactional context is live, <tt>false</tt> otherwise.
- */
- boolean inTran(StoreContext context);
-
- /**
- * Return a valid, currently unused message id.
- *
- * @return A fresh message id.
- */
- Long getNewMessageId();
-
- /**
- * Stores a chunk of message data.
- *
- * @param context The transactional context for the operation.
- * @param messageId The message to store the data for.
- * @param index The index of the data chunk.
- * @param contentBody The content of the data chunk.
- * @param lastContentBody Flag to indicate that this is the last such chunk for the message.
- *
- * @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
- */
- void storeContentBodyChunk(StoreContext context, Long messageId, int index, ContentChunk contentBody,
- boolean lastContentBody) throws AMQException;
-
- /**
- * Stores message meta-data.
- *
- * @param context The transactional context for the operation.
- * @param messageId The message to store the data for.
- * @param messageMetaData The message meta data to store.
- *
- * @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
- */
- void storeMessageMetaData(StoreContext context, Long messageId, MessageMetaData messageMetaData) throws AMQException;
-
- /**
- * Retrieves message meta-data.
- *
- * @param context The transactional context for the operation.
- * @param messageId The message to get the meta-data for.
- *
- * @return The message meta data.
- *
- * @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
- */
- MessageMetaData getMessageMetaData(StoreContext context, Long messageId) throws AMQException;
-
- /**
- * Retrieves a chunk of message data.
- *
- * @param context The transactional context for the operation.
- * @param messageId The message to get the data chunk for.
- * @param index The offset index of the data chunk within the message.
- *
- * @return A chunk of message data.
- *
- * @throws AMQException If the operation fails for any reason, or if the specified message does not exist.
- */
- ContentChunk getContentBodyChunk(StoreContext context, Long messageId, int index) throws AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java
deleted file mode 100644
index 3d1538c7eb..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.apache.qpid.server.store;
-
-import org.apache.qpid.AMQException;/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/**
- * NOTE: this class currently extends AMQException but
- * we should be using AMQExceptions internally in the code base for Protocol errors hence
- * the message store interface should throw a different super class which this should be
- * moved to reflect
- */
-public class MessageStoreClosedException extends AMQException
-{
- public MessageStoreClosedException()
- {
- super("Message store closed");
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/StoreContext.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/StoreContext.java
deleted file mode 100644
index 3ee49d58cf..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/StoreContext.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.store;
-
-import org.apache.log4j.Logger;
-
-/**
- * A context that the store can use to associate with a transactional context. For example, it could store
- * some kind of txn id.
- *
- * @author Apache Software Foundation
- */
-public class StoreContext
-{
- private static final Logger _logger = Logger.getLogger(StoreContext.class);
-
- private String _name;
- private Object _payload;
-
- public StoreContext()
- {
- _name = super.toString();
- }
-
- public StoreContext(String name)
- {
- _name = name;
- }
-
- public Object getPayload()
- {
- return _payload;
- }
-
- public void setPayload(Object payload)
- {
- _logger.debug("public void setPayload(Object payload = " + payload + "): called");
- _payload = payload;
- }
-
- /**
- * Prints out the transactional context as a string, mainly for debugging purposes.
- *
- * @return The transactional context as a string.
- */
- public String toString()
- {
- return "<_name = " + _name + ", _payload = " + _payload + ">";
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.java
deleted file mode 100644
index 23aaf56876..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.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.server.transport;
-
-import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.util.NewThreadExecutor;
-import org.apache.qpid.configuration.Configured;
-import org.apache.log4j.Logger;
-
-public class ConnectorConfiguration
-{
- private static final Logger _logger = Logger.getLogger(ConnectorConfiguration.class);
-
- public static final String DEFAULT_PORT = "5672";
-
- public static final String SSL_PORT = "8672";
-
- @Configured(path = "connector.processors",
- defaultValue = "4")
- public int processors;
-
- @Configured(path = "connector.port",
- defaultValue = DEFAULT_PORT)
- public int port;
-
- @Configured(path = "connector.bind",
- defaultValue = "wildcard")
- public String bindAddress;
-
- @Configured(path = "connector.socketReceiveBuffer",
- defaultValue = "32767")
- public int socketReceiveBufferSize;
-
- @Configured(path = "connector.socketWriteBuffer",
- defaultValue = "32767")
- public int socketWriteBuferSize;
-
- @Configured(path = "connector.tcpNoDelay",
- defaultValue = "true")
- public boolean tcpNoDelay;
-
- @Configured(path = "advanced.filterchain[@enableExecutorPool]",
- defaultValue = "false")
- public boolean enableExecutorPool;
-
- @Configured(path = "advanced.enablePooledAllocator",
- defaultValue = "false")
- public boolean enablePooledAllocator;
-
- @Configured(path = "advanced.enableDirectBuffers",
- defaultValue = "false")
- public boolean enableDirectBuffers;
-
- @Configured(path = "connector.ssl.enabled",
- defaultValue = "false")
- public boolean enableSSL;
-
- @Configured(path = "connector.ssl.sslOnly",
- defaultValue = "true")
- public boolean sslOnly;
-
- @Configured(path = "connector.ssl.port",
- defaultValue = SSL_PORT)
- public int sslPort;
-
- @Configured(path = "connector.ssl.keystorePath",
- defaultValue = "none")
- public String keystorePath;
-
- @Configured(path = "connector.ssl.keystorePassword",
- defaultValue = "none")
- public String keystorePassword;
-
- @Configured(path = "connector.ssl.certType",
- defaultValue = "SunX509")
- public String certType;
-
- @Configured(path = "connector.qpidnio",
- defaultValue = "false")
- public boolean _multiThreadNIO;
-
-
- public IoAcceptor createAcceptor()
- {
- if (_multiThreadNIO)
- {
- _logger.warn("Using Qpid Multithreaded IO Processing");
- return new org.apache.mina.transport.socket.nio.MultiThreadSocketAcceptor(processors, new NewThreadExecutor());
- }
- else
- {
- _logger.warn("Using Mina IO Processing");
- return new org.apache.mina.transport.socket.nio.SocketAcceptor(processors, new NewThreadExecutor());
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ThreadPoolFilter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ThreadPoolFilter.java
deleted file mode 100644
index bdd27f2d1c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ThreadPoolFilter.java
+++ /dev/null
@@ -1,705 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.transport;
-
-import java.util.ArrayList;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.IoFilterAdapter;
-import org.apache.mina.common.IoHandler;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.util.BlockingQueue;
-import org.apache.mina.util.ByteBufferUtil;
-import org.apache.mina.util.IdentityHashSet;
-import org.apache.mina.util.Queue;
-import org.apache.mina.util.Stack;
-
-/**
- * A Thread-pooling filter. This filter forwards {@link IoHandler} events
- * to its thread pool.
- * <p/>
- * This is an implementation of
- * <a href="http://deuce.doc.wustl.edu/doc/pspdfs/lf.pdf">Leader/Followers
- * thread pool</a> by Douglas C. Schmidt et al.
- */
-public class ThreadPoolFilter extends IoFilterAdapter
-{
- /**
- * Default maximum size of thread pool (2G).
- */
- public static final int DEFAULT_MAXIMUM_POOL_SIZE = Integer.MAX_VALUE;
-
- /**
- * Default keep-alive time of thread pool (1 min).
- */
- public static final int DEFAULT_KEEP_ALIVE_TIME = 60 * 1000;
-
- /**
- * A queue which contains {@link Integer}s which represents reusable
- * thread IDs. {@link Worker} first checks this queue and then
- * uses {@link #threadId} when no reusable thread ID is available.
- */
- private static final Queue threadIdReuseQueue = new Queue();
- private static int threadId = 0;
-
- private static int acquireThreadId()
- {
- synchronized (threadIdReuseQueue)
- {
- Integer id = (Integer) threadIdReuseQueue.pop();
- if (id == null)
- {
- return ++ threadId;
- }
- else
- {
- return id.intValue();
- }
- }
- }
-
- private static void releaseThreadId(int id)
- {
- synchronized (threadIdReuseQueue)
- {
- threadIdReuseQueue.push(new Integer(id));
- }
- }
-
- private final String threadNamePrefix;
- private final Map buffers = new IdentityHashMap();
- private final BlockingQueue unfetchedSessionBuffers = new BlockingQueue();
- private final Set allSessionBuffers = new IdentityHashSet();
-
- private Worker leader;
- private final Stack followers = new Stack();
- private final Set allWorkers = new IdentityHashSet();
-
- private int maximumPoolSize = DEFAULT_MAXIMUM_POOL_SIZE;
- private int keepAliveTime = DEFAULT_KEEP_ALIVE_TIME;
-
- private boolean shuttingDown;
-
- private int poolSize;
- private final Object poolSizeLock = new Object();
-
- /**
- * Creates a new instance of this filter with default thread pool settings.
- */
- public ThreadPoolFilter()
- {
- this("IoThreadPool");
- }
-
- /**
- * Creates a new instance of this filter with the specified thread name prefix
- * and other default settings.
- *
- * @param threadNamePrefix the prefix of the thread names this pool will create.
- */
- public ThreadPoolFilter(String threadNamePrefix)
- {
- if (threadNamePrefix == null)
- {
- throw new NullPointerException("threadNamePrefix");
- }
- threadNamePrefix = threadNamePrefix.trim();
- if (threadNamePrefix.length() == 0)
- {
- throw new IllegalArgumentException("threadNamePrefix is empty.");
- }
- this.threadNamePrefix = threadNamePrefix;
- }
-
- public String getThreadNamePrefix()
- {
- return threadNamePrefix;
- }
-
- public int getPoolSize()
- {
- synchronized (poolSizeLock)
- {
- return poolSize;
- }
- }
-
- public int getMaximumPoolSize()
- {
- return maximumPoolSize;
- }
-
- public int getKeepAliveTime()
- {
- return keepAliveTime;
- }
-
- public void setMaximumPoolSize(int maximumPoolSize)
- {
- if (maximumPoolSize <= 0)
- {
- throw new IllegalArgumentException();
- }
- this.maximumPoolSize = maximumPoolSize;
- }
-
- public void setKeepAliveTime(int keepAliveTime)
- {
- this.keepAliveTime = keepAliveTime;
- }
-
- public void init()
- {
- shuttingDown = false;
- leader = new Worker();
- leader.start();
- leader.lead();
- }
-
- public void destroy()
- {
- shuttingDown = true;
- int expectedPoolSize = 0;
- while (getPoolSize() != expectedPoolSize)
- {
- List allWorkers;
- synchronized (poolSizeLock)
- {
- allWorkers = new ArrayList(this.allWorkers);
- }
-
- // You may not interrupt the current thread.
- if (allWorkers.remove(Thread.currentThread()))
- {
- expectedPoolSize = 1;
- }
-
- for (Iterator i = allWorkers.iterator(); i.hasNext();)
- {
- Worker worker = (Worker) i.next();
- while (worker.isAlive())
- {
- worker.interrupt();
- try
- {
- // This timeout will help us from
- // infinite lock-up and interrupt workers again.
- worker.join(100);
- }
- catch (InterruptedException e)
- {
- }
- }
- }
- }
-
- this.allSessionBuffers.clear();
- this.unfetchedSessionBuffers.clear();
- this.buffers.clear();
- this.followers.clear();
- this.leader = null;
- }
-
- private void increasePoolSize(Worker worker)
- {
- synchronized (poolSizeLock)
- {
- poolSize++;
- allWorkers.add(worker);
- }
- }
-
- private void decreasePoolSize(Worker worker)
- {
- synchronized (poolSizeLock)
- {
- poolSize--;
- allWorkers.remove(worker);
- }
- }
-
- private void fireEvent(NextFilter nextFilter, IoSession session,
- EventType type, Object data)
- {
- final BlockingQueue unfetchedSessionBuffers = this.unfetchedSessionBuffers;
- final Set allSessionBuffers = this.allSessionBuffers;
- final Event event = new Event(type, nextFilter, data);
-
- synchronized (unfetchedSessionBuffers)
- {
- final SessionBuffer buf = getSessionBuffer(session);
- final Queue eventQueue = buf.eventQueue;
-
- synchronized (buf)
- {
- eventQueue.push(event);
- }
-
- if (!allSessionBuffers.contains(buf))
- {
- allSessionBuffers.add(buf);
- unfetchedSessionBuffers.push(buf);
- }
- }
- }
-
- /**
- * Implement this method to fetch (or pop) a {@link SessionBuffer} from
- * the given <tt>unfetchedSessionBuffers</tt>. The default implementation
- * simply pops the buffer from it. You could prioritize the fetch order.
- *
- * @return A non-null {@link SessionBuffer}
- */
- protected SessionBuffer fetchSessionBuffer(Queue unfetchedSessionBuffers)
- {
- return (SessionBuffer) unfetchedSessionBuffers.pop();
- }
-
- private SessionBuffer getSessionBuffer(IoSession session)
- {
- final Map buffers = this.buffers;
- SessionBuffer buf = (SessionBuffer) buffers.get(session);
- if (buf == null)
- {
- synchronized (buffers)
- {
- buf = (SessionBuffer) buffers.get(session);
- if (buf == null)
- {
- buf = new SessionBuffer(session);
- buffers.put(session, buf);
- }
- }
- }
- return buf;
- }
-
- private void removeSessionBuffer(SessionBuffer buf)
- {
- final Map buffers = this.buffers;
- final IoSession session = buf.session;
- synchronized (buffers)
- {
- buffers.remove(session);
- }
- }
-
- protected static class SessionBuffer
- {
- private final IoSession session;
-
- private final Queue eventQueue = new Queue();
-
- private SessionBuffer(IoSession session)
- {
- this.session = session;
- }
-
- public IoSession getSession()
- {
- return session;
- }
-
- public Queue getEventQueue()
- {
- return eventQueue;
- }
- }
-
- private class Worker extends Thread
- {
- private final int id;
- private final Object promotionLock = new Object();
- private boolean dead;
-
- private Worker()
- {
- int id = acquireThreadId();
- this.id = id;
- this.setName(threadNamePrefix + '-' + id);
- increasePoolSize(this);
- }
-
- public boolean lead()
- {
- final Object promotionLock = this.promotionLock;
- synchronized (promotionLock)
- {
- if (dead)
- {
- return false;
- }
-
- leader = this;
- promotionLock.notify();
- }
-
- return true;
- }
-
- public void run()
- {
- for (; ;)
- {
- if (!waitForPromotion())
- {
- break;
- }
-
- SessionBuffer buf = fetchBuffer();
- giveUpLead();
- if (buf == null)
- {
- break;
- }
-
- processEvents(buf);
- follow();
- releaseBuffer(buf);
- }
-
- decreasePoolSize(this);
- releaseThreadId(id);
- }
-
- private SessionBuffer fetchBuffer()
- {
- BlockingQueue unfetchedSessionBuffers = ThreadPoolFilter.this.unfetchedSessionBuffers;
- synchronized (unfetchedSessionBuffers)
- {
- while (!shuttingDown)
- {
- try
- {
- unfetchedSessionBuffers.waitForNewItem();
- }
- catch (InterruptedException e)
- {
- continue;
- }
-
- return ThreadPoolFilter.this.fetchSessionBuffer(unfetchedSessionBuffers);
- }
- }
-
- return null;
- }
-
- private void processEvents(SessionBuffer buf)
- {
- final IoSession session = buf.session;
- final Queue eventQueue = buf.eventQueue;
- for (; ;)
- {
- Event event;
- synchronized (buf)
- {
- event = (Event) eventQueue.pop();
- if (event == null)
- {
- break;
- }
- }
- processEvent(event.getNextFilter(), session,
- event.getType(), event.getData());
- }
- }
-
- private void follow()
- {
- final Object promotionLock = this.promotionLock;
- final Stack followers = ThreadPoolFilter.this.followers;
- synchronized (promotionLock)
- {
- if (this != leader)
- {
- synchronized (followers)
- {
- followers.push(this);
- }
- }
- }
- }
-
- private void releaseBuffer(SessionBuffer buf)
- {
- final BlockingQueue unfetchedSessionBuffers = ThreadPoolFilter.this.unfetchedSessionBuffers;
- final Set allSessionBuffers = ThreadPoolFilter.this.allSessionBuffers;
- final Queue eventQueue = buf.eventQueue;
-
- synchronized (unfetchedSessionBuffers)
- {
- if (eventQueue.isEmpty())
- {
- allSessionBuffers.remove(buf);
- removeSessionBuffer(buf);
- }
- else
- {
- unfetchedSessionBuffers.push(buf);
- }
- }
- }
-
- private boolean waitForPromotion()
- {
- final Object promotionLock = this.promotionLock;
-
- long startTime = System.currentTimeMillis();
- long currentTime = System.currentTimeMillis();
-
- synchronized (promotionLock)
- {
- while (this != leader && !shuttingDown)
- {
- // Calculate remaining keep-alive time
- int keepAliveTime = getKeepAliveTime();
- if (keepAliveTime > 0)
- {
- keepAliveTime -= (currentTime - startTime);
- }
- else
- {
- keepAliveTime = Integer.MAX_VALUE;
- }
-
- // Break the loop if there's no remaining keep-alive time.
- if (keepAliveTime <= 0)
- {
- break;
- }
-
- // Wait for promotion
- try
- {
- promotionLock.wait(keepAliveTime);
- }
- catch (InterruptedException e)
- {
- }
-
- // Update currentTime for the next iteration
- currentTime = System.currentTimeMillis();
- }
-
- boolean timeToLead = this == leader && !shuttingDown;
-
- if (!timeToLead)
- {
- // time to die
- synchronized (followers)
- {
- followers.remove(this);
- }
-
- // Mark as dead explicitly when we've got promotionLock.
- dead = true;
- }
-
- return timeToLead;
- }
- }
-
- private void giveUpLead()
- {
- final Stack followers = ThreadPoolFilter.this.followers;
- Worker worker;
- do
- {
- synchronized (followers)
- {
- worker = (Worker) followers.pop();
- }
-
- if (worker == null)
- {
- // Increase the number of threads if we
- // are not shutting down and we can increase the number.
- if (!shuttingDown
- && getPoolSize() < getMaximumPoolSize())
- {
- worker = new Worker();
- worker.lead();
- worker.start();
- }
-
- // This loop should end because:
- // 1) lead() is called already,
- // 2) or it is shutting down and there's no more threads left.
- break;
- }
- }
- while (!worker.lead());
- }
- }
-
- protected static class EventType
- {
- public static final EventType OPENED = new EventType("OPENED");
-
- public static final EventType CLOSED = new EventType("CLOSED");
-
- public static final EventType READ = new EventType("READ");
-
- public static final EventType WRITTEN = new EventType("WRITTEN");
-
- public static final EventType RECEIVED = new EventType("RECEIVED");
-
- public static final EventType SENT = new EventType("SENT");
-
- public static final EventType IDLE = new EventType("IDLE");
-
- public static final EventType EXCEPTION = new EventType("EXCEPTION");
-
- private final String value;
-
- private EventType(String value)
- {
- this.value = value;
- }
-
- public String toString()
- {
- return value;
- }
- }
-
- protected static class Event
- {
- private final EventType type;
- private final NextFilter nextFilter;
- private final Object data;
-
- public Event(EventType type, NextFilter nextFilter, Object data)
- {
- this.type = type;
- this.nextFilter = nextFilter;
- this.data = data;
- }
-
- public Object getData()
- {
- return data;
- }
-
-
- public NextFilter getNextFilter()
- {
- return nextFilter;
- }
-
-
- public EventType getType()
- {
- return type;
- }
- }
-
- public void sessionCreated(NextFilter nextFilter, IoSession session)
- {
- nextFilter.sessionCreated(session);
- }
-
- public void sessionOpened(NextFilter nextFilter,
- IoSession session)
- {
- fireEvent(nextFilter, session, EventType.OPENED, null);
- }
-
- public void sessionClosed(NextFilter nextFilter,
- IoSession session)
- {
- fireEvent(nextFilter, session, EventType.CLOSED, null);
- }
-
- public void sessionIdle(NextFilter nextFilter,
- IoSession session, IdleStatus status)
- {
- fireEvent(nextFilter, session, EventType.IDLE, status);
- }
-
- public void exceptionCaught(NextFilter nextFilter,
- IoSession session, Throwable cause)
- {
- fireEvent(nextFilter, session, EventType.EXCEPTION, cause);
- }
-
- public void messageReceived(NextFilter nextFilter,
- IoSession session, Object message)
- {
- ByteBufferUtil.acquireIfPossible(message);
- fireEvent(nextFilter, session, EventType.RECEIVED, message);
- }
-
- public void messageSent(NextFilter nextFilter,
- IoSession session, Object message)
- {
- ByteBufferUtil.acquireIfPossible(message);
- fireEvent(nextFilter, session, EventType.SENT, message);
- }
-
- protected void processEvent(NextFilter nextFilter,
- IoSession session, EventType type,
- Object data)
- {
- if (type == EventType.RECEIVED)
- {
- nextFilter.messageReceived(session, data);
- ByteBufferUtil.releaseIfPossible(data);
- }
- else if (type == EventType.SENT)
- {
- nextFilter.messageSent(session, data);
- ByteBufferUtil.releaseIfPossible(data);
- }
- else if (type == EventType.EXCEPTION)
- {
- nextFilter.exceptionCaught(session, (Throwable) data);
- }
- else if (type == EventType.IDLE)
- {
- nextFilter.sessionIdle(session, (IdleStatus) data);
- }
- else if (type == EventType.OPENED)
- {
- nextFilter.sessionOpened(session);
- }
- else if (type == EventType.CLOSED)
- {
- nextFilter.sessionClosed(session);
- }
- }
-
- public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest)
- {
- nextFilter.filterWrite(session, writeRequest);
- }
-
- public void filterClose(NextFilter nextFilter, IoSession session) throws Exception
- {
- nextFilter.filterClose(session);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/CleanupMessageOperation.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/CleanupMessageOperation.java
deleted file mode 100644
index 988f589339..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/CleanupMessageOperation.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.
- *
- */
-package org.apache.qpid.server.txn;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.RequiredDeliveryException;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.NoConsumersException;
-import org.apache.qpid.server.store.StoreContext;
-
-import java.util.List;
-
-/**
- * @author Apache Software Foundation
- */
-public class CleanupMessageOperation implements TxnOp
-{
- private static final Logger _log = Logger.getLogger(CleanupMessageOperation.class);
-
- private final AMQMessage _msg;
-
- private final List<RequiredDeliveryException> _returns;
-
- public CleanupMessageOperation(AMQMessage msg, List<RequiredDeliveryException> returns)
- {
- _msg = msg;
- _returns = returns;
- }
-
- public void prepare(StoreContext context) throws AMQException
- { }
-
- public void undoPrepare()
- {
- // don't need to do anything here, if the store's txn failed
- // when processing prepare then the message was not stored
- // or enqueued on any queues and can be discarded
- }
-
- public void commit(StoreContext context)
- {
- // No-op can't be done here has this is before the message has been attempted to be delivered.
- /*try
- {
- _msg.checkDeliveredToConsumer();
- }
- catch (NoConsumersException e)
- {
- _returns.add(e);
- }*/
- }
-
- public void rollback(StoreContext context)
- {
- // NO OP
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/LocalTransactionalContext.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/LocalTransactionalContext.java
deleted file mode 100644
index b12afd9a41..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/LocalTransactionalContext.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.txn;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.RequiredDeliveryException;
-import org.apache.qpid.server.ack.TxAck;
-import org.apache.qpid.server.ack.UnacknowledgedMessageMap;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.NoConsumersException;
-import org.apache.qpid.server.queue.QueueEntry;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.StoreContext;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/** A transactional context that only supports local transactions. */
-public class LocalTransactionalContext implements TransactionalContext
-{
- private static final Logger _log = Logger.getLogger(LocalTransactionalContext.class);
-
- private final TxnBuffer _txnBuffer = new TxnBuffer();
-
- private final List<DeliveryDetails> _postCommitDeliveryList = new LinkedList<DeliveryDetails>();
-
- /**
- * We keep hold of the ack operation so that we can consolidate acks, i.e. multiple acks within a txn are
- * consolidated into a single operation
- */
- private TxAck _ackOp;
-
- private List<RequiredDeliveryException> _returnMessages;
-
- private final MessageStore _messageStore;
-
- private final StoreContext _storeContext;
-
- private boolean _inTran = false;
-
- /** Are there messages to deliver. NOT Has the message been delivered */
- private boolean _messageDelivered = false;
-
- private static class DeliveryDetails
- {
- public QueueEntry entry;
-
- private boolean deliverFirst;
-
- public DeliveryDetails(QueueEntry entry, boolean deliverFirst)
- {
- this.entry = entry;
- this.deliverFirst = deliverFirst;
- }
- }
-
- public LocalTransactionalContext(MessageStore messageStore, StoreContext storeContext,
- List<RequiredDeliveryException> returnMessages)
- {
- _messageStore = messageStore;
- _storeContext = storeContext;
- _returnMessages = returnMessages;
- // _txnBuffer.enlist(new StoreMessageOperation(messageStore));
- }
-
- public StoreContext getStoreContext()
- {
- return _storeContext;
- }
-
- public void rollback() throws AMQException
- {
- _txnBuffer.rollback(_storeContext);
- // Hack to deal with uncommitted non-transactional writes
- if (_messageStore.inTran(_storeContext))
- {
- _messageStore.abortTran(_storeContext);
- _inTran = false;
- }
-
- _postCommitDeliveryList.clear();
- }
-
- public void deliver(QueueEntry entry, boolean deliverFirst) throws AMQException
- {
- // A publication will result in the enlisting of several
- // TxnOps. The first is an op that will store the message.
- // Following that (and ordering is important), an op will
- // be added for every queue onto which the message is
- // enqueued. Finally a cleanup op will be added to decrement
- // the reference associated with the routing.
- // message.incrementReference();
- _postCommitDeliveryList.add(new DeliveryDetails(entry, deliverFirst));
- _messageDelivered = true;
- _txnBuffer.enlist(new CleanupMessageOperation(entry.getMessage(), _returnMessages));
- /*_txnBuffer.enlist(new DeliverMessageOperation(message, queue));
- if (_log.isDebugEnabled())
- {
- _log.debug("Incrementing ref count on message and enlisting cleanup operation - id " +
- message.getMessageId());
- }
- message.incrementReference();
- _messageDelivered = true;
-
- */
- }
-
- private void checkAck(long deliveryTag, UnacknowledgedMessageMap unacknowledgedMessageMap) throws AMQException
- {
- if (!unacknowledgedMessageMap.contains(deliveryTag))
- {
- throw new AMQException("Ack with delivery tag " + deliveryTag + " not known for channel");
- }
- }
-
- public void acknowledgeMessage(long deliveryTag, long lastDeliveryTag, boolean multiple,
- UnacknowledgedMessageMap unacknowledgedMessageMap) throws AMQException
- {
- // check that the tag exists to give early failure
- if (!multiple || (deliveryTag > 0))
- {
- checkAck(deliveryTag, unacknowledgedMessageMap);
- }
- // we use a single txn op for all acks and update this op
- // as new acks come in. If this is the first ack in the txn
- // we will need to create and enlist the op.
- if (_ackOp == null)
- {
- beginTranIfNecessary();
- _ackOp = new TxAck(unacknowledgedMessageMap);
- _txnBuffer.enlist(_ackOp);
- }
- // update the op to include this ack request
- if (multiple && (deliveryTag == 0))
- {
- // if have signalled to ack all, that refers only
- // to all at this time
- _ackOp.update(lastDeliveryTag, multiple);
- }
- else
- {
- _ackOp.update(deliveryTag, multiple);
- }
- }
-
- public void messageFullyReceived(boolean persistent) throws AMQException
- {
- // Not required in this transactional context
- }
-
- public void messageProcessed(AMQProtocolSession protocolSession) throws AMQException
- {
- // Not required in this transactional context
- }
-
- public void beginTranIfNecessary() throws AMQException
- {
- if (!_inTran)
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Starting transaction on message store: " + this);
- }
-
- _messageStore.beginTran(_storeContext);
- _inTran = true;
- }
- }
-
- public void commit() throws AMQException
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Committing transactional context: " + this);
- }
-
- if (_ackOp != null)
- {
-
- _messageDelivered = true;
- _ackOp.consolidate();
- // already enlisted, after commit will reset regardless of outcome
- _ackOp = null;
- }
-
- if (_messageDelivered && _inTran)
- {
- _txnBuffer.enlist(new StoreMessageOperation(_messageStore));
- }
- // fixme fail commit here ... QPID-440
- try
- {
- _txnBuffer.commit(_storeContext);
- }
- finally
- {
- _messageDelivered = false;
- _inTran = _messageStore.inTran(_storeContext);
- }
-
- try
- {
- postCommitDelivery(_returnMessages);
- }
- catch (AMQException e)
- {
- // OK so what do we do now...?
- _log.error("Failed to deliver messages following txn commit: " + e, e);
- }
- }
-
- private void postCommitDelivery(List<RequiredDeliveryException> returnMessages) throws AMQException
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Performing post commit delivery");
- }
-
- try
- {
- for (DeliveryDetails dd : _postCommitDeliveryList)
- {
- dd.entry.process(_storeContext, dd.deliverFirst);
-
- try
- {
- dd.entry.checkDeliveredToConsumer();
- }
- catch (NoConsumersException nce)
- {
- returnMessages.add(nce);
- }
- }
- }
- finally
- {
- _postCommitDeliveryList.clear();
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/NonTransactionalContext.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/NonTransactionalContext.java
deleted file mode 100644
index 1e4b69c935..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/NonTransactionalContext.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.server.txn;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.RequiredDeliveryException;
-import org.apache.qpid.server.ack.UnacknowledgedMessage;
-import org.apache.qpid.server.ack.UnacknowledgedMessageMap;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.NoConsumersException;
-import org.apache.qpid.server.queue.QueueEntry;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.StoreContext;
-
-/** @author Apache Software Foundation */
-public class NonTransactionalContext implements TransactionalContext
-{
- private static final Logger _log = Logger.getLogger(NonTransactionalContext.class);
-
- /** Channel is useful for logging */
- private final AMQChannel _channel;
-
- /** Where to put undeliverable messages */
- private final List<RequiredDeliveryException> _returnMessages;
-
- private final Set<Long> _browsedAcks;
-
- private final MessageStore _messageStore;
-
- private final StoreContext _storeContext;
-
- /** Whether we are in a transaction */
- private boolean _inTran;
-
- public NonTransactionalContext(MessageStore messageStore, StoreContext storeContext, AMQChannel channel,
- List<RequiredDeliveryException> returnMessages, Set<Long> browsedAcks)
- {
- _channel = channel;
- _storeContext = storeContext;
- _returnMessages = returnMessages;
- _messageStore = messageStore;
- _browsedAcks = browsedAcks;
- }
-
-
- public StoreContext getStoreContext()
- {
- return _storeContext;
- }
-
- public void beginTranIfNecessary() throws AMQException
- {
- if (!_inTran)
- {
- _messageStore.beginTran(_storeContext);
- _inTran = true;
- }
- }
-
- public void commit() throws AMQException
- {
- // Does not apply to this context
- }
-
- public void rollback() throws AMQException
- {
- // Does not apply to this context
- }
-
- public void deliver(QueueEntry entry, boolean deliverFirst) throws AMQException
- {
- try
- {
- entry.process(_storeContext, deliverFirst);
- //following check implements the functionality
- //required by the 'immediate' flag:
- entry.checkDeliveredToConsumer();
- }
- catch (NoConsumersException e)
- {
- _returnMessages.add(e);
- }
- }
-
- public void acknowledgeMessage(final long deliveryTag, long lastDeliveryTag,
- boolean multiple, final UnacknowledgedMessageMap unacknowledgedMessageMap)
- throws AMQException
- {
- if (multiple)
- {
- if (deliveryTag == 0)
- {
-
- //Spec 2.1.6.11 ... If the multiple field is 1, and the delivery tag is zero,
- // tells the server to acknowledge all outstanding mesages.
- _log.info("Multiple ack on delivery tag 0. ACKing all messages. Current count:" +
- unacknowledgedMessageMap.size());
- unacknowledgedMessageMap.visit(new UnacknowledgedMessageMap.Visitor()
- {
- public boolean callback(UnacknowledgedMessage message) throws AMQException
- {
- if (!_browsedAcks.contains(deliveryTag))
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Discarding message: " + message.getMessage().getMessageId());
- }
-
- //Message has been ack so discard it. This will dequeue and decrement the reference.
- message.discard(_storeContext);
- }
- else
- {
- _browsedAcks.remove(deliveryTag);
- }
- return false;
- }
-
- public void visitComplete()
- {
- unacknowledgedMessageMap.clear();
- }
- });
- }
- else
- {
- if (!unacknowledgedMessageMap.contains(deliveryTag))
- {
- throw new AMQException("Multiple ack on delivery tag " + deliveryTag + " not known for channel");
- }
-
- LinkedList<UnacknowledgedMessage> acked = new LinkedList<UnacknowledgedMessage>();
- unacknowledgedMessageMap.drainTo(acked, deliveryTag);
- for (UnacknowledgedMessage msg : acked)
- {
- if (!_browsedAcks.contains(deliveryTag))
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Discarding message: " + msg.getMessage().getMessageId());
- }
-
- //Message has been ack so discard it. This will dequeue and decrement the reference.
- msg.discard(_storeContext);
- }
- else
- {
- _browsedAcks.remove(deliveryTag);
- }
- }
- }
- }
- else
- {
- UnacknowledgedMessage msg;
- msg = unacknowledgedMessageMap.remove(deliveryTag);
-
- if (msg == null)
- {
- _log.info("Single ack on delivery tag " + deliveryTag + " not known for channel:" +
- _channel.getChannelId());
- throw new AMQException("Single ack on delivery tag " + deliveryTag + " not known for channel:" +
- _channel.getChannelId());
- }
-
- if (!_browsedAcks.contains(deliveryTag))
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Discarding message: " + msg.getMessage().getMessageId());
- }
-
- //Message has been ack so discard it. This will dequeue and decrement the reference.
- msg.discard(_storeContext);
- }
- else
- {
- _browsedAcks.remove(deliveryTag);
- }
-
- if (_log.isDebugEnabled())
- {
- _log.debug("Received non-multiple ack for messaging with delivery tag " + deliveryTag + " msg id " +
- msg.getMessage().getMessageId());
- }
- }
- }
-
- public void messageFullyReceived(boolean persistent) throws AMQException
- {
- if (persistent)
- {
- _messageStore.commitTran(_storeContext);
- _inTran = false;
- }
- }
-
- public void messageProcessed(AMQProtocolSession protocolSession) throws AMQException
- {
- _channel.processReturns(protocolSession);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/StoreMessageOperation.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/StoreMessageOperation.java
deleted file mode 100644
index 0e4d6c2030..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/StoreMessageOperation.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.server.txn;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.StoreContext;
-
-/**
- * A transactional operation to store messages in an underlying persistent store. When this operation
- * commits it will do everything to ensure that all messages are safely committed to persistent
- * storage.
- */
-public class StoreMessageOperation implements TxnOp
-{
- private final MessageStore _messsageStore;
-
- public StoreMessageOperation(MessageStore messageStore)
- {
- _messsageStore = messageStore;
- }
-
- public void prepare(StoreContext context) throws AMQException
- {
- }
-
- public void undoPrepare()
- {
- }
-
- public void commit(StoreContext context) throws AMQException
- {
- _messsageStore.commitTran(context);
- }
-
- public void rollback(StoreContext context) throws AMQException
- {
- _messsageStore.abortTran(context);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TransactionalContext.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TransactionalContext.java
deleted file mode 100644
index 6016ecc1a5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TransactionalContext.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.server.txn;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.ack.UnacknowledgedMessageMap;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.QueueEntry;
-import org.apache.qpid.server.store.StoreContext;
-
-/**
- * TransactionalContext provides a context in which transactional operations on {@link AMQMessage}s are performed.
- * Different levels of transactional support for the delivery of messages may be provided by different implementations
- * of this interface.
- *
- * <p/>The fundamental transactional operations that can be performed on a message queue are 'enqueue' and 'dequeue'.
- * In this interface, these have been recast as the {@link #messageFullyReceived} and {@link #acknowledgeMessage}
- * operations. This interface essentially provides a way to make enqueueing and dequeuing transactional.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Explicitly accept a transaction start notification.
- * <tr><td> Commit all pending operations in a transaction.
- * <tr><td> Rollback all pending operations in a transaction.
- * <tr><td> Deliver a message to a queue as part of a transaction.
- * <tr><td> Redeliver a message to a queue as part of a transaction.
- * <tr><td> Mark a message as acknowledged as part of a transaction.
- * <tr><td> Accept notification that a message has been completely received as part of a transaction.
- * <tr><td> Accept notification that a message has been fully processed as part of a transaction.
- * <tr><td> Associate a message store context with this transaction context.
- * </table>
- *
- * @todo The 'fullyReceived' and 'messageProcessed' events sit uncomfortably in the responsibilities of a transactional
- * context. They are non-transactional operations, used to trigger other side-effects. Consider moving them
- * somewhere else, a seperate interface for example.
- *
- * @todo This transactional context could be written as a wrapper extension to a Queue implementation, that provides
- * transactional management of the enqueue and dequeue operations, with added commit/rollback methods. Any
- * queue implementation could be made transactional by wrapping it as a transactional queue. This would mean
- * that the enqueue/dequeue operations do not need to be recast as deliver/acknowledge operations, which may be
- * conceptually neater.
- *
- * For example:
- * <pre>
- * public interface Transactional
- * {
- * public void commit();
- * public void rollback();
- * }
- *
- * public interface TransactionalQueue<E> extends Transactional, SizeableQueue<E>
- * {}
- *
- * public class Queues
- * {
- * ...
- * // For transactional messaging, take a transactional view onto the queue.
- * public static <E> TransactionalQueue<E> getTransactionalQueue(SizeableQueue<E> queue) { ... }
- *
- * // For non-transactional messaging, take a non-transactional view onto the queue.
- * public static <E> TransactionalQueue<E> getNonTransactionalQueue(SizeableQueue<E> queue) { ... }
- * }
- * </pre>
- */
-public interface TransactionalContext
-{
- /**
- * Explicitly begins the transaction, if it has not already been started. {@link #commit} or {@link #rollback}
- * should automatically begin the next transaction in the chain.
- *
- * @throws AMQException If the transaction cannot be started for any reason.
- */
- void beginTranIfNecessary() throws AMQException;
-
- /**
- * Makes all pending operations on the transaction permanent and visible.
- *
- * @throws AMQException If the transaction cannot be committed for any reason.
- */
- void commit() throws AMQException;
-
- /**
- * Erases all pending operations on the transaction.
- *
- * @throws AMQException If the transaction cannot be committed for any reason.
- */
- void rollback() throws AMQException;
-
- /**
- * Delivers the specified message to the specified queue. A 'deliverFirst' flag may be set if the message is a
- * redelivery, and should be placed on the front of the queue.
- *
- * <p/>This is an 'enqueue' operation.
- *
- * @param entry The message to deliver, and the queue to deliver to.
- * @param deliverFirst <tt>true</tt> to place the message on the front of the queue for redelivery, <tt>false</tt>
- * for normal FIFO message ordering.
- *
- * @throws AMQException If the message cannot be delivered for any reason.
- */
- void deliver(QueueEntry entry, boolean deliverFirst) throws AMQException;
-
- /**
- * Acknowledges a message or many messages as delivered. All messages up to a specified one, may be acknowledged by
- * setting the 'multiple' flag. It is also possible for the acknowledged message id to be zero, when the 'multiple'
- * flag is set, in which case an acknowledgement up to the latest delivered message should be done.
- *
- * <p/>This is a 'dequeue' operation.
- *
- * @param deliveryTag The id of the message to acknowledge, or zero, if using multiple acknowledgement
- * up to the latest message.
- * @param lastDeliveryTag The latest message delivered.
- * @param multiple <tt>true</tt> if all message ids up the acknowledged one or latest delivered, are
- * to be acknowledged, <tt>false</tt> otherwise.
- * @param unacknowledgedMessageMap The unacknowledged messages in the transaction, to remove the acknowledged message
- * from.
- *
- * @throws AMQException If the message cannot be acknowledged for any reason.
- */
- void acknowledgeMessage(long deliveryTag, long lastDeliveryTag, boolean multiple,
- UnacknowledgedMessageMap unacknowledgedMessageMap) throws AMQException;
-
- /**
- * Notifies the transactional context that a message has been fully received. The actual message that was received
- * is not specified. This event may be used to trigger a process related to the receipt of the message, for example,
- * flushing its data to disk.
- *
- * @param persistent <tt>true</tt> if the received message is persistent, <tt>false</tt> otherwise.
- *
- * @throws AMQException If the fully received event cannot be processed for any reason.
- */
- void messageFullyReceived(boolean persistent) throws AMQException;
-
- /**
- * Notifies the transactional context that a message has been delivered, succesfully or otherwise. The actual
- * message that was delivered is not specified. This event may be used to trigger a process related to the
- * outcome of the delivery of the message, for example, cleaning up failed deliveries.
- *
- * @param protocolSession The protocol session of the deliverable message.
- *
- * @throws AMQException If the message processed event cannot be handled for any reason.
- */
- void messageProcessed(AMQProtocolSession protocolSession) throws AMQException;
-
- /**
- * Gets the message store context associated with this transactional context.
- *
- * @return The message store context associated with this transactional context.
- */
- StoreContext getStoreContext();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TxnBuffer.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TxnBuffer.java
deleted file mode 100644
index 46a68b6a23..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TxnBuffer.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.server.txn;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.store.StoreContext;
-
-/** Holds a list of TxnOp instance representing transactional operations. */
-public class TxnBuffer
-{
- private final List<TxnOp> _ops = new ArrayList<TxnOp>();
- private static final Logger _log = Logger.getLogger(TxnBuffer.class);
-
- public TxnBuffer()
- {
- }
-
- public void commit(StoreContext context) throws AMQException
- {
- if (_log.isDebugEnabled())
- {
- _log.debug("Committing " + _ops.size() + " ops to commit.:" + _ops);
- }
-
- if (prepare(context))
- {
- for (TxnOp op : _ops)
- {
- op.commit(context);
- }
- }
- _ops.clear();
- }
-
- private boolean prepare(StoreContext context) throws AMQException
- {
- for (int i = 0; i < _ops.size(); i++)
- {
- TxnOp op = _ops.get(i);
- try
- {
- op.prepare(context);
- }
- catch (AMQException e)
- {
- undoPrepare(i);
- throw e;
- }
- catch (RuntimeException e)
- {
- undoPrepare(i);
- throw e;
- }
- }
- return true;
- }
-
- private void undoPrepare(int lastPrepared)
- {
- //compensate previously prepared ops
- for (int j = 0; j < lastPrepared; j++)
- {
- _ops.get(j).undoPrepare();
- }
- }
-
-
-
- public void rollback(StoreContext context) throws AMQException
- {
- for (TxnOp op : _ops)
- {
- op.rollback(context);
- }
- _ops.clear();
- }
-
- public void enlist(TxnOp op)
- {
- _ops.add(op);
- }
-
- public void cancel(TxnOp op)
- {
- _ops.remove(op);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TxnOp.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TxnOp.java
deleted file mode 100644
index 919c078cf0..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/TxnOp.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.server.txn;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.store.StoreContext;
-
-/**
- * This provides the abstraction of an individual operation within a
- * transaction. It is used by the TxnBuffer class.
- */
-public interface TxnOp
-{
- /**
- * Do the part of the operation that updates persistent state
- */
- public void prepare(StoreContext context) throws AMQException;
- /**
- * Complete the operation started by prepare. Can now update in
- * memory state or make netork transfers.
- */
- public void commit(StoreContext context) throws AMQException;
- /**
- * This is not the same as rollback. Unfortunately the use of an
- * in memory reference count as a locking mechanism and a test for
- * whether a message should be deleted means that as things are,
- * handling an acknowledgement unavoidably alters both memory and
- * persistent state on prepare. This is needed to 'compensate' or
- * undo the in-memory change if the peristent update of later ops
- * fails.
- */
- public void undoPrepare();
- /**
- * Rolls back the operation.
- */
- public void rollback(StoreContext context) throws AMQException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/util/CircularBuffer.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/util/CircularBuffer.java
deleted file mode 100644
index e730e2f3c3..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/util/CircularBuffer.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.util;
-
-import java.util.Iterator;
-
-import org.apache.log4j.Logger;
-
-public class CircularBuffer implements Iterable
-{
-
- private static final Logger _logger = Logger.getLogger(CircularBuffer.class);
-
- private final Object[] _log;
- private int _size;
- private int _index;
-
- public CircularBuffer(int size)
- {
- _log = new Object[size];
- }
-
- public void add(Object o)
- {
- _log[_index++] = o;
- _size = Math.min(_size+1, _log.length);
- if(_index >= _log.length)
- {
- _index = 0;
- }
- }
-
- public Object get(int i)
- {
- if(i >= _log.length)
- {
- throw new ArrayIndexOutOfBoundsException(i);
- }
- return _log[index(i)];
- }
-
- public int size() {
- return _size;
- }
-
- public Iterator iterator()
- {
- return new Iterator()
- {
- private int i = 0;
-
- public boolean hasNext()
- {
- return i < _size;
- }
-
- public Object next()
- {
- return get(i++);
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- public String toString()
- {
- StringBuilder s = new StringBuilder();
- boolean first = true;
- for(Object o : this)
- {
- if(!first)
- {
- s.append(", ");
- }
- else
- {
- first = false;
- }
- s.append(o);
- }
- return s.toString();
- }
-
- public void dump()
- {
- for(Object o : this)
- {
- _logger.info(o);
- }
- }
-
- int index(int i)
- {
- return _size == _log.length ? (_index + i) % _log.length : i;
- }
-
- public static void main(String[] artgv)
- {
- String[] items = new String[]{
- "A","B","C","D","E","F","G","H","I","J","K"
- };
- CircularBuffer buffer = new CircularBuffer(5);
- for(String s : items)
- {
- buffer.add(s);
- _logger.info(buffer);
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/util/ConcurrentLinkedQueueNoSize.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/util/ConcurrentLinkedQueueNoSize.java
deleted file mode 100644
index cf5e71a6e2..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/util/ConcurrentLinkedQueueNoSize.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.server.util;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-public class ConcurrentLinkedQueueNoSize<E> extends ConcurrentLinkedQueue<E>
-{
- public int size()
- {
- if (isEmpty())
- {
- return 0;
- }
- else
- {
- return 1;
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/util/LoggingProxy.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/util/LoggingProxy.java
deleted file mode 100644
index eda97e0ed2..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/util/LoggingProxy.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.server.util;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Arrays;
-
-/**
- * Dynamic proxy that records invocations in a fixed size circular buffer,
- * dumping details on hitting an exception.
- * <p>
- * Useful in debugging.
- * <p>
- */
-public class LoggingProxy implements InvocationHandler
-{
- private final Object _target;
- private final CircularBuffer _log;
-
- public LoggingProxy(Object target, int size)
- {
- _target = target;
- _log = new CircularBuffer(size);
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- try
- {
- entered(method, args);
- Object result = method.invoke(_target, args);
- returned(method, result);
- return result;
- }
- catch(InvocationTargetException e)
- {
- dump();
- throw e.getTargetException();
- }
- }
-
- void dump()
- {
- _log.dump();
- }
-
- CircularBuffer getBuffer()
- {
- return _log;
- }
-
- private synchronized void entered(Method method, Object[] args)
- {
- if (args == null)
- {
- _log.add(Thread.currentThread() + ": " + method.getName() + "() entered");
- }
- else
- {
- _log.add(Thread.currentThread() + ": " + method.getName() + "(" + Arrays.toString(args) + ") entered");
- }
- }
-
- private synchronized void returned(Method method, Object result)
- {
- if (method.getReturnType() == Void.TYPE)
- {
- _log.add(Thread.currentThread() + ": " + method.getName() + "() returned");
- }
- else
- {
- _log.add(Thread.currentThread() + ": " + method.getName() + "() returned " + result);
- }
- }
-
- public Object getProxy(Class... c)
- {
- return Proxy.newProxyInstance(_target.getClass().getClassLoader(), c, this);
- }
-
- public int getBufferSize() {
- return _log.size();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/util/NullApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/util/NullApplicationRegistry.java
deleted file mode 100644
index 0acfa84f31..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/util/NullApplicationRegistry.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.MapConfiguration;
-import org.apache.qpid.server.management.ManagedObjectRegistry;
-import org.apache.qpid.server.management.NoopManagedObjectRegistry;
-import org.apache.qpid.server.plugins.PluginManager;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabaseManager;
-import org.apache.qpid.server.security.auth.database.PropertiesPrincipalDatabaseManager;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.security.access.plugins.AllowAll;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-
-public class NullApplicationRegistry extends ApplicationRegistry
-{
- private ManagedObjectRegistry _managedObjectRegistry;
-
- private AuthenticationManager _authenticationManager;
-
- private VirtualHostRegistry _virtualHostRegistry;
-
- private ACLPlugin _accessManager;
-
- private PrincipalDatabaseManager _databaseManager;
-
- private PluginManager _pluginManager;
-
-
- public NullApplicationRegistry()
- {
- super(new MapConfiguration(new HashMap()));
- }
-
- public void initialise() throws Exception
- {
- _configuration.addProperty("store.class", "org.apache.qpid.server.store.MemoryMessageStore");
-
- Properties users = new Properties();
-
- users.put("guest", "guest");
-
- _databaseManager = new PropertiesPrincipalDatabaseManager("default", users);
-
- _accessManager = new AllowAll();
-
- _authenticationManager = new PrincipalDatabaseAuthenticationManager(null, null);
-
- _managedObjectRegistry = new NoopManagedObjectRegistry();
- _virtualHostRegistry = new VirtualHostRegistry();
- VirtualHost dummyHost = new VirtualHost("test", getConfiguration());
- _virtualHostRegistry.registerVirtualHost(dummyHost);
- _virtualHostRegistry.setDefaultVirtualHostName("test");
- _pluginManager = new PluginManager("");
- _configuration.addProperty("heartbeat.delay", 10 * 60); // 10 minutes
-
- }
-
- public Configuration getConfiguration()
- {
- return _configuration;
- }
-
-
- public ManagedObjectRegistry getManagedObjectRegistry()
- {
- return _managedObjectRegistry;
- }
-
- public PrincipalDatabaseManager getDatabaseManager()
- {
- return _databaseManager;
- }
-
- public AuthenticationManager getAuthenticationManager()
- {
- return _authenticationManager;
- }
-
- public Collection<String> getVirtualHostNames()
- {
- String[] hosts = {"test"};
- return Arrays.asList(hosts);
- }
-
- public VirtualHostRegistry getVirtualHostRegistry()
- {
- return _virtualHostRegistry;
- }
-
- public ACLPlugin getAccessManager()
- {
- return _accessManager;
- }
-
- public PluginManager getPluginManager()
- {
- return _pluginManager;
- }
-}
-
-
-
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/ManagedVirtualHost.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/ManagedVirtualHost.java
deleted file mode 100644
index 85d804457e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/ManagedVirtualHost.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.server.virtualhost;
-
-import java.io.IOException;
-
-import org.apache.qpid.server.management.MBeanAttribute;
-
-/**
- * The management interface exposed to allow management of an Exchange.
- * @version 0.1
- */
-public interface ManagedVirtualHost
-{
- static final String TYPE = "VirtualHost";
-
- /**
- * Returns the name of the managed virtualHost.
- * @return the name of the exchange.
- * @throws java.io.IOException
- */
- @MBeanAttribute(name="Name", description= TYPE + " Name")
- String getName() throws IOException;
-
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
deleted file mode 100644
index 90004a028c..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.virtualhost;
-
-import javax.management.NotCompliantMBeanException;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.log4j.Logger;
-import org.apache.qpid.server.AMQBrokerManagerMBean;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.security.access.ACLManager;
-import org.apache.qpid.server.security.access.Accessable;
-import org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.exchange.DefaultExchangeFactory;
-import org.apache.qpid.server.exchange.DefaultExchangeRegistry;
-import org.apache.qpid.server.exchange.ExchangeFactory;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.management.AMQManagedObject;
-import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.server.queue.DefaultQueueRegistry;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.AMQException;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-public class VirtualHost implements Accessable
-{
- private static final Logger _logger = Logger.getLogger(VirtualHost.class);
-
-
- private final String _name;
-
- private QueueRegistry _queueRegistry;
-
- private ExchangeRegistry _exchangeRegistry;
-
- private ExchangeFactory _exchangeFactory;
-
- private MessageStore _messageStore;
-
- protected VirtualHostMBean _virtualHostMBean;
-
- private AMQBrokerManagerMBean _brokerMBean;
-
- private AuthenticationManager _authenticationManager;
-
- private ACLPlugin _accessManager;
-
- private final Timer _houseKeepingTimer = new Timer("Queue-housekeeping", true);
-
- private static final long DEFAULT_HOUSEKEEPING_PERIOD = 30000L;
-
- public void setAccessableName(String name)
- {
- _logger.warn("Setting Accessable Name for VirualHost is not allowed. ("
- + name + ") ignored remains :" + getAccessableName());
- }
-
- public String getAccessableName()
- {
- return _name;
- }
-
-
- /**
- * Abstract MBean class. This has some of the methods implemented from management intrerface for exchanges. Any
- * implementaion of an Exchange MBean should extend this class.
- */
- public class VirtualHostMBean extends AMQManagedObject implements ManagedVirtualHost
- {
- public VirtualHostMBean() throws NotCompliantMBeanException
- {
- super(ManagedVirtualHost.class, "VirtualHost");
- }
-
- public String getObjectInstanceName()
- {
- return _name.toString();
- }
-
- public String getName()
- {
- return _name.toString();
- }
-
- public VirtualHost getVirtualHost()
- {
- return VirtualHost.this;
- }
-
-
- } // End of MBean class
-
- /**
- * Used for testing only
- * @param name
- * @param store
- * @throws Exception
- */
- public VirtualHost(String name, MessageStore store) throws Exception
- {
- this(name, new PropertiesConfiguration(), store);
- }
-
- /**
- * Normal Constructor
- * @param name
- * @param hostConfig
- * @throws Exception
- */
- public VirtualHost(String name, Configuration hostConfig) throws Exception
- {
- this(name, hostConfig, null);
- }
-
- public VirtualHost(String name, Configuration hostConfig, MessageStore store) throws Exception
- {
- _name = name;
-
- _virtualHostMBean = new VirtualHostMBean();
- // This isn't needed to be registered
- //_virtualHostMBean.register();
-
- _queueRegistry = new DefaultQueueRegistry(this);
- _exchangeFactory = new DefaultExchangeFactory(this);
- _exchangeFactory.initialise(hostConfig);
- _exchangeRegistry = new DefaultExchangeRegistry(this);
-
- if (store != null)
- {
- _messageStore = store;
- }
- else
- {
- if (hostConfig == null)
- {
- throw new IllegalAccessException("HostConfig and MessageStore cannot be null");
- }
- initialiseMessageStore(hostConfig);
- }
-
- _exchangeRegistry.initialise();
-
- _authenticationManager = new PrincipalDatabaseAuthenticationManager(name, hostConfig);
-
- _accessManager = ACLManager.loadACLManager(name, hostConfig);
-
- _brokerMBean = new AMQBrokerManagerMBean(_virtualHostMBean);
- _brokerMBean.register();
- initialiseHouseKeeping(hostConfig);
- }
-
- private void initialiseHouseKeeping(final Configuration hostConfig)
- {
-
- long period = hostConfig.getLong("housekeeping.expiredMessageCheckPeriod", DEFAULT_HOUSEKEEPING_PERIOD);
-
- /* add a timer task to iterate over queues, cleaning expired messages from queues with no consumers */
- if(period != 0L)
- {
- class RemoveExpiredMessagesTask extends TimerTask
- {
- public void run()
- {
- for(AMQQueue q : _queueRegistry.getQueues())
- {
-
- try
- {
- q.removeExpiredIfNoSubscribers();
- }
- catch (AMQException e)
- {
- _logger.error("Exception in housekeeping for queue: " + q.getName().toString(),e);
- throw new RuntimeException(e);
- }
- }
- }
- }
-
- _houseKeepingTimer.scheduleAtFixedRate(new RemoveExpiredMessagesTask(),
- period/2,
- period);
- }
- }
-
- private void initialiseMessageStore(Configuration config) throws Exception
- {
- String messageStoreClass = config.getString("store.class");
-
- Class clazz = Class.forName(messageStoreClass);
- Object o = clazz.newInstance();
-
- if (!(o instanceof MessageStore))
- {
- throw new ClassCastException("Message store class must implement " + MessageStore.class + ". Class " + clazz +
- " does not.");
- }
- _messageStore = (MessageStore) o;
- _messageStore.configure(this, "store", config);
- }
-
-
- public <T> T getConfiguredObject(Class<T> instanceType, Configuration config)
- {
- T instance;
- try
- {
- instance = instanceType.newInstance();
- }
- catch (Exception e)
- {
- _logger.error("Unable to instantiate configuration class " + instanceType + " - ensure it has a public default constructor");
- throw new IllegalArgumentException("Unable to instantiate configuration class " + instanceType + " - ensure it has a public default constructor", e);
- }
- Configurator.configure(instance);
-
- return instance;
- }
-
-
- public String getName()
- {
- return _name;
- }
-
- public QueueRegistry getQueueRegistry()
- {
- return _queueRegistry;
- }
-
- public ExchangeRegistry getExchangeRegistry()
- {
- return _exchangeRegistry;
- }
-
- public ExchangeFactory getExchangeFactory()
- {
- return _exchangeFactory;
- }
-
- public ApplicationRegistry getApplicationRegistry()
- {
- throw new UnsupportedOperationException();
- }
-
- public MessageStore getMessageStore()
- {
- return _messageStore;
- }
-
- public AuthenticationManager getAuthenticationManager()
- {
- return _authenticationManager;
- }
-
- public ACLPlugin getAccessManager()
- {
- return _accessManager;
- }
-
- public void close() throws Exception
- {
- if (_messageStore != null)
- {
- _messageStore.close();
- }
- }
-
- public ManagedObject getBrokerMBean()
- {
- return _brokerMBean;
- }
-
- public ManagedObject getManagedObject()
- {
- return _virtualHostMBean;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java
deleted file mode 100644
index 27917fac8a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.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.server.virtualhost;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-public class VirtualHostRegistry
-{
- private final Map<String, VirtualHost> _registry = new ConcurrentHashMap<String,VirtualHost>();
-
-
- private String _defaultVirtualHostName;
-
- public synchronized void registerVirtualHost(VirtualHost host) throws Exception
- {
- if(_registry.containsKey(host.getName()))
- {
- throw new Exception("Virtual Host with name " + host.getName() + " already registered.");
- }
- _registry.put(host.getName(),host);
- }
-
- public VirtualHost getVirtualHost(String name)
- {
- if(name == null || name.trim().length() == 0 )
- {
- name = getDefaultVirtualHostName();
- }
-
- return _registry.get(name);
- }
-
- private String getDefaultVirtualHostName()
- {
- return _defaultVirtualHostName;
- }
-
- public void setDefaultVirtualHostName(String defaultVirtualHostName)
- {
- _defaultVirtualHostName = defaultVirtualHostName;
- }
-
-
- public Collection<VirtualHost> getVirtualHosts()
- {
- return new ArrayList<VirtualHost>(_registry.values());
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/MessageStoreTool.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/MessageStoreTool.java
deleted file mode 100644
index edc900f401..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/MessageStoreTool.java
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.messagestore;
-
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.qpid.configuration.Configuration;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
-import org.apache.qpid.server.store.MemoryMessageStore;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.tools.messagestore.commands.Clear;
-import org.apache.qpid.tools.messagestore.commands.Command;
-import org.apache.qpid.tools.messagestore.commands.Copy;
-import org.apache.qpid.tools.messagestore.commands.Dump;
-import org.apache.qpid.tools.messagestore.commands.Help;
-import org.apache.qpid.tools.messagestore.commands.List;
-import org.apache.qpid.tools.messagestore.commands.Load;
-import org.apache.qpid.tools.messagestore.commands.Quit;
-import org.apache.qpid.tools.messagestore.commands.Select;
-import org.apache.qpid.tools.messagestore.commands.Show;
-import org.apache.qpid.tools.messagestore.commands.Move;
-import org.apache.qpid.tools.messagestore.commands.Purge;
-import org.apache.qpid.tools.utils.CommandParser;
-import org.apache.qpid.tools.utils.Console;
-import org.apache.qpid.tools.utils.SimpleCommandParser;
-import org.apache.qpid.tools.utils.SimpleConsole;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * MessageStoreTool.
- */
-public class MessageStoreTool
-{
- /** Text outputted at the start of each console.*/
- private static final String BOILER_PLATE = "MessageStoreTool - for examining Persistent Qpid Broker MessageStore instances";
-
- /** I/O Wrapper. */
- protected Console _console;
-
- /** Batch mode flag. */
- protected boolean _batchMode;
-
- /** Internal State object. */
- private State _state = new State();
-
- private HashMap<String, Command> _commands = new HashMap<String, Command>();
-
- /** SLF4J Logger. */
- private static Logger _devlog = LoggerFactory.getLogger(MessageStoreTool.class);
-
- /** Loaded configuration file. */
- private Configuration _config;
-
- /** Control used for main run loop. */
- private boolean _running = true;
- private boolean _initialised = false;
-
- //---------------------------------------------------------------------------------------------------/
-
- public static void main(String[] args) throws Configuration.InitException
- {
-
- MessageStoreTool tool = new MessageStoreTool(args);
-
- tool.start();
- }
-
-
- public MessageStoreTool(String[] args) throws Configuration.InitException
- {
- this(args, System.in, System.out);
- }
-
- public MessageStoreTool(String[] args, InputStream in, OutputStream out) throws Configuration.InitException
- {
- BufferedReader consoleReader = new BufferedReader(new InputStreamReader(in));
- BufferedWriter consoleWriter = new BufferedWriter(new OutputStreamWriter(out));
-
- Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook(this)));
- _batchMode = false;
-
- _console = new SimpleConsole(consoleWriter, consoleReader);
-
- _config = new Configuration();
-
- setOptions();
- _config.processCommandline(args);
- }
-
-
- private void setOptions()
- {
- Option help = new Option("h", "help", false, "print this message");
- Option version = new Option("v", "version", false, "print the version information and exit");
- Option configFile =
- OptionBuilder.withArgName("file").hasArg()
- .withDescription("use given configuration file By "
- + "default looks for a file named "
- + Configuration.DEFAULT_CONFIG_FILE + " in " + Configuration.QPID_HOME)
- .withLongOpt("config")
- .create("c");
-
- _config.setOption(help);
- _config.setOption(version);
- _config.setOption(configFile);
- }
-
- public State getState()
- {
- return _state;
- }
-
- public Map<String, Command> getCommands()
- {
- return _commands;
- }
-
- public void setConfigurationFile(String configfile) throws Configuration.InitException
- {
- _config.loadConfig(new File(configfile));
- setup();
- }
-
- public Console getConsole()
- {
- return _console;
- }
-
- public void setConsole(Console console)
- {
- _console = console;
- }
-
- /**
- * Simple ShutdownHook to cleanly shutdown the databases
- */
- class ShutdownHook implements Runnable
- {
- MessageStoreTool _tool;
-
- ShutdownHook(MessageStoreTool messageStoreTool)
- {
- _tool = messageStoreTool;
- }
-
- public void run()
- {
- _tool.quit();
- }
- }
-
- public void quit()
- {
- _running = false;
-
- if (_initialised)
- {
- ApplicationRegistry.remove(1);
- }
-
- _console.println("...exiting");
-
- _console.close();
- }
-
- public void setBatchMode(boolean batchmode)
- {
- _batchMode = batchmode;
- }
-
- /**
- * Main loop
- */
- protected void start()
- {
- setup();
-
- if (!_initialised)
- {
- System.exit(1);
- }
-
- _console.println("");
-
- _console.println(BOILER_PLATE);
-
- runCLI();
- }
-
- private void setup()
- {
- loadDefaultVirtualHosts();
-
- loadCommands();
-
- _state.clearAll();
- }
-
- private void loadCommands()
- {
- _commands.clear();
- //todo Dynamically load the classes that exis in com.redhat.etp.qpid.commands
- _commands.put("close", new Clear(this));
- _commands.put("copy", new Copy(this));
- _commands.put("dump", new Dump(this));
- _commands.put("help", new Help(this));
- _commands.put("list", new List(this));
- _commands.put("load", new Load(this));
- _commands.put("move", new Move(this));
- _commands.put("purge", new Purge(this));
- _commands.put("quit", new Quit(this));
- _commands.put("select", new Select(this));
- _commands.put("show", new Show(this));
- }
-
- private void loadDefaultVirtualHosts()
- {
- final File configFile = _config.getConfigFile();
-
- loadVirtualHosts(configFile);
- }
-
- private void loadVirtualHosts(File configFile)
- {
-
- if (!configFile.exists())
- {
- _devlog.error("Config file not found:" + configFile.getAbsolutePath());
- return;
- }
- else
- {
- _devlog.debug("using config file :" + configFile.getAbsolutePath());
- }
-
- try
- {
- ConfigurationFileApplicationRegistry registry = new ConfigurationFileApplicationRegistry(configFile);
-
- ApplicationRegistry.remove(1);
-
- ApplicationRegistry.initialise(registry);
-
- checkMessageStores();
- _initialised = true;
- }
- catch (ConfigurationException e)
- {
- _console.println("Unable to load configuration due to configuration error: " + e.getMessage());
- e.printStackTrace();
- }
- catch (Exception e)
- {
- _console.println("Unable to load configuration due to: " + e.getMessage());
- e.printStackTrace();
- }
-
-
- }
-
- private void checkMessageStores()
- {
- Collection<VirtualHost> vhosts = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHosts();
-
- boolean warning = false;
- for (VirtualHost vhost : vhosts)
- {
- if (vhost.getMessageStore() instanceof MemoryMessageStore)
- {
- _console.println("WARNING: Virtualhost '" + vhost.getName() + "' is using a MemoryMessageStore. "
- + "Changes will not persist.");
- warning = true;
- }
- }
-
- if (warning)
- {
- _console.println("");
- _console.println("Please ensure you are using the correct config file currently using '"
- + _config.getConfigFile().getAbsolutePath() + "'");
- _console.println("New config file can be specifed by 'load <config file>' or -c on the commandline.");
- _console.println("");
- }
- }
-
- private void runCLI()
- {
- while (_running)
- {
- if (!_batchMode)
- {
- printPrompt();
- }
-
- String[] args = _console.readCommand();
-
- while (args != null)
- {
- exec(args);
-
- if (_running)
- {
- if (!_batchMode)
- {
- printPrompt();
- }
-
- args = _console.readCommand();
- }
- }
- }
- }
-
- private void printPrompt()
- {
- _console.print(prompt());
- }
-
-
- /**
- * Execute a script (batch mode).
- *
- * @param script The file script
- */
- protected void runScripts(String script)
- {
- //Store Current State
- boolean oldBatch = _batchMode;
- CommandParser oldParser = _console.getCommandParser();
- setBatchMode(true);
-
- try
- {
- _devlog.debug("Running script '" + script + "'");
-
- _console.setCommandParser(new SimpleCommandParser(new BufferedReader(new FileReader(script))));
-
- start();
- }
- catch (java.io.FileNotFoundException e)
- {
- _devlog.error("Script not found: '" + script + "' due to:" + e.getMessage());
- }
-
- //Restore previous state
- _console.setCommandParser(oldParser);
- setBatchMode(oldBatch);
- }
-
- public String prompt()
- {
- String state = _state.toString();
- if (state != null && state.length() != 0)
- {
- return state + ":bdb$ ";
- }
- else
- {
- return "bdb$ ";
- }
- }
-
- /**
- * Execute the command.
- *
- * @param args [command, arg0, arg1...].
- */
- protected void exec(String[] args)
- {
- // Comment lines start with a #
- if (args.length == 0 || args[0].startsWith("#"))
- {
- return;
- }
-
- final String command = args[0];
-
- Command cmd = _commands.get(command);
-
- if (cmd == null)
- {
- _console.println("Command not understood: " + command);
- }
- else
- {
- cmd.execute(args);
- }
- }
-
-
- /**
- * Displays usage info.
- */
- protected static void help()
- {
- System.out.println(BOILER_PLATE);
- System.out.println("Usage: java " + MessageStoreTool.class + " [Options]");
- System.out.println(" [-c <broker config file>] : Defaults to \"$QPID_HOME/etc/config.xml\"");
- }
-
-
- /**
- * This class is used to store the current state of the tool.
- *
- * This is then interrogated by the various commands to augment their behaviour.
- *
- *
- */
- public class State
- {
- private VirtualHost _vhost = null;
- private AMQQueue _queue = null;
- private Exchange _exchange = null;
- private java.util.List<Long> _msgids = null;
-
- public State()
- {
- }
-
- public void setQueue(AMQQueue queue)
- {
- _queue = queue;
- }
-
- public AMQQueue getQueue()
- {
- return _queue;
- }
-
- public void setVhost(VirtualHost vhost)
- {
- _vhost = vhost;
- }
-
- public VirtualHost getVhost()
- {
- return _vhost;
- }
-
- public Exchange getExchange()
- {
- return _exchange;
- }
-
- public void setExchange(Exchange exchange)
- {
- _exchange = exchange;
- }
-
- public String toString()
- {
- StringBuilder status = new StringBuilder();
-
- if (_vhost != null)
- {
- status.append(_vhost.getName());
-
- if (_exchange != null)
- {
- status.append("[");
- status.append(_exchange.getName());
- status.append("]");
-
- if (_queue != null)
- {
- status.append("->'");
- status.append(_queue.getName());
- status.append("'");
-
- if (_msgids != null)
- {
- status.append(printMessages());
- }
- }
- }
- }
-
- return status.toString();
- }
-
-
- public String printMessages()
- {
- StringBuilder sb = new StringBuilder();
-
- Long previous = null;
-
- Long start = null;
- for (Long id : _msgids)
- {
- if (previous != null)
- {
- if (id == previous + 1)
- {
- if (start == null)
- {
- start = previous;
- }
- }
- else
- {
- if (start != null)
- {
- sb.append(",");
- sb.append(start);
- sb.append("-");
- sb.append(id);
- start = null;
- }
- else
- {
- sb.append(",");
- sb.append(previous);
- }
- }
- }
-
- previous = id;
- }
-
- if (start != null)
- {
- sb.append(",");
- sb.append(start);
- sb.append("-");
- sb.append(_msgids.get(_msgids.size() - 1));
- }
- else
- {
- sb.append(",");
- sb.append(previous);
- }
-
- // surround list in ()
- sb.replace(0, 1, "(");
- sb.append(")");
- return sb.toString();
- }
-
- public void clearAll()
- {
- _vhost = null;
- clearExchange();
- }
-
- public void clearExchange()
- {
- _exchange = null;
- clearQueue();
- }
-
- public void clearQueue()
- {
- _queue = null;
- clearMessages();
- }
-
- public void clearMessages()
- {
- _msgids = null;
- }
-
- /**
- * A common location to provide parsing of the message id string
- * utilised by a number of the commands.
- * The String is comma separated list of ids that can be individual ids
- * or a range (4-10)
- *
- * @param msgString string of msg ids to parse 1,2,4-10
- */
- public void setMessages(String msgString)
- {
- StringTokenizer tok = new StringTokenizer(msgString, ",");
-
- if (tok.hasMoreTokens())
- {
- _msgids = new LinkedList<Long>();
- }
-
- while (tok.hasMoreTokens())
- {
- String next = tok.nextToken();
- if (next.contains("-"))
- {
- Long start = Long.parseLong(next.substring(0, next.indexOf("-")));
- Long end = Long.parseLong(next.substring(next.indexOf("-") + 1));
-
- if (end >= start)
- {
- for (long l = start; l <= end; l++)
- {
- _msgids.add(l);
- }
- }
- }
- else
- {
- _msgids.add(Long.parseLong(next));
- }
- }
-
- }
-
- public void setMessages(java.util.List<Long> msgids)
- {
- _msgids = msgids;
- }
-
- public java.util.List<Long> getMessages()
- {
- return _msgids;
- }
- }//Class State
-
-}//Class MessageStoreTool
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/AbstractCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/AbstractCommand.java
deleted file mode 100644
index 5444197cb4..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/AbstractCommand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.messagestore.commands;
-
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-import org.apache.qpid.tools.utils.Console;
-
-public abstract class AbstractCommand implements Command
-{
- protected Console _console;
- protected MessageStoreTool _tool;
-
- public AbstractCommand(MessageStoreTool tool)
- {
- _console = tool.getConsole();
- _tool = tool;
- }
-
- public void setOutput(Console out)
- {
- _console = out;
- }
-
- protected void commandError(String message, String[] args)
- {
- _console.print(getCommand() + " : " + message);
-
- if (args != null)
- {
- for (int i = 1; i < args.length; i++)
- {
- _console.print(args[i]);
- }
- }
- _console.println("");
- _console.println(help());
- }
-
-
- public abstract String help();
-
- public abstract String usage();
-
- public abstract String getCommand();
-
-
- public abstract void execute(String... args);
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Clear.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Clear.java
deleted file mode 100644
index b0006b3fe6..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Clear.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.tools.messagestore.commands;
-
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-
-public class Clear extends AbstractCommand
-{
- public Clear(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Clears any selection.";
- }
-
- public String usage()
- {
- return "clear [ all | virtualhost | exchange | queue | msgs ]";
- }
-
- public String getCommand()
- {
- return "clear";
- }
-
- public void execute(String... args)
- {
- assert args.length > 0;
- assert args[0].equals(getCommand());
-
- if (args.length < 1)
- {
- doClose("all");
- }
- else
- {
- doClose(args[1]);
- }
- }
-
- private void doClose(String type)
- {
- if (type.equals("virtualhost")
- || type.equals("all"))
- {
- _tool.getState().clearAll();
- }
-
- if (type.equals("exchange"))
- {
- _tool.getState().clearExchange();
- }
-
- if (type.equals("queue"))
- {
- _tool.getState().clearQueue();
- }
-
- if (type.equals("msgs"))
- {
- _tool.getState().clearMessages();
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Command.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Command.java
deleted file mode 100644
index bfa775a34a..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Command.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.tools.messagestore.commands;
-
-import org.apache.qpid.tools.utils.Console;
-
-public interface Command
-{
- public void setOutput(Console out);
-
- public String help();
-
- public abstract String usage();
-
- String getCommand();
-
- public void execute(String... args);
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Copy.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Copy.java
deleted file mode 100644
index a5b3a87616..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Copy.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.tools.messagestore.commands;
-
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-
-public class Copy extends Move
-{
- public Copy(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Copy messages between queues.";/*\n" +
- "The currently selected message set will be copied to the specifed queue.\n" +
- "Alternatively the values can be provided on the command line."; */
- }
-
- public String usage()
- {
- return "copy to=<queue> [from=<queue>] [msgids=<msgids eg, 1,2,4-10>]";
- }
-
- public String getCommand()
- {
- return "copy";
- }
-
- protected void doCommand(AMQQueue fromQueue, long start, long end, AMQQueue toQueue)
- {
- fromQueue.copyMessagesToAnotherQueue(start, end, toQueue.getName().toString(), _storeContext);
- }
-
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Dump.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Dump.java
deleted file mode 100644
index 218d5f04ed..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Dump.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.messagestore.commands;
-
-import org.apache.commons.codec.binary.Hex;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.QueueEntry;
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-import org.apache.qpid.tools.utils.Console;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-public class Dump extends Show
-{
- private static final int LINE_SIZE = 8;
- private static final String DEFAULT_ENCODING = "utf-8";
- private static final boolean SPACE_BYTES = true;
- private static final String BYTE_SPACER = " ";
- private static final String NON_PRINTING_ASCII_CHAR = "?";
-
- protected boolean _content = true;
-
- public Dump(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Dump selected message content. Default: show=content";
- }
-
- public String usage()
- {
- return getCommand() + " [show=[all],[msgheaders],[_amqHeaders],[routing],[content]] [id=<msgid e.g. 1,2,4-10>]";
- }
-
- public String getCommand()
- {
- return "dump";
- }
-
- public void execute(String... args)
- {
- assert args.length > 0;
- assert args[0].equals(getCommand());
-
-
- if (args.length >= 2)
- {
- for (String arg : args)
- {
- if (arg.startsWith("show="))
- {
- _content = arg.contains("content") || arg.contains("all");
- }
- }
-
- parseArgs(args);
- }
-
- performShow();
- }
-
-
- protected List<List> createMessageData(java.util.List<Long> msgids, List<QueueEntry> messages, boolean showHeaders, boolean showRouting,
- boolean showMessageHeaders)
- {
-
- List<List> display = new LinkedList<List>();
-
- List<String> hex = new LinkedList<String>();
- List<String> ascii = new LinkedList<String>();
- display.add(hex);
- display.add(ascii);
-
- for (QueueEntry entry : messages)
- {
- AMQMessage msg = entry.getMessage();
- if (!includeMsg(msg, msgids))
- {
- continue;
- }
-
- //Add divider between messages
- hex.add(Console.ROW_DIVIDER);
- ascii.add(Console.ROW_DIVIDER);
-
- // Show general message information
- hex.add(Show.Columns.ID.name());
- ascii.add(msg.getMessageId().toString());
-
- hex.add(Console.ROW_DIVIDER);
- ascii.add(Console.ROW_DIVIDER);
-
- if (showRouting)
- {
- addShowInformation(hex, ascii, msg, "Routing Details", true, false, false);
- }
- if (showHeaders)
- {
- addShowInformation(hex, ascii, msg, "Headers", false, true, false);
- }
- if (showMessageHeaders)
- {
- addShowInformation(hex, ascii, msg, null, false, false, true);
- }
-
- // Add Content Body seciont
- hex.add("Content Body");
- ascii.add("");
- hex.add(Console.ROW_DIVIDER);
- ascii.add(Console.ROW_DIVIDER);
-
- Iterator bodies = msg.getContentBodyIterator();
- if (bodies.hasNext())
- {
-
- hex.add("Hex");
- hex.add(Console.ROW_DIVIDER);
-
-
- ascii.add("ASCII");
- ascii.add(Console.ROW_DIVIDER);
-
- while (bodies.hasNext())
- {
- ContentChunk chunk = (ContentChunk) bodies.next();
-
- //Duplicate so we don't destroy original data :)
- ByteBuffer hexBuffer = chunk.getData().duplicate();
-
- ByteBuffer charBuffer = hexBuffer.duplicate();
-
- Hex hexencoder = new Hex();
-
- while (hexBuffer.hasRemaining())
- {
- byte[] line = new byte[LINE_SIZE];
-
- int bufsize = hexBuffer.remaining();
- if (bufsize < LINE_SIZE)
- {
- hexBuffer.get(line, 0, bufsize);
- }
- else
- {
- bufsize = line.length;
- hexBuffer.get(line);
- }
-
- byte[] encoded = hexencoder.encode(line);
-
- try
- {
- String encStr = new String(encoded, 0, bufsize * 2, DEFAULT_ENCODING);
- String hexLine = "";
-
- int strKength = encStr.length();
- for (int c = 0; c < strKength; c++)
- {
- hexLine += encStr.charAt(c);
-
- if (c % 2 == 1 && SPACE_BYTES)
- {
- hexLine += BYTE_SPACER;
- }
- }
-
- hex.add(hexLine);
- }
- catch (UnsupportedEncodingException e)
- {
- _console.println(e.getMessage());
- return null;
- }
- }
-
- while (charBuffer.hasRemaining())
- {
- String asciiLine = "";
-
- for (int pos = 0; pos < LINE_SIZE; pos++)
- {
- if (charBuffer.hasRemaining())
- {
- byte ch = charBuffer.get();
-
- if (isPrintable(ch))
- {
- asciiLine += (char) ch;
- }
- else
- {
- asciiLine += NON_PRINTING_ASCII_CHAR;
- }
-
- if (SPACE_BYTES)
- {
- asciiLine += BYTE_SPACER;
- }
- }
- else
- {
- break;
- }
- }
-
- ascii.add(asciiLine);
- }
- }
- }
- else
- {
- List<String> result = new LinkedList<String>();
-
- display.add(result);
- result.add("No ContentBodies");
- }
- }
-
- // if hex is empty then we have no data to display
- if (hex.size() == 0)
- {
- return null;
- }
-
- return display;
- }
-
- private void addShowInformation(List<String> column1, List<String> column2, AMQMessage msg,
- String title, boolean routing, boolean headers, boolean messageHeaders)
- {
- List<QueueEntry> single = new LinkedList<QueueEntry>();
- single.add(new QueueEntry(null,msg));
-
- List<List> routingData = super.createMessageData(null, single, headers, routing, messageHeaders);
-
- //Reformat data
- if (title != null)
- {
- column1.add(title);
- column2.add("");
- column1.add(Console.ROW_DIVIDER);
- column2.add(Console.ROW_DIVIDER);
- }
-
- // look at all columns in the routing Data
- for (List item : routingData)
- {
- // the item should be:
- // Title
- // *divider
- // value
- // otherwise we can't reason about the correct value
- if (item.size() == 3)
- {
- //Filter out the columns we are not interested in.
-
- String columnName = item.get(0).toString();
-
- if (!(columnName.equals(Show.Columns.ID.name())
- || columnName.equals(Show.Columns.Size.name())))
- {
- column1.add(columnName);
- column2.add(item.get(2).toString());
- }
- }
- }
- column1.add(Console.ROW_DIVIDER);
- column2.add(Console.ROW_DIVIDER);
- }
-
- private boolean isPrintable(byte c)
- {
- return c > 31 && c < 127;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Help.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Help.java
deleted file mode 100644
index 0f9546541b..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Help.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.tools.messagestore.commands;
-
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-import org.apache.qpid.tools.utils.Console;
-
-import java.util.LinkedList;
-import java.util.Map;
-
-public class Help extends AbstractCommand
-{
- public Help(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Provides detailed help on commands.";
- }
-
- public String getCommand()
- {
- return "help";
- }
-
- public String usage()
- {
- return "help [<command>]";
- }
-
- public void execute(String... args)
- {
- assert args.length > 0;
- assert args[0].equals(getCommand());
-
- if (args.length > 1)
- {
- Command command = _tool.getCommands().get(args[1]);
- if (command != null)
- {
- _console.println(command.help());
- _console.println("Usage:" + command.usage());
- }
- else
- {
- commandError("Command not found: ", args);
- }
- }
- else
- {
- java.util.List<java.util.List> data = new LinkedList<java.util.List>();
-
- java.util.List<String> commandName = new LinkedList<String>();
- java.util.List<String> commandDescription = new LinkedList<String>();
-
- data.add(commandName);
- data.add(commandDescription);
-
- //Set up Headers
- commandName.add("Command");
- commandDescription.add("Description");
-
- commandName.add(Console.ROW_DIVIDER);
- commandDescription.add(Console.ROW_DIVIDER);
-
- //Add current Commands with descriptions
- Map<String, Command> commands = _tool.getCommands();
-
- for (Command command : commands.values())
- {
- commandName.add(command.getCommand());
- commandDescription.add(command.help());
- }
-
- _console.printMap("Available Commands", data);
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/List.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/List.java
deleted file mode 100644
index df8b59ec19..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/List.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.messagestore.commands;
-
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-import org.apache.qpid.tools.utils.Console;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-public class List extends AbstractCommand
-{
-
- public List(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public void setOutput(Console out)
- {
- _console = out;
- }
-
- public String help()
- {
- return "list available items.";
- }
-
- public String usage()
- {
- return "list queues [<exchange>] | exchanges | bindings [<exchange>] | all";
- }
-
- public String getCommand()
- {
- return "list";
- }
-
- public void execute(String... args)
- {
- assert args.length > 0;
- assert args[0].equals(getCommand());
-
- if (args.length > 1)
- {
- if ((args[1].equals("exchanges"))
- || (args[1].equals("queues"))
- || (args[1].equals("bindings"))
- || (args[1].equals("all")))
- {
- if (args.length == 2)
- {
- doList(args[1]);
- }
- else if (args.length == 3)
- {
- doList(args[1], args[2]);
- }
- }
- else
- {
- commandError("Unknown options. ", args);
- }
- }
- else if (args.length < 2)
- {
- doList("all");
- }
- else
- {
- doList(args[1]);
- }
- }
-
- private void doList(String... listItem)
- {
- if (_tool.getState().getVhost() == null)
- {
- _console.println("No Virtualhost open. Open a Virtualhost first.");
- listVirtualHosts();
- return;
- }
-
- VirtualHost vhost = _tool.getState().getVhost();
-
- java.util.List<String> data = null;
-
- if (listItem[0].equals("queues"))
- {
- if (listItem.length > 1)
- {
- data = listQueues(vhost, new AMQShortString(listItem[1]));
- }
- else
- {
- Exchange exchange = _tool.getState().getExchange();
- data = listQueues(vhost, exchange);
- }
- }
-
- if (listItem[0].equals("exchanges"))
- {
- data = listExchanges(vhost);
- }
-
- if (listItem[0].equals("bindings"))
- {
-
- if (listItem.length > 1)
- {
- data = listBindings(vhost, new AMQShortString(listItem[1]));
- }
- else
- {
- Exchange exchange = _tool.getState().getExchange();
-
- data = listBindings(vhost, exchange);
- }
- }
-
- if (data != null)
- {
- if (data.size() == 1)
- {
- _console.println("No '" + listItem[0] + "' to display,");
- }
- else
- {
- _console.displayList(true, data.toArray(new String[0]));
- }
- }
-
-
- if (listItem[0].equals("all"))
- {
-
- boolean displayed = false;
- Exchange exchange = _tool.getState().getExchange();
-
- //Do the display here for each one so that they are pretty printed
- data = listQueues(vhost, exchange);
- if (data != null)
- {
- displayed = true;
- _console.displayList(true, data.toArray(new String[0]));
- }
-
- if (exchange == null)
- {
- data = listExchanges(vhost);
- if (data != null)
- {
- displayed = true;
- _console.displayList(true, data.toArray(new String[0]));
- }
- }
-
- data = listBindings(vhost, exchange);
- if (data != null)
- {
- displayed = true;
- _console.displayList(true, data.toArray(new String[0]));
- }
-
- if (!displayed)
- {
- _console.println("Nothing to list");
- }
- }
- }
-
- private void listVirtualHosts()
- {
- Collection<VirtualHost> vhosts = ApplicationRegistry.getInstance()
- .getVirtualHostRegistry().getVirtualHosts();
-
- String[] data = new String[vhosts.size() + 1];
-
- data[0] = "Available VirtualHosts";
-
- int index = 1;
- for (VirtualHost vhost : vhosts)
- {
- data[index] = vhost.getName();
- index++;
- }
-
- _console.displayList(true, data);
- }
-
- private java.util.List<String> listBindings(VirtualHost vhost, AMQShortString exchangeName)
- {
- return listBindings(vhost, vhost.getExchangeRegistry().getExchange(exchangeName));
- }
-
- private java.util.List<String> listBindings(VirtualHost vhost, Exchange exchange)
- {
- Collection<AMQShortString> queues = vhost.getQueueRegistry().getQueueNames();
-
- if (queues == null || queues.size() == 0)
- {
- return null;
- }
-
- java.util.List<String> data = new LinkedList<String>();
-
- data.add("Current Bindings");
-
- for (AMQShortString queue : queues)
- {
- if (exchange != null)
- {
- if (exchange.isBound(queue))
- {
- data.add(queue.toString());
- }
- }
- else
- {
- data.add(queue.toString());
- }
- }
-
- return data;
- }
-
- private java.util.List<String> listExchanges(VirtualHost vhost)
- {
- Collection<AMQShortString> queues = vhost.getExchangeRegistry().getExchangeNames();
-
- if (queues == null || queues.size() == 0)
- {
- return null;
- }
-
- java.util.List<String> data = new LinkedList<String>();
-
- data.add("Available Exchanges");
-
- for (AMQShortString queue : queues)
- {
- data.add(queue.toString());
- }
-
- return data;
- }
-
- private java.util.List<String> listQueues(VirtualHost vhost, AMQShortString exchangeName)
- {
- return listQueues(vhost, vhost.getExchangeRegistry().getExchange(exchangeName));
- }
-
- private java.util.List<String> listQueues(VirtualHost vhost, Exchange exchange)
- {
- Collection<AMQQueue> queues = vhost.getQueueRegistry().getQueues();
-
- if (queues == null || queues.size() == 0)
- {
- return null;
- }
-
- java.util.List<String> data = new LinkedList<String>();
-
- data.add("Available Queues");
-
- for (AMQQueue queue : queues)
- {
- if (exchange != null)
- {
- if (exchange.isBound(queue))
- {
- data.add(queue.getName().toString());
- }
- }
- else
- {
- data.add(queue.getName().toString());
- }
- }
-
- if (exchange != null)
- {
- if (queues.size() == 1)
- {
- return null;
- }
- }
-
- return data;
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Load.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Load.java
deleted file mode 100644
index 244a311c30..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Load.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.messagestore.commands;
-
-import org.apache.qpid.configuration.Configuration;
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-
-public class Load extends AbstractCommand
-{
- public Load(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Loads specified broker configuration file.";
- }
-
- public String usage()
- {
- return "load <configuration file>";
- }
-
- public String getCommand()
- {
- return "load";
- }
-
- public void execute(String... args)
- {
- assert args.length > 0;
- assert args[0].equals(getCommand());
-
- if (args.length > 2)
- {
- _console.print("load " + args[1] + ": additional options not understood:");
- for (int i = 2; i < args.length; i++)
- {
- _console.print(args[i] + " ");
- }
- _console.println("");
- }
- else if (args.length < 2)
- {
- _console.println("Enter Configuration file.");
- String input = _console.readln();
- if (input != null)
- {
- doLoad(input);
- }
- else
- {
- _console.println("Did not recognise config file.");
- }
- }
- else
- {
- doLoad(args[1]);
- }
- }
-
- private void doLoad(String configfile)
- {
- _console.println("Loading Configuration:" + configfile);
-
- try
- {
- _tool.setConfigurationFile(configfile);
- }
- catch (Configuration.InitException e)
- {
- _console.println("Unable to open config file due to: '" + e.getMessage() + "'");
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Move.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Move.java
deleted file mode 100644
index 7e21253fab..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Move.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.messagestore.commands;
-
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueEntry;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class Move extends AbstractCommand
-{
-
- /**
- * Since the Coopy command is not associated with a real channel we can safely create our own store context
- * for use in the few methods that require one.
- */
- protected StoreContext _storeContext = new StoreContext();
-
- public Move(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Move messages between queues.";/*\n" +
- "The currently selected message set will be moved to the specifed queue.\n" +
- "Alternatively the values can be provided on the command line.";*/
- }
-
- public String usage()
- {
- return "move to=<queue> [from=<queue>] [msgids=<msgids eg, 1,2,4-10>]";
- }
-
- public String getCommand()
- {
- return "move";
- }
-
- public void execute(String... args)
- {
- AMQQueue toQueue = null;
- AMQQueue fromQueue = _tool.getState().getQueue();
- java.util.List<Long> msgids = _tool.getState().getMessages();
-
- if (args.length >= 2)
- {
- for (String arg : args)
- {
- if (arg.startsWith("to="))
- {
- String queueName = arg.substring(arg.indexOf("=") + 1);
- toQueue = _tool.getState().getVhost().getQueueRegistry().getQueue(new AMQShortString(queueName));
- }
-
- if (arg.startsWith("from="))
- {
- String queueName = arg.substring(arg.indexOf("=") + 1);
- fromQueue = _tool.getState().getVhost().getQueueRegistry().getQueue(new AMQShortString(queueName));
- }
-
- if (arg.startsWith("msgids="))
- {
- String msgidStr = arg.substring(arg.indexOf("=") + 1);
-
- // Record the current message selection
- java.util.List<Long> currentIDs = _tool.getState().getMessages();
-
- // Use the ToolState class to perform the messasge parsing
- _tool.getState().setMessages(msgidStr);
- msgids = _tool.getState().getMessages();
-
- // Reset the original selection of messages
- _tool.getState().setMessages(currentIDs);
- }
- }
- }
-
- if (!checkRequirements(fromQueue, toQueue, msgids))
- {
- return;
- }
-
- processIDs(fromQueue, toQueue, msgids);
- }
-
- private void processIDs(AMQQueue fromQueue, AMQQueue toQueue, java.util.List<Long> msgids)
- {
- Long previous = null;
- Long start = null;
-
- if (msgids == null)
- {
- msgids = allMessageIDs(fromQueue);
- }
-
- if (msgids == null || msgids.size() == 0)
- {
- _console.println("No Messages to move.");
- return;
- }
-
- for (long id : msgids)
- {
- if (previous != null)
- {
- if (id == previous + 1)
- {
- if (start == null)
- {
- start = previous;
- }
- }
- else
- {
- if (start != null)
- {
- //move a range of ids
- doCommand(fromQueue, start, id, toQueue);
- start = null;
- }
- else
- {
- //move a single id
- doCommand(fromQueue, id, id, toQueue);
- }
- }
- }
-
- previous = id;
- }
-
- if (start != null)
- {
- //move a range of ids
- doCommand(fromQueue, start, previous, toQueue);
- }
- }
-
- private List<Long> allMessageIDs(AMQQueue fromQueue)
- {
- List<Long> ids = new LinkedList<Long>();
-
- if (fromQueue != null)
- {
- List<QueueEntry> messages = fromQueue.getMessagesOnTheQueue();
- if (messages != null)
- {
- for (QueueEntry msg : messages)
- {
- ids.add(msg.getMessage().getMessageId());
- }
- }
- }
-
- return ids;
- }
-
- protected boolean checkRequirements(AMQQueue fromQueue, AMQQueue toQueue, List<Long> msgids)
- {
- if (toQueue == null)
- {
- _console.println("Destination queue not specifed.");
- _console.println(usage());
- return false;
- }
-
- if (fromQueue == null)
- {
- _console.println("Source queue not specifed.");
- _console.println(usage());
- return false;
- }
-
- return true;
- }
-
- protected void doCommand(AMQQueue fromQueue, long start, long id, AMQQueue toQueue)
- {
- fromQueue.moveMessagesToAnotherQueue(start, id, toQueue.getName().toString(), _storeContext);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Purge.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Purge.java
deleted file mode 100644
index f187e26593..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Purge.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.messagestore.commands;
-
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-
-public class Purge extends Move
-{
- public Purge(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Purge messages from a queue.\n" +
- "The currently selected message set will be purged from the specifed queue.\n" +
- "Alternatively the values can be provided on the command line.";
- }
-
- public String usage()
- {
- return "purge from=<queue> [msgids=<msgids eg, 1,2,4-10>]";
- }
-
- public String getCommand()
- {
- return "purge";
- }
-
-
- protected boolean checkRequirements(AMQQueue fromQueue, AMQQueue toQueue, java.util.List<Long> msgids)
- {
- if (fromQueue == null)
- {
- _console.println("Source queue not specifed.");
- _console.println(usage());
- return false;
- }
-
- return true;
- }
-
- protected void doCommand(AMQQueue fromQueue, long start, long end, AMQQueue toQueue)
- {
- fromQueue.removeMessagesFromQueue(start, end, _storeContext);
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Quit.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Quit.java
deleted file mode 100644
index a81bc07c38..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Quit.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.tools.messagestore.commands;
-
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-
-public class Quit extends AbstractCommand
-{
- public Quit(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Quit the tool.";
- }
-
- public String usage()
- {
- return "quit";
- }
-
- public String getCommand()
- {
- return "quit";
- }
-
- public void execute(String... args)
- {
- assert args.length > 0;
- assert args[0].equals("quit");
-
- _tool.quit();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Select.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Select.java
deleted file mode 100644
index fd7d4c3f13..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Select.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.
- *
- *
- */
-package org.apache.qpid.tools.messagestore.commands;
-
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-
-import java.util.LinkedList;
-import java.util.StringTokenizer;
-
-public class Select extends AbstractCommand
-{
-
- public Select(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Perform a selection.";
- }
-
- public String usage()
- {
- return "select virtualhost <name> |exchange <name> |queue <name> | msg id=<msgids eg. 1,2,4-10>";
- }
-
- public String getCommand()
- {
- return "select";
- }
-
- public void execute(String... args)
- {
- assert args.length > 2;
- assert args[0].equals("select");
-
- if (args.length < 3)
- {
- if (args[1].equals("show"))
- {
- doSelect(args[1], null);
- }
- else
- {
- _console.print("select : unknown command:");
- _console.println(help());
- }
- }
- else
- {
- if (args[1].equals("virtualhost")
- || args[1].equals("vhost")
- || args[1].equals("exchange")
- || args[1].equals("queue")
- || args[1].equals("msg")
- )
- {
- doSelect(args[1], args[2]);
- }
- else
- {
- _console.println(help());
- }
- }
- }
-
- private void doSelect(String type, String item)
- {
- if (type.equals("virtualhost"))
- {
-
- VirtualHost vhost = ApplicationRegistry.getInstance()
- .getVirtualHostRegistry().getVirtualHost(item);
-
- if (vhost == null)
- {
- _console.println("Virtualhost '" + item + "' not found.");
- }
- else
- {
- _tool.getState().setVhost(vhost);
- }
- }
-
- if (type.equals("exchange"))
- {
-
- VirtualHost vhost = _tool.getState().getVhost();
-
- if (vhost == null)
- {
- _console.println("No Virtualhost open. Open a Virtualhost first.");
- return;
- }
-
-
- Exchange exchange = vhost.getExchangeRegistry().getExchange(new AMQShortString(item));
-
- if (exchange == null)
- {
- _console.println("Exchange '" + item + "' not found.");
- }
- else
- {
- _tool.getState().setExchange(exchange);
- }
-
- if (_tool.getState().getQueue() != null)
- {
- if (!exchange.isBound(_tool.getState().getQueue()))
- {
- _tool.getState().setQueue(null);
- }
- }
- }
-
- if (type.equals("queue"))
- {
- VirtualHost vhost = _tool.getState().getVhost();
-
- if (vhost == null)
- {
- _console.println("No Virtualhost open. Open a Virtualhost first.");
- return;
- }
-
- AMQQueue queue = vhost.getQueueRegistry().getQueue(new AMQShortString(item));
-
- if (queue == null)
- {
- _console.println("Queue '" + item + "' not found.");
- }
- else
- {
- _tool.getState().setQueue(queue);
-
- if (_tool.getState().getExchange() == null)
- {
- for (AMQShortString exchangeName : vhost.getExchangeRegistry().getExchangeNames())
- {
- Exchange exchange = vhost.getExchangeRegistry().getExchange(exchangeName);
- if (exchange.isBound(queue))
- {
- _tool.getState().setExchange(exchange);
- break;
- }
- }
- }
-
- //remove the message selection
- _tool.getState().setMessages((java.util.List<Long>) null);
- }
- }
-
- if (type.equals("msg"))
- {
- if (item.startsWith("id="))
- {
- StringTokenizer tok = new StringTokenizer(item.substring(item.indexOf("=") + 1), ",");
-
- java.util.List<Long> msgids = null;
-
- if (tok.hasMoreTokens())
- {
- msgids = new LinkedList<Long>();
- }
-
- while (tok.hasMoreTokens())
- {
- String next = tok.nextToken();
- if (next.contains("-"))
- {
- Long start = Long.parseLong(next.substring(0, next.indexOf("-")));
- Long end = Long.parseLong(next.substring(next.indexOf("-") + 1));
-
- if (end >= start)
- {
- for (long l = start; l <= end; l++)
- {
- msgids.add(l);
- }
- }
- }
- else
- {
- msgids.add(Long.parseLong(next));
- }
- }
-
- _tool.getState().setMessages(msgids);
- }
-
- }
-
- if (type.equals("show"))
- {
- _console.println(_tool.getState().toString());
- if (_tool.getState().getMessages() != null)
- {
- _console.print("Msgs:");
- for (Long l : _tool.getState().getMessages())
- {
- _console.print(" " + l);
- }
- _console.println("");
- }
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Show.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Show.java
deleted file mode 100644
index a6dccf0f36..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/messagestore/commands/Show.java
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.messagestore.commands;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueEntry;
-import org.apache.qpid.tools.messagestore.MessageStoreTool;
-import org.apache.qpid.tools.utils.Console;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-public class Show extends AbstractCommand
-{
- protected boolean _amqHeaders = false;
- protected boolean _routing = false;
- protected boolean _msgHeaders = false;
-
- public Show(MessageStoreTool tool)
- {
- super(tool);
- }
-
- public String help()
- {
- return "Shows the messages headers.";
- }
-
- public String usage()
- {
- return getCommand() + " [show=[all],[msgheaders],[amqheaders],[routing]] [id=<msgid e.g. 1,2,4-10>]";
- }
-
- public String getCommand()
- {
- return "show";
- }
-
- public void execute(String... args)
- {
- assert args.length > 0;
- assert args[0].equals(getCommand());
-
- if (args.length < 2)
- {
- parseArgs("all");
- }
- else
- {
- parseArgs(args);
- }
-
- performShow();
- }
-
- protected void parseArgs(String... args)
- {
- List<Long> msgids = null;
-
- if (args.length >= 2)
- {
- for (String arg : args)
- {
- if (arg.startsWith("show="))
- {
- _msgHeaders = arg.contains("msgheaders") || arg.contains("all");
- _amqHeaders = arg.contains("amqheaders") || arg.contains("all");
- _routing = arg.contains("routing") || arg.contains("all");
- }
-
- if (arg.startsWith("id="))
- {
- _tool.getState().setMessages(msgids);
- }
- }//for args
- }// if args > 2
- }
-
- protected void performShow()
- {
- if (_tool.getState().getVhost() == null)
- {
- _console.println("No Virtualhost selected. 'DuSelect' a Virtualhost first.");
- return;
- }
-
- AMQQueue _queue = _tool.getState().getQueue();
-
- List<Long> msgids = _tool.getState().getMessages();
-
- if (_queue != null)
- {
- List<QueueEntry> messages = _queue.getMessagesOnTheQueue();
- if (messages == null || messages.size() == 0)
- {
- _console.println("No messages on queue");
- return;
- }
-
- List<List> data = createMessageData(msgids, messages, _amqHeaders, _routing, _msgHeaders);
- if (data != null)
- {
- _console.printMap(null, data);
- }
- else
- {
- String message = "No data to display.";
- if (msgids != null)
- {
- message += " Is message selection correct? " + _tool.getState().printMessages();
- }
- _console.println(message);
- }
-
- }
- else
- {
- _console.println("No Queue specified to show.");
- }
- }
-
- /**
- * Create the list data for display from the messages.
- *
- * @param msgids The list of message ids to display
- * @param messages A list of messages to format and display.
- * @param showHeaders should the header info be shown
- * @param showRouting show the routing info be shown
- * @param showMessageHeaders show the msg headers be shown
- * @return the formated data lists for printing
- */
- protected List<List> createMessageData(List<Long> msgids, List<QueueEntry> messages, boolean showHeaders, boolean showRouting,
- boolean showMessageHeaders)
- {
-
- // Currenly exposed message properties
-// //Printing the content Body
-// msg.getContentBodyIterator();
-// //Print the Headers
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getAppId();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getAppIdAsString();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getClusterId();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getContentType();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getCorrelationId();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getDeliveryMode();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getEncoding();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getExpiration();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getHeaders();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getMessageId();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getPriority();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getPropertyFlags();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getReplyTo();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getTimestamp();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getType();
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getUserId();
-//
-// //Print out all the property names
-// ((BasicContentHeaderProperties)msg.getContentHeaderBody().properties).getHeaders().getPropertyNames();
-//
-// msg.getMessageId();
-// msg.getSize();
-// msg.getArrivalTime();
-
-// msg.getDeliveredSubscription();
-// msg.getDeliveredToConsumer();
-// msg.getMessageHandle();
-// msg.getMessageId();
-// msg.getMessagePublishInfo();
-// msg.getPublisher();
-
-// msg.getStoreContext();
-// msg.isAllContentReceived();
-// msg.isPersistent();
-// msg.isRedelivered();
-// msg.isRejectedBy();
-// msg.isTaken();
-
- //Header setup
-
- List<List> data = new LinkedList<List>();
-
- List<String> id = new LinkedList<String>();
- data.add(id);
- id.add(Columns.ID.name());
- id.add(Console.ROW_DIVIDER);
-
- List<String> exchange = new LinkedList<String>();
- List<String> routingkey = new LinkedList<String>();
- List<String> immediate = new LinkedList<String>();
- List<String> mandatory = new LinkedList<String>();
- if (showRouting)
- {
- data.add(exchange);
- exchange.add(Columns.Exchange.name());
- exchange.add(Console.ROW_DIVIDER);
-
- data.add(routingkey);
- routingkey.add(Columns.RoutingKey.name());
- routingkey.add(Console.ROW_DIVIDER);
-
- data.add(immediate);
- immediate.add(Columns.isImmediate.name());
- immediate.add(Console.ROW_DIVIDER);
-
- data.add(mandatory);
- mandatory.add(Columns.isMandatory.name());
- mandatory.add(Console.ROW_DIVIDER);
- }
-
- List<String> size = new LinkedList<String>();
- List<String> appid = new LinkedList<String>();
- List<String> clusterid = new LinkedList<String>();
- List<String> contenttype = new LinkedList<String>();
- List<String> correlationid = new LinkedList<String>();
- List<String> deliverymode = new LinkedList<String>();
- List<String> encoding = new LinkedList<String>();
- List<String> arrival = new LinkedList<String>();
- List<String> expiration = new LinkedList<String>();
- List<String> priority = new LinkedList<String>();
- List<String> propertyflag = new LinkedList<String>();
- List<String> replyto = new LinkedList<String>();
- List<String> timestamp = new LinkedList<String>();
- List<String> type = new LinkedList<String>();
- List<String> userid = new LinkedList<String>();
- List<String> ispersitent = new LinkedList<String>();
- List<String> isredelivered = new LinkedList<String>();
- List<String> isdelivered = new LinkedList<String>();
-
- data.add(size);
- size.add(Columns.Size.name());
- size.add(Console.ROW_DIVIDER);
-
- if (showHeaders)
- {
- data.add(ispersitent);
- ispersitent.add(Columns.isPersistent.name());
- ispersitent.add(Console.ROW_DIVIDER);
-
- data.add(isredelivered);
- isredelivered.add(Columns.isRedelivered.name());
- isredelivered.add(Console.ROW_DIVIDER);
-
- data.add(isdelivered);
- isdelivered.add(Columns.isDelivered.name());
- isdelivered.add(Console.ROW_DIVIDER);
-
- data.add(appid);
- appid.add(Columns.App_ID.name());
- appid.add(Console.ROW_DIVIDER);
-
- data.add(clusterid);
- clusterid.add(Columns.Cluster_ID.name());
- clusterid.add(Console.ROW_DIVIDER);
-
- data.add(contenttype);
- contenttype.add(Columns.Content_Type.name());
- contenttype.add(Console.ROW_DIVIDER);
-
- data.add(correlationid);
- correlationid.add(Columns.Correlation_ID.name());
- correlationid.add(Console.ROW_DIVIDER);
-
- data.add(deliverymode);
- deliverymode.add(Columns.Delivery_Mode.name());
- deliverymode.add(Console.ROW_DIVIDER);
-
- data.add(encoding);
- encoding.add(Columns.Encoding.name());
- encoding.add(Console.ROW_DIVIDER);
-
- data.add(arrival);
- expiration.add(Columns.Arrival.name());
- expiration.add(Console.ROW_DIVIDER);
-
- data.add(expiration);
- expiration.add(Columns.Expiration.name());
- expiration.add(Console.ROW_DIVIDER);
-
- data.add(priority);
- priority.add(Columns.Priority.name());
- priority.add(Console.ROW_DIVIDER);
-
- data.add(propertyflag);
- propertyflag.add(Columns.Property_Flag.name());
- propertyflag.add(Console.ROW_DIVIDER);
-
- data.add(replyto);
- replyto.add(Columns.ReplyTo.name());
- replyto.add(Console.ROW_DIVIDER);
-
- data.add(timestamp);
- timestamp.add(Columns.Timestamp.name());
- timestamp.add(Console.ROW_DIVIDER);
-
- data.add(type);
- type.add(Columns.Type.name());
- type.add(Console.ROW_DIVIDER);
-
- data.add(userid);
- userid.add(Columns.UserID.name());
- userid.add(Console.ROW_DIVIDER);
- }
-
- List<String> msgHeaders = new LinkedList<String>();
- if (showMessageHeaders)
- {
- data.add(msgHeaders);
- msgHeaders.add(Columns.MsgHeaders.name());
- msgHeaders.add(Console.ROW_DIVIDER);
- }
-
- //Add create the table of data
- for (QueueEntry entry : messages)
- {
- AMQMessage msg = entry.getMessage();
- if (!includeMsg(msg, msgids))
- {
- continue;
- }
-
- id.add(msg.getMessageId().toString());
-
- size.add("" + msg.getSize());
-
- arrival.add("" + msg.getArrivalTime());
-
- try
- {
- ispersitent.add(msg.isPersistent() ? "true" : "false");
- }
- catch (AMQException e)
- {
- ispersitent.add("n/a");
- }
-
- isredelivered.add(msg.isRedelivered() ? "true" : "false");
-
- isdelivered.add(msg.getDeliveredToConsumer() ? "true" : "false");
-
-// msg.getMessageHandle();
-
- BasicContentHeaderProperties headers = null;
-
- try
- {
- headers = ((BasicContentHeaderProperties) msg.getContentHeaderBody().properties);
- }
- catch (AMQException e)
- {
- //ignore
-// commandError("Unable to read properties for message: " + e.getMessage(), null);
- }
-
- if (headers != null)
- {
- String appidS = headers.getAppIdAsString();
- appid.add(appidS == null ? "null" : appidS);
-
- String clusterS = headers.getClusterIdAsString();
- clusterid.add(clusterS == null ? "null" : clusterS);
-
- String contentS = headers.getContentTypeAsString();
- contenttype.add(contentS == null ? "null" : contentS);
-
- String correlationS = headers.getCorrelationIdAsString();
- correlationid.add(correlationS == null ? "null" : correlationS);
-
- deliverymode.add("" + headers.getDeliveryMode());
-
- AMQShortString encodeSS = headers.getEncoding();
- encoding.add(encodeSS == null ? "null" : encodeSS.toString());
-
- expiration.add("" + headers.getExpiration());
-
- FieldTable headerFT = headers.getHeaders();
- msgHeaders.add(headerFT == null ? "none" : "" + headerFT.toString());
-
- priority.add("" + headers.getPriority());
- propertyflag.add("" + headers.getPropertyFlags());
-
- AMQShortString replytoSS = headers.getReplyTo();
- replyto.add(replytoSS == null ? "null" : replytoSS.toString());
-
- timestamp.add("" + headers.getTimestamp());
-
- AMQShortString typeSS = headers.getType();
- type.add(typeSS == null ? "null" : typeSS.toString());
-
- AMQShortString useridSS = headers.getUserId();
- userid.add(useridSS == null ? "null" : useridSS.toString());
-
- MessagePublishInfo info = null;
- try
- {
- info = msg.getMessagePublishInfo();
- }
- catch (AMQException e)
- {
- //ignore
- }
-
- if (info != null)
- {
- AMQShortString exchangeSS = info.getExchange();
- exchange.add(exchangeSS == null ? "null" : exchangeSS.toString());
-
- AMQShortString routingkeySS = info.getRoutingKey();
- routingkey.add(routingkeySS == null ? "null" : routingkeySS.toString());
-
- immediate.add(info.isImmediate() ? "true" : "false");
- mandatory.add(info.isMandatory() ? "true" : "false");
- }
-
-// msg.getPublisher(); -- only used in clustering
-// msg.getStoreContext();
-// msg.isAllContentReceived();
-
- }// if headers!=null
-
-// need to access internal map and do lookups.
-// msg.isTaken();
-// msg.getDeliveredSubscription();
-// msg.isRejectedBy();
-
- }
-
- // if id only had the header and the divider in it then we have no data to display
- if (id.size() == 2)
- {
- return null;
- }
- return data;
- }
-
- protected boolean includeMsg(AMQMessage msg, List<Long> msgids)
- {
- if (msgids == null)
- {
- return true;
- }
-
- Long msgid = msg.getMessageId();
-
- boolean found = false;
-
- if (msgids != null)
- {
- //check msgid is in msgids
- for (Long l : msgids)
- {
- if (l.equals(msgid))
- {
- found = true;
- break;
- }
- }
- }
- return found;
- }
-
- public enum Columns
- {
- ID,
- Size,
- Exchange,
- RoutingKey,
- isImmediate,
- isMandatory,
- isPersistent,
- isRedelivered,
- isDelivered,
- App_ID,
- Cluster_ID,
- Content_Type,
- Correlation_ID,
- Delivery_Mode,
- Encoding,
- Arrival,
- Expiration,
- Priority,
- Property_Flag,
- ReplyTo,
- Timestamp,
- Type,
- UserID,
- MsgHeaders
- }
-}
-
-
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/security/Passwd.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/security/Passwd.java
deleted file mode 100644
index c27c52eb8e..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/security/Passwd.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.tools.security;
-
-import org.apache.commons.codec.binary.Base64;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.DigestException;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintStream;
-
-public class Passwd
-{
- public static void main(String args[]) throws NoSuchAlgorithmException, DigestException, IOException
- {
- if (args.length != 2)
- {
- System.out.println("Passwd <username> <password>");
- System.exit(0);
- }
-
- byte[] data = args[1].getBytes("utf-8");
-
- MessageDigest md = MessageDigest.getInstance("MD5");
-
- for (byte b : data)
- {
- md.update(b);
- }
-
- byte[] digest = md.digest();
-
- Base64 b64 = new Base64();
-
- byte[] encoded = b64.encode(digest);
-
- output(args[0], encoded);
- }
-
- private static void output(String user, byte[] encoded) throws IOException
- {
-
-// File passwdFile = new File("qpid.passwd");
-
- PrintStream ps = new PrintStream(System.out);
-
- user += ":";
- ps.write(user.getBytes("utf-8"));
-
- for (byte b : encoded)
- {
- ps.write(b);
- }
-
- ps.println();
-
- ps.flush();
- ps.close();
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/CommandParser.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/CommandParser.java
deleted file mode 100644
index 986fea32cc..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/CommandParser.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.tools.utils;
-
-public interface CommandParser
-{
- /**
- * If there is more than one command received on the last parse request.
- *
- * Subsequent calls to parse will utilise this input rather than reading new data from the input source
- * @return boolean
- */
- boolean more();
-
- /**
- * True if the currently parsed command has been requested as a background operation
- *
- * @return boolean
- */
- boolean isBackground();
-
- /**
- * Parses user commands, and groups tokens in the
- * String[] format that all Java main's love.
- *
- * If more than one command is provided in one input line then the more() method will return true.
- * A subsequent call to parse() will continue to parse that input line before reading new input.
- *
- * @return <code>input</code> split in args[] format; null if eof.
- * @throws java.io.IOException if there is a problem reading from the input stream
- */
- String[] parse() throws java.io.IOException;
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/Console.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/Console.java
deleted file mode 100644
index cf457d1ea5..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/Console.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.tools.utils;
-
-import java.util.List;
-
-public interface Console
-{
- public enum CellFormat
- {
- CENTRED, LEFT, RIGHT
- }
-
- public static String ROW_DIVIDER = "*divider";
-
- public void print(String... message);
-
- public void println(String... message);
-
- public String readln();
-
- /**
- * Reads and parses the command line.
- *
- *
- * @return The next command or null
- */
- public String[] readCommand();
-
- public CommandParser getCommandParser();
-
- public void setCommandParser(CommandParser parser);
-
- /**
- *
- * Prints the list of String nicely.
- *
- * +-------------+
- * | Heading |
- * +-------------+
- * | Item 1 |
- * | Item 2 |
- * | Item 3 |
- * +-------------+
- *
- * @param hasTitle should list[0] be used as a heading
- * @param list The list of Strings to display
- */
- public void displayList(boolean hasTitle, String... list);
-
- /**
- *
- * Prints the list of String nicely.
- *
- * +----------------------------+
- * | Heading |
- * +----------------------------+
- * | title | title | ..
- * +----------------------------+
- * | Item 2 | value 2 | ..
- * +----------------------------+ (*divider)
- * | Item 3 | value 2 | ..
- * +----------------------------+
- *
- * @param title The title to display if any
- * @param entries the entries to display in a map.
- */
- void printMap(String title, List<List> entries);
-
-
- public void close();
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/SimpleCommandParser.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/SimpleCommandParser.java
deleted file mode 100644
index 09444ccdd7..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/SimpleCommandParser.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.tools.utils;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-public class SimpleCommandParser implements CommandParser
-{
- private static final String COMMAND_SEPERATOR = ";";
-
- /** Input source of commands */
- protected BufferedReader _reader;
-
- /** The next list of commands from the command line */
- private StringBuilder _nextCommand = null;
-
- public SimpleCommandParser(BufferedReader reader)
- {
- _reader = reader;
- }
-
- public boolean more()
- {
- return _nextCommand != null;
- }
-
- public boolean isBackground()
- {
- return false;
- }
-
- public String[] parse() throws IOException
- {
- String[] commands = null;
-
- String input = null;
-
- if (_nextCommand == null)
- {
- input = _reader.readLine();
- }
- else
- {
- input = _nextCommand.toString();
- _nextCommand = null;
- }
-
- if (input == null)
- {
- return null;
- }
-
- StringTokenizer tok = new StringTokenizer(input, " ");
-
- int tokenCount = tok.countTokens();
- int index = 0;
-
- if (tokenCount > 0)
- {
- commands = new String[tokenCount];
- boolean commandComplete = false;
-
- while (tok.hasMoreTokens())
- {
- String next = tok.nextToken();
-
- if (next.equals(COMMAND_SEPERATOR))
- {
- commandComplete = true;
- _nextCommand = new StringBuilder();
- continue;
- }
-
- if (commandComplete)
- {
- _nextCommand.append(next);
- _nextCommand.append(" ");
- }
- else
- {
- commands[index] = next;
- index++;
- }
- }
-
- }
-
- //Reduce the String[] if not all the tokens were used in this command.
- // i.e. there is more than one command on the line.
- if (index != tokenCount)
- {
- String[] shortCommands = new String[index];
- System.arraycopy(commands, 0, shortCommands, 0, index);
- return shortCommands;
- }
- else
- {
- return commands;
- }
- }
-}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/SimpleConsole.java b/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/SimpleConsole.java
deleted file mode 100644
index ec080a4611..0000000000
--- a/qpid/java/broker/src/main/java/org/apache/qpid/tools/utils/SimpleConsole.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.tools.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-
-public class SimpleConsole implements Console
-{
- /** SLF4J Logger. */
- private static Logger _devlog = LoggerFactory.getLogger(SimpleConsole.class);
-
- /** Console Writer. */
- protected static BufferedWriter _consoleWriter;
-
- /** Console Reader. */
- protected static BufferedReader _consoleReader;
-
- /** Parser for command-line input. */
- protected CommandParser _parser;
-
- public SimpleConsole(BufferedWriter writer, BufferedReader reader)
- {
- _consoleWriter = writer;
- _consoleReader = reader;
- _parser = new SimpleCommandParser(_consoleReader);
- }
-
- public void print(String... message)
- {
- try
- {
- for (String s : message)
- {
- _consoleWriter.write(s);
- }
- _consoleWriter.flush();
- }
- catch (IOException e)
- {
- _devlog.error(e.getMessage() + ": Occured whilst trying to write:" + message);
- }
-
- }
-
- public void println(String... message)
- {
- print(message);
- print(System.getProperty("line.separator"));
- }
-
-
- public String readln()
- {
- try
- {
- return _consoleReader.readLine();
- }
- catch (IOException e)
- {
- _devlog.debug("Unable to read input due to:" + e.getMessage());
- return null;
- }
- }
-
- public String[] readCommand()
- {
- try
- {
- return _parser.parse();
- }
- catch (IOException e)
- {
- _devlog.error("Error reading command:" + e.getMessage());
- return new String[0];
- }
- }
-
- public CommandParser getCommandParser()
- {
- return _parser;
- }
-
- public void setCommandParser(CommandParser parser)
- {
- _parser = parser;
- }
-
- public void displayList(boolean hasTitle, String... list)
- {
- java.util.List<java.util.List> data = new LinkedList<List>();
-
- java.util.List<String> values = new LinkedList<String>();
-
- data.add(values);
-
- for (String value : list)
- {
- values.add(value);
- }
-
- if (hasTitle)
- {
- values.add(1, "*divider");
- }
-
- printMap(null, data);
- }
-
- /**
- *
- * Prints the list of String nicely.
- *
- * +----------------------------+
- * | Heading |
- * +----------------------------+
- * | title | title | ..
- * +----------------------------+
- * | Item 2 | value 2 | ..
- * | Item 3 | value 2 | ..
- * +----------------------------+
- *
- * @param title The title to display if any
- * @param entries the entries to display in a map.
- */
- public void printMap(String title, java.util.List<java.util.List> entries)
- {
- try
- {
- int columns = entries.size();
-
- int[] columnWidth = new int[columns];
-
- // calculate row count
- int rowMax = 0;
-
- //the longest item
- int itemMax = 0;
-
- for (int i = 0; i < columns; i++)
- {
- int columnIRowMax = entries.get(i).size();
-
- if (columnIRowMax > rowMax)
- {
- rowMax = columnIRowMax;
- }
- for (Object values : entries.get(i))
- {
- if (values.toString().equals(Console.ROW_DIVIDER))
- {
- continue;
- }
-
- int itemLength = values.toString().length();
-
- //note for single width
- if (itemLength > itemMax)
- {
- itemMax = itemLength;
- }
-
- //note for mulit width
- if (itemLength > columnWidth[i])
- {
- columnWidth[i] = itemLength;
- }
-
- }
- }
-
- int tableWidth = 0;
-
-
- for (int i = 0; i < columns; i++)
- {
- // plus 2 for the space padding
- columnWidth[i] += 2;
- }
- for (int size : columnWidth)
- {
- tableWidth += size;
- }
- tableWidth += (columns - 1);
-
- if (title != null)
- {
- if (title.length() > tableWidth)
- {
- tableWidth = title.length();
- }
-
- printCellRow("+", "-", tableWidth);
-
- printCell(CellFormat.CENTRED, "|", tableWidth, " " + title + " ", 0);
- _consoleWriter.newLine();
-
- }
-
- //put top line | or bottom of title
- printCellRow("+", "-", tableWidth);
-
- //print the table data
- int row = 0;
-
- for (; row < rowMax; row++)
- {
- for (int i = 0; i < columns; i++)
- {
- java.util.List columnData = entries.get(i);
-
- String value;
- // does this column have a value for this row
- if (columnData.size() > row)
- {
- value = " " + columnData.get(row).toString() + " ";
- }
- else
- {
- value = " ";
- }
-
- if (i == 0 && value.equals(" " + Console.ROW_DIVIDER + " "))
- {
- printCellRow("+", "-", tableWidth);
- //move on to the next row
- break;
- }
- else
- {
- printCell(CellFormat.LEFT, "|", columnWidth[i], value, i);
- }
-
- // if it is the last row then do a new line.
- if (i == columns - 1)
- {
- _consoleWriter.newLine();
- }
- }
- }
-
- printCellRow("+", "-", tableWidth);
-
- }
- catch (IOException e)
- {
- _devlog.error(e.getMessage() + ": Occured whilst trying to write.");
- }
- }
-
- public void close()
- {
-
- try
- {
- _consoleReader.close();
- }
- catch (IOException e)
- {
- _devlog.error(e.getMessage() + ": Occured whilst trying to close reader.");
- }
-
- try
- {
-
- _consoleWriter.close();
- }
- catch (IOException e)
- {
- _devlog.error(e.getMessage() + ": Occured whilst trying to close writer.");
- }
-
- }
-
- private void printCell(CellFormat format, String edge, int cellWidth, String cell, int column) throws IOException
- {
- int pad = cellWidth - cell.length();
-
- if (column == 0)
- {
- _consoleWriter.write(edge);
- }
-
- switch (format)
- {
- case CENTRED:
- printPad(" ", pad / 2);
- break;
- case RIGHT:
- printPad(" ", pad);
- break;
- }
-
- _consoleWriter.write(cell);
-
-
- switch (format)
- {
- case CENTRED:
- // if pad isn't even put the extra one on the right
- if (pad % 2 == 0)
- {
- printPad(" ", pad / 2);
- }
- else
- {
- printPad(" ", (pad / 2) + 1);
- }
- break;
- case LEFT:
- printPad(" ", pad);
- break;
- }
-
-
- _consoleWriter.write(edge);
-
- }
-
- private void printCellRow(String edge, String mid, int cellWidth) throws IOException
- {
- _consoleWriter.write(edge);
-
- printPad(mid, cellWidth);
-
- _consoleWriter.write(edge);
- _consoleWriter.newLine();
- }
-
- private void printPad(String padChar, int count) throws IOException
- {
- for (int i = 0; i < count; i++)
- {
- _consoleWriter.write(padChar);
- }
- }
-
-
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/RunBrokerWithCommand.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/RunBrokerWithCommand.java
deleted file mode 100644
index d8b5f5f7e6..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/RunBrokerWithCommand.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.Level;
-
-import java.io.InputStream;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.IOException;
-
-public class RunBrokerWithCommand
-{
- public static void main(String[] args)
- {
- //Start broker
- try
- {
- String[] fudge = args.clone();
-
- // Override the first value which is the command we are going to run later.
- fudge[0] = "-v";
- new Main(fudge).startup();
- }
- catch (Exception e)
- {
- System.err.println("Unable to start broker due to: " + e.getMessage());
-
- e.printStackTrace();
- exit(1);
- }
-
- Logger.getRootLogger().setLevel(Level.ERROR);
-
- //run command
- try
- {
- Process task = Runtime.getRuntime().exec(args[0]);
- System.err.println("Started Proccess: " + args[0]);
-
- InputStream inputStream = task.getInputStream();
-
- InputStream errorStream = task.getErrorStream();
-
- Thread out = new Thread(new Outputter("[OUT]", new BufferedReader(new InputStreamReader(inputStream))));
- Thread err = new Thread(new Outputter("[ERR]", new BufferedReader(new InputStreamReader(errorStream))));
-
- out.start();
- err.start();
-
- out.join();
- err.join();
-
- System.err.println("Waiting for process to exit: " + args[0]);
- task.waitFor();
- System.err.println("Done Proccess: " + args[0]);
-
- }
- catch (IOException e)
- {
- System.err.println("Proccess had problems: " + e.getMessage());
- e.printStackTrace(System.err);
- exit(1);
- }
- catch (InterruptedException e)
- {
- System.err.println("Proccess had problems: " + e.getMessage());
- e.printStackTrace(System.err);
-
- exit(1);
- }
-
-
- exit(0);
- }
-
- private static void exit(int i)
- {
- Logger.getRootLogger().setLevel(Level.INFO);
- System.exit(i);
- }
-
- static class Outputter implements Runnable
- {
-
- BufferedReader reader;
- String prefix;
-
- Outputter(String s, BufferedReader r)
- {
- prefix = s;
- reader = r;
- }
-
- public void run()
- {
- String line;
- try
- {
- while ((line = reader.readLine()) != null)
- {
- System.out.println(prefix + line);
- }
- }
- catch (IOException e)
- {
- System.out.println("Error occured reading; " + e.getMessage());
- }
- }
-
- }
-
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/TestPropertyUtils.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/TestPropertyUtils.java
deleted file mode 100644
index 3b83190e42..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/TestPropertyUtils.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.server.configuration;
-
-import org.apache.qpid.configuration.PropertyException;
-import org.apache.qpid.configuration.PropertyUtils;
-
-import junit.framework.TestCase;
-
-// TODO: This belongs in the "common" module.
-public class TestPropertyUtils extends TestCase
-{
- 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");
- }
-
- public static junit.framework.Test suite()
- {
- return new junit.framework.TestSuite(TestPropertyUtils.class);
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java
deleted file mode 100644
index 7e2d56b460..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java
+++ /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.
- *
- *
- */
-package org.apache.qpid.server.exchange;
-
-import junit.framework.TestCase;
-import junit.framework.Assert;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.AMQMessage;
-import org.apache.qpid.server.queue.MessageHandleFactory;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.txn.NonTransactionalContext;
-import org.apache.qpid.server.txn.TransactionalContext;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.MemoryMessageStore;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.RequiredDeliveryException;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.LinkedList;
-
-public class DestWildExchangeTest extends TestCase
-{
-
- DestWildExchange _exchange;
-
- VirtualHost _vhost;
- MessageStore _store;
- StoreContext _context;
-
-
- public void setUp() throws AMQException
- {
- _exchange = new DestWildExchange();
- _vhost = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHosts().iterator().next();
- _store = new MemoryMessageStore();
- _context = new StoreContext();
- }
-
-
- public void testNoRoute() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a*#b"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.*.#.b"), queue, null);
-
-
- MessagePublishInfo info = new PublishInfo(new AMQShortString("a.b"));
-
- AMQMessage message = new AMQMessage(0L, info, null);
-
- try
- {
- _exchange.route(message);
- fail("Message has no route and shouldn't be routed");
- }
- catch (NoRouteException nre)
- {
- //normal
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
- }
-
- public void testDirectMatch() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("ab"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.b"), queue, null);
-
-
- AMQMessage message = createMessage("a.b");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
-
- message = createMessage("a.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has no route and should fail to be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
- }
-
-
- public void testStarMatch() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a*"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.*"), queue, null);
-
-
- AMQMessage message = createMessage("a.b");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
-
- message = createMessage("a.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
-
- message = createMessage("a");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has no route and should fail to be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
- }
-
- public void testHashMatch() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a#"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.#"), queue, null);
-
-
- AMQMessage message = createMessage("a.b.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
-
- message = createMessage("a.b");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
-
- message = createMessage("a.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
- message = createMessage("a");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
-
- message = createMessage("b");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has no route and should fail to be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
- }
-
-
- public void testMidHash() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.*.#.b"), queue, null);
-
-
- AMQMessage message = createMessage("a.c.d.b");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has no route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
- message = createMessage("a.c.b");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has no route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
- }
-
- public void testMatchafterHash() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a#"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.*.#.b.c"), queue, null);
-
-
- AMQMessage message = createMessage("a.c.b.b");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has route and should not be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
-
-
- message = createMessage("a.a.b.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has no route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
- message = createMessage("a.b.c.b");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has route and should not be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
-
- message = createMessage("a.b.c.b.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has no route and should be routed");
-
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
- }
-
-
- public void testHashAfterHash() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a#"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.*.#.b.c.#.d"), queue, null);
-
-
- AMQMessage message = createMessage("a.c.b.b.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has route and should not be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
-
-
- message = createMessage("a.a.b.c.d");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has no route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
- }
-
- public void testHashHash() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a#"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.#.*.#.d"), queue, null);
-
-
- AMQMessage message = createMessage("a.c.b.b.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has route and should not be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
-
- message = createMessage("a.a.b.c.d");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- }
- catch (AMQException nre)
- {
- fail("Message has no route and should be routed");
- }
-
- Assert.assertEquals(1, queue.getMessageCount());
-
- Assert.assertEquals("Wrong message recevied", message, queue.getMessagesOnTheQueue().get(0).getMessage());
-
- queue.deleteMessageFromTop(_context);
- Assert.assertEquals(0, queue.getMessageCount());
-
- }
-
- public void testSubMatchFails() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.b.c.d"), queue, null);
-
-
- AMQMessage message = createMessage("a.b.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has route and should not be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
-
- }
-
- public void testMoreRouting() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.b"), queue, null);
-
-
- AMQMessage message = createMessage("a.b.c");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has route and should not be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
-
- }
-
- public void testMoreQueue() throws AMQException
- {
- AMQQueue queue = new AMQQueue(new AMQShortString("a"), false, null, false, _vhost);
- _exchange.registerQueue(new AMQShortString("a.b"), queue, null);
-
-
- AMQMessage message = createMessage("a");
-
- try
- {
- _exchange.route(message);
- message.routingComplete(_store, _context, new MessageHandleFactory());
- fail("Message has route and should not be routed");
- }
- catch (AMQException nre)
- {
- }
-
- Assert.assertEquals(0, queue.getMessageCount());
-
- }
-
- private AMQMessage createMessage(String s) throws AMQException
- {
- MessagePublishInfo info = new PublishInfo(new AMQShortString(s));
-
- TransactionalContext trancontext = new NonTransactionalContext(_store, _context, null,
- new LinkedList<RequiredDeliveryException>(),
- new HashSet<Long>());
-
- AMQMessage message = new AMQMessage(0L, info, trancontext);
- message.setContentHeaderBody(new ContentHeaderBody());
-
- return message;
- }
-
-
- class PublishInfo implements MessagePublishInfo
- {
- AMQShortString _routingkey;
-
- PublishInfo(AMQShortString routingkey)
- {
- _routingkey = routingkey;
- }
-
- public AMQShortString getExchange()
- {
- return null;
- }
-
- public void setExchange(AMQShortString exchange)
- {
-
- }
-
- public boolean isImmediate()
- {
- return false;
- }
-
- public boolean isMandatory()
- {
- return true;
- }
-
- public AMQShortString getRoutingKey()
- {
- return _routingkey;
- }
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java
deleted file mode 100644
index 18d8592817..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.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.server.exchange;
-
-import junit.framework.TestCase;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.IApplicationRegistry;
-import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.TabularData;
-import java.util.ArrayList;
-
-/**
- * Unit test class for testing different Exchange MBean operations
- */
-public class ExchangeMBeanTest extends TestCase
-{
- private AMQQueue _queue;
- private QueueRegistry _queueRegistry;
- private VirtualHost _virtualHost;
-
- /**
- * Test for direct exchange mbean
- * @throws Exception
- */
-
- public void testDirectExchangeMBean() throws Exception
- {
- DestNameExchange exchange = new DestNameExchange();
- exchange.initialise(_virtualHost, ExchangeDefaults.DIRECT_EXCHANGE_NAME, false, 0, true);
- ManagedObject managedObj = exchange.getManagedObject();
- ManagedExchange mbean = (ManagedExchange)managedObj;
-
- mbean.createNewBinding(_queue.getName().toString(), "binding1");
- mbean.createNewBinding(_queue.getName().toString(), "binding2");
-
- TabularData data = mbean.bindings();
- ArrayList<Object> list = new ArrayList<Object>(data.values());
- assertTrue(list.size() == 2);
-
- // test general exchange properties
- assertEquals(mbean.getName(), "amq.direct");
- assertEquals(mbean.getExchangeType(), "direct");
- assertTrue(mbean.getTicketNo() == 0);
- assertTrue(!mbean.isDurable());
- assertTrue(mbean.isAutoDelete());
- }
-
- /**
- * Test for "topic" exchange mbean
- * @throws Exception
- */
-
- public void testTopicExchangeMBean() throws Exception
- {
- DestWildExchange exchange = new DestWildExchange();
- exchange.initialise(_virtualHost,ExchangeDefaults.TOPIC_EXCHANGE_NAME, false, 0, true);
- ManagedObject managedObj = exchange.getManagedObject();
- ManagedExchange mbean = (ManagedExchange)managedObj;
-
- mbean.createNewBinding(_queue.getName().toString(), "binding1");
- mbean.createNewBinding(_queue.getName().toString(), "binding2");
-
- TabularData data = mbean.bindings();
- ArrayList<Object> list = new ArrayList<Object>(data.values());
- assertTrue(list.size() == 2);
-
- // test general exchange properties
- assertEquals(mbean.getName(), "amq.topic");
- assertEquals(mbean.getExchangeType(), "topic");
- assertTrue(mbean.getTicketNo() == 0);
- assertTrue(!mbean.isDurable());
- assertTrue(mbean.isAutoDelete());
- }
-
- /**
- * Test for "Headers" exchange mbean
- * @throws Exception
- */
-
- public void testHeadersExchangeMBean() throws Exception
- {
- HeadersExchange exchange = new HeadersExchange();
- exchange.initialise(_virtualHost,ExchangeDefaults.HEADERS_EXCHANGE_NAME, false, 0, true);
- ManagedObject managedObj = exchange.getManagedObject();
- ManagedExchange mbean = (ManagedExchange)managedObj;
-
- mbean.createNewBinding(_queue.getName().toString(), "key1=binding1,key2=binding2");
- mbean.createNewBinding(_queue.getName().toString(), "key3=binding3");
-
- TabularData data = mbean.bindings();
- ArrayList<Object> list = new ArrayList<Object>(data.values());
- assertTrue(list.size() == 2);
-
- // test general exchange properties
- assertEquals(mbean.getName(), "amq.match");
- assertEquals(mbean.getExchangeType(), "headers");
- assertTrue(mbean.getTicketNo() == 0);
- assertTrue(!mbean.isDurable());
- assertTrue(mbean.isAutoDelete());
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- IApplicationRegistry applicationRegistry = ApplicationRegistry.getInstance();
- _virtualHost = applicationRegistry.getVirtualHostRegistry().getVirtualHost("test");
- _queueRegistry = _virtualHost.getQueueRegistry();
- _queue = new AMQQueue(new AMQShortString("testQueue"), false, new AMQShortString("ExchangeMBeanTest"), false, _virtualHost);
- _queueRegistry.registerQueue(_queue);
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java
deleted file mode 100644
index 86ba96bf5d..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.exchange;
-
-import java.util.Map;
-import java.util.HashMap;
-
-import junit.framework.TestCase;
-import org.apache.qpid.framing.FieldTable;
-
-/**
- */
-public class HeadersBindingTest extends TestCase
-{
- private FieldTable bindHeaders = new FieldTable();
- private FieldTable matchHeaders = new FieldTable();
-
- public void testDefault_1()
- {
- bindHeaders.setString("A", "Value of A");
-
- matchHeaders.setString("A", "Value of A");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testDefault_2()
- {
- bindHeaders.setString("A", "Value of A");
-
- matchHeaders.setString("A", "Value of A");
- matchHeaders.setString("B", "Value of B");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testDefault_3()
- {
- bindHeaders.setString("A", "Value of A");
-
- matchHeaders.setString("A", "Altered value of A");
-
- assertFalse(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAll_1()
- {
- bindHeaders.setString("X-match", "all");
- bindHeaders.setString("A", "Value of A");
-
- matchHeaders.setString("A", "Value of A");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAll_2()
- {
- bindHeaders.setString("X-match", "all");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Value of A");
-
- assertFalse(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAll_3()
- {
- bindHeaders.setString("X-match", "all");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Value of A");
- matchHeaders.setString("B", "Value of B");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAll_4()
- {
- bindHeaders.setString("X-match", "all");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Value of A");
- matchHeaders.setString("B", "Value of B");
- matchHeaders.setString("C", "Value of C");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAll_5()
- {
- bindHeaders.setString("X-match", "all");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Value of A");
- matchHeaders.setString("B", "Altered value of B");
- matchHeaders.setString("C", "Value of C");
-
- assertFalse(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAny_1()
- {
- bindHeaders.setString("X-match", "any");
- bindHeaders.setString("A", "Value of A");
-
- matchHeaders.setString("A", "Value of A");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAny_2()
- {
- bindHeaders.setString("X-match", "any");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Value of A");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAny_3()
- {
- bindHeaders.setString("X-match", "any");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Value of A");
- matchHeaders.setString("B", "Value of B");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAny_4()
- {
- bindHeaders.setString("X-match", "any");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Value of A");
- matchHeaders.setString("B", "Value of B");
- matchHeaders.setString("C", "Value of C");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAny_5()
- {
- bindHeaders.setString("X-match", "any");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Value of A");
- matchHeaders.setString("B", "Altered value of B");
- matchHeaders.setString("C", "Value of C");
-
- assertTrue(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public void testAny_6()
- {
- bindHeaders.setString("X-match", "any");
- bindHeaders.setString("A", "Value of A");
- bindHeaders.setString("B", "Value of B");
-
- matchHeaders.setString("A", "Altered value of A");
- matchHeaders.setString("B", "Altered value of B");
- matchHeaders.setString("C", "Value of C");
-
- assertFalse(new HeadersBinding(bindHeaders).matches(matchHeaders));
- }
-
- public static junit.framework.Test suite()
- {
- return new junit.framework.TestSuite(HeadersBindingTest.class);
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/TestIoSession.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/TestIoSession.java
deleted file mode 100644
index ff4d3ed9fb..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/TestIoSession.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.protocol;
-
-import org.apache.mina.common.*;
-import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
-import org.apache.qpid.pool.ReadWriteThreadModel;
-
-import java.net.SocketAddress;
-import java.net.InetSocketAddress;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Test implementation of IoSession, which is required for some tests. Methods not being used are not implemented,
- * so if this class is being used and some methods are to be used, then please update those.
- */
-public class TestIoSession implements IoSession
-{
- private final ConcurrentMap attributes = new ConcurrentHashMap();
-
- public TestIoSession()
- {
- }
-
- public IoService getService()
- {
- return null;
- }
-
- public IoServiceConfig getServiceConfig()
- {
- return new TestIoConfig();
- }
-
- public IoHandler getHandler()
- {
- return null;
- }
-
- public IoSessionConfig getConfig()
- {
- return null;
- }
-
- public IoFilterChain getFilterChain()
- {
- return null;
- }
-
- public WriteFuture write(Object message)
- {
- return null;
- }
-
- public CloseFuture close()
- {
- return null;
- }
-
- public Object getAttachment()
- {
- return getAttribute("");
- }
-
- public Object setAttachment(Object attachment)
- {
- return setAttribute("",attachment);
- }
-
- public Object getAttribute(String key)
- {
- return attributes.get(key);
- }
-
- public Object setAttribute(String key, Object value)
- {
- return attributes.put(key,value);
- }
-
- public Object setAttribute(String key)
- {
- return attributes.put(key, Boolean.TRUE);
- }
-
- public Object removeAttribute(String key)
- {
- return attributes.remove(key);
- }
-
- public boolean containsAttribute(String key)
- {
- return attributes.containsKey(key);
- }
-
- public Set getAttributeKeys()
- {
- return attributes.keySet();
- }
-
- public TransportType getTransportType()
- {
- return null;
- }
-
- public boolean isConnected()
- {
- return false;
- }
-
- public boolean isClosing()
- {
- return false;
- }
-
- public CloseFuture getCloseFuture()
- {
- return null;
- }
-
- public SocketAddress getRemoteAddress()
- {
- return new InetSocketAddress("127.0.0.1", 1234);
- }
-
- public SocketAddress getLocalAddress()
- {
- return null;
- }
-
- public SocketAddress getServiceAddress()
- {
- return null;
- }
-
- public int getIdleTime(IdleStatus status)
- {
- return 0;
- }
-
- public long getIdleTimeInMillis(IdleStatus status)
- {
- return 0;
- }
-
- public void setIdleTime(IdleStatus status, int idleTime)
- {
-
- }
-
- public int getWriteTimeout()
- {
- return 0;
- }
-
- public long getWriteTimeoutInMillis()
- {
- return 0;
- }
-
- public void setWriteTimeout(int writeTimeout)
- {
-
- }
-
- public TrafficMask getTrafficMask()
- {
- return null;
- }
-
- public void setTrafficMask(TrafficMask trafficMask)
- {
-
- }
-
- public void suspendRead()
- {
-
- }
-
- public void suspendWrite()
- {
-
- }
-
- public void resumeRead()
- {
-
- }
-
- public void resumeWrite()
- {
-
- }
-
- public long getReadBytes()
- {
- return 0;
- }
-
- public long getWrittenBytes()
- {
- return 0;
- }
-
- public long getReadMessages()
- {
- return 0;
- }
-
- public long getWrittenMessages()
- {
- return 0;
- }
-
- public long getWrittenWriteRequests()
- {
- return 0;
- }
-
- public int getScheduledWriteRequests()
- {
- return 0;
- }
-
- public int getScheduledWriteBytes()
- {
- return 0;
- }
-
- public long getCreationTime()
- {
- return 0;
- }
-
- public long getLastIoTime()
- {
- return 0;
- }
-
- public long getLastReadTime()
- {
- return 0;
- }
-
- public long getLastWriteTime()
- {
- return 0;
- }
-
- public boolean isIdle(IdleStatus status)
- {
- return false;
- }
-
- public int getIdleCount(IdleStatus status)
- {
- return 0;
- }
-
- public long getLastIdleTime(IdleStatus status)
- {
- return 0;
- }
-
- /**
- * Test implementation of IoServiceConfig
- */
- private class TestIoConfig extends SocketAcceptorConfig
- {
- public ThreadModel getThreadModel()
- {
- return ReadWriteThreadModel.getInstance();
- }
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/TestMinaProtocolSession.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/TestMinaProtocolSession.java
deleted file mode 100644
index 0c0d8f471e..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/TestMinaProtocolSession.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.server.protocol;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.codec.AMQCodecFactory;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.output.ProtocolOutputConverter;
-import org.apache.qpid.server.output.ProtocolOutputConverterRegistry;
-
-public class TestMinaProtocolSession extends AMQMinaProtocolSession
-{
- public TestMinaProtocolSession() throws AMQException
- {
- super(new TestIoSession(),
- ApplicationRegistry.getInstance().getVirtualHostRegistry(),
- new AMQCodecFactory(true));
- }
-
- public ProtocolOutputConverter getProtocolOutputConverter()
- {
- return ProtocolOutputConverterRegistry.getConverter(this);
- }
-
- public byte getProtocolMajorVersion()
- {
- return (byte)8;
- }
-
- public byte getProtocolMinorVersion()
- {
- return (byte)0;
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java
deleted file mode 100644
index ed79384d42..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.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.server.queue;
-
-import junit.framework.TestCase;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.MemoryMessageStore;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.registry.IApplicationRegistry;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.txn.TransactionalContext;
-import org.apache.qpid.server.txn.NonTransactionalContext;
-import org.apache.qpid.server.RequiredDeliveryException;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.protocol.TestMinaProtocolSession;
-import org.apache.qpid.server.protocol.AMQMinaProtocolSession;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-
-import javax.management.Notification;
-import java.util.LinkedList;
-import java.util.HashSet;
-
-/** This class tests all the alerts an AMQQueue can throw based on threshold values of different parameters */
-public class AMQQueueAlertTest extends TestCase
-{
- private final static long MAX_MESSAGE_COUNT = 50;
- private final static long MAX_MESSAGE_AGE = 250; // 0.25 sec
- private final static long MAX_MESSAGE_SIZE = 2000; // 2 KB
- private final static long MAX_QUEUE_DEPTH = 10000; // 10 KB
- private AMQQueue _queue;
- private AMQQueueMBean _queueMBean;
- private VirtualHost _virtualHost;
- private AMQMinaProtocolSession protocolSession = null;
- private MessageStore _messageStore = new MemoryMessageStore();
- private StoreContext _storeContext = new StoreContext();
- private TransactionalContext _transactionalContext = new NonTransactionalContext(_messageStore, _storeContext,
- null,
- new LinkedList<RequiredDeliveryException>(),
- new HashSet<Long>());
-
- /**
- * Tests if the alert gets thrown when message count increases the threshold limit
- *
- * @throws Exception
- */
- public void testMessageCountAlert() throws Exception
- {
- _queue = new AMQQueue(new AMQShortString("testQueue1"), false, new AMQShortString("AMQueueAlertTest"),
- false, _virtualHost);
- _queueMBean = (AMQQueueMBean) _queue.getManagedObject();
-
- _queueMBean.setMaximumMessageCount(MAX_MESSAGE_COUNT);
-
- sendMessages(MAX_MESSAGE_COUNT, 256l);
- assertTrue(_queueMBean.getMessageCount() == MAX_MESSAGE_COUNT);
-
- Notification lastNotification = _queueMBean.getLastNotification();
- assertNotNull(lastNotification);
-
- String notificationMsg = lastNotification.getMessage();
- assertTrue(notificationMsg.startsWith(NotificationCheck.MESSAGE_COUNT_ALERT.name()));
- }
-
- /**
- * Tests if the Message Size alert gets thrown when message of higher than threshold limit is sent
- *
- * @throws Exception
- */
- public void testMessageSizeAlert() throws Exception
- {
- _queue = new AMQQueue(new AMQShortString("testQueue2"), false, new AMQShortString("AMQueueAlertTest"),
- false, _virtualHost);
- _queueMBean = (AMQQueueMBean) _queue.getManagedObject();
- _queueMBean.setMaximumMessageCount(MAX_MESSAGE_COUNT);
- _queueMBean.setMaximumMessageSize(MAX_MESSAGE_SIZE);
-
- sendMessages(1, MAX_MESSAGE_SIZE * 2);
- assertTrue(_queueMBean.getMessageCount() == 1);
-
- Notification lastNotification = _queueMBean.getLastNotification();
- assertNotNull(lastNotification);
-
- String notificationMsg = lastNotification.getMessage();
- assertTrue(notificationMsg.startsWith(NotificationCheck.MESSAGE_SIZE_ALERT.name()));
- }
-
- /**
- * Tests if Queue Depth alert is thrown when queue depth reaches the threshold value
- *
- * Based on FT-402 subbmitted by client
- *
- * @throws Exception
- */
- public void testQueueDepthAlertNoSubscriber() throws Exception
- {
- _queue = new AMQQueue(new AMQShortString("testQueue3"), false, new AMQShortString("AMQueueAlertTest"),
- false, _virtualHost);
- _queueMBean = (AMQQueueMBean) _queue.getManagedObject();
- _queueMBean.setMaximumMessageCount(MAX_MESSAGE_COUNT);
- _queueMBean.setMaximumQueueDepth(MAX_QUEUE_DEPTH);
-
- while (_queue.getQueueDepth() < MAX_QUEUE_DEPTH)
- {
- sendMessages(1, MAX_MESSAGE_SIZE);
- }
-
- Notification lastNotification = _queueMBean.getLastNotification();
- assertNotNull(lastNotification);
-
- String notificationMsg = lastNotification.getMessage();
- assertTrue(notificationMsg.startsWith(NotificationCheck.QUEUE_DEPTH_ALERT.name()));
- }
-
- /**
- * Tests if MESSAGE AGE alert is thrown, when a message is in the queue for time higher than threshold value of
- * message age
- *
- * Alternative test to FT-401 provided by client
- *
- * @throws Exception
- */
- public void testMessageAgeAlert() throws Exception
- {
- _queue = new AMQQueue(new AMQShortString("testQueue4"), false, new AMQShortString("AMQueueAlertTest"),
- false, _virtualHost);
- _queueMBean = (AMQQueueMBean) _queue.getManagedObject();
- _queueMBean.setMaximumMessageCount(MAX_MESSAGE_COUNT);
- _queueMBean.setMaximumMessageAge(MAX_MESSAGE_AGE);
-
- sendMessages(1, MAX_MESSAGE_SIZE);
-
- // Ensure message sits on queue long enough to age.
- Thread.sleep(MAX_MESSAGE_AGE * 2);
-
- sendMessages(1, MAX_MESSAGE_SIZE);
- assertTrue(_queueMBean.getMessageCount() == 2);
-
- Notification lastNotification = _queueMBean.getLastNotification();
- assertNotNull(lastNotification);
-
- String notificationMsg = lastNotification.getMessage();
- assertTrue(notificationMsg.startsWith(NotificationCheck.MESSAGE_AGE_ALERT.name()));
- }
-
- /*
- This test sends some messages to the queue with subscribers needing message to be acknowledged.
- The messages will not be acknowledged and will be required twice. Why we are checking this is because
- the bug reported said that the queueDepth keeps increasing when messages are requeued.
- The QueueDepth should decrease when messages are delivered from the queue (QPID-408)
- */
- public void testQueueDepthAlertWithSubscribers() throws Exception
- {
- protocolSession = new TestMinaProtocolSession();
- AMQChannel channel = new AMQChannel(protocolSession, 2, _messageStore);
- protocolSession.addChannel(channel);
-
- // Create queue
- _queue = getNewQueue();
- _queue.registerProtocolSession(protocolSession, channel.getChannelId(),
- new AMQShortString("consumer_tag"), true, null, false, false);
-
- _queueMBean = (AMQQueueMBean) _queue.getManagedObject();
- _queueMBean.setMaximumMessageCount(9999l); // Set a high value, because this is not being tested
- _queueMBean.setMaximumQueueDepth(MAX_QUEUE_DEPTH);
-
- // Send messages(no of message to be little more than what can cause a Queue_Depth alert)
- int messageCount = Math.round(MAX_QUEUE_DEPTH / MAX_MESSAGE_SIZE) + 10;
- long totalSize = (messageCount * MAX_MESSAGE_SIZE) >> 10;
- sendMessages(messageCount, MAX_MESSAGE_SIZE);
-
- // Check queueDepth. There should be no messages on the queue and as the subscriber is listening
- // so there should be no Queue_Deoth alert raised
- assertEquals(new Long(0), new Long(_queueMBean.getQueueDepth()));
- Notification lastNotification = _queueMBean.getLastNotification();
- assertNull(lastNotification);
-
- // Kill the subscriber and check for the queue depth values.
- // Messages are unacknowledged, so those should get requeued. All messages should be on the Queue
- _queue.unregisterProtocolSession(protocolSession, channel.getChannelId(), new AMQShortString("consumer_tag"));
- channel.requeue();
-
- assertEquals(new Long(totalSize), new Long(_queueMBean.getQueueDepth()));
-
- lastNotification = _queueMBean.getLastNotification();
- assertNotNull(lastNotification);
- String notificationMsg = lastNotification.getMessage();
- assertTrue(notificationMsg.startsWith(NotificationCheck.QUEUE_DEPTH_ALERT.name()));
-
- // Connect a consumer again and check QueueDepth values. The queue should get emptied.
- // Messages will get delivered but still are unacknowledged.
- _queue.registerProtocolSession(protocolSession, channel.getChannelId(),
- new AMQShortString("consumer_tag"), true, null, false, false);
- _queue.deliverAsync();
- while (_queue.getMessageCount() != 0)
- {
- Thread.sleep(100);
- }
- assertEquals(new Long(0), new Long(_queueMBean.getQueueDepth()));
-
- // Kill the subscriber again. Now those messages should get requeued again. Check if the queue depth
- // value is correct.
- _queue.unregisterProtocolSession(protocolSession, channel.getChannelId(), new AMQShortString("consumer_tag"));
- channel.requeue();
-
- assertEquals(new Long(totalSize), new Long(_queueMBean.getQueueDepth()));
- protocolSession.closeSession();
-
- // Check the clear queue
- _queueMBean.clearQueue();
- assertEquals(new Long(0), new Long(_queueMBean.getQueueDepth()));
- }
-
- protected AMQMessage message(final boolean immediate, long size) throws AMQException
- {
- MessagePublishInfo publish = new MessagePublishInfo()
- {
-
- public AMQShortString getExchange()
- {
- return null;
- }
-
- public void setExchange(AMQShortString exchange)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean isImmediate()
- {
- return immediate;
- }
-
- public boolean isMandatory()
- {
- return false;
- }
-
- public AMQShortString getRoutingKey()
- {
- return null;
- }
- };
-
- ContentHeaderBody contentHeaderBody = new ContentHeaderBody();
- contentHeaderBody.bodySize = size; // in bytes
- AMQMessage message = new AMQMessage(_messageStore.getNewMessageId(), publish, _transactionalContext);
- message.setContentHeaderBody(contentHeaderBody);
- message.setPublisher(protocolSession);
- return message;
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- IApplicationRegistry applicationRegistry = ApplicationRegistry.getInstance();
- _virtualHost = applicationRegistry.getVirtualHostRegistry().getVirtualHost("test");
- }
-
- private void sendMessages(long messageCount, long size) throws AMQException
- {
- AMQMessage[] messages = new AMQMessage[(int) messageCount];
- for (int i = 0; i < messages.length; i++)
- {
- messages[i] = message(false, size);
- messages[i].enqueue(_queue);
- messages[i].routingComplete(_messageStore, _storeContext, new MessageHandleFactory());
- }
-
- for (int i = 0; i < messageCount; i++)
- {
- _queue.process(_storeContext, new QueueEntry(_queue,messages[i]), false);
- }
- }
-
- private AMQQueue getNewQueue() throws AMQException
- {
- return new AMQQueue(new AMQShortString("testQueue" + Math.random()),
- false,
- new AMQShortString("AMQueueAlertTest"),
- false,
- _virtualHost);
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java
deleted file mode 100644
index c02b47e9fd..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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.server.queue;
-
-import junit.framework.TestCase;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.qpid.server.RequiredDeliveryException;
-import org.apache.qpid.server.protocol.TestMinaProtocolSession;
-import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.registry.IApplicationRegistry;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.txn.TransactionalContext;
-import org.apache.qpid.server.txn.NonTransactionalContext;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.store.MemoryMessageStore;
-import org.apache.qpid.server.store.TestableMemoryMessageStore;
-import org.apache.mina.common.ByteBuffer;
-
-import javax.management.JMException;
-import java.util.LinkedList;
-import java.util.HashSet;
-
-/**
- * Test class to test AMQQueueMBean attribtues and operations
- */
-public class AMQQueueMBeanTest extends TestCase
-{
- private static long MESSAGE_SIZE = 1000;
- private AMQQueue _queue;
- private AMQQueueMBean _queueMBean;
- private MessageStore _messageStore;
- private StoreContext _storeContext = new StoreContext();
- private TransactionalContext _transactionalContext;
- private VirtualHost _virtualHost;
- private AMQProtocolSession _protocolSession;
-
- public void testMessageCountTransient() throws Exception
- {
- int messageCount = 10;
- sendMessages(messageCount, false);
- assertTrue(_queueMBean.getMessageCount() == messageCount);
- assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
- long queueDepth = (messageCount * MESSAGE_SIZE) >> 10;
- assertTrue(_queueMBean.getQueueDepth() == queueDepth);
-
- _queueMBean.deleteMessageFromTop();
- assertTrue(_queueMBean.getMessageCount() == (messageCount - 1));
- assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
-
- _queueMBean.clearQueue();
- assertTrue(_queueMBean.getMessageCount() == 0);
- assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
-
- //Ensure that the data has been removed from the Store
- verifyBrokerState();
- }
-
- public void testMessageCountPersistent() throws Exception
- {
- int messageCount = 10;
- sendMessages(messageCount, true);
- assertEquals("", messageCount, _queueMBean.getMessageCount().intValue());
- assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
- long queueDepth = (messageCount * MESSAGE_SIZE) >> 10;
- assertTrue(_queueMBean.getQueueDepth() == queueDepth);
-
- _queueMBean.deleteMessageFromTop();
- assertTrue(_queueMBean.getMessageCount() == (messageCount - 1));
- assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
-
- _queueMBean.clearQueue();
- assertTrue(_queueMBean.getMessageCount() == 0);
- assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
-
- //Ensure that the data has been removed from the Store
- verifyBrokerState();
- }
-
- // todo: collect to a general testing class -duplicated from Systest/MessageReturntest
- private void verifyBrokerState()
- {
-
- TestableMemoryMessageStore store = new TestableMemoryMessageStore((MemoryMessageStore) _virtualHost.getMessageStore());
-
- // Unlike MessageReturnTest there is no need for a delay as there this thread does the clean up.
- assertNotNull("ContentBodyMap should not be null", store.getContentBodyMap());
- assertEquals("Expected the store to have no content:" + store.getContentBodyMap(), 0, store.getContentBodyMap().size());
- assertNotNull("MessageMetaDataMap should not be null", store.getMessageMetaDataMap());
- assertEquals("Expected the store to have no metadata:" + store.getMessageMetaDataMap(), 0, store.getMessageMetaDataMap().size());
- }
-
- public void testConsumerCount() throws AMQException
- {
- SubscriptionManager mgr = _queue.getSubscribers();
- assertFalse(mgr.hasActiveSubscribers());
- assertTrue(_queueMBean.getActiveConsumerCount() == 0);
-
-
- TestMinaProtocolSession protocolSession = new TestMinaProtocolSession();
- AMQChannel channel = new AMQChannel(protocolSession, 1, _messageStore);
- protocolSession.addChannel(channel);
-
- _queue.registerProtocolSession(protocolSession, 1, new AMQShortString("test"), false, null, false, false);
- assertTrue(_queueMBean.getActiveConsumerCount() == 1);
-
- SubscriptionSet _subscribers = (SubscriptionSet) mgr;
- SubscriptionFactory subscriptionFactory = new SubscriptionImpl.Factory();
- Subscription s1 = subscriptionFactory.createSubscription(channel.getChannelId(),
- protocolSession,
- new AMQShortString("S1"),
- false,
- null,
- true,
- _queue);
-
- Subscription s2 = subscriptionFactory.createSubscription(channel.getChannelId(),
- protocolSession,
- new AMQShortString("S2"),
- false,
- null,
- true,
- _queue);
- _subscribers.addSubscriber(s1);
- _subscribers.addSubscriber(s2);
- assertTrue(_queueMBean.getActiveConsumerCount() == 3);
- assertTrue(_queueMBean.getConsumerCount() == 3);
-
- s1.close();
- assertTrue(_queueMBean.getActiveConsumerCount() == 2);
- assertTrue(_queueMBean.getConsumerCount() == 3);
- }
-
- public void testGeneralProperties()
- {
- long maxQueueDepth = 1000; // in bytes
- _queueMBean.setMaximumMessageCount(50000l);
- _queueMBean.setMaximumMessageSize(2000l);
- _queueMBean.setMaximumQueueDepth(maxQueueDepth);
-
- assertTrue(_queueMBean.getMaximumMessageCount() == 50000);
- assertTrue(_queueMBean.getMaximumMessageSize() == 2000);
- assertTrue(_queueMBean.getMaximumQueueDepth() == (maxQueueDepth >> 10));
-
- assertTrue(_queueMBean.getName().equals("testQueue"));
- assertTrue(_queueMBean.getOwner().equals("AMQueueMBeanTest"));
- assertFalse(_queueMBean.isAutoDelete());
- assertFalse(_queueMBean.isDurable());
- }
-
- public void testExceptions() throws Exception
- {
- try
- {
- _queueMBean.viewMessages(0, 3);
- fail();
- }
- catch (JMException ex)
- {
-
- }
-
- try
- {
- _queueMBean.viewMessages(2, 1);
- fail();
- }
- catch (JMException ex)
- {
-
- }
-
- try
- {
- _queueMBean.viewMessages(-1, 1);
- fail();
- }
- catch (JMException ex)
- {
-
- }
-
- AMQMessage msg = message(false, false);
- long id = msg.getMessageId();
- _queue.clearQueue(_storeContext);
-
- msg.enqueue(_queue);
- msg.routingComplete(_messageStore, _storeContext, new MessageHandleFactory());
- _queue.process(_storeContext, new QueueEntry(_queue, msg), false);
- _queueMBean.viewMessageContent(id);
- try
- {
- _queueMBean.viewMessageContent(id + 1);
- fail();
- }
- catch (JMException ex)
- {
-
- }
- }
-
- private AMQMessage message(final boolean immediate, boolean persistent) throws AMQException
- {
- MessagePublishInfo publish = new MessagePublishInfo()
- {
-
- public AMQShortString getExchange()
- {
- return null;
- }
-
- public void setExchange(AMQShortString exchange)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean isImmediate()
- {
- return immediate;
- }
-
- public boolean isMandatory()
- {
- return false;
- }
-
- public AMQShortString getRoutingKey()
- {
- return null;
- }
- };
-
- ContentHeaderBody contentHeaderBody = new ContentHeaderBody();
- contentHeaderBody.bodySize = MESSAGE_SIZE; // in bytes
- contentHeaderBody.properties = new BasicContentHeaderProperties();
- ((BasicContentHeaderProperties) contentHeaderBody.properties).setDeliveryMode((byte) (persistent ? 2 : 1));
- return new AMQMessage(_messageStore.getNewMessageId(), publish, _transactionalContext, contentHeaderBody);
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- IApplicationRegistry applicationRegistry = ApplicationRegistry.getInstance();
- _virtualHost = applicationRegistry.getVirtualHostRegistry().getVirtualHost("test");
- _messageStore = _virtualHost.getMessageStore();
-
- _transactionalContext = new NonTransactionalContext(_messageStore, _storeContext,
- null,
- new LinkedList<RequiredDeliveryException>(),
- new HashSet<Long>());
-
- _queue = new AMQQueue(new AMQShortString("testQueue"), false, new AMQShortString("AMQueueMBeanTest"), false, _virtualHost);
- _queueMBean = new AMQQueueMBean(_queue);
-
- _protocolSession = new TestMinaProtocolSession();
- }
-
- private void sendMessages(int messageCount, boolean persistent) throws AMQException
- {
- for (int i = 0; i < messageCount; i++)
- {
- AMQMessage currentMessage = message(false, persistent);
- currentMessage.enqueue(_queue);
-
- // route header
- currentMessage.routingComplete(_messageStore, _storeContext, new MessageHandleFactory());
-
- // Add the body so we have somthing to test later
- currentMessage.addContentBodyFrame(_storeContext,
- _protocolSession.getMethodRegistry()
- .getProtocolVersionMethodConverter()
- .convertToContentChunk(
- new ContentBody(ByteBuffer.allocate((int) MESSAGE_SIZE),
- MESSAGE_SIZE)));
-
-
- }
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
deleted file mode 100644
index 48d808142c..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.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.
- *
- */
-package org.apache.qpid.server.store;
-
-import org.apache.qpid.server.queue.MessageMetaData;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.abstraction.ContentChunk;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.List;
-
-/**
- * Adds some extra methods to the memory message store for testing purposes.
- */
-public class TestableMemoryMessageStore extends MemoryMessageStore
-{
-
- MemoryMessageStore _mms = null;
-
- public TestableMemoryMessageStore(MemoryMessageStore mms)
- {
- _mms = mms;
- }
-
- public TestableMemoryMessageStore()
- {
- _metaDataMap = new ConcurrentHashMap<Long, MessageMetaData>();
- _contentBodyMap = new ConcurrentHashMap<Long, List<ContentChunk>>();
- }
-
- public ConcurrentMap<Long, MessageMetaData> getMessageMetaDataMap()
- {
- if (_mms != null)
- {
- return _mms._metaDataMap;
- }
- else
- {
- return _metaDataMap;
- }
- }
-
- public ConcurrentMap<Long, List<ContentChunk>> getContentBodyMap()
- {
- if (_mms != null)
- {
- return _mms._contentBodyMap;
- }
- else
- {
- return _contentBodyMap;
- }
- }
-}
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/util/LoggingProxyTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/util/LoggingProxyTest.java
deleted file mode 100644
index c7db51016e..0000000000
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/util/LoggingProxyTest.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.server.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class LoggingProxyTest extends TestCase
-{
- static interface IFoo {
- void foo();
- void foo(int i, Collection c);
- String bar();
- String bar(String s, List l);
- }
-
- static class Foo implements IFoo {
- public void foo()
- {
- }
-
- public void foo(int i, Collection c)
- {
- }
-
- public String bar()
- {
- return null;
- }
-
- public String bar(String s, List l)
- {
- return "ha";
- }
- }
-
- public void testSimple() {
- LoggingProxy proxy = new LoggingProxy(new Foo(), 20);
- IFoo foo = (IFoo)proxy.getProxy(IFoo.class);
- foo.foo();
- assertEquals(2, proxy.getBufferSize());
- assertTrue(proxy.getBuffer().get(0).toString().matches(".*: foo\\(\\) entered$"));
- assertTrue(proxy.getBuffer().get(1).toString().matches(".*: foo\\(\\) returned$"));
-
- foo.foo(3, Arrays.asList(0, 1, 2));
- assertEquals(4, proxy.getBufferSize());
- assertTrue(proxy.getBuffer().get(2).toString().matches(".*: foo\\(\\[3, \\[0, 1, 2\\]\\]\\) entered$"));
- assertTrue(proxy.getBuffer().get(3).toString().matches(".*: foo\\(\\) returned$"));
-
- foo.bar();
- assertEquals(6, proxy.getBufferSize());
- assertTrue(proxy.getBuffer().get(4).toString().matches(".*: bar\\(\\) entered$"));
- assertTrue(proxy.getBuffer().get(5).toString().matches(".*: bar\\(\\) returned null$"));
-
- foo.bar("hello", Arrays.asList(1, 2, 3));
- assertEquals(8, proxy.getBufferSize());
- assertTrue(proxy.getBuffer().get(6).toString().matches(".*: bar\\(\\[hello, \\[1, 2, 3\\]\\]\\) entered$"));
- assertTrue(proxy.getBuffer().get(7).toString().matches(".*: bar\\(\\) returned ha$"));
-
- proxy.dump();
- }
-
- public static junit.framework.Test suite()
- {
- return new junit.framework.TestSuite(LoggingProxyTest.class);
- }
-}
diff --git a/qpid/ruby/DISCLAIMER b/qpid/ruby/DISCLAIMER
deleted file mode 100644
index c321113c9e..0000000000
--- a/qpid/ruby/DISCLAIMER
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Qpid is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC.
-
-Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
-
-While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
diff --git a/qpid/ruby/LICENSE.txt b/qpid/ruby/LICENSE.txt
deleted file mode 100755
index ebe01d702c..0000000000
--- a/qpid/ruby/LICENSE.txt
+++ /dev/null
@@ -1,330 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-=======================================================================
- AMQP License
-======================================================================
-
- Copyright Notice
- ================
- (c) Copyright JPMorgan Chase Bank & Co., Cisco Systems, Inc., Envoy
-Technologies Inc.,
- iMatix Corporation, IONA\ufffd Technologies, Red Hat, Inc.,
- TWIST Process Innovations, and 29West Inc. 2006. All rights reserved.
-
- License
- =======
- JPMorgan Chase Bank & Co., Cisco Systems, Inc., Envoy Technologies Inc.,
-iMatix
- Corporation, IONA Technologies, Red Hat, Inc., TWIST Process Innovations,
-and
- 29West Inc. (collectively, the "Authors") each hereby grants to you a
-worldwide,
- perpetual, royalty-free, nontransferable, nonexclusive license to
- (i) copy, display, distribute and implement the Advanced Messaging Queue
-Protocol
- ("AMQP") Specification and (ii) the Licensed Claims that are held by
- the Authors, all for the purpose of implementing the Advanced Messaging
- Queue Protocol Specification. Your license and any rights under this
- Agreement will terminate immediately without notice from
- any Author if you bring any claim, suit, demand, or action related to
- the Advanced Messaging Queue Protocol Specification against any Author.
- Upon termination, you shall destroy all copies of the Advanced Messaging
- Queue Protocol Specification in your possession or control.
-
- As used hereunder, "Licensed Claims" means those claims of a patent or
- patent application, throughout the world, excluding design patents and
- design registrations, owned or controlled, or that can be sublicensed
- without fee and in compliance with the requirements of this
- Agreement, by an Author or its affiliates now or at any
- future time and which would necessarily be infringed by implementation
- of the Advanced Messaging Queue Protocol Specification. A claim is
- necessarily infringed hereunder only when it is not possible to avoid
- infringing it because there is no plausible non-infringing alternative
- for implementing the required portions of the Advanced Messaging Queue
- Protocol Specification. Notwithstanding the foregoing, Licensed Claims
- shall not include any claims other than as set forth above even if
- contained in the same patent as Licensed Claims; or that read solely
- on any implementations of any portion of the Advanced Messaging Queue
- Protocol Specification that are not required by the Advanced Messaging
- Queue Protocol Specification, or that, if licensed, would require a
- payment of royalties by the licensor to unaffiliated third parties.
- Moreover, Licensed Claims shall not include (i) any enabling technologies
- that may be necessary to make or use any Licensed Product but are not
- themselves expressly set forth in the Advanced Messaging Queue Protocol
- Specification (e.g., semiconductor manufacturing technology, compiler
- technology, object oriented technology, networking technology, operating
- system technology, and the like); or (ii) the implementation of other
- published standards developed elsewhere and merely referred to in the
- body of the Advanced Messaging Queue Protocol Specification, or
- (iii) any Licensed Product and any combinations thereof the purpose or
- function of which is not required for compliance with the Advanced
- Messaging Queue Protocol Specification. For purposes of this definition,
- the Advanced Messaging Queue Protocol Specification shall be deemed to
- include both architectural and interconnection requirements essential
- for interoperability and may also include supporting source code artifacts
- where such architectural, interconnection requirements and source code
- artifacts are expressly identified as being required or documentation to
- achieve compliance with the Advanced Messaging Queue Protocol
-Specification.
-
- As used hereunder, "Licensed Products" means only those specific portions
- of products (hardware, software or combinations thereof) that implement
- and are compliant with all relevant portions of the Advanced Messaging
- Queue Protocol Specification.
-
- The following disclaimers, which you hereby also acknowledge as to any
- use you may make of the Advanced Messaging Queue Protocol Specification:
-
- THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION IS PROVIDED "AS IS,"
- AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
- IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE
- CONTENTS OF THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION ARE
- SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF THE ADVANCED
- MESSAGING QUEUE PROTOCOL SPECIFICATION WILL NOT INFRINGE ANY THIRD PARTY
- PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
- THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
- INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
- USE, IMPLEMENTATION OR DISTRIBUTION OF THE ADVANCED MESSAGING QUEUE
- PROTOCOL SPECIFICATION.
-
- The name and trademarks of the Authors may NOT be used in any manner,
- including advertising or publicity pertaining to the Advanced Messaging
- Queue Protocol Specification or its contents without specific, written
- prior permission. Title to copyright in the Advanced Messaging Queue
- Protocol Specification will at all times remain with the Authors.
-
- No other rights are granted by implication, estoppel or otherwise.
-
- Upon termination of your license or rights under this Agreement, you
- shall destroy all copies of the Advanced Messaging Queue Protocol
- Specification in your possession or control.
-
- Trademarks
- ==========
- "JPMorgan", "JPMorgan Chase", "Chase", the JPMorgan Chase logo and the
- Octagon Symbol are trademarks of JPMorgan Chase & Co.
-
- IMATIX and the iMatix logo are trademarks of iMatix Corporation sprl.
-
- IONA, IONA Technologies, and the IONA logos are trademarks of IONA
- Technologies PLC and/or its subsidiaries.
-
- LINUX is a trademark of Linus Torvalds. RED HAT and JBOSS are registered
- trademarks of Red Hat, Inc. in the US and other countries.
-
- Java, all Java-based trademarks and OpenOffice.org are trademarks of
- Sun Microsystems, Inc. in the United States, other countries, or both.
-
- Other company, product, or service names may be trademarks or service
- marks of others.
-
- Links to full AMQP specification:
- =================================
- http://www.envoytech.org/spec/amq/
- http://www.iona.com/opensource/amqp/
- http://www.redhat.com/solutions/specifications/amqp/
- http://www.twiststandards.org/tiki-index.php?page=AMQ
- http://www.imatix.com/amqp
diff --git a/qpid/ruby/NOTICE.txt b/qpid/ruby/NOTICE.txt
deleted file mode 100644
index fff2bca45c..0000000000
--- a/qpid/ruby/NOTICE.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-=========================================================================
-== NOTICE file corresponding to the section 4 d of ==
-== the Apache License, Version 2.0, ==
-== in this case for the Apache Qpid distribution. ==
-=========================================================================
-
-This product includes software developed by the Apache Software Foundation
-(http://www.apache.org/).
-
-Please read the LICENSE.txt file present in the root directory of this
-distribution.
-
-
-Aside from contributions to the Apache Qpid project, this software also
-includes (binary only):
-
- - None at this time.
-
-
diff --git a/qpid/ruby/RELEASE_NOTES b/qpid/ruby/RELEASE_NOTES
deleted file mode 100644
index 5ea0bd8eec..0000000000
--- a/qpid/ruby/RELEASE_NOTES
+++ /dev/null
@@ -1,19 +0,0 @@
-Apache Incubator Qpid Ruby M2 Release Notes
----------------------------------------------
-
-The Qpid M2 release contains support the for AMQP 0-8 specification.
-You can access the 0-8 specification using the following link.
-http://www.amqp.org/tikiwiki/tiki-index.php?page=Download
-
-For full details of Qpid capabilities, as they currently stand, see our
-detailed project documentation at:
-
-http://cwiki.apache.org/confluence/pages/viewpage.action?pageId=28284
-
-Please take time to go through the README file provided with the distro.
-
-
-Known Issues/Outstanding Work
------------------------------
-
-Bug QPID-467 Complete Interop Testing
diff --git a/qpid/ruby/qpid.rb b/qpid/ruby/qpid.rb
deleted file mode 100644
index 25cd26f362..0000000000
--- a/qpid/ruby/qpid.rb
+++ /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.
-#
-
-require "qpid/client"
-require "qpid/queue"
-require "qpid/codec"
-require "qpid/connection"
-require "qpid/peer"
-require "qpid/spec"
diff --git a/qpid/ruby/qpid/client.rb b/qpid/ruby/qpid/client.rb
deleted file mode 100644
index f10f2e564b..0000000000
--- a/qpid/ruby/qpid/client.rb
+++ /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.
-#
-
-require "thread"
-require "qpid/peer"
-require "qpid/queue"
-
-module Qpid
-
- class Client
- def initialize(host, port, spec, vhost = "/")
- @host = host
- @port = port
- @spec = spec
- @vhost = vhost
-
- @mechanism = nil
- @response = nil
- @locale = nil
-
- @queues = {}
- @mutex = Mutex.new()
-
- @closed = false
- @code = nil
- @started = ConditionVariable.new()
-
- @conn = Connection.new(@host, @port, @spec)
- @peer = Peer.new(@conn, ClientDelegate.new(self))
- end
-
- attr_reader :mechanism, :response, :locale
-
- def closed?; @closed end
- def closed=(value); @closed = value end
- def code; @code end
-
- def wait()
- @mutex.synchronize do
- @started.wait(@mutex)
- end
- raise EOFError.new() if closed?
- end
-
- def signal_start()
- @started.broadcast()
- end
-
- def queue(key)
- @mutex.synchronize do
- q = @queues[key]
- if q.nil?
- q = Queue.new()
- @queues[key] = q
- end
- return q
- end
- end
-
- def start(response, mechanism="AMQPLAIN", locale="en_US")
- @response = response
- @mechanism = mechanism
- @locale = locale
-
- @conn.connect()
- @conn.init()
- @peer.start()
- wait()
- channel(0).connection_open(@vhost)
- end
-
- def channel(id)
- return @peer.channel(id)
- end
-
- def close(msg = nil)
- @closed = true
- @code = msg
- @peer.close()
- end
- end
-
- class ClientDelegate
- include Delegate
-
- def initialize(client)
- @client = client
- end
-
- def connection_start(ch, msg)
- ch.connection_start_ok(:mechanism => @client.mechanism,
- :response => @client.response,
- :locale => @client.locale)
- end
-
- def connection_tune(ch, msg)
- ch.connection_tune_ok(*msg.fields)
- @client.signal_start()
- end
-
- def connection_close(ch, msg)
- puts "CONNECTION CLOSED: #{msg.args.join(", ")}"
- @client.close(msg)
- end
-
- def channel_close(ch, msg)
- puts "CHANNEL[#{ch.id}] CLOSED: #{msg.args.join(", ")}"
- ch.channel_close_ok()
- ch.close()
- end
-
- def basic_deliver(ch, msg)
- queue = @client.queue(msg.consumer_tag)
- queue << msg
- end
-
- end
-
-end
diff --git a/qpid/ruby/qpid/codec.rb b/qpid/ruby/qpid/codec.rb
deleted file mode 100644
index 8d80e10aee..0000000000
--- a/qpid/ruby/qpid/codec.rb
+++ /dev/null
@@ -1,257 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-module Codec
- # is there a better way to do this?
- class StringWriter
-
- def initialize(str = "")
- @str = str
- end
-
- def write(value)
- @str << value
- end
-
- def to_s()
- return @str
- end
-
- end
-
- class EOF < Exception; end
-
- class Encoder
-
- def initialize(out)
- @out = out
- @bits = []
- end
-
- attr_reader(:out)
-
- def encode(type, value)
- send(type, value)
- end
-
- def bit(b)
- @bits << b
- end
-
- def octet(o)
- pack("C", o)
- end
-
- def short(s)
- pack("n", s)
- end
-
- def long(l)
- pack("N", l)
- end
-
- def longlong(l)
- lower = l & 0xffffffff
- upper = (l & ~0xffffffff) >> 32
- long(upper)
- long(lower)
- end
-
- def shortstr(s)
- # shortstr is actually octetstr
- octet(s.length)
- write(s)
- end
-
- def longstr(s)
- case s
- when Hash
- table(s)
- else
- long(s.length)
- write(s)
- end
- end
-
- def table(t)
- t = {} if t.nil?
- enc = Encoder.new(StringWriter.new())
- t.each {|key, value|
- enc.shortstr(key)
- # I offer this chicken to the gods of polymorphism. May they
- # choke on it.
- case value
- when String
- type = :longstr
- desc = "S"
- when Numeric
- type = :long
- desc = "I"
- else
- raise Exception.new("unknown table value: #{value.class}")
- end
- enc.write(desc)
- enc.encode(type, value)
- }
- longstr(enc.out.to_s())
- end
-
- def write(str)
- flushbits()
- @out.write(str)
-# puts "OUT #{str.inspect()}"
- end
-
- def pack(fmt, *args)
- write(args.pack(fmt))
- end
-
- def flush()
- flushbits()
- end
-
- private
-
- def flushbits()
- if @bits.empty? then return end
-
- bytes = []
- index = 0
- @bits.each {|b|
- bytes << 0 if index == 0
- if b then bytes[-1] |= 1 << index end
- index = (index + 1) % 8
- }
- @bits.clear()
- bytes.each {|b|
- octet(b)
- }
- end
-
- end
-
- class StringReader
-
- def initialize(str)
- @str = str
- @index = 0
- end
-
- def read(n)
- result = @str[@index, n]
- @index += result.length
- return result
- end
-
- end
-
- class Decoder
-
- def initialize(_in)
- @in = _in
- @bits = []
- end
-
- def decode(type)
- return send(type)
- end
-
- def bit()
- if @bits.empty?
- byte = octet()
- 7.downto(0) {|i|
- @bits << (byte[i] == 1)
- }
- end
- return @bits.pop()
- end
-
- def octet()
- return unpack("C", 1)
- end
-
- def short()
- return unpack("n", 2)
- end
-
- def long()
- return unpack("N", 4)
- end
-
- def longlong()
- upper = long()
- lower = long()
- return upper << 32 | lower
- end
-
- def shortstr()
- # shortstr is actually octetstr
- return read(octet())
- end
-
- def longstr()
- return read(long())
- end
-
- def table()
- dec = Decoder.new(StringReader.new(longstr()))
- result = {}
- while true
- begin
- key = dec.shortstr()
- rescue EOF
- break
- end
- desc = dec.read(1)
- case desc
- when "S"
- value = dec.longstr()
- when "I"
- value = dec.long()
- else
- raise Exception.new("unrecognized descriminator: #{desc.inspect()}")
- end
- result[key] = value
- end
- return result
- end
-
- def read(n)
- return "" if n == 0
- result = @in.read(n)
- if result.nil? or result.empty?
- raise EOF.new()
- else
-# puts " IN #{result.inspect()}"
- return result
- end
- end
-
- def unpack(fmt, size)
- result = read(size).unpack(fmt)
- if result.length == 1
- return result[0]
- else
- return result
- end
- end
-
- end
-
-end
diff --git a/qpid/ruby/qpid/connection.rb b/qpid/ruby/qpid/connection.rb
deleted file mode 100644
index f6ee9cf1e4..0000000000
--- a/qpid/ruby/qpid/connection.rb
+++ /dev/null
@@ -1,254 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-require "socket"
-require "qpid/codec"
-
-include Codec
-
-module Qpid
-
- class Connection
-
- def initialize(host, port, spec)
- @host = host
- @port = port
- @spec = spec
- end
-
- attr_reader(:host, :port, :spec)
-
- def connect()
- @sock = TCPSocket.open(@host, @port)
- @out = Encoder.new(@sock)
- @in = Decoder.new(@sock)
- end
-
- def init()
- @out.write("AMQP")
- [1, 1, @spec.major, @spec.minor].each {|o|
- @out.octet(o)
- }
- end
-
- def write(frame)
-# puts "OUT #{frame.inspect()}"
- @out.octet(@spec.constants[frame.payload.type].id)
- @out.short(frame.channel)
- frame.payload.encode(@out)
- @out.octet(frame_end)
- end
-
- def read()
- type = @spec.constants[@in.octet()].name
- channel = @in.short()
- payload = Payload.decode(type, @spec, @in)
- oct = @in.octet()
- if oct != frame_end
- raise Exception.new("framing error: expected #{frame_end}, got #{oct}")
- end
- frame = Frame.new(channel, payload)
-# puts " IN #{frame.inspect}"
- return frame
- end
-
- private
-
- def frame_end
- @spec.constants[:"frame_end"].id
- end
-
- end
-
- class Frame
-
- def initialize(channel, payload)
- @channel = channel
- @payload = payload
- end
-
- attr_reader(:channel, :payload)
-
- end
-
- class Payload
-
- TYPES = {}
-
- def Payload.singleton_method_added(name)
- if name == :type
- TYPES[type] = self
- end
- end
-
- def Payload.decode(type, spec, dec)
- klass = TYPES[type]
- klass.decode(spec, dec)
- end
-
- end
-
- class Method < Payload
-
- def initialize(method, args)
- if args.size != method.fields.size
- raise ArgumentError.new("argument mismatch #{method} #{args}")
- end
- @method = method
- @args = args
- end
-
- attr_reader(:method, :args)
-
- def Method.type; :frame_method end
-
- def type; Method.type end
-
- def encode(encoder)
- buf = StringWriter.new()
- enc = Encoder.new(buf)
- enc.short(@method.parent.id)
- enc.short(@method.id)
- @method.fields.zip(self.args).each {|f, a|
- if a.nil?; a = f.default end
- enc.encode(f.type, a)
- }
- enc.flush()
- encoder.longstr(buf.to_s)
- end
-
- def Method.decode(spec, decoder)
- buf = decoder.longstr()
- dec = Decoder.new(StringReader.new(buf))
- klass = spec.classes[dec.short()]
- meth = klass.methods[dec.short()]
- args = meth.fields.map {|f| dec.decode(f.type)}
- return Method.new(meth, args)
- end
-
- def inspect(); "#{method.qname}(#{args.join(", ")})" end
-
- end
-
- class Header < Payload
-
- def Header.type; :frame_header end
-
- def initialize(klass, weight, size, properties)
- @klass = klass
- @weight = weight
- @size = size
- @properties = properties
- end
-
- attr_reader :weight, :size, :properties
-
- def type; Header.type end
-
- def encode(encoder)
- buf = StringWriter.new()
- enc = Encoder.new(buf)
- enc.short(@klass.id)
- enc.short(@weight)
- enc.longlong(@size)
-
- # property flags
- nprops = @klass.fields.size
- flags = 0
- 0.upto(nprops - 1) do |i|
- f = @klass.fields[i]
- flags <<= 1
- flags |= 1 unless @properties[f.name].nil?
- # the last bit indicates more flags
- if i > 0 and (i % 15) == 0
- flags <<= 1
- if nprops > (i + 1)
- flags |= 1
- enc.short(flags)
- flags = 0
- end
- end
- end
- flags <<= ((16 - (nprops % 15)) % 16)
- enc.short(flags)
-
- # properties
- @klass.fields.each do |f|
- v = @properties[f.name]
- enc.encode(f.type, v) unless v.nil?
- end
- enc.flush()
- encoder.longstr(buf.to_s)
- end
-
- def Header.decode(spec, decoder)
- dec = Decoder.new(StringReader.new(decoder.longstr()))
- klass = spec.classes[dec.short()]
- weight = dec.short()
- size = dec.longlong()
-
- # property flags
- bits = []
- while true
- flags = dec.short()
- 15.downto(1) do |i|
- if flags >> i & 0x1 != 0
- bits << true
- else
- bits << false
- end
- end
- break if flags & 0x1 == 0
- end
-
- # properties
- properties = {}
- bits.zip(klass.fields).each do |b, f|
- properties[f.name] = dec.decode(f.type) if b
- end
- return Header.new(klass, weight, size, properties)
- end
-
- def inspect(); "#{@klass.name}(#{@properties.inspect()})" end
-
- end
-
- class Body < Payload
-
- def Body.type; :frame_body end
-
- def type; Body.type end
-
- def initialize(content)
- @content = content
- end
-
- attr_reader :content
-
- def encode(enc)
- enc.longstr(@content)
- end
-
- def Body.decode(spec, dec)
- return Body.new(dec.longstr())
- end
-
- end
-
-end
diff --git a/qpid/ruby/qpid/fields.rb b/qpid/ruby/qpid/fields.rb
deleted file mode 100644
index 91484af850..0000000000
--- a/qpid/ruby/qpid/fields.rb
+++ /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.
-#
-
-class Class
- def fields(*fields)
- module_eval {
- def initialize(*args, &block)
- args = init_fields(*args)
-
- if respond_to? :init
- init(*args) {|*a| yield(*a)}
- elsif args.any?
- raise ArgumentException.new("extra arguments: #{args}")
- end
- end
- }
-
- vars = fields.map {|f| :"@#{f.to_s().chomp("?")}"}
-
- define_method(:init_fields) {|*args|
- vars.each {|v|
- instance_variable_set(v, args.shift())
- }
- args
- }
-
- vars.each_index {|i|
- define_method(fields[i]) {
- instance_variable_get(vars[i])
- }
- }
- end
-end
diff --git a/qpid/ruby/qpid/peer.rb b/qpid/ruby/qpid/peer.rb
deleted file mode 100644
index 320808fdc6..0000000000
--- a/qpid/ruby/qpid/peer.rb
+++ /dev/null
@@ -1,287 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-require "thread"
-require "qpid/queue"
-require "qpid/connection"
-require "qpid/fields"
-
-module Qpid
-
- class Peer
-
- def initialize(conn, delegate)
- @conn = conn
- @delegate = delegate
- @outgoing = Queue.new()
- @work = Queue.new()
- @channels = {}
- @mutex = Mutex.new()
- end
-
- def channel(id)
- @mutex.synchronize do
- ch = @channels[id]
- if ch.nil?
- ch = Channel.new(id, self, @outgoing, @conn.spec)
- @channels[id] = ch
- end
- return ch
- end
- end
-
- def channel_delete(id)
- @channels.delete(id)
- end
-
- def start()
- spawn(:writer)
- spawn(:reader)
- spawn(:worker)
- end
-
- def close()
- @mutex.synchronize do
- @channels.each_value do |ch|
- ch.close()
- @outgoing.close()
- @work.close()
- end
- end
- end
-
- private
-
- def spawn(method, *args)
- Thread.new do
- begin
- send(method, *args)
- # is this the standard way to catch any exception?
- rescue Closed => e
- puts "#{method} #{e}"
- rescue Object => e
- print e
- e.backtrace.each do |line|
- print "\n ", line
- end
- print "\n"
- end
- end
- end
-
- def reader()
- while true
- frame = @conn.read()
- ch = channel(frame.channel)
- ch.dispatch(frame, @work)
- end
- end
-
- def writer()
- while true
- @conn.write(@outgoing.pop())
- end
- end
-
- def worker()
- while true
- dispatch(@work.pop())
- end
- end
-
- def dispatch(queue)
- frame = queue.pop()
- ch = channel(frame.channel)
- payload = frame.payload
- if payload.method.content?
- content = Qpid::read_content(queue)
- else
- content = nil
- end
-
- message = Message.new(payload.method, payload.args, content)
- @delegate.dispatch(ch, message)
- end
-
- end
-
- class Channel
- def initialize(id, peer, outgoing, spec)
- @id = id
- @peer = peer
- @outgoing = outgoing
- @spec = spec
- @incoming = Queue.new()
- @responses = Queue.new()
- @queue = nil
- @closed = false
- end
-
- attr_reader :id
-
- def closed?; @closed end
-
- def close()
- return if closed?
- @peer.channel_delete(@id)
- @closed = true
- @incoming.close()
- @responses.close()
- end
-
- def dispatch(frame, work)
- payload = frame.payload
- case payload
- when Method
- if payload.method.response?
- @queue = @responses
- else
- @queue = @incoming
- work << @incoming
- end
- end
- @queue << frame
- end
-
- def method_missing(name, *args)
- method = @spec.find_method(name)
- if method.nil?
- raise NoMethodError.new("undefined method '#{name}' for #{self}:#{self.class}")
- end
-
- if args.size == 1 and args[0].instance_of? Hash
- kwargs = args[0]
- invoke_args = method.fields.map do |f|
- kwargs[f.name]
- end
- content = kwargs[:content]
- else
- invoke_args = []
- method.fields.each do |f|
- if args.any?
- invoke_args << args.shift()
- else
- invoke_args << f.default
- end
- end
- if method.content? and args.any?
- content = args.shift()
- else
- content = nil
- end
- if args.any? then raise ArgumentError.new("#{args.size} extr arguments") end
- end
- return invoke(method, invoke_args, content)
- end
-
- def invoke(method, args, content = nil)
- raise Closed() if closed?
- frame = Frame.new(@id, Method.new(method, args))
- @outgoing << frame
-
- if method.content?
- content = Content.new() if content.nil?
- write_content(method.parent, content, @outgoing)
- end
-
- nowait = false
- f = method.fields[:"nowait"]
- nowait = args[method.fields.index(f)] unless f.nil?
-
- unless nowait or method.responses.empty?
- resp = @responses.pop().payload
- if resp.method.content?
- content = read_content(@responses)
- else
- content = nil
- end
- if method.responses.include? resp.method
- return Message.new(resp.method, resp.args, content)
- else
- # XXX: ValueError doesn't actually exist
- raise ValueError.new(resp)
- end
- end
- end
-
- def write_content(klass, content, queue)
- size = content.size
- header = Frame.new(@id, Header.new(klass, content.weight, size, content.headers))
- queue << header
- content.children.each {|child| write_content(klass, child, queue)}
- queue << Frame.new(@id, Body.new(content.body)) if size > 0
- end
-
- end
-
- def Qpid.read_content(queue)
- frame = queue.pop()
- header = frame.payload
- children = []
- 1.upto(header.weight) { children << read_content(queue) }
- size = header.size
- read = 0
- buf = ""
- while read < size
- body = queue.pop()
- content = body.payload.content
- buf << content
- read += content.size
- end
- buf.freeze()
- return Content.new(header.properties.clone(), buf, children)
- end
-
- class Content
- def initialize(headers = {}, body = "", children = [])
- @headers = headers
- @body = body
- @children = children
- end
-
- attr_reader :headers, :body, :children
-
- def size; body.size end
- def weight; children.size end
-
- def [](key); @headers[key] end
- def []=(key, value); @headers[key] = value end
- end
-
- class Message
- fields(:method, :args, :content)
-
- alias fields args
-
- def method_missing(name)
- return args[@method.fields[name].id]
- end
-
- def inspect()
- "#{method.qname}(#{args.join(", ")})"
- end
- end
-
- module Delegate
- def dispatch(ch, msg)
- send(msg.method.qname, ch, msg)
- end
- end
-
-end
diff --git a/qpid/ruby/qpid/queue.rb b/qpid/ruby/qpid/queue.rb
deleted file mode 100644
index 350310882f..0000000000
--- a/qpid/ruby/qpid/queue.rb
+++ /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.
-#
-
-require "thread"
-
-module Qpid
-
- class Closed < Exception; end
-
- class Queue < Queue
-
- @@END = Object.new()
-
- def close()
- # sentinal to indicate the end of the queue
- self << @@END
- end
-
- def pop(*args)
- result = super(*args)
- if @@END.equal? result
- # we put another sentinal on the end in case there are
- # subsequent calls to pop by this or other threads
- self << @@END
- raise Closed.new()
- else
- return result
- end
- end
-
- alias shift pop
- alias deq pop
-
- end
-
-end
diff --git a/qpid/ruby/qpid/spec.rb b/qpid/ruby/qpid/spec.rb
deleted file mode 100644
index 9a04f584d0..0000000000
--- a/qpid/ruby/qpid/spec.rb
+++ /dev/null
@@ -1,289 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-require "set"
-require "rexml/document"
-require "qpid/fields"
-require "qpid/traverse"
-
-module Spec
-
- include REXML
-
- class Container < Array
-
- def initialize()
- @cache = {}
- end
-
- def [](key)
- return @cache[key] if @cache.include?(key)
-
- case key
- when String
- value = find {|x| x.name == key.intern()}
- when Symbol
- value = find {|x| x.name == key}
- when Integer
- value = find {|x| x.id == key}
- else
- raise Exception.new("invalid key: #{key}")
- end
-
- @cache[key] = value
- return value
- end
-
- end
-
- class Root
- fields(:major, :minor, :classes, :constants, :domains)
-
- def find_method(name)
- classes.each do |c|
- c.methods.each do |m|
- if name == m.qname
- return m
- end
- end
- end
-
- return nil
- end
- end
-
- class Constant
- fields(:name, :id, :type, :docs)
- end
-
- class Domain
- fields(:name, :type)
- end
-
- class Class
- fields(:name, :id, :handler, :fields, :methods, :docs)
- end
-
- class Method
- fields(:name, :id, :content?, :responses, :synchronous?, :fields,
- :docs)
-
- def init()
- @response = false
- end
-
- attr :parent, true
-
- def response?; @response end
- def response=(b); @response = b end
-
- def qname
- :"#{parent.name}_#{name}"
- end
- end
-
- class Field
- fields(:name, :id, :type, :docs)
-
- def default
- case type
- when :bit then false
- when :octet, :short, :long, :longlong then 0
- when :shortstr, :longstr then ""
- when :table then {}
- end
- end
-
- end
-
- class Doc
- fields(:type, :text)
- end
-
- class Reference
-
- fields(:name)
-
- def init(&block)
- @resolver = block
- end
-
- def resolve(spec, klass)
- @resolver.call(spec, klass)
- end
-
- end
-
- class Loader
-
- def initialize()
- @stack = []
- end
-
- def load(obj)
- case obj
- when String
- elem = @stack[-1]
- result = Container.new()
- elem.elements.each(obj) {|e|
- @index = result.size
- result << load(e)
- }
- @index = nil
- return result
- else
- elem = obj
- @stack << elem
- begin
- result = send(:"load_#{elem.name}")
- ensure
- @stack.pop()
- end
- return result
- end
- end
-
- def element
- @stack[-1]
- end
-
- def text
- element.text
- end
-
- def attr(name, type = :string, default = nil)
- value = element.attributes[name]
- value = value.strip() unless value.nil?
- value = nil unless value.nil? or value.any?
- if value.nil? and not default.nil? then
- default
- else
- send(:"parse_#{type}", value)
- end
- end
-
- def parse_int(value)
- value.to_i
- end
-
- TRUE = ["yes", "true", "1"].to_set
- FALSE = ["no", "false", "0", nil].to_set
-
- def parse_bool(value)
- if TRUE.include?(value)
- true
- elsif FALSE.include?(value)
- false
- else
- raise Exception.new("parse error, expecting boolean: #{value}")
- end
- end
-
- def parse_string(value)
- value.to_s
- end
-
- def parse_symbol(value)
- value.intern() unless value.nil?
- end
-
- def parse_name(value)
- value.gsub(/[\s-]/, '_').intern() unless value.nil?
- end
-
- def load_amqp()
- Root.new(attr("major", :int), attr("minor", :int), load("class"),
- load("constant"), load("domain"))
- end
-
- def load_class()
- Class.new(attr("name", :name), attr("index", :int), attr("handler", :name),
- load("field"), load("method"), load("doc"))
- end
-
- def load_method()
- Method.new(attr("name", :name), attr("index", :int),
- attr("content", :bool), load("response"),
- attr("synchronous", :bool), load("field"), load("docs"))
- end
-
- def load_response()
- name = attr("name", :name)
- Reference.new {|spec, klass|
- response = klass.methods[name]
- if response.nil?
- raise Exception.new("no such method: #{name}")
- end
- response
- }
- end
-
- def load_field()
- type = attr("type", :name)
- if type.nil?
- domain = attr("domain", :name)
- type = Reference.new {|spec, klass|
- spec.domains[domain].type
- }
- end
- Field.new(attr("name", :name), @index, type, load("docs"))
- end
-
- def load_constant()
- Constant.new(attr("name", :name), attr("value", :int), attr("class", :name),
- load("doc"))
- end
-
- def load_domain()
- Domain.new(attr("name", :name), attr("type", :name))
- end
-
- def load_doc()
- Doc.new(attr("type", :symbol), text)
- end
-
- end
-
- def Spec.load(spec)
- case spec
- when String
- spec = File.new(spec)
- end
- doc = Document.new(spec)
- spec = Loader.new().load(doc.root)
- spec.classes.each do |klass|
- klass.traverse! do |o|
- case o
- when Reference
- o.resolve(spec, klass)
- else
- o
- end
- end
- klass.methods.each do |m|
- m.parent = klass
- m.responses.each do |r|
- r.response = true
- end
- end
- end
- spec
- end
-
-end
diff --git a/qpid/ruby/qpid/test.rb b/qpid/ruby/qpid/test.rb
deleted file mode 100644
index f8107143ab..0000000000
--- a/qpid/ruby/qpid/test.rb
+++ /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.
-#
-#/
-
-require "qpid/spec"
-require "qpid/client"
-
-module Qpid
-
- module Test
-
- def connect()
- spec = Spec.load("../specs/amqp.0-8.xml")
- c = Client.new("0.0.0.0", 5672, spec)
- c.start({"LOGIN" => "guest", "PASSWORD" => "guest"})
- return c
- end
-
- end
-
-end
diff --git a/qpid/ruby/qpid/traverse.rb b/qpid/ruby/qpid/traverse.rb
deleted file mode 100644
index 67358a7eb1..0000000000
--- a/qpid/ruby/qpid/traverse.rb
+++ /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.
-#
-
-class Object
-
- public
-
- def traverse()
- traverse! {|o| yield(o); o}
- end
-
- def traverse_children!()
- instance_variables.each {|v|
- value = instance_variable_get(v)
- replacement = yield(value)
- instance_variable_set(v, replacement) unless replacement.equal? value
- }
- end
-
- def traverse!(replacements = {})
- return replacements[__id__] if replacements.has_key? __id__
- replacement = yield(self)
- replacements[__id__] = replacement
- traverse_children! {|o| o.traverse!(replacements) {|c| yield(c)}}
- return replacement
- end
-
-end
-
-class Array
- def traverse_children!()
- map! {|o| yield(o)}
- end
-end
-
-class Hash
- def traverse_children!()
- mods = {}
- each_pair {|k, v|
- key = yield(k)
- value = yield(v)
- mods[key] = value unless key.equal? k and value.equal? v
- delete(k) unless key.equal? k
- }
-
- merge!(mods)
- end
-end
diff --git a/qpid/ruby/run-tests b/qpid/ruby/run-tests
deleted file mode 100755
index b4c51a75ed..0000000000
--- a/qpid/ruby/run-tests
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/ruby
-
-require "tests/channel"
-require "tests/basic"
diff --git a/qpid/ruby/tests/basic.rb b/qpid/ruby/tests/basic.rb
deleted file mode 100644
index 0018050fe2..0000000000
--- a/qpid/ruby/tests/basic.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-require "test/unit"
-require "qpid/test"
-require "qpid"
-
-class Basic < Test::Unit::TestCase
-
- include Qpid::Test
-
- def publish(body, headers = {})
- cli = connect()
- ch = cli.channel(1)
- ch.channel_open()
- content = Qpid::Content.new(headers, body)
- ch.basic_publish(:content => content)
- msg = ch.channel_close()
- assert msg.method.qname == :channel_close_ok
- end
-
- def consume(body, headers = {})
- cli = connect()
- ch = cli.channel(1)
- ch.channel_open()
- ch.queue_declare(:queue => "test-queue")
- ch.queue_bind(:queue_name => "test-queue")
- ch.basic_consume(:queue => "test-queue", :consumer_tag => "ctag")
- content = Qpid::Content.new(headers, body)
- ch.basic_publish(:routing_key => "test-queue", :content => content)
- queue = cli.queue("ctag")
- msg = queue.pop()
- assert content.headers == msg.content.headers
- assert content.body == msg.content.body
- assert content.children == msg.content.children
- ch.basic_ack(msg.delivery_tag)
- msg = ch.channel_close()
- assert msg.method.qname == :channel_close_ok
- end
-
- def test_publish(); publish("hello world") end
-
- def test_publish_empty(); publish("") end
-
- def test_publish_headers(); publish("hello world", :content_type => "text/plain") end
-
- def test_consume(); consume("hello world") end
-
- def test_consume_empty(); consume("") end
-
- def test_consume_headers(); consume("hello_world", :content_type => "text/plain") end
-
-end
diff --git a/qpid/ruby/tests/channel.rb b/qpid/ruby/tests/channel.rb
deleted file mode 100644
index 31c5f19d92..0000000000
--- a/qpid/ruby/tests/channel.rb
+++ /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.
-#
-
-require "test/unit"
-require "qpid/test"
-require "qpid"
-
-class Channel < Test::Unit::TestCase
-
- include Qpid::Test
-
- def test_channel_open_close()
- c = connect()
- ch = c.channel(1)
- msg = ch.channel_open()
- assert msg.method.qname == :channel_open_ok
- msg = ch.channel_close()
- assert msg.method.qname == :channel_close_ok
- end
-
- def test_channel_close()
- c = connect()
- ch = c.channel(1)
- begin
- ch.channel_close()
- rescue Qpid::Closed => e
- assert c.code.method.qname == :connection_close
- assert c.code.reply_code == 504
- end
- end
-
-end