Author: tabish
Date: Tue Jan 27 22:58:37 2009
New Revision: 738290
URL: http://svn.apache.org/viewvc?rev=738290&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-100
More work on the Failover bits, adding in the state of a Connection State
Tracker.
Added:
activemq/activemq-cpp/trunk/src/main/activemq/state/
activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitor.h
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitorAdapter.h
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.cpp
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.h
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.cpp
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.h (with
props)
activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.cpp
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.h (with
props)
activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h (with
props)
activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.cpp (with
props)
activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.h (with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp
(with props)
activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
(with props)
Modified:
activemq/activemq-cpp/trunk/src/main/Makefile.am
Modified: activemq/activemq-cpp/trunk/src/main/Makefile.am
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/Makefile.am?rev=738290&r1=738289&r2=738290&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/main/Makefile.am Tue Jan 27 22:58:37 2009
@@ -43,6 +43,13 @@
activemq/core/ActiveMQProducer.cpp \
activemq/core/ActiveMQConnectionFactory.cpp \
activemq/core/ActiveMQSessionExecutor.cpp \
+ activemq/state/ConnectionState.cpp \
+ activemq/state/ConnectionStateTracker.cpp \
+ activemq/state/ConsumerState.cpp \
+ activemq/state/ProducerState.cpp \
+ activemq/state/SessionState.cpp \
+ activemq/state/TransactionState.cpp \
+ activemq/state/Tracked.cpp \
activemq/transport/failover/BackupTransport.cpp \
activemq/transport/failover/FailoverTransport.cpp \
activemq/transport/failover/FailoverTransportFactory.cpp \
@@ -181,6 +188,15 @@
activemq/exceptions/ActiveMQException.h \
activemq/exceptions/BrokerException.h \
activemq/exceptions/ExceptionDefines.h \
+ activemq/state/CommandVisitor.h \
+ activemq/state/CommandVisitorAdapter.h \
+ activemq/state/ConnectionState.h \
+ activemq/state/ConnectionStateTracker.h \
+ activemq/state/ConsumerState.h \
+ activemq/state/ProducerState.h \
+ activemq/state/SessionState.h \
+ activemq/state/TransactionState.h \
+ activemq/state/Tracked.h \
activemq/transport/AbstractTransportFactory.h \
activemq/transport/Command.h \
activemq/transport/CommandIOException.h \
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitor.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitor.h?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitor.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitor.h Tue
Jan 27 22:58:37 2009
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_COMMANDVISITOR_H_
+#define _ACTIVEMQ_STATE_COMMANDVISITOR_H_
+
+#include <activemq/util/Config.h>
+#include <activemq/transport/Response.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+#include <activemq/commands/ConnectionInfo.h>
+#include <activemq/commands/SessionInfo.h>
+#include <activemq/commands/ProducerInfo.h>
+#include <activemq/commands/ConsumerInfo.h>
+#include <activemq/commands/ConnectionId.h>
+#include <activemq/commands/SessionId.h>
+#include <activemq/commands/ProducerId.h>
+#include <activemq/commands/ConsumerId.h>
+#include <activemq/commands/DestinationInfo.h>
+#include <activemq/commands/RemoveSubscriptionInfo.h>
+#include <activemq/commands/Message.h>
+#include <activemq/commands/MessageAck.h>
+#include <activemq/commands/MessagePull.h>
+#include <activemq/commands/TransactionInfo.h>
+#include <activemq/commands/WireFormatInfo.h>
+#include <activemq/commands/ProducerAck.h>
+#include <activemq/commands/MessageDispatch.h>
+#include <activemq/commands/MessageDispatchNotification.h>
+#include <activemq/commands/ControlCommand.h>
+#include <activemq/commands/ConnectionError.h>
+#include <activemq/commands/ConnectionControl.h>
+#include <activemq/commands/ConsumerControl.h>
+#include <activemq/commands/ShutdownInfo.h>
+#include <activemq/commands/KeepAliveInfo.h>
+#include <activemq/commands/FlushCommand.h>
+#include <activemq/commands/BrokerInfo.h>
+
+namespace activemq {
+namespace state {
+
+ /**
+ * Interface for an Object that can visit the various Command Objects that
+ * are sent from and to this client. The Commands themselves implement a
+ * <code>visit</code> method that is called with an instance of this
interface
+ * and each one then call the appropriate <code>processXXX</code> method.
+ *
+ * @since 3.0
+ */
+ class AMQCPP_API CommandVisitor {
+ public:
+
+ virtual ~CommandVisitor() {}
+
+ virtual transport::Response* processAddConnection(
+ commands::ConnectionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processAddSession(
+ commands::SessionInfo info ) throw ( exceptions::ActiveMQException
) = 0;
+
+ virtual transport::Response* processAddProducer(
+ commands::ProducerInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processAddConsumer(
+ commands::ConsumerInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processRemoveConnection(
+ commands::ConnectionId id ) throw ( exceptions::ActiveMQException
) = 0;
+
+ virtual transport::Response* processRemoveSession(
+ commands::SessionId id ) throw ( exceptions::ActiveMQException ) =
0;
+
+ virtual transport::Response* processRemoveProducer(
+ commands::ProducerId id ) throw ( exceptions::ActiveMQException )
= 0;
+
+ virtual transport::Response* processRemoveConsumer(
+ commands::ConsumerId id ) throw ( exceptions::ActiveMQException )
= 0;
+
+ virtual transport::Response* processAddDestination(
+ commands::DestinationInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processRemoveDestination(
+ commands::DestinationInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processRemoveSubscription(
+ commands::RemoveSubscriptionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processMessage(
+ commands::Message send ) throw ( exceptions::ActiveMQException ) =
0;
+
+ virtual transport::Response* processMessageAck(
+ commands::MessageAck ack ) throw ( exceptions::ActiveMQException )
= 0;
+
+ virtual transport::Response* processMessagePull(
+ commands::MessagePull pull ) throw ( exceptions::ActiveMQException
) = 0;
+
+ virtual transport::Response* processBeginTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processPrepareTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processCommitTransactionOnePhase(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processCommitTransactionTwoPhase(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processRollbackTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processWireFormat(
+ commands::WireFormatInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processKeepAlive(
+ commands::KeepAliveInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processShutdown(
+ commands::ShutdownInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processFlush(
+ commands::FlushCommand command ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processBrokerInfo(
+ commands::BrokerInfo info) throw ( exceptions::ActiveMQException )
= 0;
+
+ virtual transport::Response* processRecoverTransactions(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processForgetTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processEndTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processMessageDispatchNotification(
+ commands::MessageDispatchNotification notification ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processProducerAck(
+ commands::ProducerAck ack ) throw ( exceptions::ActiveMQException
) = 0;
+
+ virtual transport::Response* processMessageDispatch(
+ commands::MessageDispatch dispatch ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processControlCommand(
+ commands::ControlCommand command ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processConnectionError(
+ commands::ConnectionError error ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processConnectionControl(
+ commands::ConnectionControl control ) throw (
exceptions::ActiveMQException ) = 0;
+
+ virtual transport::Response* processConsumerControl(
+ commands::ConsumerControl control ) throw (
exceptions::ActiveMQException ) = 0;
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_COMMANDVISITOR_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitor.h
------------------------------------------------------------------------------
svn:eol-style = native
Added:
activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitorAdapter.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitorAdapter.h?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitorAdapter.h
(added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitorAdapter.h
Tue Jan 27 22:58:37 2009
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_COMMANDVISITORADAPTER_H_
+#define _ACTIVEMQ_STATE_COMMANDVISITORADAPTER_H_
+
+#include <activemq/util/Config.h>
+
+#include <activemq/state/CommandVisitor.h>
+
+namespace activemq {
+namespace state {
+
+ /**
+ * Default Implementation of a CommandVisitor that returns NULL for all
calls.
+ *
+ * @since 3.0
+ */
+ class AMQCPP_API CommandVisitorAdapter : public CommandVisitor {
+ public:
+
+ virtual ~CommandVisitorAdapter() {}
+
+ virtual transport::Response* processAddConnection(
+ commands::ConnectionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processAddSession(
+ commands::SessionInfo info ) throw ( exceptions::ActiveMQException
) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processAddProducer(
+ commands::ProducerInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processAddConsumer(
+ commands::ConsumerInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processRemoveConnection(
+ commands::ConnectionId id ) throw ( exceptions::ActiveMQException
) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processRemoveSession(
+ commands::SessionId id ) throw ( exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processRemoveProducer(
+ commands::ProducerId id ) throw ( exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processRemoveConsumer(
+ commands::ConsumerId id ) throw ( exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processAddDestination(
+ commands::DestinationInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processRemoveDestination(
+ commands::DestinationInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processRemoveSubscription(
+ commands::RemoveSubscriptionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processMessage(
+ commands::Message send ) throw ( exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processMessageAck(
+ commands::MessageAck ack ) throw ( exceptions::ActiveMQException )
{
+
+ return NULL;
+ }
+
+ virtual transport::Response* processMessagePull(
+ commands::MessagePull pull ) throw ( exceptions::ActiveMQException
) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processBeginTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processPrepareTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processCommitTransactionOnePhase(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processCommitTransactionTwoPhase(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processRollbackTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processWireFormat(
+ commands::WireFormatInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processKeepAlive(
+ commands::KeepAliveInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processShutdown(
+ commands::ShutdownInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processFlush(
+ commands::FlushCommand command ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processBrokerInfo(
+ commands::BrokerInfo info) throw ( exceptions::ActiveMQException )
{
+
+ return NULL;
+ }
+
+ virtual transport::Response* processRecoverTransactions(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processForgetTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processEndTransaction(
+ commands::TransactionInfo info ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processMessageDispatchNotification(
+ commands::MessageDispatchNotification notification ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processProducerAck(
+ commands::ProducerAck ack ) throw ( exceptions::ActiveMQException
) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processMessageDispatch(
+ commands::MessageDispatch dispatch ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processControlCommand(
+ commands::ControlCommand command ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processConnectionError(
+ commands::ConnectionError error ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processConnectionControl(
+ commands::ConnectionControl control ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ virtual transport::Response* processConsumerControl(
+ commands::ConsumerControl control ) throw (
exceptions::ActiveMQException ) {
+
+ return NULL;
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_COMMANDVISITORADAPTER_H_*/
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/CommandVisitorAdapter.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp
(added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp Tue
Jan 27 22:58:37 2009
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ConnectionState.h"
+
+#include <decaf/lang/exceptions/IllegalStateException.h>
+
+using namespace activemq;
+using namespace activemq::state;
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionState::ConnectionState( commands::ConnectionInfo* info ) : disposed(
false ) {
+
+ this->info.reset( info->cloneDataStructure() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionState::~ConnectionState() {
+
+ // TODO - Free all pointers.
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ConnectionState::toString() const {
+
+ if( this->info.get() != NULL ) {
+ return this->info->toString();
+ }
+
+ return "NULL";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ConnectionState::shutdown() {
+
+ if( this->disposed.compareAndSet( false, true ) ) {
+
+ std::vector<SessionState*> values = this->sessions.getValues();
+ std::vector<SessionState*>::iterator iter = values.begin();
+
+ for( ; iter != values.end(); ++iter ) {
+ (*iter)->shutdown();
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ConnectionState::checkShutdown() const {
+
+ if( this->disposed.get() ) {
+ throw decaf::lang::exceptions::IllegalStateException(
+ __FILE__, __LINE__, "Connection already Disposed" );
+ }
+}
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
(added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h Tue
Jan 27 22:58:37 2009
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_CONNECTIONSTATE_H_
+#define _ACTIVEMQ_STATE_CONNECTIONSTATE_H_
+
+#include <activemq/util/Config.h>
+#include <activemq/commands/ConnectionInfo.h>
+#include <activemq/commands/DestinationInfo.h>
+#include <activemq/commands/SessionInfo.h>
+#include <activemq/commands/ConsumerId.h>
+#include <activemq/commands/ProducerId.h>
+#include <activemq/commands/TransactionId.h>
+#include <activemq/state/ConsumerState.h>
+#include <activemq/state/ProducerState.h>
+#include <activemq/state/SessionState.h>
+#include <activemq/state/TransactionState.h>
+
+#include <decaf/util/concurrent/atomic/AtomicBoolean.h>
+#include <decaf/util/Map.h>
+#include <decaf/util/List.h>
+
+#include <string>
+#include <memory>
+
+namespace activemq {
+namespace state {
+
+ class ConnectionState {
+ private:
+
+ std::auto_ptr<commands::ConnectionInfo> info;
+ decaf::util::Map< commands::TransactionId*, TransactionState* >
transactions;
+ decaf::util::Map< commands::SessionId*, SessionState* > sessions;
+ decaf::util::List< commands::DestinationInfo* > tempDestinations;
+ decaf::util::concurrent::atomic::AtomicBoolean disposed;
+
+ public:
+
+ ConnectionState( commands::ConnectionInfo* info );
+
+ virtual ~ConnectionState();
+
+ std::string toString() const;
+
+ const commands::ConnectionInfo* getInfo() const {
+ return this->info.get();
+ }
+
+ void checkShutdown() const;
+
+ void shutdown();
+
+// void reset(ConnectionInfo info) {
+// this.info = info;
+// transactions.clear();
+// sessions.clear();
+// tempDestinations.clear();
+// shutdown.set(false);
+// }
+//
+// void addTempDestination(DestinationInfo info) {
+// checkShutdown();
+// tempDestinations.add(info);
+// }
+//
+// void removeTempDestination(ActiveMQDestination destination) {
+// for (Iterator<DestinationInfo> iter =
tempDestinations.iterator(); iter.hasNext();) {
+// DestinationInfo di = iter.next();
+// if (di.getDestination().equals(destination)) {
+// iter.remove();
+// }
+// }
+// }
+//
+// void addTransactionState(TransactionId id) {
+// checkShutdown();
+// transactions.put(id, new TransactionState(id));
+// }
+//
+// TransactionState getTransactionState(TransactionId id) {
+// return transactions.get(id);
+// }
+//
+// Collection<TransactionState> getTransactionStates() {
+// return transactions.values();
+// }
+//
+// TransactionState removeTransactionState(TransactionId id) {
+// return transactions.remove(id);
+// }
+//
+// void addSession(SessionInfo info) {
+// checkShutdown();
+// sessions.put(info.getSessionId(), new SessionState(info));
+// }
+//
+// SessionState removeSession(SessionId id) {
+// return sessions.remove(id);
+// }
+//
+// SessionState getSessionState(SessionId id) {
+// return sessions.get(id);
+// }
+//
+// ConnectionInfo getInfo() {
+// return info;
+// }
+//
+// Set<SessionId> getSessionIds() {
+// return sessions.keySet();
+// }
+//
+// List<DestinationInfo> getTempDesinations() {
+// return tempDestinations;
+// }
+//
+// Collection<SessionState> getSessionStates() {
+// return sessions.values();
+// }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_CONNECTIONSTATE_H_*/
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
------------------------------------------------------------------------------
svn:eol-style = native
Added:
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.cpp?rev=738290&view=auto
==============================================================================
---
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.cpp
(added)
+++
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.cpp
Tue Jan 27 22:58:37 2009
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ConnectionStateTracker.h"
+
+using namespace activemq;
+using namespace activemq::state;
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionStateTracker::ConnectionStateTracker() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionStateTracker::~ConnectionStateTracker() {
+}
+
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added:
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.h?rev=738290&view=auto
==============================================================================
---
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.h
(added)
+++
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.h
Tue Jan 27 22:58:37 2009
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_CONNECTIONSTATETRACKER_H_
+#define _ACTIVEMQ_STATE_CONNECTIONSTATETRACKER_H_
+
+#include <activemq/util/Config.h>
+#include <activemq/state/CommandVisitorAdapter.h>
+#include <activemq/state/ConnectionState.h>
+#include <activemq/state/ConsumerState.h>
+#include <activemq/state/ProducerState.h>
+#include <activemq/state/SessionState.h>
+#include <activemq/state/TransactionState.h>
+
+namespace activemq {
+namespace state {
+
+ class AMQCPP_API ConnectionStateTracker : public CommandVisitorAdapter {
+ private:
+
+ public:
+
+ ConnectionStateTracker();
+
+ virtual ~ConnectionStateTracker();
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_CONNECTIONSTATETRACKER_H_*/
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionStateTracker.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.cpp?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.cpp
(added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.cpp Tue
Jan 27 22:58:37 2009
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ConsumerState.h"
+
+using namespace activemq;
+using namespace activemq::state;
+
+////////////////////////////////////////////////////////////////////////////////
+ConsumerState::ConsumerState( const commands::ConsumerInfo* info ) {
+
+ this->info.reset( info->cloneDataStructure() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ConsumerState::~ConsumerState() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ConsumerState::toString() const {
+
+ if( this->info.get() != NULL ) {
+ return this->info->toString();
+ }
+
+ return "NULL";
+}
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.h?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.h Tue Jan
27 22:58:37 2009
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_CONSUMERSTATE_H_
+#define _ACTIVEMQ_STATE_CONSUMERSTATE_H_
+
+#include <activemq/util/Config.h>
+
+#include <activemq/commands/ConsumerInfo.h>
+
+#include <string>
+#include <memory>
+
+namespace activemq {
+namespace state {
+
+ class AMQCPP_API ConsumerState {
+ private:
+
+ std::auto_ptr<commands::ConsumerInfo> info;
+
+ public:
+
+ ConsumerState( const commands::ConsumerInfo* );
+
+ virtual ~ConsumerState();
+
+ std::string toString() const;
+
+ const commands::ConsumerInfo* getInfo() const {
+ return this->info.get();
+ }
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_CONSUMERSTATE_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/state/ConsumerState.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.cpp?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.cpp
(added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.cpp Tue
Jan 27 22:58:37 2009
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ProducerState.h"
+
+using namespace activemq;
+using namespace activemq::state;
+
+////////////////////////////////////////////////////////////////////////////////
+ProducerState::ProducerState( const commands::ProducerInfo* info ) {
+
+ this->info.reset( info->cloneDataStructure() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ProducerState::~ProducerState() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ProducerState::toString() const {
+
+ if( this->info.get() != NULL ) {
+ return this->info->toString();
+ }
+
+ return "NULL";
+}
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.h?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.h Tue Jan
27 22:58:37 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_PRODUCERSTATE_H_
+#define _ACTIVEMQ_STATE_PRODUCERSTATE_H_
+
+#include <activemq/util/Config.h>
+
+#include <activemq/commands/ProducerInfo.h>
+
+#include <string>
+#include <memory>
+
+namespace activemq {
+namespace state {
+
+ class AMQCPP_API ProducerState {
+ private:
+
+ std::auto_ptr<commands::ProducerInfo> info;
+
+ public:
+
+ ProducerState( const commands::ProducerInfo* info );
+
+ virtual ~ProducerState();
+
+ std::string toString() const;
+
+ const commands::ProducerInfo* getInfo() const {
+ return this->info.get();
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_PRODUCERSTATE_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/state/ProducerState.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp Tue
Jan 27 22:58:37 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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 <decaf/lang/exceptions/IllegalStateException.h>
+
+using namespace activemq;
+using namespace activemq::state;
+
+////////////////////////////////////////////////////////////////////////////////
+SessionState::SessionState( const commands::SessionInfo* info ) : disposed(
false ) {
+
+ this->info.reset( info->cloneDataStructure() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SessionState::~SessionState() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string SessionState::toString() const {
+
+ if( this->info.get() != NULL ) {
+ return this->info->toString();
+ }
+
+ return "NULL";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SessionState::checkShutdown() const {
+
+ if( this->disposed.get() ) {
+ throw decaf::lang::exceptions::IllegalStateException(
+ __FILE__, __LINE__, "Session already Disposed" );
+ }
+}
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h Tue Jan
27 22:58:37 2009
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_SESSIONSTATE_H_
+#define _ACTIVEMQ_STATE_SESSIONSTATE_H_
+
+#include <activemq/util/Config.h>
+#include <activemq/commands/SessionInfo.h>
+#include <activemq/commands/ConsumerId.h>
+#include <activemq/commands/ProducerId.h>
+#include <activemq/state/ConsumerState.h>
+#include <activemq/state/ProducerState.h>
+
+#include <decaf/util/concurrent/atomic/AtomicBoolean.h>
+#include <decaf/util/Map.h>
+
+#include <string>
+#include <memory>
+
+namespace activemq {
+namespace state {
+
+ class AMQCPP_API SessionState {
+ private:
+
+ std::auto_ptr<commands::SessionInfo> info;
+ decaf::util::Map< commands::ProducerId*, ProducerState* > producers;
+ decaf::util::Map< commands::ConsumerId*, ConsumerState* > consumers;
+ decaf::util::concurrent::atomic::AtomicBoolean disposed;
+
+ public:
+
+ SessionState( const commands::SessionInfo* info );
+
+ virtual ~SessionState();
+
+ std::string toString() const;
+
+ const commands::SessionInfo* getInfo() const {
+ return this->info.get();
+ }
+
+// void addProducer(commands::ProducerInfo info) {
+// checkShutdown();
+// producers.put(info.getProducerId(), new ProducerState(info));
+// }
+//
+// ProducerState removeProducer(commands::ProducerId id) {
+// return producers.remove(id);
+// }
+//
+// void addConsumer(commands::ConsumerInfo info) {
+// checkShutdown();
+// consumers.put(info.getConsumerId(), new ConsumerState(info));
+// }
+//
+// ConsumerState removeConsumer(commands::ConsumerId id) {
+// return consumers.remove(id);
+// }
+//
+// Set<commands::ConsumerId> getConsumerIds() {
+// return consumers.keySet();
+// }
+//
+// Set<commands::ProducerId> getProducerIds() {
+// return producers.keySet();
+// }
+//
+// Collection<ProducerState> getProducerStates() {
+// return producers.values();
+// }
+//
+// ProducerState getProducerState(commands::ProducerId producerId) {
+// return producers.get(producerId);
+// }
+//
+// Collection<ConsumerState> getConsumerStates() {
+// return consumers.values();
+// }
+//
+// ConsumerState getConsumerState( const commands::ConsumerId&
consumerId) {
+// return consumers.get(consumerId);
+// }
+
+ void checkShutdown() const;
+
+ void shutdown() {
+ this->disposed.set( true );
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_SESSIONSTATE_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.cpp?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.cpp Tue Jan 27
22:58:37 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Tracked.h"
+
+#include <activemq/exceptions/ActiveMQException.h>
+
+using namespace activemq;
+using namespace activemq::state;
+using namespace activemq::transport;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+Tracked::Tracked( decaf::lang::Runnable* runnable ) {
+ this->runnable = runnable;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Tracked::onResponses() {
+
+ try {
+
+ if( this->runnable != NULL ) {
+ this->runnable->run();
+ this->runnable = NULL;
+ }
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.h?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.h Tue Jan 27
22:58:37 2009
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_TRACKED_H_
+#define _ACTIVEMQ_STATE_TRACKED_H_
+
+#include <activemq/util/Config.h>
+#include <activemq/transport/Response.h>
+#include <decaf/lang/Runnable.h>
+
+namespace activemq {
+namespace state {
+
+ class AMQCPP_API Tracked : public transport::Response {
+ private:
+
+ decaf::lang::Runnable* runnable;
+
+ public:
+
+ Tracked( decaf::lang::Runnable* runnable );
+
+ virtual ~Tracked() {}
+
+ void onResponses();
+
+ bool isWaitingForResponse() const {
+ return runnable != NULL;
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_TRACKED_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/state/Tracked.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp
(added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp
Tue Jan 27 22:58:37 2009
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TransactionState.h"
+
+#include <decaf/lang/exceptions/IllegalStateException.h>
+
+using namespace activemq;
+using namespace activemq::state;
+using namespace activemq::transport;
+using namespace decaf;
+using namespace decaf::util;
+
+////////////////////////////////////////////////////////////////////////////////
+TransactionState::TransactionState( const commands::TransactionId* id ) :
disposed( false ) {
+
+ this->id.reset( id->cloneDataStructure() );
+ this->prepared = false;
+ this->preparedResult = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+TransactionState::~TransactionState() {
+
+ std::auto_ptr< Iterator<Command*> > iter( this->commands.iterator() );
+
+ while( iter->hasNext() ) {
+ delete iter->next();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string TransactionState::toString() const {
+
+ if( this->id.get() == NULL ) {
+ return this->id->toString();
+ }
+
+ return "NULL";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TransactionState::addCommand( transport::Command* operation ) {
+
+ checkShutdown();
+
+ commands.add( operation->cloneCommand() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TransactionState::checkShutdown() const {
+
+ if( this->disposed.get() ) {
+ throw decaf::lang::exceptions::IllegalStateException(
+ __FILE__, __LINE__, "Transaction already Disposed" );
+ }
+}
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h?rev=738290&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
(added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h Tue
Jan 27 22:58:37 2009
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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_STATE_TRANSACTIONSTATE_H_
+#define _ACTIVEMQ_STATE_TRANSACTIONSTATE_H_
+
+#include <activemq/util/Config.h>
+#include <activemq/transport/Command.h>
+#include <activemq/commands/TransactionId.h>
+
+#include <decaf/util/List.h>
+#include <decaf/util/concurrent/atomic/AtomicBoolean.h>
+
+#include <string>
+#include <memory>
+
+namespace activemq {
+namespace state {
+
+ class AMQCPP_API TransactionState {
+ private:
+
+ decaf::util::List<transport::Command*> commands;
+ std::auto_ptr<commands::TransactionId> id;
+ decaf::util::concurrent::atomic::AtomicBoolean disposed;
+ bool prepared;
+ int preparedResult;
+
+ public:
+
+ TransactionState( const commands::TransactionId* id );
+
+ virtual ~TransactionState();
+
+ std::string toString() const;
+
+ void addCommand( transport::Command* operation );
+
+ void checkShutdown() const;
+
+ void shutdown() {
+ this->disposed.set( true );
+ }
+
+ const decaf::util::List<transport::Command*>& getCommands() {
+ return commands;
+ }
+
+ const commands::TransactionId* getId() const {
+ return id.get();
+ }
+
+ void setPrepared( bool prepared ) {
+ this->prepared = prepared;
+ }
+
+ bool isPrepared() const {
+ return this->prepared;
+ }
+
+ void setPreparedResult( int preparedResult ) {
+ this->preparedResult = preparedResult;
+ }
+
+ int getPreparedResult() const {
+ return this->preparedResult;
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_STATE_TRANSACTIONSTATE_H_*/
Propchange:
activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
------------------------------------------------------------------------------
svn:eol-style = native