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/06 00:27:47 UTC
svn commit: r419365 [9/25] - in /incubator/activemq/trunk:
activemq-core/src/main/java/org/apache/activemq/thread/
activemq-core/src/test/java/org/apache/activemq/openwire/v1/
activemq-cpp/src/main/activemq/concurrent/
activemq-cpp/src/main/activemq/co...
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/SubscribeCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/SubscribeCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/SubscribeCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/SubscribeCommand.h Wed Jul 5 15:27:34 2006
@@ -1,205 +1,205 @@
-/*
- * 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_CONNECTOR_STOMP_COMMANDS_SUBSCRIBECOMMAND_H_
-#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_SUBSCRIBECOMMAND_H_
-
-#include <activemq/connector/stomp/commands/AbstractCommand.h>
-#include <activemq/connector/stomp/commands/CommandConstants.h>
-#include <activemq/transport/Command.h>
-#include <activemq/util/Boolean.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace commands{
-
- /**
- * Command sent to the broker to subscribe to a topic
- * or queue.
- */
- class SubscribeCommand : public AbstractCommand< transport::Command >
- {
- public:
-
- SubscribeCommand(void) :
- AbstractCommand<transport::Command>() {
- initialize( getFrame() );
- }
- SubscribeCommand( StompFrame* frame ) :
- AbstractCommand< transport::Command >( frame ) {
- validate( getFrame() );
- }
- virtual ~SubscribeCommand(void) {}
-
- /**
- * Get the destination
- * @returns the destination Name String
- */
- virtual const char* getDestination(void) const{
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION) );
- }
-
- /**
- * Set the destination
- * @param the destination Name String
- */
- virtual void setDestination( const std::string& dest ){
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION),
- dest );
- }
-
- /**
- * Set the Ack Mode of this Subscription
- * @param mode setting.
- */
- virtual void setAckMode( const CommandConstants::AckMode mode ){
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_ACK),
- CommandConstants::toString( mode ) );
- }
-
- /**
- * Get the Ack Mode of this Subscription
- * @return mode setting.
- */
- virtual CommandConstants::AckMode getAckMode(void) const{
- return CommandConstants::toAckMode(
- getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_ACK) ) );
- }
-
- /**
- * Sets the Message Selector that is associated with this
- * subscribe request
- * @param selector string
- */
- virtual void setMessageSelector( const std::string& selector ) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_SELECTOR),
- selector );
- }
-
- /**
- * Gets the Message Selector that is associated with this
- * subscribe request
- * @returns the selector string
- */
- virtual const char* getMessageSelector(void) const{
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_SELECTOR) );
- }
-
- /**
- * Sets the Subscription Name that is associated with this
- * subscribe request
- * @param Subscription Name
- */
- virtual void setSubscriptionName( const std::string& name ) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_SUBSCRIPTIONNAME),
- name );
- }
-
- /**
- * Gets the Subscription Name that is associated with this
- * subscribe request
- * @returns the Subscription Name
- */
- virtual const char* getSubscriptionName(void) const{
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_SUBSCRIPTIONNAME) );
- }
-
- /**
- * Gets hether or not locally sent messages should be ignored for
- * subscriptions. Set to true to filter out locally sent messages
- * @return NoLocal value
- */
- virtual bool getNoLocal(void) const {
- return util::Boolean::parseBoolean( getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_NOLOCAL ),
- "false" ) );
- }
-
- /**
- * Gets hether or not locally sent messages should be ignored for
- * subscriptions. Set to true to filter out locally sent messages
- * @param NoLocal value
- */
- virtual void setNoLocal( bool noLocal ) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_NOLOCAL ),
- util::Boolean::toString( noLocal ) );
- }
-
- protected:
-
- /**
- * Inheritors are required to override this method to init the
- * frame with data appropriate for the command type.
- * @param Frame to init
- */
- virtual void initialize( StompFrame& frame )
- {
- frame.setCommand( CommandConstants::toString(
- CommandConstants::SUBSCRIBE ) );
-
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_ACK),
- CommandConstants::toString(
- CommandConstants::ACK_AUTO ) );
- }
-
- /**
- * Inheritors are required to override this method to validate
- * the passed stomp frame before it is marshalled or unmarshaled
- * @param Frame to validate
- * @returns true if frame is valid
- */
- virtual bool validate( const StompFrame& frame ) const
- {
- if((frame.getCommand() ==
- CommandConstants::toString( CommandConstants::SUBSCRIBE )) &&
- (frame.getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION ) ) ) )
- {
- return true;
- }
-
- return false;
- }
-
- };
-
-}}}}
-
-#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_SUBSCRIBECOMMAND_H_*/
+/*
+ * 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_CONNECTOR_STOMP_COMMANDS_SUBSCRIBECOMMAND_H_
+#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_SUBSCRIBECOMMAND_H_
+
+#include <activemq/connector/stomp/commands/AbstractCommand.h>
+#include <activemq/connector/stomp/commands/CommandConstants.h>
+#include <activemq/transport/Command.h>
+#include <activemq/util/Boolean.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+ /**
+ * Command sent to the broker to subscribe to a topic
+ * or queue.
+ */
+ class SubscribeCommand : public AbstractCommand< transport::Command >
+ {
+ public:
+
+ SubscribeCommand(void) :
+ AbstractCommand<transport::Command>() {
+ initialize( getFrame() );
+ }
+ SubscribeCommand( StompFrame* frame ) :
+ AbstractCommand< transport::Command >( frame ) {
+ validate( getFrame() );
+ }
+ virtual ~SubscribeCommand(void) {}
+
+ /**
+ * Get the destination
+ * @returns the destination Name String
+ */
+ virtual const char* getDestination(void) const{
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION) );
+ }
+
+ /**
+ * Set the destination
+ * @param the destination Name String
+ */
+ virtual void setDestination( const std::string& dest ){
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION),
+ dest );
+ }
+
+ /**
+ * Set the Ack Mode of this Subscription
+ * @param mode setting.
+ */
+ virtual void setAckMode( const CommandConstants::AckMode mode ){
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_ACK),
+ CommandConstants::toString( mode ) );
+ }
+
+ /**
+ * Get the Ack Mode of this Subscription
+ * @return mode setting.
+ */
+ virtual CommandConstants::AckMode getAckMode(void) const{
+ return CommandConstants::toAckMode(
+ getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_ACK) ) );
+ }
+
+ /**
+ * Sets the Message Selector that is associated with this
+ * subscribe request
+ * @param selector string
+ */
+ virtual void setMessageSelector( const std::string& selector ) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_SELECTOR),
+ selector );
+ }
+
+ /**
+ * Gets the Message Selector that is associated with this
+ * subscribe request
+ * @returns the selector string
+ */
+ virtual const char* getMessageSelector(void) const{
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_SELECTOR) );
+ }
+
+ /**
+ * Sets the Subscription Name that is associated with this
+ * subscribe request
+ * @param Subscription Name
+ */
+ virtual void setSubscriptionName( const std::string& name ) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_SUBSCRIPTIONNAME),
+ name );
+ }
+
+ /**
+ * Gets the Subscription Name that is associated with this
+ * subscribe request
+ * @returns the Subscription Name
+ */
+ virtual const char* getSubscriptionName(void) const{
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_SUBSCRIPTIONNAME) );
+ }
+
+ /**
+ * Gets hether or not locally sent messages should be ignored for
+ * subscriptions. Set to true to filter out locally sent messages
+ * @return NoLocal value
+ */
+ virtual bool getNoLocal(void) const {
+ return util::Boolean::parseBoolean( getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_NOLOCAL ),
+ "false" ) );
+ }
+
+ /**
+ * Gets hether or not locally sent messages should be ignored for
+ * subscriptions. Set to true to filter out locally sent messages
+ * @param NoLocal value
+ */
+ virtual void setNoLocal( bool noLocal ) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_NOLOCAL ),
+ util::Boolean::toString( noLocal ) );
+ }
+
+ protected:
+
+ /**
+ * Inheritors are required to override this method to init the
+ * frame with data appropriate for the command type.
+ * @param Frame to init
+ */
+ virtual void initialize( StompFrame& frame )
+ {
+ frame.setCommand( CommandConstants::toString(
+ CommandConstants::SUBSCRIBE ) );
+
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_ACK),
+ CommandConstants::toString(
+ CommandConstants::ACK_AUTO ) );
+ }
+
+ /**
+ * Inheritors are required to override this method to validate
+ * the passed stomp frame before it is marshalled or unmarshaled
+ * @param Frame to validate
+ * @returns true if frame is valid
+ */
+ virtual bool validate( const StompFrame& frame ) const
+ {
+ if((frame.getCommand() ==
+ CommandConstants::toString( CommandConstants::SUBSCRIBE )) &&
+ (frame.getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION ) ) ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ };
+
+}}}}
+
+#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_SUBSCRIBECOMMAND_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/SubscribeCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/TextMessageCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/TextMessageCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/TextMessageCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/TextMessageCommand.h Wed Jul 5 15:27:34 2006
@@ -1,75 +1,75 @@
-/*
- * 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_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMAND_H_
-#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMAND_H_
-
-#include <cms/TextMessage.h>
-#include <activemq/connector/stomp/commands/StompMessage.h>
-#include <activemq/connector/stomp/commands/CommandConstants.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace commands{
-
- class TextMessageCommand : public StompMessage< cms::TextMessage >
- {
- public:
-
- TextMessageCommand(void) :
- StompMessage< cms::TextMessage >() {
- initialize( getFrame() );
- }
- TextMessageCommand( StompFrame* frame ) :
- StompMessage< cms::TextMessage >( frame ) {
- validate( getFrame() );
- }
- virtual ~TextMessageCommand(void) {}
-
- /**
- * Clonse this message exactly, returns a new instance that the
- * caller is required to delete.
- * @return new copy of this message
- */
- virtual cms::Message* clone(void) const {
- StompFrame* frame = getFrame().clone();
-
- return new TextMessageCommand( frame );
- }
-
- /**
- * Gets the message character buffer.
- * @return The message character buffer.
- */
- virtual const char* getText(void) const throw( cms::CMSException ) {
- return getBytes();
- }
-
- /**
- * Sets the message contents.
- * @param msg The message buffer.
- */
- virtual void setText( const char* msg ) throw( cms::CMSException ) {
- setBytes( msg, strlen(msg) + 1, false );
- }
-
- };
-
-}}}}
-
-#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMAND_H_*/
+/*
+ * 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_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMAND_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMAND_H_
+
+#include <cms/TextMessage.h>
+#include <activemq/connector/stomp/commands/StompMessage.h>
+#include <activemq/connector/stomp/commands/CommandConstants.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+ class TextMessageCommand : public StompMessage< cms::TextMessage >
+ {
+ public:
+
+ TextMessageCommand(void) :
+ StompMessage< cms::TextMessage >() {
+ initialize( getFrame() );
+ }
+ TextMessageCommand( StompFrame* frame ) :
+ StompMessage< cms::TextMessage >( frame ) {
+ validate( getFrame() );
+ }
+ virtual ~TextMessageCommand(void) {}
+
+ /**
+ * Clonse this message exactly, returns a new instance that the
+ * caller is required to delete.
+ * @return new copy of this message
+ */
+ virtual cms::Message* clone(void) const {
+ StompFrame* frame = getFrame().clone();
+
+ return new TextMessageCommand( frame );
+ }
+
+ /**
+ * Gets the message character buffer.
+ * @return The message character buffer.
+ */
+ virtual const char* getText(void) const throw( cms::CMSException ) {
+ return getBytes();
+ }
+
+ /**
+ * Sets the message contents.
+ * @param msg The message buffer.
+ */
+ virtual void setText( const char* msg ) throw( cms::CMSException ) {
+ setBytes( msg, strlen(msg) + 1, false );
+ }
+
+ };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMAND_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/TextMessageCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/UnsubscribeCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/UnsubscribeCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/UnsubscribeCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/UnsubscribeCommand.h Wed Jul 5 15:27:34 2006
@@ -1,104 +1,104 @@
-/*
- * 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_CONNECTOR_STOMP_COMMANDS_UNSUBSCRIBECOMMAND_H_
-#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_UNSUBSCRIBECOMMAND_H_
-
-#include <activemq/connector/stomp/commands/AbstractCommand.h>
-#include <activemq/connector/stomp/commands/CommandConstants.h>
-#include <activemq/transport/Command.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace commands{
-
- /**
- * Command sent to the broker to unsubscribe to a
- * topic or queue.
- */
- class UnsubscribeCommand : public AbstractCommand< transport::Command >
- {
- public:
-
- UnsubscribeCommand(void) :
- AbstractCommand< transport::Command >() {
- initialize( getFrame() );
- }
- UnsubscribeCommand( StompFrame* frame ) :
- AbstractCommand< transport::Command >( frame ) {
- validate( getFrame() );
- }
- virtual ~UnsubscribeCommand(void) {};
-
- /**
- * Get the destination
- */
- virtual const char* getDestination(void) const{
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION) );
- }
-
- /**
- * Set the destination
- */
- virtual void setDestination( const std::string& dest ){
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION) ,
- dest );
- }
-
- protected:
-
- /**
- * Inheritors are required to override this method to init the
- * frame with data appropriate for the command type.
- * @param Frame to init
- */
- virtual void initialize( StompFrame& frame )
- {
- frame.setCommand( CommandConstants::toString(
- CommandConstants::UNSUBSCRIBE ) );
- }
-
- /**
- * Inheritors are required to override this method to validate
- * the passed stomp frame before it is marshalled or unmarshaled
- * @param Frame to validate
- * @returns true if frame is valid
- */
- virtual bool validate( const StompFrame& frame ) const
- {
- if((frame.getCommand() ==
- CommandConstants::toString( CommandConstants::UNSUBSCRIBE )) &&
- (frame.getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION ) ) ) )
- {
- return true;
- }
-
- return false;
- }
-
- };
-
-}}}}
-
-#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_UNSUBSCRIBECOMMAND_H_*/
+/*
+ * 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_CONNECTOR_STOMP_COMMANDS_UNSUBSCRIBECOMMAND_H_
+#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_UNSUBSCRIBECOMMAND_H_
+
+#include <activemq/connector/stomp/commands/AbstractCommand.h>
+#include <activemq/connector/stomp/commands/CommandConstants.h>
+#include <activemq/transport/Command.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+ /**
+ * Command sent to the broker to unsubscribe to a
+ * topic or queue.
+ */
+ class UnsubscribeCommand : public AbstractCommand< transport::Command >
+ {
+ public:
+
+ UnsubscribeCommand(void) :
+ AbstractCommand< transport::Command >() {
+ initialize( getFrame() );
+ }
+ UnsubscribeCommand( StompFrame* frame ) :
+ AbstractCommand< transport::Command >( frame ) {
+ validate( getFrame() );
+ }
+ virtual ~UnsubscribeCommand(void) {};
+
+ /**
+ * Get the destination
+ */
+ virtual const char* getDestination(void) const{
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION) );
+ }
+
+ /**
+ * Set the destination
+ */
+ virtual void setDestination( const std::string& dest ){
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION) ,
+ dest );
+ }
+
+ protected:
+
+ /**
+ * Inheritors are required to override this method to init the
+ * frame with data appropriate for the command type.
+ * @param Frame to init
+ */
+ virtual void initialize( StompFrame& frame )
+ {
+ frame.setCommand( CommandConstants::toString(
+ CommandConstants::UNSUBSCRIBE ) );
+ }
+
+ /**
+ * Inheritors are required to override this method to validate
+ * the passed stomp frame before it is marshalled or unmarshaled
+ * @param Frame to validate
+ * @returns true if frame is valid
+ */
+ virtual bool validate( const StompFrame& frame ) const
+ {
+ if((frame.getCommand() ==
+ CommandConstants::toString( CommandConstants::UNSUBSCRIBE )) &&
+ (frame.getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION ) ) ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ };
+
+}}}}
+
+#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_UNSUBSCRIBECOMMAND_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/UnsubscribeCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/MarshalException.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshalable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshalable.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshalable.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshalable.h Wed Jul 5 15:27:34 2006
@@ -1,49 +1,49 @@
-/*
- * 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_CONNECTOR_STOMP_MARSHAL_MARSHALABLE_H_
-#define _ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALABLE_H_
-
-#include <activemq/connector/stomp/StompFrame.h>
-#include <activemq/connector/stomp/marshal/MarshalException.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace marshal{
-
- class Marshalable
- {
- public:
-
- virtual ~Marshalable(void) {}
-
- /**
- * Marshals the command to a stomp frame.
- * @returns the stomp frame representation of this
- * command.
- * @throws MarshalException if the command is not
- * in a state that can be marshalled.
- */
- virtual const StompFrame& marshal(void) const
- throw ( marshal::MarshalException ) = 0;
-
- };
-
-}}}}
-
-#endif /*_ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALABLE_H_*/
+/*
+ * 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_CONNECTOR_STOMP_MARSHAL_MARSHALABLE_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALABLE_H_
+
+#include <activemq/connector/stomp/StompFrame.h>
+#include <activemq/connector/stomp/marshal/MarshalException.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace marshal{
+
+ class Marshalable
+ {
+ public:
+
+ virtual ~Marshalable(void) {}
+
+ /**
+ * Marshals the command to a stomp frame.
+ * @returns the stomp frame representation of this
+ * command.
+ * @throws MarshalException if the command is not
+ * in a state that can be marshalled.
+ */
+ virtual const StompFrame& marshal(void) const
+ throw ( marshal::MarshalException ) = 0;
+
+ };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALABLE_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshalable.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.cpp Wed Jul 5 15:27:34 2006
@@ -1,115 +1,115 @@
-/*
- * 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/connector/stomp/marshal/Marshaler.h>
-
-#include <activemq/transport/Command.h>
-#include <activemq/connector/stomp/marshal/MarshalException.h>
-#include <activemq/connector/stomp/commands/CommandConstants.h>
-#include <activemq/connector/stomp/commands/AbstractCommand.h>
-#include <activemq/connector/stomp/StompFrame.h>
-
-// Commands we can receive
-#include <activemq/connector/stomp/commands/ConnectedCommand.h>
-#include <activemq/connector/stomp/commands/ReceiptCommand.h>
-#include <activemq/connector/stomp/commands/ErrorCommand.h>
-
-// Message Commands we can receive
-#include <activemq/connector/stomp/commands/MessageCommand.h>
-#include <activemq/connector/stomp/commands/BytesMessageCommand.h>
-#include <activemq/connector/stomp/commands/TextMessageCommand.h>
-
-using namespace activemq;
-using namespace activemq::exceptions;
-using namespace activemq::transport;
-using namespace activemq::connector::stomp;
-using namespace activemq::connector::stomp::commands;
-using namespace activemq::connector::stomp::marshal;
-
-////////////////////////////////////////////////////////////////////////////////
-transport::Command* Marshaler::marshal( StompFrame* frame )
- throw ( MarshalException )
-{
- try
- {
- CommandConstants::CommandId commandId =
- CommandConstants::toCommandId(frame->getCommand().c_str());
- transport::Command* command = NULL;
-
- if(commandId == CommandConstants::CONNECTED){
- command = new ConnectedCommand( frame );
- }
- else if(commandId == CommandConstants::ERROR_CMD){
- command = new ErrorCommand( frame );
- }
- else if(commandId == CommandConstants::RECEIPT){
- command = new ReceiptCommand( frame );
- }
- else if(commandId == CommandConstants::MESSAGE){
- if( !frame->getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_CONTENTLENGTH ) ) )
- {
- command = new TextMessageCommand( frame );
- }
- else
- {
- command = new BytesMessageCommand( frame );
- }
- }
-
- // We either got a command or a response, but if we got neither
- // then complain, something went wrong.
- if(command == NULL)
- {
- throw MarshalException(
- __FILE__, __LINE__,
- "Marshaler::marshal - No Command Created from frame");
- }
-
- return command;
- }
- AMQ_CATCH_RETHROW( MarshalException )
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, MarshalException )
- AMQ_CATCHALL_THROW( MarshalException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-const StompFrame& Marshaler::marshal( const transport::Command* command )
- throw ( MarshalException )
-{
- try
- {
- const Marshalable* marshalable =
- dynamic_cast<const Marshalable*>(command);
-
- // Easy, just get the frame from the command
- if(marshalable != NULL)
- {
- return marshalable->marshal();
- }
- else
- {
- throw MarshalException(
- __FILE__, __LINE__,
- "Marshaler::marshal - Invalid Command Type!");
- }
- }
- AMQ_CATCH_RETHROW( MarshalException )
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, MarshalException )
- AMQ_CATCHALL_THROW( MarshalException )
-}
+/*
+ * 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/connector/stomp/marshal/Marshaler.h>
+
+#include <activemq/transport/Command.h>
+#include <activemq/connector/stomp/marshal/MarshalException.h>
+#include <activemq/connector/stomp/commands/CommandConstants.h>
+#include <activemq/connector/stomp/commands/AbstractCommand.h>
+#include <activemq/connector/stomp/StompFrame.h>
+
+// Commands we can receive
+#include <activemq/connector/stomp/commands/ConnectedCommand.h>
+#include <activemq/connector/stomp/commands/ReceiptCommand.h>
+#include <activemq/connector/stomp/commands/ErrorCommand.h>
+
+// Message Commands we can receive
+#include <activemq/connector/stomp/commands/MessageCommand.h>
+#include <activemq/connector/stomp/commands/BytesMessageCommand.h>
+#include <activemq/connector/stomp/commands/TextMessageCommand.h>
+
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace activemq::transport;
+using namespace activemq::connector::stomp;
+using namespace activemq::connector::stomp::commands;
+using namespace activemq::connector::stomp::marshal;
+
+////////////////////////////////////////////////////////////////////////////////
+transport::Command* Marshaler::marshal( StompFrame* frame )
+ throw ( MarshalException )
+{
+ try
+ {
+ CommandConstants::CommandId commandId =
+ CommandConstants::toCommandId(frame->getCommand().c_str());
+ transport::Command* command = NULL;
+
+ if(commandId == CommandConstants::CONNECTED){
+ command = new ConnectedCommand( frame );
+ }
+ else if(commandId == CommandConstants::ERROR_CMD){
+ command = new ErrorCommand( frame );
+ }
+ else if(commandId == CommandConstants::RECEIPT){
+ command = new ReceiptCommand( frame );
+ }
+ else if(commandId == CommandConstants::MESSAGE){
+ if( !frame->getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_CONTENTLENGTH ) ) )
+ {
+ command = new TextMessageCommand( frame );
+ }
+ else
+ {
+ command = new BytesMessageCommand( frame );
+ }
+ }
+
+ // We either got a command or a response, but if we got neither
+ // then complain, something went wrong.
+ if(command == NULL)
+ {
+ throw MarshalException(
+ __FILE__, __LINE__,
+ "Marshaler::marshal - No Command Created from frame");
+ }
+
+ return command;
+ }
+ AMQ_CATCH_RETHROW( MarshalException )
+ AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, MarshalException )
+ AMQ_CATCHALL_THROW( MarshalException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const StompFrame& Marshaler::marshal( const transport::Command* command )
+ throw ( MarshalException )
+{
+ try
+ {
+ const Marshalable* marshalable =
+ dynamic_cast<const Marshalable*>(command);
+
+ // Easy, just get the frame from the command
+ if(marshalable != NULL)
+ {
+ return marshalable->marshal();
+ }
+ else
+ {
+ throw MarshalException(
+ __FILE__, __LINE__,
+ "Marshaler::marshal - Invalid Command Type!");
+ }
+ }
+ AMQ_CATCH_RETHROW( MarshalException )
+ AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, MarshalException )
+ AMQ_CATCHALL_THROW( MarshalException )
+}
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.h Wed Jul 5 15:27:34 2006
@@ -1,67 +1,67 @@
-/*
- * 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_CONNECTOR_STOMP_MARSHALER_H_
-#define ACTIVEMQ_CONNECTOR_STOMP_MARSHALER_H_
-
-#include <activemq/transport/Command.h>
-#include <activemq/connector/stomp/StompFrame.h>
-#include <activemq/connector/stomp/marshal/MarshalException.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace marshal{
-
- /**
- * Interface for all marshallers between Commands and
- * stomp frames.
- */
- class Marshaler
- {
- public:
-
- Marshaler(void) {}
- virtual ~Marshaler(void) {}
-
- /**
- * Marshall a Stomp Frame to a Stomp Command, the frame is now
- * owned by this Command, caller should not use the frame again.
- * @param Frame to Marshall
- * @return Newly Marshaled Stomp Message
- * @throws MarshalException
- */
- virtual transport::Command* marshal( StompFrame* frame )
- throw ( MarshalException );
-
- /**
- * Marshal a Stomp Command to a Stom Frame, if the command that
- * is past is not castable to a Stomp Command an Exception will
- * be thrown
- * @param The Stomp Command to Marshal
- * @return newly Marshaled Stomp Frame
- * @throws MarshalException
- */
- virtual const StompFrame& marshal(
- const transport::Command* command )
- throw ( MarshalException );
-
- };
-
-}}}}
-
-#endif /*ACTIVEMQ_CONNECTOR_STOMP_MARSHALER_H_*/
+/*
+ * 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_CONNECTOR_STOMP_MARSHALER_H_
+#define ACTIVEMQ_CONNECTOR_STOMP_MARSHALER_H_
+
+#include <activemq/transport/Command.h>
+#include <activemq/connector/stomp/StompFrame.h>
+#include <activemq/connector/stomp/marshal/MarshalException.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace marshal{
+
+ /**
+ * Interface for all marshallers between Commands and
+ * stomp frames.
+ */
+ class Marshaler
+ {
+ public:
+
+ Marshaler(void) {}
+ virtual ~Marshaler(void) {}
+
+ /**
+ * Marshall a Stomp Frame to a Stomp Command, the frame is now
+ * owned by this Command, caller should not use the frame again.
+ * @param Frame to Marshall
+ * @return Newly Marshaled Stomp Message
+ * @throws MarshalException
+ */
+ virtual transport::Command* marshal( StompFrame* frame )
+ throw ( MarshalException );
+
+ /**
+ * Marshal a Stomp Command to a Stom Frame, if the command that
+ * is past is not castable to a Stomp Command an Exception will
+ * be thrown
+ * @param The Stomp Command to Marshal
+ * @return newly Marshaled Stomp Frame
+ * @throws MarshalException
+ */
+ virtual const StompFrame& marshal(
+ const transport::Command* command )
+ throw ( MarshalException );
+
+ };
+
+}}}}
+
+#endif /*ACTIVEMQ_CONNECTOR_STOMP_MARSHALER_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/marshal/Marshaler.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h Wed Jul 5 15:27:34 2006
@@ -1,49 +1,49 @@
-/*
- * 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_CORE_ACTIVEMQACKHANDLER_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQACKHANDLER_H_
-
-#include <cms/CMSException.h>
-
-namespace activemq{
-namespace core{
-
- class ActiveMQMessage;
-
- /**
- * Interface class that is used to give CMS Messages an interface to
- * Ack themselves with.
- */
- class ActiveMQAckHandler
- {
- public:
-
- virtual ~ActiveMQAckHandler(void) {};
-
- /**
- * Method called to acknowledge the message passed
- * @param Message to Acknowlegde
- * @throw CMSException
- */
- virtual void acknowledgeMessage( const ActiveMQMessage* message )
- throw ( cms::CMSException ) = 0;
-
- };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQACKHANDLER_H_*/
+/*
+ * 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_CORE_ACTIVEMQACKHANDLER_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQACKHANDLER_H_
+
+#include <cms/CMSException.h>
+
+namespace activemq{
+namespace core{
+
+ class ActiveMQMessage;
+
+ /**
+ * Interface class that is used to give CMS Messages an interface to
+ * Ack themselves with.
+ */
+ class ActiveMQAckHandler
+ {
+ public:
+
+ virtual ~ActiveMQAckHandler(void) {};
+
+ /**
+ * Method called to acknowledge the message passed
+ * @param Message to Acknowlegde
+ * @throw CMSException
+ */
+ virtual void acknowledgeMessage( const ActiveMQMessage* message )
+ throw ( cms::CMSException ) = 0;
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQACKHANDLER_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp Wed Jul 5 15:27:34 2006
@@ -1,201 +1,201 @@
-/*
- * 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 "ActiveMQConnection.h"
-
-#include <cms/Session.h>
-#include <activemq/core/ActiveMQSession.h>
-#include <activemq/core/ActiveMQConsumer.h>
-#include <activemq/exceptions/NullPointerException.h>
-
-using namespace cms;
-using namespace activemq;
-using namespace activemq::core;
-using namespace activemq::connector;
-using namespace activemq::exceptions;
-using namespace std;
-
-////////////////////////////////////////////////////////////////////////////////
-ActiveMQConnection::ActiveMQConnection(ActiveMQConnectionData* connectionData)
-{
- this->connectionData = connectionData;
- this->started = false;
- this->exceptionListener = NULL;
-
- // We want to be the sink for all messages from the Connector
- connectionData->getConnector()->setConsumerMessageListener( this );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ActiveMQConnection::~ActiveMQConnection(void)
-{
- try
- {
- close();
- }
- AMQ_CATCH_NOTHROW( ActiveMQException )
- AMQ_CATCHALL_NOTHROW( )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-cms::Session* ActiveMQConnection::createSession(void)
- throw ( cms::CMSException )
-{
- try
- {
- return this->createSession( Session::AutoAcknowledge );
- }
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-cms::Session* ActiveMQConnection::createSession(
- cms::Session::AcknowledgeMode ackMode )
- throw ( cms::CMSException )
-{
- try
- {
- return new ActiveMQSession(
- connectionData->getConnector()->createSession( ackMode ),
- connectionData->getProperties(),
- this );
- }
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string ActiveMQConnection::getClientId(void) const
-{
- return connectionData->getConnector()->getClientId();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::close(void) throw ( cms::CMSException )
-{
- try
- {
- // Once current deliveries are done this stops the delivery
- // of any new messages.
- started = false;
-
- // Destroy the connection data
- delete connectionData;
- connectionData = NULL;
- }
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::start(void) throw ( cms::CMSException )
-{
- // This starts or restarts the delivery of all incomming messages
- // messages delivered while this connection is stopped are dropped
- // and not acknowledged.
- started = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::stop(void) throw ( cms::CMSException )
-{
- // Once current deliveries are done this stops the delivery of any
- // new messages.
- started = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::addMessageListener( const unsigned int consumerId,
- ActiveMQMessageListener* listener )
-{
- // Place in Map
- synchronized(&mutex)
- {
- consumers[consumerId] = listener;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::removeMessageListener( const unsigned int consumerId )
-{
- // Remove from Map
- synchronized(&mutex)
- {
- consumers.erase( consumerId );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::onConsumerMessage( connector::ConsumerInfo* consumer,
- core::ActiveMQMessage* message )
-{
- try
- {
- if( connectionData == NULL)
- {
- NullPointerException ex(
- __FILE__, __LINE__,
- "ActiveMQConnection::onConsumerMessage - "
- "Connection Data Null, could be closed." );
-
- fire( ex );
-
- return;
- }
-
- // When not started we drop incomming messages
- if( !started )
- {
- // Indicate to Broker that we received the message, but it
- // was not consumed.
- connectionData->getConnector()->acknowledge(
- consumer->getSessionInfo(),
- (Message*)message,
- Connector::DeliveredAck );
-
- // Delete the message here
- delete message;
-
- return;
- }
-
- // Started, so lock map and dispatch the message.
- synchronized(&mutex)
- {
- if(consumers.find(consumer->getConsumerId()) != consumers.end())
- {
- consumers[consumer->getConsumerId()]->
- onActiveMQMessage( message );
- }
- }
- }
- catch( exceptions::ActiveMQException& ex )
- {
- ex.setMark( __FILE__, __LINE__ );
- fire( ex );
- }
- catch( ... )
- {
- exceptions::ActiveMQException ex(
- __FILE__, __LINE__,
- "IOTransport::run - caught unknown exception" );
- fire( ex );
- }
-
-}
-
+/*
+ * 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 "ActiveMQConnection.h"
+
+#include <cms/Session.h>
+#include <activemq/core/ActiveMQSession.h>
+#include <activemq/core/ActiveMQConsumer.h>
+#include <activemq/exceptions/NullPointerException.h>
+
+using namespace cms;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::connector;
+using namespace activemq::exceptions;
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQConnection::ActiveMQConnection(ActiveMQConnectionData* connectionData)
+{
+ this->connectionData = connectionData;
+ this->started = false;
+ this->exceptionListener = NULL;
+
+ // We want to be the sink for all messages from the Connector
+ connectionData->getConnector()->setConsumerMessageListener( this );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQConnection::~ActiveMQConnection(void)
+{
+ try
+ {
+ close();
+ }
+ AMQ_CATCH_NOTHROW( ActiveMQException )
+ AMQ_CATCHALL_NOTHROW( )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::Session* ActiveMQConnection::createSession(void)
+ throw ( cms::CMSException )
+{
+ try
+ {
+ return this->createSession( Session::AutoAcknowledge );
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::Session* ActiveMQConnection::createSession(
+ cms::Session::AcknowledgeMode ackMode )
+ throw ( cms::CMSException )
+{
+ try
+ {
+ return new ActiveMQSession(
+ connectionData->getConnector()->createSession( ackMode ),
+ connectionData->getProperties(),
+ this );
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQConnection::getClientId(void) const
+{
+ return connectionData->getConnector()->getClientId();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnection::close(void) throw ( cms::CMSException )
+{
+ try
+ {
+ // Once current deliveries are done this stops the delivery
+ // of any new messages.
+ started = false;
+
+ // Destroy the connection data
+ delete connectionData;
+ connectionData = NULL;
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnection::start(void) throw ( cms::CMSException )
+{
+ // This starts or restarts the delivery of all incomming messages
+ // messages delivered while this connection is stopped are dropped
+ // and not acknowledged.
+ started = true;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnection::stop(void) throw ( cms::CMSException )
+{
+ // Once current deliveries are done this stops the delivery of any
+ // new messages.
+ started = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnection::addMessageListener( const unsigned int consumerId,
+ ActiveMQMessageListener* listener )
+{
+ // Place in Map
+ synchronized(&mutex)
+ {
+ consumers[consumerId] = listener;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnection::removeMessageListener( const unsigned int consumerId )
+{
+ // Remove from Map
+ synchronized(&mutex)
+ {
+ consumers.erase( consumerId );
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnection::onConsumerMessage( connector::ConsumerInfo* consumer,
+ core::ActiveMQMessage* message )
+{
+ try
+ {
+ if( connectionData == NULL)
+ {
+ NullPointerException ex(
+ __FILE__, __LINE__,
+ "ActiveMQConnection::onConsumerMessage - "
+ "Connection Data Null, could be closed." );
+
+ fire( ex );
+
+ return;
+ }
+
+ // When not started we drop incomming messages
+ if( !started )
+ {
+ // Indicate to Broker that we received the message, but it
+ // was not consumed.
+ connectionData->getConnector()->acknowledge(
+ consumer->getSessionInfo(),
+ (Message*)message,
+ Connector::DeliveredAck );
+
+ // Delete the message here
+ delete message;
+
+ return;
+ }
+
+ // Started, so lock map and dispatch the message.
+ synchronized(&mutex)
+ {
+ if(consumers.find(consumer->getConsumerId()) != consumers.end())
+ {
+ consumers[consumer->getConsumerId()]->
+ onActiveMQMessage( message );
+ }
+ }
+ }
+ catch( exceptions::ActiveMQException& ex )
+ {
+ ex.setMark( __FILE__, __LINE__ );
+ fire( ex );
+ }
+ catch( ... )
+ {
+ exceptions::ActiveMQException ex(
+ __FILE__, __LINE__,
+ "IOTransport::run - caught unknown exception" );
+ fire( ex );
+ }
+
+}
+
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h Wed Jul 5 15:27:34 2006
@@ -1,179 +1,179 @@
-/*
- * 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_CORE_ACTIVEMQCONNECTION_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTION_H_
-
-#include <cms/Connection.h>
-#include <cms/ExceptionListener.h>
-#include <activemq/concurrent/Mutex.h>
-#include <activemq/core/ActiveMQConnectionData.h>
-#include <activemq/core/ActiveMQMessageListener.h>
-#include <activemq/core/ActiveMQMessage.h>
-#include <activemq/connector/ConsumerMessageListener.h>
-#include <activemq/util/Properties.h>
-
-#include <map>
-#include <string>
-
-namespace activemq{
-namespace core{
-
- class cms::Session;
- class ActiveMQConsumer;
-
- class ActiveMQConnection :
- public cms::Connection,
- public connector::ConsumerMessageListener
- {
- private:
-
- // the registered exception listener
- cms::ExceptionListener* exceptionListener;
-
- // All the data that is used to connect this Connection
- ActiveMQConnectionData* connectionData;
-
- // Indicates if this Connection is started
- bool started;
-
- // Map of Consumer Ids to ActiveMQMessageListeners
- std::map<unsigned int, ActiveMQMessageListener*> consumers;
-
- // Mutex to lock the Consumers Map
- concurrent::Mutex mutex;
-
- public:
-
- /**
- * Constructor
- */
- ActiveMQConnection(ActiveMQConnectionData* connectionData);
-
- /**
- * Destructor
- */
- virtual ~ActiveMQConnection(void);
-
- public: // Connection Interface Methods
-
- /**
- * Creates a new Session to work for this Connection
- */
- virtual cms::Session* createSession(void) throw ( cms::CMSException );
-
- /**
- * Creates a new Session to work for this Connection using the
- * specified acknowledgment mode
- * @param the Acknowledgement Mode to use.
- */
- virtual cms::Session* createSession(cms::Session::AcknowledgeMode ackMode)
- throw ( cms::CMSException );
-
- /**
- * Get the Client Id for this session
- * @return string version of Client Id
- */
- virtual std::string getClientId(void) const;
-
- /**
- * Retrieves the Connection Data object for this object.
- * @return pointer to a connection data object.
- */
- virtual ActiveMQConnectionData* getConnectionData(void){
- return connectionData;
- }
-
- /**
- * Gets the registered Exception Listener for this connection
- * @return pointer to an exception listnener or NULL
- */
- virtual cms::ExceptionListener* getExceptionListener(void) const{
- return exceptionListener; };
-
- /**
- * Sets the registed Exception Listener for this connection
- * @param pointer to and <code>ExceptionListener</code>
- */
- virtual void setExceptionListener(cms::ExceptionListener* listener){
- exceptionListener = listener; };
-
- /**
- * Close the currently open connection
- * @throws CMSException
- */
- virtual void close(void) throw ( cms::CMSException );
-
- /**
- * Starts or (restarts) a connections delivery of incoming messages
- * @throws CMSException
- */
- virtual void start(void) throw ( cms::CMSException );
-
- /**
- * Stop the flow of incoming messages
- * @throws CMSException
- */
- virtual void stop(void) throw ( cms::CMSException );
-
- public: // ActiveMQConnection Methods
-
- /**
- * Adds the ActiveMQMessageListener to the Mapping of Consumer Id's
- * to listeners, all message to that id will be routed to the given
- * listener
- * @param Consumer Id String
- * @param ActiveMQMessageListener Pointer
- */
- virtual void addMessageListener(const unsigned int consumerId,
- ActiveMQMessageListener* listener);
-
- /**
- * Remove the Listener for the specified Consumer Id
- * @param Consumer Id string
- */
- virtual void removeMessageListener(const unsigned int consumerId);
-
- private:
-
- /**
- * Notify the excpetion listener
- */
- void fire( exceptions::ActiveMQException& ex )
- {
- if( exceptionListener != NULL )
- {
- try
- {
- exceptionListener->onException( ex );
- }
- catch(...){}
- }
- }
-
- /**
- * Called to dispatch a message to a particular consumer.
- * @param consumer the target consumer of the dispatch.
- * @param msg the message to be dispatched.
- */
- virtual void onConsumerMessage( connector::ConsumerInfo* consumer,
- core::ActiveMQMessage* message );
-
- };
-
-}}
-
-#endif /*ACTIVEMQCONNECTION_H_*/
+/*
+ * 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_CORE_ACTIVEMQCONNECTION_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTION_H_
+
+#include <cms/Connection.h>
+#include <cms/ExceptionListener.h>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/core/ActiveMQConnectionData.h>
+#include <activemq/core/ActiveMQMessageListener.h>
+#include <activemq/core/ActiveMQMessage.h>
+#include <activemq/connector/ConsumerMessageListener.h>
+#include <activemq/util/Properties.h>
+
+#include <map>
+#include <string>
+
+namespace activemq{
+namespace core{
+
+ class cms::Session;
+ class ActiveMQConsumer;
+
+ class ActiveMQConnection :
+ public cms::Connection,
+ public connector::ConsumerMessageListener
+ {
+ private:
+
+ // the registered exception listener
+ cms::ExceptionListener* exceptionListener;
+
+ // All the data that is used to connect this Connection
+ ActiveMQConnectionData* connectionData;
+
+ // Indicates if this Connection is started
+ bool started;
+
+ // Map of Consumer Ids to ActiveMQMessageListeners
+ std::map<unsigned int, ActiveMQMessageListener*> consumers;
+
+ // Mutex to lock the Consumers Map
+ concurrent::Mutex mutex;
+
+ public:
+
+ /**
+ * Constructor
+ */
+ ActiveMQConnection(ActiveMQConnectionData* connectionData);
+
+ /**
+ * Destructor
+ */
+ virtual ~ActiveMQConnection(void);
+
+ public: // Connection Interface Methods
+
+ /**
+ * Creates a new Session to work for this Connection
+ */
+ virtual cms::Session* createSession(void) throw ( cms::CMSException );
+
+ /**
+ * Creates a new Session to work for this Connection using the
+ * specified acknowledgment mode
+ * @param the Acknowledgement Mode to use.
+ */
+ virtual cms::Session* createSession(cms::Session::AcknowledgeMode ackMode)
+ throw ( cms::CMSException );
+
+ /**
+ * Get the Client Id for this session
+ * @return string version of Client Id
+ */
+ virtual std::string getClientId(void) const;
+
+ /**
+ * Retrieves the Connection Data object for this object.
+ * @return pointer to a connection data object.
+ */
+ virtual ActiveMQConnectionData* getConnectionData(void){
+ return connectionData;
+ }
+
+ /**
+ * Gets the registered Exception Listener for this connection
+ * @return pointer to an exception listnener or NULL
+ */
+ virtual cms::ExceptionListener* getExceptionListener(void) const{
+ return exceptionListener; };
+
+ /**
+ * Sets the registed Exception Listener for this connection
+ * @param pointer to and <code>ExceptionListener</code>
+ */
+ virtual void setExceptionListener(cms::ExceptionListener* listener){
+ exceptionListener = listener; };
+
+ /**
+ * Close the currently open connection
+ * @throws CMSException
+ */
+ virtual void close(void) throw ( cms::CMSException );
+
+ /**
+ * Starts or (restarts) a connections delivery of incoming messages
+ * @throws CMSException
+ */
+ virtual void start(void) throw ( cms::CMSException );
+
+ /**
+ * Stop the flow of incoming messages
+ * @throws CMSException
+ */
+ virtual void stop(void) throw ( cms::CMSException );
+
+ public: // ActiveMQConnection Methods
+
+ /**
+ * Adds the ActiveMQMessageListener to the Mapping of Consumer Id's
+ * to listeners, all message to that id will be routed to the given
+ * listener
+ * @param Consumer Id String
+ * @param ActiveMQMessageListener Pointer
+ */
+ virtual void addMessageListener(const unsigned int consumerId,
+ ActiveMQMessageListener* listener);
+
+ /**
+ * Remove the Listener for the specified Consumer Id
+ * @param Consumer Id string
+ */
+ virtual void removeMessageListener(const unsigned int consumerId);
+
+ private:
+
+ /**
+ * Notify the excpetion listener
+ */
+ void fire( exceptions::ActiveMQException& ex )
+ {
+ if( exceptionListener != NULL )
+ {
+ try
+ {
+ exceptionListener->onException( ex );
+ }
+ catch(...){}
+ }
+ }
+
+ /**
+ * Called to dispatch a message to a particular consumer.
+ * @param consumer the target consumer of the dispatch.
+ * @param msg the message to be dispatched.
+ */
+ virtual void onConsumerMessage( connector::ConsumerInfo* consumer,
+ core::ActiveMQMessage* message );
+
+ };
+
+}}
+
+#endif /*ACTIVEMQCONNECTION_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionData.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionData.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionData.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionData.h Wed Jul 5 15:27:34 2006
@@ -1,120 +1,120 @@
-/*
- * 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_CORE_ACTIVEMQCONNECTIONDATA_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONDATA_H_
-
-#include <activemq/connector/Connector.h>
-#include <activemq/transport/Transport.h>
-#include <activemq/exceptions/IllegalArgumentException.h>
-#include <activemq/util/Properties.h>
-
-namespace activemq{
-namespace core{
-
- /**
- * Container of the Data that is needed when creating a new connection
- * object. Each ActiveMQConnection owns one of these objects. This
- * object knows how to clean up the Connection Dependencies correctly
- */
- class ActiveMQConnectionData
- {
- private:
-
- // Connector Object
- connector::Connector* connector;
-
- // Transport we are using
- transport::Transport* transport;
-
- // Properties used to configure this connection.
- util::Properties* properties;
-
- public:
-
- /**
- * Creates a new Connection Data object, passing it the data that
- * it will manage for the parent connection object.
- * @param A connector instance
- * @param A Socket instance
- * @param A Transport instance
- * @throw IllegalArgumentException if an element is NULL
- */
- ActiveMQConnectionData( connector::Connector* connector,
- transport::Transport* transport,
- util::Properties* properties )
- {
- if( connector == NULL ||
- transport == NULL ||
- properties == NULL )
- {
- throw exceptions::IllegalArgumentException(
- __FILE__, __LINE__,
- "ActiveMQConnectionData::ActiveMQConnectionData - "
- "Required Parameter was NULL.");
- }
-
- this->connector = connector;
- this->transport = transport;
- this->properties = properties;
- }
-
- virtual ~ActiveMQConnectionData(void)
- {
- try
- {
- connector->close();
- delete connector;
-
- transport->close();
- delete transport;
-
- delete properties;
- }
- AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
- AMQ_CATCHALL_NOTHROW( )
- }
-
- /**
- * Get the Connector that this Connection Data object holds
- * @return Connector Pointer
- */
- virtual connector::Connector* getConnector(void){
- return connector;
- }
-
- /**
- * Get the Connector that this Connection Data object holds
- * @return Connector Pointer
- */
- virtual transport::Transport* getTransport(void){
- return transport;
- }
-
- /**
- * Gets a reference to the properties that were used to configure
- * this Connection.
- * @return Properties object reference.
- */
- virtual const util::Properties& getProperties(void) const {
- return *properties;
- }
-
- };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONDATA_H_*/
+/*
+ * 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_CORE_ACTIVEMQCONNECTIONDATA_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONDATA_H_
+
+#include <activemq/connector/Connector.h>
+#include <activemq/transport/Transport.h>
+#include <activemq/exceptions/IllegalArgumentException.h>
+#include <activemq/util/Properties.h>
+
+namespace activemq{
+namespace core{
+
+ /**
+ * Container of the Data that is needed when creating a new connection
+ * object. Each ActiveMQConnection owns one of these objects. This
+ * object knows how to clean up the Connection Dependencies correctly
+ */
+ class ActiveMQConnectionData
+ {
+ private:
+
+ // Connector Object
+ connector::Connector* connector;
+
+ // Transport we are using
+ transport::Transport* transport;
+
+ // Properties used to configure this connection.
+ util::Properties* properties;
+
+ public:
+
+ /**
+ * Creates a new Connection Data object, passing it the data that
+ * it will manage for the parent connection object.
+ * @param A connector instance
+ * @param A Socket instance
+ * @param A Transport instance
+ * @throw IllegalArgumentException if an element is NULL
+ */
+ ActiveMQConnectionData( connector::Connector* connector,
+ transport::Transport* transport,
+ util::Properties* properties )
+ {
+ if( connector == NULL ||
+ transport == NULL ||
+ properties == NULL )
+ {
+ throw exceptions::IllegalArgumentException(
+ __FILE__, __LINE__,
+ "ActiveMQConnectionData::ActiveMQConnectionData - "
+ "Required Parameter was NULL.");
+ }
+
+ this->connector = connector;
+ this->transport = transport;
+ this->properties = properties;
+ }
+
+ virtual ~ActiveMQConnectionData(void)
+ {
+ try
+ {
+ connector->close();
+ delete connector;
+
+ transport->close();
+ delete transport;
+
+ delete properties;
+ }
+ AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_NOTHROW( )
+ }
+
+ /**
+ * Get the Connector that this Connection Data object holds
+ * @return Connector Pointer
+ */
+ virtual connector::Connector* getConnector(void){
+ return connector;
+ }
+
+ /**
+ * Get the Connector that this Connection Data object holds
+ * @return Connector Pointer
+ */
+ virtual transport::Transport* getTransport(void){
+ return transport;
+ }
+
+ /**
+ * Gets a reference to the properties that were used to configure
+ * this Connection.
+ * @return Properties object reference.
+ */
+ virtual const util::Properties& getProperties(void) const {
+ return *properties;
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONDATA_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionData.h
------------------------------------------------------------------------------
svn:eol-style = native