You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/07/28 10:22:55 UTC
svn commit: r426431 [5/14] - in /incubator/activemq/branches/activemq-4.0:
activemq-core/src/gram/script/
activemq-core/src/main/java/org/apache/activemq/kaha/impl/
activemq-core/src/main/java/org/apache/activemq/openwire/v1/
activemq-core/src/test/jav...
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Session.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Session.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Session.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Session.hpp Fri Jul 28 01:22:48 2006
@@ -1,161 +1,161 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef ActiveMQ_Session_hpp_
-#define ActiveMQ_Session_hpp_
-
-#include <string>
-#include <map>
-#include "activemq/AcknowledgementMode.hpp"
-#include "cms/IMessage.hpp"
-#include "cms/IBytesMessage.hpp"
-#include "cms/IMapMessage.hpp"
-#include "cms/ITextMessage.hpp"
-#include "cms/ISession.hpp"
-#include "cms/CmsException.hpp"
-#include "activemq/IDataStructure.hpp"
-#include "activemq/MessageConsumer.hpp"
-#include "activemq/MessageProducer.hpp"
-#include "activemq/TransactionContext.hpp"
-#include "activemq/command/ConsumerInfo.hpp"
-#include "activemq/command/ProducerInfo.hpp"
-#include "activemq/command/RemoveInfo.hpp"
-#include "activemq/command/SessionInfo.hpp"
-#include "activemq/command/SessionId.hpp"
-#include "ppr/thread/SimpleMutex.hpp"
-#include "ppr/thread/Semaphore.hpp"
-#include "ppr/thread/Thread.hpp"
-#include "ppr/util/ifr/array"
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
- namespace activemq
- {
- using namespace ifr;
- using namespace apache::cms;
- using namespace apache::ppr::thread;
- using namespace apache::ppr::util;
- class Connection;
- class DispatchThread;
-
-/*
- *
- */
-class Session : public ISession
-{
-private:
- p<Connection> connection ;
- p<SessionInfo> sessionInfo ;
- AcknowledgementMode ackMode ;
- p<TransactionContext> transactionContext ;
- p<DispatchThread> dispatchThread ;
- map<long long, p<MessageConsumer> > consumers ;
- map<long long, p<MessageProducer> > producers ;
- SimpleMutex mutex ;
- long consumerCounter,
- producerCounter ;
- int prefetchSize ;
- bool closed ;
-
-public:
- Session(p<Connection> connection, p<SessionInfo> sessionInfo, AcknowledgementMode ackMode) ;
- virtual ~Session() ;
-
- // Attribute methods
- virtual bool isTransacted() ;
- virtual p<Connection> getConnection() ;
- virtual p<SessionId> getSessionId() ;
- virtual p<TransactionContext> getTransactionContext() ;
- virtual p<MessageConsumer> getConsumer(p<ConsumerId> consumerId) ;
- virtual p<MessageProducer> getProducer(p<ProducerId> producerId) ;
-
- // Operation methods
- virtual void commit() throw(CmsException) ;
- virtual void rollback() throw(CmsException) ;
- virtual p<IMessageProducer> createProducer() ;
- virtual p<IMessageProducer> createProducer(p<IDestination> destination) ;
- virtual p<IMessageConsumer> createConsumer(p<IDestination> destination) ;
- virtual p<IMessageConsumer> createConsumer(p<IDestination> destination, const char* selector) ;
- virtual p<IMessageConsumer> createDurableConsumer(p<ITopic> destination, const char* name, const char* selector, bool noLocal) ;
- virtual p<IQueue> getQueue(const char* name) ;
- virtual p<ITopic> getTopic(const char* name) ;
- virtual p<ITemporaryQueue> createTemporaryQueue() ;
- virtual p<ITemporaryTopic> createTemporaryTopic() ;
- virtual p<IMessage> createMessage() ;
- virtual p<IBytesMessage> createBytesMessage() ;
- virtual p<IBytesMessage> createBytesMessage(char* body, int size) ;
- virtual p<IMapMessage> createMapMessage() ;
- virtual p<ITextMessage> createTextMessage() ;
- virtual p<ITextMessage> createTextMessage(const char* text) ;
-
- virtual void doSend(p<IDestination> destination, p<IMessage> message) ;
- virtual void doStartTransaction() ;
- virtual void dispatch(int delay = 0) ;
- virtual void dispatchAsyncMessages() ;
- virtual void close() ;
-
-protected:
- // Implementation methods
- p<ConsumerInfo> createConsumerInfo(p<IDestination> destination, const char* selector) ;
- p<ProducerInfo> createProducerInfo(p<IDestination> destination) ;
- void configure(p<IMessage> message) ;
-} ;
-
-/*
- *
- */
-class DispatchThread : public Thread
-{
-public:
- p<Session> session ;
- Semaphore semaphore ;
- bool interrupted ;
-
- DispatchThread(p<Session> session)
- {
- this->session = session ;
- this->interrupted = false ;
- }
-
- void interrupt()
- {
- interrupted = true ;
- }
-
- void wakeup()
- {
- semaphore.notify() ;
- }
-
-protected:
- virtual void run () throw (p<exception>)
- {
- while( !interrupted )
- {
- // Wait for wake-up call
- semaphore.wait() ;
-
- session->dispatchAsyncMessages() ;
- }
- }
-} ;
-
-/* namespace */
- }
-}
-
-#endif /*ActiveMQ_Session_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef ActiveMQ_Session_hpp_
+#define ActiveMQ_Session_hpp_
+
+#include <string>
+#include <map>
+#include "activemq/AcknowledgementMode.hpp"
+#include "cms/IMessage.hpp"
+#include "cms/IBytesMessage.hpp"
+#include "cms/IMapMessage.hpp"
+#include "cms/ITextMessage.hpp"
+#include "cms/ISession.hpp"
+#include "cms/CmsException.hpp"
+#include "activemq/IDataStructure.hpp"
+#include "activemq/MessageConsumer.hpp"
+#include "activemq/MessageProducer.hpp"
+#include "activemq/TransactionContext.hpp"
+#include "activemq/command/ConsumerInfo.hpp"
+#include "activemq/command/ProducerInfo.hpp"
+#include "activemq/command/RemoveInfo.hpp"
+#include "activemq/command/SessionInfo.hpp"
+#include "activemq/command/SessionId.hpp"
+#include "ppr/thread/SimpleMutex.hpp"
+#include "ppr/thread/Semaphore.hpp"
+#include "ppr/thread/Thread.hpp"
+#include "ppr/util/ifr/array"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+ namespace activemq
+ {
+ using namespace ifr;
+ using namespace apache::cms;
+ using namespace apache::ppr::thread;
+ using namespace apache::ppr::util;
+ class Connection;
+ class DispatchThread;
+
+/*
+ *
+ */
+class Session : public ISession
+{
+private:
+ p<Connection> connection ;
+ p<SessionInfo> sessionInfo ;
+ AcknowledgementMode ackMode ;
+ p<TransactionContext> transactionContext ;
+ p<DispatchThread> dispatchThread ;
+ map<long long, p<MessageConsumer> > consumers ;
+ map<long long, p<MessageProducer> > producers ;
+ SimpleMutex mutex ;
+ long consumerCounter,
+ producerCounter ;
+ int prefetchSize ;
+ bool closed ;
+
+public:
+ Session(p<Connection> connection, p<SessionInfo> sessionInfo, AcknowledgementMode ackMode) ;
+ virtual ~Session() ;
+
+ // Attribute methods
+ virtual bool isTransacted() ;
+ virtual p<Connection> getConnection() ;
+ virtual p<SessionId> getSessionId() ;
+ virtual p<TransactionContext> getTransactionContext() ;
+ virtual p<MessageConsumer> getConsumer(p<ConsumerId> consumerId) ;
+ virtual p<MessageProducer> getProducer(p<ProducerId> producerId) ;
+
+ // Operation methods
+ virtual void commit() throw(CmsException) ;
+ virtual void rollback() throw(CmsException) ;
+ virtual p<IMessageProducer> createProducer() ;
+ virtual p<IMessageProducer> createProducer(p<IDestination> destination) ;
+ virtual p<IMessageConsumer> createConsumer(p<IDestination> destination) ;
+ virtual p<IMessageConsumer> createConsumer(p<IDestination> destination, const char* selector) ;
+ virtual p<IMessageConsumer> createDurableConsumer(p<ITopic> destination, const char* name, const char* selector, bool noLocal) ;
+ virtual p<IQueue> getQueue(const char* name) ;
+ virtual p<ITopic> getTopic(const char* name) ;
+ virtual p<ITemporaryQueue> createTemporaryQueue() ;
+ virtual p<ITemporaryTopic> createTemporaryTopic() ;
+ virtual p<IMessage> createMessage() ;
+ virtual p<IBytesMessage> createBytesMessage() ;
+ virtual p<IBytesMessage> createBytesMessage(char* body, int size) ;
+ virtual p<IMapMessage> createMapMessage() ;
+ virtual p<ITextMessage> createTextMessage() ;
+ virtual p<ITextMessage> createTextMessage(const char* text) ;
+
+ virtual void doSend(p<IDestination> destination, p<IMessage> message) ;
+ virtual void doStartTransaction() ;
+ virtual void dispatch(int delay = 0) ;
+ virtual void dispatchAsyncMessages() ;
+ virtual void close() ;
+
+protected:
+ // Implementation methods
+ p<ConsumerInfo> createConsumerInfo(p<IDestination> destination, const char* selector) ;
+ p<ProducerInfo> createProducerInfo(p<IDestination> destination) ;
+ void configure(p<IMessage> message) ;
+} ;
+
+/*
+ *
+ */
+class DispatchThread : public Thread
+{
+public:
+ p<Session> session ;
+ Semaphore semaphore ;
+ bool interrupted ;
+
+ DispatchThread(p<Session> session)
+ {
+ this->session = session ;
+ this->interrupted = false ;
+ }
+
+ void interrupt()
+ {
+ interrupted = true ;
+ }
+
+ void wakeup()
+ {
+ semaphore.notify() ;
+ }
+
+protected:
+ virtual void run () throw (p<exception>)
+ {
+ while( !interrupted )
+ {
+ // Wait for wake-up call
+ semaphore.wait() ;
+
+ session->dispatchAsyncMessages() ;
+ }
+ }
+} ;
+
+/* namespace */
+ }
+}
+
+#endif /*ActiveMQ_Session_hpp_*/
Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Session.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.cpp Fri Jul 28 01:22:48 2006
@@ -1,149 +1,149 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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 "activemq/TransactionContext.hpp"
-#include "activemq/Session.hpp"
-
-using namespace apache::activemq;
-
-/*
- *
- */
-TransactionContext::TransactionContext(p<Session> session)
-{
- this->session = session ;
- this->transactionId = NULL ;
-}
-
-/*
- *
- */
-TransactionContext::~TransactionContext()
-{
- // no-op
-}
-
-/*
- *
- */
-p<TransactionId> TransactionContext::getTransactionId()
-{
- return transactionId ;
-}
-
-/*
- *
- */
-void TransactionContext::addSynchronization(p<ISynchronization> synchronization)
-{
- synchronizations.push_back(synchronization) ;
-}
-
-/*
- *
- */
-void TransactionContext::begin()
-{
- if( transactionId == NULL )
- {
- // Create a new local transaction id
- transactionId = session->getConnection()->createLocalTransactionId() ;
-
- // Create a new transaction command
- p<TransactionInfo> info = new TransactionInfo() ;
- info->setConnectionId( session->getConnection()->getConnectionId() ) ;
- info->setTransactionId( transactionId ) ;
- info->setType( BeginTx ) ;
-
- // Send begin command to broker
- session->getConnection()->oneway(info) ;
- }
-}
-
-/*
- *
- */
-void TransactionContext::commit()
-{
- list< p<ISynchronization> >::const_iterator tempIter ;
-
- // Iterate through each synchronization and call beforeCommit()
- for( tempIter = synchronizations.begin() ;
- tempIter != synchronizations.end() ;
- tempIter++ )
- {
- (*tempIter)->beforeCommit() ;
- }
-
- if( transactionId != NULL )
- {
- // Create a new transaction command
- p<TransactionInfo> info = new TransactionInfo() ;
- info->setConnectionId( session->getConnection()->getConnectionId() ) ;
- info->setTransactionId( transactionId ) ;
- info->setType( CommitOnePhaseTx ) ;
-
- // Reset transaction
- transactionId = NULL ;
-
- // Send commit command to broker
- session->getConnection()->oneway(info) ;
- }
-
- // Iterate through each synchronization and call afterCommit()
- for( tempIter = synchronizations.begin() ;
- tempIter != synchronizations.end() ;
- tempIter++ )
- {
- (*tempIter)->afterCommit() ;
- }
-
- // Clear all syncronizations
- synchronizations.clear() ;
-}
-
-/*
- *
- */
-void TransactionContext::rollback()
-{
- if( transactionId != NULL )
- {
- // Create a new transaction command
- p<TransactionInfo> info = new TransactionInfo() ;
- info->setConnectionId( session->getConnection()->getConnectionId() ) ;
- info->setTransactionId( transactionId ) ;
- info->setType( RollbackTx ) ;
-
- // Reset transaction
- transactionId = NULL ;
-
- // Send rollback command to broker
- session->getConnection()->oneway(info) ;
- }
-
- list< p<ISynchronization> >::const_iterator tempIter ;
-
- // Iterate through each synchronization and call afterRollback()
- for( tempIter = synchronizations.begin() ;
- tempIter != synchronizations.end() ;
- tempIter++ )
- {
- (*tempIter)->afterRollback() ;
- }
- // Clear all syncronizations
- synchronizations.clear() ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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 "activemq/TransactionContext.hpp"
+#include "activemq/Session.hpp"
+
+using namespace apache::activemq;
+
+/*
+ *
+ */
+TransactionContext::TransactionContext(p<Session> session)
+{
+ this->session = session ;
+ this->transactionId = NULL ;
+}
+
+/*
+ *
+ */
+TransactionContext::~TransactionContext()
+{
+ // no-op
+}
+
+/*
+ *
+ */
+p<TransactionId> TransactionContext::getTransactionId()
+{
+ return transactionId ;
+}
+
+/*
+ *
+ */
+void TransactionContext::addSynchronization(p<ISynchronization> synchronization)
+{
+ synchronizations.push_back(synchronization) ;
+}
+
+/*
+ *
+ */
+void TransactionContext::begin()
+{
+ if( transactionId == NULL )
+ {
+ // Create a new local transaction id
+ transactionId = session->getConnection()->createLocalTransactionId() ;
+
+ // Create a new transaction command
+ p<TransactionInfo> info = new TransactionInfo() ;
+ info->setConnectionId( session->getConnection()->getConnectionId() ) ;
+ info->setTransactionId( transactionId ) ;
+ info->setType( BeginTx ) ;
+
+ // Send begin command to broker
+ session->getConnection()->oneway(info) ;
+ }
+}
+
+/*
+ *
+ */
+void TransactionContext::commit()
+{
+ list< p<ISynchronization> >::const_iterator tempIter ;
+
+ // Iterate through each synchronization and call beforeCommit()
+ for( tempIter = synchronizations.begin() ;
+ tempIter != synchronizations.end() ;
+ tempIter++ )
+ {
+ (*tempIter)->beforeCommit() ;
+ }
+
+ if( transactionId != NULL )
+ {
+ // Create a new transaction command
+ p<TransactionInfo> info = new TransactionInfo() ;
+ info->setConnectionId( session->getConnection()->getConnectionId() ) ;
+ info->setTransactionId( transactionId ) ;
+ info->setType( CommitOnePhaseTx ) ;
+
+ // Reset transaction
+ transactionId = NULL ;
+
+ // Send commit command to broker
+ session->getConnection()->oneway(info) ;
+ }
+
+ // Iterate through each synchronization and call afterCommit()
+ for( tempIter = synchronizations.begin() ;
+ tempIter != synchronizations.end() ;
+ tempIter++ )
+ {
+ (*tempIter)->afterCommit() ;
+ }
+
+ // Clear all syncronizations
+ synchronizations.clear() ;
+}
+
+/*
+ *
+ */
+void TransactionContext::rollback()
+{
+ if( transactionId != NULL )
+ {
+ // Create a new transaction command
+ p<TransactionInfo> info = new TransactionInfo() ;
+ info->setConnectionId( session->getConnection()->getConnectionId() ) ;
+ info->setTransactionId( transactionId ) ;
+ info->setType( RollbackTx ) ;
+
+ // Reset transaction
+ transactionId = NULL ;
+
+ // Send rollback command to broker
+ session->getConnection()->oneway(info) ;
+ }
+
+ list< p<ISynchronization> >::const_iterator tempIter ;
+
+ // Iterate through each synchronization and call afterRollback()
+ for( tempIter = synchronizations.begin() ;
+ tempIter != synchronizations.end() ;
+ tempIter++ )
+ {
+ (*tempIter)->afterRollback() ;
+ }
+ // Clear all syncronizations
+ synchronizations.clear() ;
+}
Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.hpp Fri Jul 28 01:22:48 2006
@@ -1,61 +1,61 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef ActiveMQ_TransactionContext_hpp_
-#define ActiveMQ_TransactionContext_hpp_
-
-#include <list>
-#include "activemq/ISynchronization.hpp"
-#include "activemq/Connection.hpp"
-#include "activemq/TransactionType.hpp"
-#include "activemq/command/TransactionId.hpp"
-#include "activemq/command/TransactionInfo.hpp"
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
- namespace activemq
- {
- using namespace ifr;
- using namespace apache::activemq::command;
- class Session;
-
-/*
- *
- */
-class TransactionContext
-{
-private:
- p<TransactionId> transactionId ;
- p<Session> session ;
- list< p<ISynchronization> > synchronizations ;
-
-public:
- TransactionContext(p<Session> session) ;
- virtual ~TransactionContext() ;
-
- virtual p<TransactionId> getTransactionId() ;
- virtual void addSynchronization(p<ISynchronization> synchronization) ;
- virtual void begin() ;
- virtual void commit() ;
- virtual void rollback() ;
-} ;
-
-/* namespace */
- }
-}
-
-#endif /*ActiveMQ_TransactionContext_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef ActiveMQ_TransactionContext_hpp_
+#define ActiveMQ_TransactionContext_hpp_
+
+#include <list>
+#include "activemq/ISynchronization.hpp"
+#include "activemq/Connection.hpp"
+#include "activemq/TransactionType.hpp"
+#include "activemq/command/TransactionId.hpp"
+#include "activemq/command/TransactionInfo.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+ namespace activemq
+ {
+ using namespace ifr;
+ using namespace apache::activemq::command;
+ class Session;
+
+/*
+ *
+ */
+class TransactionContext
+{
+private:
+ p<TransactionId> transactionId ;
+ p<Session> session ;
+ list< p<ISynchronization> > synchronizations ;
+
+public:
+ TransactionContext(p<Session> session) ;
+ virtual ~TransactionContext() ;
+
+ virtual p<TransactionId> getTransactionId() ;
+ virtual void addSynchronization(p<ISynchronization> synchronization) ;
+ virtual void begin() ;
+ virtual void commit() ;
+ virtual void rollback() ;
+} ;
+
+/* namespace */
+ }
+}
+
+#endif /*ActiveMQ_TransactionContext_hpp_*/
Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionContext.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionType.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionType.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionType.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionType.hpp Fri Jul 28 01:22:48 2006
@@ -1,38 +1,38 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef ActiveMQ_TransactionType_hpp_
-#define ActiveMQ_TransactionType_hpp_
-
-namespace apache
-{
- namespace activemq
- {
- enum TransactionType
- {
- BeginTx = 0,
- PrepareTx = 1,
- CommitOnePhaseTx = 2,
- CommitTwoPhaseTx = 3,
- RollbackTx = 4,
- RecoverTx = 5,
- ForgetTx = 6,
- EndTx = 7
- };
- }
-}
-
-#endif /*ActiveMQ_TransactionType_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef ActiveMQ_TransactionType_hpp_
+#define ActiveMQ_TransactionType_hpp_
+
+namespace apache
+{
+ namespace activemq
+ {
+ enum TransactionType
+ {
+ BeginTx = 0,
+ PrepareTx = 1,
+ CommitOnePhaseTx = 2,
+ CommitTwoPhaseTx = 3,
+ RollbackTx = 4,
+ RecoverTx = 5,
+ ForgetTx = 6,
+ EndTx = 7
+ };
+ }
+}
+
+#endif /*ActiveMQ_TransactionType_hpp_*/
Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/TransactionType.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.cpp Fri Jul 28 01:22:48 2006
@@ -1,377 +1,377 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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 "activemq/command/ActiveMQBytesMessage.hpp"
-
-using namespace apache::activemq::command;
-
-
-/*
- *
- */
-ActiveMQBytesMessage::ActiveMQBytesMessage()
-{
- this->in = NULL ;
- this->out = new ByteArrayOutputStream() ;
- this->readMode = false ;
-}
-
-/*
- *
- */
-ActiveMQBytesMessage::ActiveMQBytesMessage(char* body, int size)
-{
- // Convert body to SP array
- array<char> buffer = array<char> (size) ;
- memcpy(buffer.c_array(), body, size);
-
- this->in = NULL ;
- this->out = new ByteArrayOutputStream(buffer) ;
- this->readMode = false ;
-}
-
-/*
- *
- */
-ActiveMQBytesMessage::~ActiveMQBytesMessage()
-{
-}
-
-/*
- *
- */
-unsigned char ActiveMQBytesMessage::getDataStructureType()
-{
- return ActiveMQBytesMessage::TYPE ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::reset()
-{
- if( !readMode )
- {
- this->in = new ByteArrayInputStream( out->toArray() ) ;
- this->out = NULL ;
- this->readMode = true ;
- }
-}
-
-/*
- *
- */
-char ActiveMQBytesMessage::readByte() throw(MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read a single byte
- return readByte() ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-int ActiveMQBytesMessage::readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read some bytes
- return in->read(buffer, index, length) ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-bool ActiveMQBytesMessage::readBoolean() throw(MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read a boolean
- return in->readBoolean() ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-double ActiveMQBytesMessage::readDouble() throw(MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read a double
- return in->readDouble() ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-float ActiveMQBytesMessage::readFloat() throw(MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read a float
- return in->readFloat() ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-short ActiveMQBytesMessage::readShort() throw(MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read a short
- return in->readShort() ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-int ActiveMQBytesMessage::readInt() throw(MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read an integer
- return in->readInt() ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-long long ActiveMQBytesMessage::readLong() throw(MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read a long long
- return in->readLong() ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-p<string> ActiveMQBytesMessage::readUTF() throw(MessageNotReadableException, MessageEOFException)
-{
- // Assert read mode
- if( !readMode )
- throw MessageNotReadableException() ;
-
- try
- {
- // Read a string
- return in->readString() ;
- }
- catch( EOFException eof )
- {
- throw MessageEOFException() ;
- }
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeByte(char value) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write a single byte
- out->writeByte(value) ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeBytes(char* value, int index, int length) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write some bytes
- out->write(value, index, length) ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeBoolean(bool value) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write a boolean
- out->writeBoolean(value) ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeDouble(double value) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write a double
- out->writeDouble(value) ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeFloat(float value) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write a float
- out->writeFloat(value) ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeInt(int value) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write an integer
- out->writeInt(value) ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeLong(long long value) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write a long long
- out->writeLong(value) ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeShort(short value) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write a short
- out->writeShort(value) ;
-}
-
-/*
- *
- */
-void ActiveMQBytesMessage::writeUTF(const char* value) throw (MessageNotWritableException)
-{
- // Assert write mode
- if( readMode )
- throw MessageNotWritableException() ;
-
- // Write a string
- p<string> v = new string(value) ;
- out->writeString(v) ;
-}
-
-/*
- *
- */
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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 "activemq/command/ActiveMQBytesMessage.hpp"
+
+using namespace apache::activemq::command;
+
+
+/*
+ *
+ */
+ActiveMQBytesMessage::ActiveMQBytesMessage()
+{
+ this->in = NULL ;
+ this->out = new ByteArrayOutputStream() ;
+ this->readMode = false ;
+}
+
+/*
+ *
+ */
+ActiveMQBytesMessage::ActiveMQBytesMessage(char* body, int size)
+{
+ // Convert body to SP array
+ array<char> buffer = array<char> (size) ;
+ memcpy(buffer.c_array(), body, size);
+
+ this->in = NULL ;
+ this->out = new ByteArrayOutputStream(buffer) ;
+ this->readMode = false ;
+}
+
+/*
+ *
+ */
+ActiveMQBytesMessage::~ActiveMQBytesMessage()
+{
+}
+
+/*
+ *
+ */
+unsigned char ActiveMQBytesMessage::getDataStructureType()
+{
+ return ActiveMQBytesMessage::TYPE ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::reset()
+{
+ if( !readMode )
+ {
+ this->in = new ByteArrayInputStream( out->toArray() ) ;
+ this->out = NULL ;
+ this->readMode = true ;
+ }
+}
+
+/*
+ *
+ */
+char ActiveMQBytesMessage::readByte() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read a single byte
+ return readByte() ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+int ActiveMQBytesMessage::readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read some bytes
+ return in->read(buffer, index, length) ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+bool ActiveMQBytesMessage::readBoolean() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read a boolean
+ return in->readBoolean() ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+double ActiveMQBytesMessage::readDouble() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read a double
+ return in->readDouble() ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+float ActiveMQBytesMessage::readFloat() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read a float
+ return in->readFloat() ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+short ActiveMQBytesMessage::readShort() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read a short
+ return in->readShort() ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+int ActiveMQBytesMessage::readInt() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read an integer
+ return in->readInt() ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+long long ActiveMQBytesMessage::readLong() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read a long long
+ return in->readLong() ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+p<string> ActiveMQBytesMessage::readUTF() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ try
+ {
+ // Read a string
+ return in->readString() ;
+ }
+ catch( EOFException eof )
+ {
+ throw MessageEOFException() ;
+ }
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeByte(char value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write a single byte
+ out->writeByte(value) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeBytes(char* value, int index, int length) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write some bytes
+ out->write(value, index, length) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeBoolean(bool value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write a boolean
+ out->writeBoolean(value) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeDouble(double value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write a double
+ out->writeDouble(value) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeFloat(float value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write a float
+ out->writeFloat(value) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeInt(int value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write an integer
+ out->writeInt(value) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeLong(long long value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write a long long
+ out->writeLong(value) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeShort(short value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write a short
+ out->writeShort(value) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeUTF(const char* value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write a string
+ p<string> v = new string(value) ;
+ out->writeString(v) ;
+}
+
+/*
+ *
+ */
int ActiveMQBytesMessage::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
{
int size = 0 ;
@@ -388,9 +388,9 @@
return size ;
}
-/*
- *
- */
+/*
+ *
+ */
void ActiveMQBytesMessage::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
{
// Note! Message content unmarshalling is done in super class
Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.hpp Fri Jul 28 01:22:48 2006
@@ -1,181 +1,181 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef ActiveMQ_ActiveMQBytesMessage_hpp_
-#define ActiveMQ_ActiveMQBytesMessage_hpp_
-
-// Turn off warning message for ignored exception specification
-#ifdef _MSC_VER
-#pragma warning( disable : 4290 )
-#endif
-
-#include <map>
-#include <string>
-#include "cms/IBytesMessage.hpp"
-#include "cms/MessageEOFException.hpp"
-#include "cms/MessageNotWritableException.hpp"
-#include "activemq/command/ActiveMQMessage.hpp"
-#include "ppr/io/ByteArrayInputStream.hpp"
-#include "ppr/io/ByteArrayOutputStream.hpp"
-#include "ppr/io/EOFException.hpp"
-#include "ppr/util/Endian.hpp"
-#include "ppr/util/MapItemHolder.hpp"
-#include "ppr/util/ifr/array"
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
- namespace activemq
- {
- namespace command
- {
- using namespace ifr;
- using namespace apache::cms;
- using namespace apache::ppr::io;
- using namespace apache::ppr::util;
-
-/*
- *
- */
-class ActiveMQBytesMessage : public ActiveMQMessage , public IBytesMessage
-{
-private:
- p<ByteArrayInputStream> in ;
- p<ByteArrayOutputStream> out ;
- bool readMode ;
-
- const static int INITIAL_SIZE = 256 ;
- const static int EXPAND_SIZE = 128 ;
-
-public:
- const static unsigned char TYPE = 24 ;
-
-public:
- ActiveMQBytesMessage() ;
- ActiveMQBytesMessage(char* body, int size) ;
- virtual ~ActiveMQBytesMessage() ;
-
- virtual unsigned char getDataStructureType() ;
-
- virtual void reset() ;
- virtual char readByte() throw (MessageNotReadableException, MessageEOFException) ;
- virtual int readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException) ;
- virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) ;
- virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) ;
- virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) ;
- virtual int readInt() throw (MessageNotReadableException, MessageEOFException) ;
- virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) ;
- virtual short readShort() throw (MessageNotReadableException, MessageEOFException) ;
- virtual p<string> readUTF() throw (MessageNotReadableException, MessageEOFException) ;
- virtual void writeBoolean(bool value) throw (MessageNotWritableException) ;
- virtual void writeByte(char value) throw (MessageNotWritableException) ;
- virtual void writeBytes(char* value, int index, int length) throw (MessageNotWritableException) ;
- virtual void writeDouble(double value) throw (MessageNotWritableException) ;
- virtual void writeFloat(float value) throw (MessageNotWritableException) ;
- virtual void writeInt(int value) throw (MessageNotWritableException) ;
- virtual void writeLong(long long value) throw (MessageNotWritableException) ;
- virtual void writeShort(short value) throw (MessageNotWritableException) ;
- virtual void writeUTF(const char* value) throw (MessageNotWritableException) ;
-
- virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
- virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
-
- //
- // The methods below are needed to resolve the multiple
- // inheritance of IMessage.
- virtual void acknowledge() {
- ActiveMQMessage::acknowledge() ;
- } ;
- virtual p<PropertyMap> getProperties() {
- return ActiveMQMessage::getProperties() ;
- } ;
- virtual p<string> getJMSCorrelationID() {
- return ActiveMQMessage::getJMSCorrelationID() ;
- } ;
- virtual void setJMSCorrelationID(const char* correlationId) {
- return ActiveMQMessage::setJMSCorrelationID(correlationId) ;
- } ;
- virtual p<IDestination> getJMSDestination() {
- return ActiveMQMessage::getJMSDestination() ;
- } ;
- virtual long long getJMSExpiration() {
- return ActiveMQMessage::getJMSExpiration() ;
- } ;
- virtual void setJMSExpiration(long long time) {
- return ActiveMQMessage::setJMSExpiration(time) ;
- } ;
- virtual p<string> getJMSMessageID() {
- return ActiveMQMessage::getJMSMessageID() ;
- } ;
- virtual bool getJMSPersistent() {
- return ActiveMQMessage::getJMSPersistent() ;
- } ;
- virtual void setJMSPersistent(bool persistent) {
- return ActiveMQMessage::setJMSPersistent(persistent) ;
- } ;
- virtual unsigned char getJMSPriority() {
- return ActiveMQMessage::getJMSPriority() ;
- } ;
- virtual void setJMSPriority(unsigned char priority) {
- return ActiveMQMessage::setJMSPriority(priority) ;
- } ;
- virtual bool getJMSRedelivered() {
- return ActiveMQMessage::getJMSRedelivered() ;
- } ;
- virtual p<IDestination> getJMSReplyTo() {
- return ActiveMQMessage::getJMSReplyTo() ;
- } ;
- virtual void setJMSReplyTo(p<IDestination> destination) {
- return ActiveMQMessage::setJMSReplyTo(destination) ;
- } ;
- virtual long long getJMSTimestamp() {
- return ActiveMQMessage::getJMSTimestamp() ;
- } ;
- virtual p<string> getJMSType() {
- return ActiveMQMessage::getJMSType() ;
- } ;
- virtual void setJMSType(const char* type) {
- return ActiveMQMessage::setJMSType(type) ;
- } ;
- virtual int getJMSXDeliveryCount() {
- return ActiveMQMessage::getJMSXDeliveryCount() ;
- } ;
- virtual p<string> getJMSXGroupID() {
- return ActiveMQMessage::getJMSXGroupID() ;
- } ;
- virtual void setJMSXGroupID(const char* groupId) {
- return ActiveMQMessage::setJMSXGroupID(groupId) ;
- } ;
- virtual int getJMSXGroupSeq() {
- return ActiveMQMessage::getJMSXGroupSeq() ;
- } ;
- virtual void setJMSXGroupSeq(int sequence) {
- return ActiveMQMessage::setJMSXGroupSeq(sequence) ;
- } ;
- virtual p<string> getJMSXProducerTxID() {
- return ActiveMQMessage::getJMSXProducerTxID() ;
- } ;
-
-//private:
- // void expandBody() ;
-} ;
-
-/* namespace */
- }
- }
-}
-
-#endif /*ActiveMQ_ActiveMQBytesMessage_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef ActiveMQ_ActiveMQBytesMessage_hpp_
+#define ActiveMQ_ActiveMQBytesMessage_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <map>
+#include <string>
+#include "cms/IBytesMessage.hpp"
+#include "cms/MessageEOFException.hpp"
+#include "cms/MessageNotWritableException.hpp"
+#include "activemq/command/ActiveMQMessage.hpp"
+#include "ppr/io/ByteArrayInputStream.hpp"
+#include "ppr/io/ByteArrayOutputStream.hpp"
+#include "ppr/io/EOFException.hpp"
+#include "ppr/util/Endian.hpp"
+#include "ppr/util/MapItemHolder.hpp"
+#include "ppr/util/ifr/array"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace command
+ {
+ using namespace ifr;
+ using namespace apache::cms;
+ using namespace apache::ppr::io;
+ using namespace apache::ppr::util;
+
+/*
+ *
+ */
+class ActiveMQBytesMessage : public ActiveMQMessage , public IBytesMessage
+{
+private:
+ p<ByteArrayInputStream> in ;
+ p<ByteArrayOutputStream> out ;
+ bool readMode ;
+
+ const static int INITIAL_SIZE = 256 ;
+ const static int EXPAND_SIZE = 128 ;
+
+public:
+ const static unsigned char TYPE = 24 ;
+
+public:
+ ActiveMQBytesMessage() ;
+ ActiveMQBytesMessage(char* body, int size) ;
+ virtual ~ActiveMQBytesMessage() ;
+
+ virtual unsigned char getDataStructureType() ;
+
+ virtual void reset() ;
+ virtual char readByte() throw (MessageNotReadableException, MessageEOFException) ;
+ virtual int readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException) ;
+ virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) ;
+ virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) ;
+ virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) ;
+ virtual int readInt() throw (MessageNotReadableException, MessageEOFException) ;
+ virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) ;
+ virtual short readShort() throw (MessageNotReadableException, MessageEOFException) ;
+ virtual p<string> readUTF() throw (MessageNotReadableException, MessageEOFException) ;
+ virtual void writeBoolean(bool value) throw (MessageNotWritableException) ;
+ virtual void writeByte(char value) throw (MessageNotWritableException) ;
+ virtual void writeBytes(char* value, int index, int length) throw (MessageNotWritableException) ;
+ virtual void writeDouble(double value) throw (MessageNotWritableException) ;
+ virtual void writeFloat(float value) throw (MessageNotWritableException) ;
+ virtual void writeInt(int value) throw (MessageNotWritableException) ;
+ virtual void writeLong(long long value) throw (MessageNotWritableException) ;
+ virtual void writeShort(short value) throw (MessageNotWritableException) ;
+ virtual void writeUTF(const char* value) throw (MessageNotWritableException) ;
+
+ virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
+ virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
+
+ //
+ // The methods below are needed to resolve the multiple
+ // inheritance of IMessage.
+ virtual void acknowledge() {
+ ActiveMQMessage::acknowledge() ;
+ } ;
+ virtual p<PropertyMap> getProperties() {
+ return ActiveMQMessage::getProperties() ;
+ } ;
+ virtual p<string> getJMSCorrelationID() {
+ return ActiveMQMessage::getJMSCorrelationID() ;
+ } ;
+ virtual void setJMSCorrelationID(const char* correlationId) {
+ return ActiveMQMessage::setJMSCorrelationID(correlationId) ;
+ } ;
+ virtual p<IDestination> getJMSDestination() {
+ return ActiveMQMessage::getJMSDestination() ;
+ } ;
+ virtual long long getJMSExpiration() {
+ return ActiveMQMessage::getJMSExpiration() ;
+ } ;
+ virtual void setJMSExpiration(long long time) {
+ return ActiveMQMessage::setJMSExpiration(time) ;
+ } ;
+ virtual p<string> getJMSMessageID() {
+ return ActiveMQMessage::getJMSMessageID() ;
+ } ;
+ virtual bool getJMSPersistent() {
+ return ActiveMQMessage::getJMSPersistent() ;
+ } ;
+ virtual void setJMSPersistent(bool persistent) {
+ return ActiveMQMessage::setJMSPersistent(persistent) ;
+ } ;
+ virtual unsigned char getJMSPriority() {
+ return ActiveMQMessage::getJMSPriority() ;
+ } ;
+ virtual void setJMSPriority(unsigned char priority) {
+ return ActiveMQMessage::setJMSPriority(priority) ;
+ } ;
+ virtual bool getJMSRedelivered() {
+ return ActiveMQMessage::getJMSRedelivered() ;
+ } ;
+ virtual p<IDestination> getJMSReplyTo() {
+ return ActiveMQMessage::getJMSReplyTo() ;
+ } ;
+ virtual void setJMSReplyTo(p<IDestination> destination) {
+ return ActiveMQMessage::setJMSReplyTo(destination) ;
+ } ;
+ virtual long long getJMSTimestamp() {
+ return ActiveMQMessage::getJMSTimestamp() ;
+ } ;
+ virtual p<string> getJMSType() {
+ return ActiveMQMessage::getJMSType() ;
+ } ;
+ virtual void setJMSType(const char* type) {
+ return ActiveMQMessage::setJMSType(type) ;
+ } ;
+ virtual int getJMSXDeliveryCount() {
+ return ActiveMQMessage::getJMSXDeliveryCount() ;
+ } ;
+ virtual p<string> getJMSXGroupID() {
+ return ActiveMQMessage::getJMSXGroupID() ;
+ } ;
+ virtual void setJMSXGroupID(const char* groupId) {
+ return ActiveMQMessage::setJMSXGroupID(groupId) ;
+ } ;
+ virtual int getJMSXGroupSeq() {
+ return ActiveMQMessage::getJMSXGroupSeq() ;
+ } ;
+ virtual void setJMSXGroupSeq(int sequence) {
+ return ActiveMQMessage::setJMSXGroupSeq(sequence) ;
+ } ;
+ virtual p<string> getJMSXProducerTxID() {
+ return ActiveMQMessage::getJMSXProducerTxID() ;
+ } ;
+
+//private:
+ // void expandBody() ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*ActiveMQ_ActiveMQBytesMessage_hpp_*/
Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQBytesMessage.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.cpp Fri Jul 28 01:22:48 2006
@@ -1,352 +1,352 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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 "activemq/DestinationFilter.hpp"
-#include "activemq/command/ActiveMQDestination.hpp"
-#include "activemq/command/ActiveMQTempQueue.hpp"
-#include "activemq/command/ActiveMQTempTopic.hpp"
-#include "activemq/command/ActiveMQQueue.hpp"
-#include "activemq/command/ActiveMQTopic.hpp"
-
-using namespace apache::activemq::command;
-
-
-// --- Static initialization ----------------------------------------
-
-const char* ActiveMQDestination::ADVISORY_PREFIX = "ActiveMQ.Advisory." ;
-const char* ActiveMQDestination::CONSUMER_ADVISORY_PREFIX = "ActiveMQ.Advisory.Consumers." ;
-const char* ActiveMQDestination::PRODUCER_ADVISORY_PREFIX = "ActiveMQ.Advisory.Producers." ;
-const char* ActiveMQDestination::CONNECTION_ADVISORY_PREFIX = "ActiveMQ.Advisory.Connections." ;
-const char* ActiveMQDestination::DEFAULT_ORDERED_TARGET = "coordinator" ;
-
-const char* ActiveMQDestination::TEMP_PREFIX = "{TD{" ;
-const char* ActiveMQDestination::TEMP_POSTFIX = "}TD}" ;
-const char* ActiveMQDestination::COMPOSITE_SEPARATOR = "," ;
-const char* ActiveMQDestination::QUEUE_PREFIX = "queue://" ;
-const char* ActiveMQDestination::TOPIC_PREFIX = "topic://" ;
-
-
-/*
- * Default constructor
- */
-ActiveMQDestination::ActiveMQDestination()
-{
- orderedTarget = new string(DEFAULT_ORDERED_TARGET) ;
- physicalName = new string("") ;
- exclusive = false ;
- ordered = false ;
- advisory = false ;
-}
-
-/*
- * Constructs the destination with a specified physical name.
- *
- * @param name the physical name for the destination.
- */
-ActiveMQDestination::ActiveMQDestination(const char* name)
-{
- orderedTarget = new string(DEFAULT_ORDERED_TARGET) ;
- physicalName = new string(name) ;
- exclusive = false ;
- ordered = false ;
- advisory = ( name != NULL && (physicalName->find(ADVISORY_PREFIX) == 0)) ? true : false ;
-}
-
-/*
- *
- */
-ActiveMQDestination::~ActiveMQDestination()
-{
- // no-op
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isAdvisory()
-{
- return advisory ;
-}
-
-/*
- *
- */
-void ActiveMQDestination::setAdvisory(bool advisory)
-{
- this->advisory = advisory ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isConsumerAdvisory()
-{
- return ( isAdvisory() && (physicalName->find(CONSUMER_ADVISORY_PREFIX) == 0) ) ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isProducerAdvisory()
-{
- return ( isAdvisory() && (physicalName->find(PRODUCER_ADVISORY_PREFIX) == 0) ) ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isConnectionAdvisory()
-{
- return ( isAdvisory() && (physicalName->find(CONNECTION_ADVISORY_PREFIX) == 0) ) ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isExclusive()
-{
- return exclusive ;
-}
-
-/*
- *
- */
-void ActiveMQDestination::setExclusive(bool exclusive)
-{
- this->exclusive = exclusive ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isOrdered()
-{
- return ordered ;
-}
-
-/*
- *
- */
-void ActiveMQDestination::setOrdered(bool ordered)
-{
- this->ordered = ordered ;
-}
-
-/*
- *
- */
-p<string> ActiveMQDestination::getOrderedTarget()
-{
- return orderedTarget ;
-}
-
-/*
- *
- */
-void ActiveMQDestination::setOrderedTarget(const char* target)
-{
- this->orderedTarget->assign(target) ;
-}
-
-/*
- *
- */
-p<string> ActiveMQDestination::getPhysicalName()
-{
- return physicalName ;
-}
-
-/*
- *
- */
-void ActiveMQDestination::setPhysicalName(const char* name)
-{
- physicalName->assign(name) ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isTopic()
-{
- return ( getDestinationType() == ACTIVEMQ_TOPIC ||
- getDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC ) ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isQueue()
-{
- return !isTopic() ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isTemporary()
-{
- return ( getDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC ||
- getDestinationType() == ACTIVEMQ_TEMPORARY_QUEUE ) ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isComposite()
-{
- return ( physicalName->find(ActiveMQDestination::COMPOSITE_SEPARATOR) > 0 ) ;
-}
-
-/*
- *
- */
-bool ActiveMQDestination::isWildcard()
-{
- if( physicalName != NULL )
- {
- return ( physicalName->find( DestinationFilter::ANY_CHILD ) >= 0 ||
- physicalName->find( DestinationFilter::ANY_DESCENDENT ) >= 0 ) ;
- }
- return false ;
-}
-
-/*
- *
- */
-p<string> ActiveMQDestination::toString()
-{
- return physicalName ;
-}
-
-// --- Static methods ---------------------------------------------
-
-/*
- * A helper method to return a descriptive string for the topic or queue.
- */
-p<string> ActiveMQDestination::inspect(p<ActiveMQDestination> destination)
-{
- p<string> description = new string() ;
-
- if( typeid(*destination) == typeid(ITopic) )
- description->assign("Topic(") ;
- else
- description->assign("Queue(") ;
-
- description->append( destination->toString()->c_str() ) ;
- description->append(")") ;
-
- return description ;
-}
-
-/*
- *
- */
-/*p<ActiveMQDestination> ActiveMQDestination::transform(p<IDestination> destination)
-{
- p<ActiveMQDestination> result = NULL ;
-
- if( destination != NULL )
- {
- if( typeid(*destination) == typeid(ActiveMQDestination) )
- result = p_cast<ActiveMQDestination> (destination) ;
-
- else
- {
- if( typeid(ITopic).before(typeid(IDestination)) )
- result = new ActiveMQTopic( (p_cast<ITopic> (destination))->getTopicName()->c_str() ) ;
-
- else if( typeid(*destination).before(typeid(IQueue)) )
- result = new ActiveMQQueue( (p_cast<IQueue> (destination))->getQueueName()->c_str() ) ;
-
- else if( typeid(ITemporaryQueue).before(typeid(*destination)) )
- result = new ActiveMQTempQueue( (p_cast<IQueue> (destination))->getQueueName()->c_str() ) ;
-
- else if( typeid(ITemporaryTopic).before(typeid(*destination)) )
- result = new ActiveMQTempTopic( (p_cast<ITopic> (destination))->getTopicName()->c_str() ) ;
-
- }
- }
- return result ;
-}*/
-
-/*
- *
- */
-p<ActiveMQDestination> ActiveMQDestination::createDestination(int type, const char* physicalName)
-{
- p<ActiveMQDestination> result = NULL ;
-
- if( type == ActiveMQDestination::ACTIVEMQ_TOPIC )
- result = new ActiveMQTopic(physicalName) ;
-
- else if( type == ActiveMQDestination::ACTIVEMQ_TEMPORARY_TOPIC )
- result = new ActiveMQTempTopic(physicalName) ;
-
- else if (type == ActiveMQDestination::ACTIVEMQ_QUEUE)
- result = new ActiveMQQueue(physicalName) ;
-
- else
- result = new ActiveMQTempQueue(physicalName) ;
-
- return result ;
-}
-
-/*
- *
- */
-p<string> ActiveMQDestination::createTemporaryName(const char* clientId)
-{
- p<string> tempName = new string() ;
-
- tempName->assign( ActiveMQDestination::TEMP_PREFIX ) ;
- tempName->append(clientId) ;
- tempName->append( ActiveMQDestination::TEMP_POSTFIX ) ;
-
- return tempName ;
-}
-
-/*
- *
- */
-p<string> ActiveMQDestination::getClientId(p<ActiveMQDestination> destination)
-{
- p<string> answer = NULL ;
-
- if( destination != NULL && destination->isTemporary() )
- {
- p<string> name = destination->getPhysicalName() ;
- int start = (int)name->find(TEMP_PREFIX),
- stop ;
-
- if( start >= 0 )
- {
- start += (int)strlen(TEMP_PREFIX) ;
- stop = (int)name->find_last_of(TEMP_POSTFIX) ;
-
- if( stop > start && stop < (int)name->length() )
- answer->assign( name->substr(start, stop) ) ;
- }
- }
- return answer;
-}
-
-/*
- *
- */
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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 "activemq/DestinationFilter.hpp"
+#include "activemq/command/ActiveMQDestination.hpp"
+#include "activemq/command/ActiveMQTempQueue.hpp"
+#include "activemq/command/ActiveMQTempTopic.hpp"
+#include "activemq/command/ActiveMQQueue.hpp"
+#include "activemq/command/ActiveMQTopic.hpp"
+
+using namespace apache::activemq::command;
+
+
+// --- Static initialization ----------------------------------------
+
+const char* ActiveMQDestination::ADVISORY_PREFIX = "ActiveMQ.Advisory." ;
+const char* ActiveMQDestination::CONSUMER_ADVISORY_PREFIX = "ActiveMQ.Advisory.Consumers." ;
+const char* ActiveMQDestination::PRODUCER_ADVISORY_PREFIX = "ActiveMQ.Advisory.Producers." ;
+const char* ActiveMQDestination::CONNECTION_ADVISORY_PREFIX = "ActiveMQ.Advisory.Connections." ;
+const char* ActiveMQDestination::DEFAULT_ORDERED_TARGET = "coordinator" ;
+
+const char* ActiveMQDestination::TEMP_PREFIX = "{TD{" ;
+const char* ActiveMQDestination::TEMP_POSTFIX = "}TD}" ;
+const char* ActiveMQDestination::COMPOSITE_SEPARATOR = "," ;
+const char* ActiveMQDestination::QUEUE_PREFIX = "queue://" ;
+const char* ActiveMQDestination::TOPIC_PREFIX = "topic://" ;
+
+
+/*
+ * Default constructor
+ */
+ActiveMQDestination::ActiveMQDestination()
+{
+ orderedTarget = new string(DEFAULT_ORDERED_TARGET) ;
+ physicalName = new string("") ;
+ exclusive = false ;
+ ordered = false ;
+ advisory = false ;
+}
+
+/*
+ * Constructs the destination with a specified physical name.
+ *
+ * @param name the physical name for the destination.
+ */
+ActiveMQDestination::ActiveMQDestination(const char* name)
+{
+ orderedTarget = new string(DEFAULT_ORDERED_TARGET) ;
+ physicalName = new string(name) ;
+ exclusive = false ;
+ ordered = false ;
+ advisory = ( name != NULL && (physicalName->find(ADVISORY_PREFIX) == 0)) ? true : false ;
+}
+
+/*
+ *
+ */
+ActiveMQDestination::~ActiveMQDestination()
+{
+ // no-op
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isAdvisory()
+{
+ return advisory ;
+}
+
+/*
+ *
+ */
+void ActiveMQDestination::setAdvisory(bool advisory)
+{
+ this->advisory = advisory ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isConsumerAdvisory()
+{
+ return ( isAdvisory() && (physicalName->find(CONSUMER_ADVISORY_PREFIX) == 0) ) ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isProducerAdvisory()
+{
+ return ( isAdvisory() && (physicalName->find(PRODUCER_ADVISORY_PREFIX) == 0) ) ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isConnectionAdvisory()
+{
+ return ( isAdvisory() && (physicalName->find(CONNECTION_ADVISORY_PREFIX) == 0) ) ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isExclusive()
+{
+ return exclusive ;
+}
+
+/*
+ *
+ */
+void ActiveMQDestination::setExclusive(bool exclusive)
+{
+ this->exclusive = exclusive ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isOrdered()
+{
+ return ordered ;
+}
+
+/*
+ *
+ */
+void ActiveMQDestination::setOrdered(bool ordered)
+{
+ this->ordered = ordered ;
+}
+
+/*
+ *
+ */
+p<string> ActiveMQDestination::getOrderedTarget()
+{
+ return orderedTarget ;
+}
+
+/*
+ *
+ */
+void ActiveMQDestination::setOrderedTarget(const char* target)
+{
+ this->orderedTarget->assign(target) ;
+}
+
+/*
+ *
+ */
+p<string> ActiveMQDestination::getPhysicalName()
+{
+ return physicalName ;
+}
+
+/*
+ *
+ */
+void ActiveMQDestination::setPhysicalName(const char* name)
+{
+ physicalName->assign(name) ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isTopic()
+{
+ return ( getDestinationType() == ACTIVEMQ_TOPIC ||
+ getDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC ) ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isQueue()
+{
+ return !isTopic() ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isTemporary()
+{
+ return ( getDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC ||
+ getDestinationType() == ACTIVEMQ_TEMPORARY_QUEUE ) ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isComposite()
+{
+ return ( physicalName->find(ActiveMQDestination::COMPOSITE_SEPARATOR) > 0 ) ;
+}
+
+/*
+ *
+ */
+bool ActiveMQDestination::isWildcard()
+{
+ if( physicalName != NULL )
+ {
+ return ( physicalName->find( DestinationFilter::ANY_CHILD ) >= 0 ||
+ physicalName->find( DestinationFilter::ANY_DESCENDENT ) >= 0 ) ;
+ }
+ return false ;
+}
+
+/*
+ *
+ */
+p<string> ActiveMQDestination::toString()
+{
+ return physicalName ;
+}
+
+// --- Static methods ---------------------------------------------
+
+/*
+ * A helper method to return a descriptive string for the topic or queue.
+ */
+p<string> ActiveMQDestination::inspect(p<ActiveMQDestination> destination)
+{
+ p<string> description = new string() ;
+
+ if( typeid(*destination) == typeid(ITopic) )
+ description->assign("Topic(") ;
+ else
+ description->assign("Queue(") ;
+
+ description->append( destination->toString()->c_str() ) ;
+ description->append(")") ;
+
+ return description ;
+}
+
+/*
+ *
+ */
+/*p<ActiveMQDestination> ActiveMQDestination::transform(p<IDestination> destination)
+{
+ p<ActiveMQDestination> result = NULL ;
+
+ if( destination != NULL )
+ {
+ if( typeid(*destination) == typeid(ActiveMQDestination) )
+ result = p_cast<ActiveMQDestination> (destination) ;
+
+ else
+ {
+ if( typeid(ITopic).before(typeid(IDestination)) )
+ result = new ActiveMQTopic( (p_cast<ITopic> (destination))->getTopicName()->c_str() ) ;
+
+ else if( typeid(*destination).before(typeid(IQueue)) )
+ result = new ActiveMQQueue( (p_cast<IQueue> (destination))->getQueueName()->c_str() ) ;
+
+ else if( typeid(ITemporaryQueue).before(typeid(*destination)) )
+ result = new ActiveMQTempQueue( (p_cast<IQueue> (destination))->getQueueName()->c_str() ) ;
+
+ else if( typeid(ITemporaryTopic).before(typeid(*destination)) )
+ result = new ActiveMQTempTopic( (p_cast<ITopic> (destination))->getTopicName()->c_str() ) ;
+
+ }
+ }
+ return result ;
+}*/
+
+/*
+ *
+ */
+p<ActiveMQDestination> ActiveMQDestination::createDestination(int type, const char* physicalName)
+{
+ p<ActiveMQDestination> result = NULL ;
+
+ if( type == ActiveMQDestination::ACTIVEMQ_TOPIC )
+ result = new ActiveMQTopic(physicalName) ;
+
+ else if( type == ActiveMQDestination::ACTIVEMQ_TEMPORARY_TOPIC )
+ result = new ActiveMQTempTopic(physicalName) ;
+
+ else if (type == ActiveMQDestination::ACTIVEMQ_QUEUE)
+ result = new ActiveMQQueue(physicalName) ;
+
+ else
+ result = new ActiveMQTempQueue(physicalName) ;
+
+ return result ;
+}
+
+/*
+ *
+ */
+p<string> ActiveMQDestination::createTemporaryName(const char* clientId)
+{
+ p<string> tempName = new string() ;
+
+ tempName->assign( ActiveMQDestination::TEMP_PREFIX ) ;
+ tempName->append(clientId) ;
+ tempName->append( ActiveMQDestination::TEMP_POSTFIX ) ;
+
+ return tempName ;
+}
+
+/*
+ *
+ */
+p<string> ActiveMQDestination::getClientId(p<ActiveMQDestination> destination)
+{
+ p<string> answer = NULL ;
+
+ if( destination != NULL && destination->isTemporary() )
+ {
+ p<string> name = destination->getPhysicalName() ;
+ int start = (int)name->find(TEMP_PREFIX),
+ stop ;
+
+ if( start >= 0 )
+ {
+ start += (int)strlen(TEMP_PREFIX) ;
+ stop = (int)name->find_last_of(TEMP_POSTFIX) ;
+
+ if( stop > start && stop < (int)name->length() )
+ answer->assign( name->substr(start, stop) ) ;
+ }
+ }
+ return answer;
+}
+
+/*
+ *
+ */
int ActiveMQDestination::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
{
int size = 0 ;
@@ -355,9 +355,9 @@
return size ;
}
-/*
- *
- */
+/*
+ *
+ */
void ActiveMQDestination::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
{
physicalName = p_cast<string>(marshaller->unmarshalString(mode, reader)) ;
Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.hpp Fri Jul 28 01:22:48 2006
@@ -1,137 +1,137 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef ActiveMQ_ActiveMQDestination_hpp_
-#define ActiveMQ_ActiveMQDestination_hpp_
-
-#include <typeinfo>
-#include "cms/IDestination.hpp"
-#include "cms/ITopic.hpp"
-#include "cms/IQueue.hpp"
-#include "cms/ITemporaryTopic.hpp"
-#include "cms/ITemporaryQueue.hpp"
-#include "activemq/command/AbstractCommand.hpp"
-#include "activemq/protocol/IMarshaller.hpp"
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef ActiveMQ_ActiveMQDestination_hpp_
+#define ActiveMQ_ActiveMQDestination_hpp_
+
+#include <typeinfo>
+#include "cms/IDestination.hpp"
+#include "cms/ITopic.hpp"
+#include "cms/IQueue.hpp"
+#include "cms/ITemporaryTopic.hpp"
+#include "cms/ITemporaryQueue.hpp"
+#include "activemq/command/AbstractCommand.hpp"
+#include "activemq/protocol/IMarshaller.hpp"
#include "ppr/io/IOutputStream.hpp"
#include "ppr/io/IInputStream.hpp"
#include "ppr/io/IOException.hpp"
#include "ppr/util/ifr/p"
-
-namespace apache
-{
- namespace activemq
- {
- namespace command
- {
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace command
+ {
using namespace ifr;
- using namespace apache::activemq;
- using namespace apache::activemq::protocol;
- using namespace apache::cms;
- using namespace apache::ppr::io;
- class ActiveMQQueue ;
- class ActiveMQTempQueue ;
- class ActiveMQTopic ;
- class ActiveMQTempTopic ;
-
-/*
- *
- */
-class ActiveMQDestination : public AbstractCommand, public IDestination
-{
-private:
- p<string> orderedTarget,
- physicalName ;
- bool exclusive,
- ordered,
- advisory ;
-
- // Prefix/postfix for queue/topic names
- static const char* TEMP_PREFIX ;
- static const char* TEMP_POSTFIX ;
- static const char* COMPOSITE_SEPARATOR ;
- static const char* QUEUE_PREFIX ;
- static const char* TOPIC_PREFIX ;
-
-public:
- // Destination type constants
- static const int ACTIVEMQ_TOPIC = 1 ;
- static const int ACTIVEMQ_TEMPORARY_TOPIC = 2 ;
- static const int ACTIVEMQ_QUEUE = 3 ;
- static const int ACTIVEMQ_TEMPORARY_QUEUE = 4 ;
-
- // Prefixes for Advisory message destinations
- static const char* ADVISORY_PREFIX ;
- static const char* CONSUMER_ADVISORY_PREFIX ;
- static const char* PRODUCER_ADVISORY_PREFIX ;
- static const char* CONNECTION_ADVISORY_PREFIX ;
-
- // The default target for ordered destinations
- static const char* DEFAULT_ORDERED_TARGET ;
-
-protected:
- ActiveMQDestination() ;
- ActiveMQDestination(const char* name) ;
-
-public:
- virtual ~ActiveMQDestination() ;
-
- // Attributes methods
- virtual bool isAdvisory() ;
- virtual void setAdvisory(bool advisory) ;
- virtual bool isConsumerAdvisory() ;
- virtual bool isProducerAdvisory() ;
- virtual bool isConnectionAdvisory() ;
- virtual bool isExclusive() ;
- virtual void setExclusive(bool exclusive) ;
- virtual bool isOrdered() ;
- virtual void setOrdered(bool ordered) ;
- virtual p<string> getOrderedTarget() ;
- virtual void setOrderedTarget(const char* target) ;
- virtual p<string> getPhysicalName() ;
- virtual void setPhysicalName(const char* name) ;
- virtual bool isTopic() ;
- virtual bool isQueue() ;
- virtual bool isTemporary() ;
- virtual bool isComposite() ;
- virtual bool isWildcard() ;
- virtual p<string> toString() ;
-
+ using namespace apache::activemq;
+ using namespace apache::activemq::protocol;
+ using namespace apache::cms;
+ using namespace apache::ppr::io;
+ class ActiveMQQueue ;
+ class ActiveMQTempQueue ;
+ class ActiveMQTopic ;
+ class ActiveMQTempTopic ;
+
+/*
+ *
+ */
+class ActiveMQDestination : public AbstractCommand, public IDestination
+{
+private:
+ p<string> orderedTarget,
+ physicalName ;
+ bool exclusive,
+ ordered,
+ advisory ;
+
+ // Prefix/postfix for queue/topic names
+ static const char* TEMP_PREFIX ;
+ static const char* TEMP_POSTFIX ;
+ static const char* COMPOSITE_SEPARATOR ;
+ static const char* QUEUE_PREFIX ;
+ static const char* TOPIC_PREFIX ;
+
+public:
+ // Destination type constants
+ static const int ACTIVEMQ_TOPIC = 1 ;
+ static const int ACTIVEMQ_TEMPORARY_TOPIC = 2 ;
+ static const int ACTIVEMQ_QUEUE = 3 ;
+ static const int ACTIVEMQ_TEMPORARY_QUEUE = 4 ;
+
+ // Prefixes for Advisory message destinations
+ static const char* ADVISORY_PREFIX ;
+ static const char* CONSUMER_ADVISORY_PREFIX ;
+ static const char* PRODUCER_ADVISORY_PREFIX ;
+ static const char* CONNECTION_ADVISORY_PREFIX ;
+
+ // The default target for ordered destinations
+ static const char* DEFAULT_ORDERED_TARGET ;
+
+protected:
+ ActiveMQDestination() ;
+ ActiveMQDestination(const char* name) ;
+
+public:
+ virtual ~ActiveMQDestination() ;
+
+ // Attributes methods
+ virtual bool isAdvisory() ;
+ virtual void setAdvisory(bool advisory) ;
+ virtual bool isConsumerAdvisory() ;
+ virtual bool isProducerAdvisory() ;
+ virtual bool isConnectionAdvisory() ;
+ virtual bool isExclusive() ;
+ virtual void setExclusive(bool exclusive) ;
+ virtual bool isOrdered() ;
+ virtual void setOrdered(bool ordered) ;
+ virtual p<string> getOrderedTarget() ;
+ virtual void setOrderedTarget(const char* target) ;
+ virtual p<string> getPhysicalName() ;
+ virtual void setPhysicalName(const char* name) ;
+ virtual bool isTopic() ;
+ virtual bool isQueue() ;
+ virtual bool isTemporary() ;
+ virtual bool isComposite() ;
+ virtual bool isWildcard() ;
+ virtual p<string> toString() ;
+
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
-
- //
- // Abstract methods
-
- // Factory method to create a child destination if this destination is a composite.
- virtual p<ActiveMQDestination> createDestination(const char* name) = 0 ;
- virtual int getDestinationType() = 0 ;
-
- //
- // Static methods
-
- static p<string> inspect(p<ActiveMQDestination> destination) ;
- //static p<ActiveMQDestination> transform(p<IDestination> destination) ;
- static p<ActiveMQDestination> createDestination(int type, const char* physicalName) ;
- static p<string> createTemporaryName(const char* clientId) ;
- static p<string> getClientId(p<ActiveMQDestination> destination) ;
-} ;
-
-/* namespace */
- }
- }
-}
-
-#endif /*ActiveMQ_ActiveMQDestination_hpp_*/
+
+ //
+ // Abstract methods
+
+ // Factory method to create a child destination if this destination is a composite.
+ virtual p<ActiveMQDestination> createDestination(const char* name) = 0 ;
+ virtual int getDestinationType() = 0 ;
+
+ //
+ // Static methods
+
+ static p<string> inspect(p<ActiveMQDestination> destination) ;
+ //static p<ActiveMQDestination> transform(p<IDestination> destination) ;
+ static p<ActiveMQDestination> createDestination(int type, const char* physicalName) ;
+ static p<string> createTemporaryName(const char* clientId) ;
+ static p<string> getClientId(p<ActiveMQDestination> destination) ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*ActiveMQ_ActiveMQDestination_hpp_*/
Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/command/ActiveMQDestination.hpp
------------------------------------------------------------------------------
svn:eol-style = native