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 [8/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/ConnectCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectCommand.h Wed Jul 5 15:27:34 2006
@@ -1,144 +1,144 @@
-/*
- * 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_CONNECTCOMMAND_H_
-#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTCOMMAND_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{
-
- /**
- * Message sent to the broker to connect.
- */
- class ConnectCommand : public AbstractCommand< transport::Command >
- {
- public:
-
- ConnectCommand(void) :
- AbstractCommand<transport::Command>() {
- initialize( getFrame() );
- }
- ConnectCommand( StompFrame* frame ) :
- AbstractCommand<transport::Command>(frame) {
- validate( getFrame() );
- }
- virtual ~ConnectCommand(void) {};
-
- /**
- * Get the login
- * @return char* to login, can be ""
- */
- virtual const char* getLogin(void) const {
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_LOGIN) );
- }
-
- /**
- * Set the login
- * @param password string value
- */
- virtual void setLogin( const std::string& login ){
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_LOGIN) ,
- login );
- }
-
- /**
- * Get the password
- * @return char* to password, can be ""
- */
- virtual const char* getPassword(void) const{
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_PASSWORD) );
- }
-
- /**
- * Set the password
- * @param passwrod string value
- */
- virtual void setPassword( const std::string& password ){
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_PASSWORD) ,
- password );
- }
-
- /**
- * Get the Client Id
- * @return char* to client Id, can be ""
- */
- virtual const char* getClientId(void) const{
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_CLIENT_ID) );
- }
-
- /**
- * Set the Client Id
- * @param client id string value
- */
- virtual void setClientId( const std::string& clientId ){
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_CLIENT_ID) ,
- clientId );
- }
-
- 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::CONNECT ) );
- }
-
- /**
- * 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::CONNECT ) )
- {
- return true;
- }
-
- return false;
- }
-
- };
-
-}}}}
-
-#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTCOMMAND_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_CONNECTCOMMAND_H_
+#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTCOMMAND_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{
+
+ /**
+ * Message sent to the broker to connect.
+ */
+ class ConnectCommand : public AbstractCommand< transport::Command >
+ {
+ public:
+
+ ConnectCommand(void) :
+ AbstractCommand<transport::Command>() {
+ initialize( getFrame() );
+ }
+ ConnectCommand( StompFrame* frame ) :
+ AbstractCommand<transport::Command>(frame) {
+ validate( getFrame() );
+ }
+ virtual ~ConnectCommand(void) {};
+
+ /**
+ * Get the login
+ * @return char* to login, can be ""
+ */
+ virtual const char* getLogin(void) const {
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_LOGIN) );
+ }
+
+ /**
+ * Set the login
+ * @param password string value
+ */
+ virtual void setLogin( const std::string& login ){
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_LOGIN) ,
+ login );
+ }
+
+ /**
+ * Get the password
+ * @return char* to password, can be ""
+ */
+ virtual const char* getPassword(void) const{
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_PASSWORD) );
+ }
+
+ /**
+ * Set the password
+ * @param passwrod string value
+ */
+ virtual void setPassword( const std::string& password ){
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_PASSWORD) ,
+ password );
+ }
+
+ /**
+ * Get the Client Id
+ * @return char* to client Id, can be ""
+ */
+ virtual const char* getClientId(void) const{
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_CLIENT_ID) );
+ }
+
+ /**
+ * Set the Client Id
+ * @param client id string value
+ */
+ virtual void setClientId( const std::string& clientId ){
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_CLIENT_ID) ,
+ clientId );
+ }
+
+ 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::CONNECT ) );
+ }
+
+ /**
+ * 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::CONNECT ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ };
+
+}}}}
+
+#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTCOMMAND_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectedCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectedCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectedCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectedCommand.h Wed Jul 5 15:27:34 2006
@@ -1,101 +1,101 @@
-/*
- * 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_COMMAND_STOMP_COMMANDS_CONNECTEDCOMMAND_H_
-#define ACTIVEMQ_COMMAND_STOMP_COMMANDS_CONNECTEDCOMMAND_H_
-
-#include <activemq/connector/stomp/commands/AbstractCommand.h>
-#include <activemq/connector/stomp/commands/CommandConstants.h>
-#include <activemq/transport/Response.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace commands{
-
- /**
- * The stomp command returned from the broker indicating
- * a connection has been established.
- */
- class ConnectedCommand : public AbstractCommand< transport::Response >
- {
- public:
-
- ConnectedCommand(void) :
- AbstractCommand< transport::Response >() {
- initialize( getFrame() );
- }
- ConnectedCommand( StompFrame* frame ) :
- AbstractCommand< transport::Response >( frame ) {
- validate( getFrame() );
- }
- virtual ~ConnectedCommand(void) {}
-
- /**
- * Get the Session Id
- */
- virtual const char* getSessionId() const {
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_SESSIONID) );
- }
-
- /**
- * Set the Session Id
- */
- virtual void setSessionId( const std::string& session ) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_SESSIONID),
- session );
- }
-
- 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::CONNECTED ) );
- }
-
- /**
- * 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::CONNECTED ) )
- {
- return true;
- }
-
- return false;
- }
-
- };
-
-}}}}
-
-#endif /*ACTIVEMQ_COMMAND_STOMP_COMMANDS_CONNECTEDCOMMAND_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_COMMAND_STOMP_COMMANDS_CONNECTEDCOMMAND_H_
+#define ACTIVEMQ_COMMAND_STOMP_COMMANDS_CONNECTEDCOMMAND_H_
+
+#include <activemq/connector/stomp/commands/AbstractCommand.h>
+#include <activemq/connector/stomp/commands/CommandConstants.h>
+#include <activemq/transport/Response.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+ /**
+ * The stomp command returned from the broker indicating
+ * a connection has been established.
+ */
+ class ConnectedCommand : public AbstractCommand< transport::Response >
+ {
+ public:
+
+ ConnectedCommand(void) :
+ AbstractCommand< transport::Response >() {
+ initialize( getFrame() );
+ }
+ ConnectedCommand( StompFrame* frame ) :
+ AbstractCommand< transport::Response >( frame ) {
+ validate( getFrame() );
+ }
+ virtual ~ConnectedCommand(void) {}
+
+ /**
+ * Get the Session Id
+ */
+ virtual const char* getSessionId() const {
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_SESSIONID) );
+ }
+
+ /**
+ * Set the Session Id
+ */
+ virtual void setSessionId( const std::string& session ) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_SESSIONID),
+ session );
+ }
+
+ 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::CONNECTED ) );
+ }
+
+ /**
+ * 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::CONNECTED ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ };
+
+}}}}
+
+#endif /*ACTIVEMQ_COMMAND_STOMP_COMMANDS_CONNECTEDCOMMAND_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ConnectedCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/DisconnectCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/DisconnectCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/DisconnectCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/DisconnectCommand.h Wed Jul 5 15:27:34 2006
@@ -1,84 +1,84 @@
-/*
- * 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_DISCONNECTCOMMAND_H_
-#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMAND_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{
-
- /**
- * Sent to the broker to disconnect gracefully before closing
- * the transport.
- */
- class DisconnectCommand : public AbstractCommand< transport::Command >
- {
- public:
-
- DisconnectCommand(void) :
- AbstractCommand<transport::Command>() {
- initialize( getFrame() );
- }
- DisconnectCommand( StompFrame* frame ) :
- AbstractCommand<transport::Command>(frame) {
- validate( getFrame() );
- }
- virtual ~DisconnectCommand(void){};
-
- 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::DISCONNECT ) );
- }
-
- /**
- * 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::DISCONNECT ) )
- {
- return true;
- }
-
- return false;
- }
-
- };
-
-}}}}
-
-#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMAND_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_DISCONNECTCOMMAND_H_
+#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMAND_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{
+
+ /**
+ * Sent to the broker to disconnect gracefully before closing
+ * the transport.
+ */
+ class DisconnectCommand : public AbstractCommand< transport::Command >
+ {
+ public:
+
+ DisconnectCommand(void) :
+ AbstractCommand<transport::Command>() {
+ initialize( getFrame() );
+ }
+ DisconnectCommand( StompFrame* frame ) :
+ AbstractCommand<transport::Command>(frame) {
+ validate( getFrame() );
+ }
+ virtual ~DisconnectCommand(void){};
+
+ 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::DISCONNECT ) );
+ }
+
+ /**
+ * 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::DISCONNECT ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ };
+
+}}}}
+
+#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMAND_H_*/
+
+
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/DisconnectCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ErrorCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ErrorCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ErrorCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ErrorCommand.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_CONNECTOR_STOMP_COMMANDS_ERRORCOMMAND_H_
-#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ERRORCOMMAND_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{
-
- /**
- * Message sent from the broker when an error
- * occurs.
- */
- class ErrorCommand : public AbstractCommand< transport::Command >
- {
- public:
-
- ErrorCommand(void) :
- AbstractCommand<transport::Command>() {
- initialize( getFrame() );
- }
- ErrorCommand( StompFrame* frame ) :
- AbstractCommand<transport::Command>(frame) {
- validate( getFrame() );
- }
- virtual ~ErrorCommand(void) {};
-
- /**
- * Get the error message
- */
- virtual const char* getErrorMessage(void) const {
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_MESSAGE) );
- }
-
- /**
- * Set the error message
- */
- virtual void setErrorMessage( const std::string& title ) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_MESSAGE),
- title );
- }
-
- /**
- * Set the Text associated with this Error
- * @param Error Message
- */
- virtual void setErrorDetails( const std::string& text ) {
- setBytes( text.c_str(), text.length() + 1 );
- }
-
- /**
- * Get the Text associated with this Error
- * @return Error Message
- */
- virtual const char* getErrorDetails(void) const {
- return getBytes();
- }
-
- 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::ERROR_CMD ) );
- }
-
- /**
- * 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::ERROR_CMD ) ) &&
- (frame.getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_MESSAGE ) ) ) )
- {
- return true;
- }
-
- return false;
- }
-
- };
-
-}}}}
-
-#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ERRORCOMMAND_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_ERRORCOMMAND_H_
+#define ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ERRORCOMMAND_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{
+
+ /**
+ * Message sent from the broker when an error
+ * occurs.
+ */
+ class ErrorCommand : public AbstractCommand< transport::Command >
+ {
+ public:
+
+ ErrorCommand(void) :
+ AbstractCommand<transport::Command>() {
+ initialize( getFrame() );
+ }
+ ErrorCommand( StompFrame* frame ) :
+ AbstractCommand<transport::Command>(frame) {
+ validate( getFrame() );
+ }
+ virtual ~ErrorCommand(void) {};
+
+ /**
+ * Get the error message
+ */
+ virtual const char* getErrorMessage(void) const {
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_MESSAGE) );
+ }
+
+ /**
+ * Set the error message
+ */
+ virtual void setErrorMessage( const std::string& title ) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_MESSAGE),
+ title );
+ }
+
+ /**
+ * Set the Text associated with this Error
+ * @param Error Message
+ */
+ virtual void setErrorDetails( const std::string& text ) {
+ setBytes( text.c_str(), text.length() + 1 );
+ }
+
+ /**
+ * Get the Text associated with this Error
+ * @return Error Message
+ */
+ virtual const char* getErrorDetails(void) const {
+ return getBytes();
+ }
+
+ 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::ERROR_CMD ) );
+ }
+
+ /**
+ * 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::ERROR_CMD ) ) &&
+ (frame.getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_MESSAGE ) ) ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ };
+
+}}}}
+
+#endif /*ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ERRORCOMMAND_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ErrorCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/MessageCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ReceiptCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ReceiptCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ReceiptCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ReceiptCommand.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_RECEIPTCOMMAND_H_
-#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_RECEIPTCOMMAND_H_
-
-#include <activemq/connector/stomp/commands/AbstractCommand.h>
-#include <activemq/connector/stomp/commands/CommandConstants.h>
-#include <activemq/transport/Response.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace commands{
-
- /**
- * Message sent from the Broker when a receipt is requested
- * for messages that are sent.
- */
- class ReceiptCommand : public AbstractCommand< transport::Response >
- {
- public:
-
- ReceiptCommand(void) :
- AbstractCommand<transport::Response>() {
- initialize( getFrame() );
- }
- ReceiptCommand( StompFrame* frame ) :
- AbstractCommand<transport::Response>(frame) {
- validate( getFrame() );
- }
- virtual ~ReceiptCommand(void) {}
-
- /**
- * Get the receipt id
- */
- virtual const char* getReceiptId(void) const{
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_RECEIPTID) );
- }
-
- /**
- * Set the receipt id
- */
- virtual void setReceiptId( const std::string& id ){
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_RECEIPTID),
- id );
- }
-
- 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::RECEIPT ) );
- }
-
- /**
- * 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::RECEIPT )) &&
- (frame.getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_RECEIPTID ) ) ) )
- {
- return true;
- }
-
- return false;
- }
-
- };
-
-}}}}
-
-#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_RECEIPTCOMMAND_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_RECEIPTCOMMAND_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_RECEIPTCOMMAND_H_
+
+#include <activemq/connector/stomp/commands/AbstractCommand.h>
+#include <activemq/connector/stomp/commands/CommandConstants.h>
+#include <activemq/transport/Response.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+ /**
+ * Message sent from the Broker when a receipt is requested
+ * for messages that are sent.
+ */
+ class ReceiptCommand : public AbstractCommand< transport::Response >
+ {
+ public:
+
+ ReceiptCommand(void) :
+ AbstractCommand<transport::Response>() {
+ initialize( getFrame() );
+ }
+ ReceiptCommand( StompFrame* frame ) :
+ AbstractCommand<transport::Response>(frame) {
+ validate( getFrame() );
+ }
+ virtual ~ReceiptCommand(void) {}
+
+ /**
+ * Get the receipt id
+ */
+ virtual const char* getReceiptId(void) const{
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_RECEIPTID) );
+ }
+
+ /**
+ * Set the receipt id
+ */
+ virtual void setReceiptId( const std::string& id ){
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_RECEIPTID),
+ id );
+ }
+
+ 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::RECEIPT ) );
+ }
+
+ /**
+ * 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::RECEIPT )) &&
+ (frame.getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_RECEIPTID ) ) ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_RECEIPTCOMMAND_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/ReceiptCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompCommand.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompCommand.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompCommand.h Wed Jul 5 15:27:34 2006
@@ -1,111 +1,111 @@
-/*
- * 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_STOMPCOMMAND_H_
-#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_STOMPCOMMAND_H_
-
-#include <activemq/connector/stomp/commands/CommandConstants.h>
-#include <activemq/connector/stomp/marshal/Marshalable.h>
-#include <activemq/connector/stomp/marshal/MarshalException.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace commands{
-
- class StompCommand : public marshal::Marshalable
- {
- 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 ) = 0;
-
- /**
- * 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 = 0;
-
- public:
-
- virtual ~StompCommand(void) {}
-
- /**
- * Sets the Command Id of this Message
- * @param Command Id
- */
- virtual void setCommandId( const unsigned int id ) = 0;
-
- /**
- * Gets the Command Id of this Message
- * @return Command Id
- */
- virtual unsigned int getCommandId(void) const = 0;
-
- /**
- * Set if this Message requires a Response
- * @param true if response is required
- */
- virtual void setResponseRequired( const bool required ) = 0;
-
- /**
- * Is a Response required for this Command
- * @return true if a response is required.
- */
- virtual bool isResponseRequired(void) const = 0;
-
- /**
- * Gets the Correlation Id that is associated with this message
- * @return the Correlation Id
- */
- virtual unsigned int getCorrelationId(void) const = 0;
-
- /**
- * Sets the Correlation Id if this Command
- * @param Id
- */
- virtual void setCorrelationId( const unsigned int corrId ) = 0;
-
- /**
- * Get the Transaction Id of this Command
- * @return the Id of the Transaction
- */
- virtual const char* getTransactionId(void) const = 0;
-
- /**
- * Set the Transaction Id of this Command
- * @param the Id of the Transaction
- */
- virtual void setTransactionId( const std::string& id ) = 0;
-
- /**
- * Retrieve the Stomp Command Id for this message.
- * @return Stomp CommandId enum
- */
- virtual CommandConstants::CommandId getStompCommandId(void) const = 0;
-
- };
-
-}}}}
-
-#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_STOMPCOMMAND_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_STOMPCOMMAND_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_STOMPCOMMAND_H_
+
+#include <activemq/connector/stomp/commands/CommandConstants.h>
+#include <activemq/connector/stomp/marshal/Marshalable.h>
+#include <activemq/connector/stomp/marshal/MarshalException.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+ class StompCommand : public marshal::Marshalable
+ {
+ 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 ) = 0;
+
+ /**
+ * 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 = 0;
+
+ public:
+
+ virtual ~StompCommand(void) {}
+
+ /**
+ * Sets the Command Id of this Message
+ * @param Command Id
+ */
+ virtual void setCommandId( const unsigned int id ) = 0;
+
+ /**
+ * Gets the Command Id of this Message
+ * @return Command Id
+ */
+ virtual unsigned int getCommandId(void) const = 0;
+
+ /**
+ * Set if this Message requires a Response
+ * @param true if response is required
+ */
+ virtual void setResponseRequired( const bool required ) = 0;
+
+ /**
+ * Is a Response required for this Command
+ * @return true if a response is required.
+ */
+ virtual bool isResponseRequired(void) const = 0;
+
+ /**
+ * Gets the Correlation Id that is associated with this message
+ * @return the Correlation Id
+ */
+ virtual unsigned int getCorrelationId(void) const = 0;
+
+ /**
+ * Sets the Correlation Id if this Command
+ * @param Id
+ */
+ virtual void setCorrelationId( const unsigned int corrId ) = 0;
+
+ /**
+ * Get the Transaction Id of this Command
+ * @return the Id of the Transaction
+ */
+ virtual const char* getTransactionId(void) const = 0;
+
+ /**
+ * Set the Transaction Id of this Command
+ * @param the Id of the Transaction
+ */
+ virtual void setTransactionId( const std::string& id ) = 0;
+
+ /**
+ * Retrieve the Stomp Command Id for this message.
+ * @return Stomp CommandId enum
+ */
+ virtual CommandConstants::CommandId getStompCommandId(void) const = 0;
+
+ };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_STOMPCOMMAND_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompCommand.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h Wed Jul 5 15:27:34 2006
@@ -1,400 +1,400 @@
-/*
- * 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_STOMPMESSAGE_H_
-#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_STOMPMESSAGE_H_
-
-#include <activemq/core/ActiveMQMessage.h>
-#include <activemq/core/ActiveMQAckHandler.h>
-#include <activemq/connector/stomp/commands/AbstractCommand.h>
-#include <activemq/transport/Command.h>
-#include <activemq/connector/stomp/StompTopic.h>
-
-#include <activemq/util/Long.h>
-#include <activemq/util/Integer.h>
-#include <activemq/util/Boolean.h>
-
-#include <string>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace commands{
-
- /**
- * Base class for Stomp Commands that represent the Active MQ message
- * types. This class is templated and expects the Template type to be
- * a cms::Message type, Message, TextMessage etc. This class will
- * implement all the general cms:Message methods
- *
- * This class implement AbsractCommand<StompCommnd> and the
- * ActiveMQMessage interface.
- */
- template<typename T>
- class StompMessage :
- public AbstractCommand< transport::Command >,
- public T,
- public core::ActiveMQMessage
- {
- private:
-
- // Core API defined Acknowedge Handler.
- core::ActiveMQAckHandler* ackHandler;
-
- // Cached Destination
- cms::Destination* dest;
-
- public:
-
- StompMessage(void) :
- AbstractCommand< transport::Command >(),
- ackHandler( NULL ) { dest = new StompTopic(); }
- StompMessage( StompFrame* frame ) :
- AbstractCommand< transport::Command >( frame ),
- ackHandler( NULL )
- {
- dest = CommandConstants::toDestination(
- getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION ), "" ) );
- }
-
- virtual ~StompMessage(void) { delete dest; }
-
- /**
- * Gets the properties map for this command.
- * @return Reference to a Properties object
- */
- virtual util::Properties& getProperties(void){
- return getFrame().getProperties();
- }
- virtual const util::Properties& getProperties(void) const{
- return getFrame().getProperties();
- }
-
- /**
- * Get the Correlation Id for this message
- * @return string representation of the correlation Id
- */
- virtual const char* getCMSCorrelationId(void) const {
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_CORRELATIONID ) );
- }
-
- /**
- * Sets the Correlation Id used by this message
- * @param String representing the correlation id.
- */
- virtual void setCMSCorrelationId(const std::string& correlationId) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_CORRELATIONID ) ,
- correlationId );
- }
-
- /**
- * Acknowledges all consumed messages of the session
- * of this consumed message.
- */
- virtual void acknowledge(void) const throw( cms::CMSException ) {
- if(ackHandler != NULL) ackHandler->acknowledgeMessage(this);
- }
-
- /**
- * Sets the DeliveryMode for this message
- * @return DeliveryMode enumerated value.
- */
- virtual cms::Message::DeliveryMode getCMSDeliveryMode(void) const {
- if(!getFrame().getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_PERSISTANT ) ) ) {
- return cms::Message::PERSISTANT;
- }
-
- return (cms::Message::DeliveryMode)(
- util::Integer::parseInt( getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_PERSISTANT ) ) ) );
- }
-
- /**
- * Sets the DeliveryMode for this message
- * @param DeliveryMode enumerated value.
- */
- virtual void setCMSDeliveryMode(cms::Message::DeliveryMode mode) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_PERSISTANT ) ,
- util::Integer::toString((int)mode) );
- }
-
- /**
- * Gets the Destination for this Message
- * @return Destination object
- */
- virtual const cms::Destination& getCMSDestination(void) const{
- return *dest;
- }
-
- /**
- * Sets the Destination for this message
- * @param Destination Object
- */
- virtual void setCMSDestination(const cms::Destination& destination) {
- dest->copy( destination );
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION ),
- dest->toProviderString() );
- }
-
- /**
- * Gets the Expiration Time for this Message
- * @return time value
- */
- virtual long getCMSExpiration(void) const {
- return util::Long::parseLong( getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_EXPIRES ), "0" ) );
- }
-
- /**
- * Sets the Expiration Time for this message
- * @param time value
- */
- virtual void setCMSExpiration(long expireTime) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_EXPIRES) ,
- util::Long::toString( expireTime ) );
- }
-
- /**
- * Gets the CMS Message Id for this Message
- * @return time value
- */
- virtual const char* getCMSMessageId(void) const {
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_MESSAGEID ) );
- }
-
- /**
- * Sets the CMS Message Id for this message
- * @param time value
- */
- virtual void setCMSMessageId(const std::string& id) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_MESSAGEID ),
- id );
- }
-
- /**
- * Gets the Priority Value for this Message
- * @return priority value
- */
- virtual int getCMSPriority(void) const {
- return util::Integer::parseInt( getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_PRIORITY ), "0" ) );
- }
-
- /**
- * Sets the Priority Value for this message
- * @param priority value
- */
- virtual void setCMSPriority(int priority) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_PRIORITY),
- util::Integer::toString( priority ) );
- }
-
- /**
- * Gets the Redelivered Flag for this Message
- * @return redelivered value
- */
- virtual bool getCMSRedelivered(void) const {
- return util::Boolean::parseBoolean( getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_REDELIVERED ),
- "false" ) );
- }
-
- /**
- * Sets the Redelivered Flag for this message
- * @param redelivered value
- */
- virtual void setCMSRedelivered(bool redelivered) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_REDELIVERED ),
- util::Boolean::toString( redelivered ) );
- }
-
- /**
- * Gets the CMS Reply To Address for this Message
- * @return Reply To Value
- */
- virtual const char* getCMSReplyTo(void) const {
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_REPLYTO ) );
- }
-
- /**
- * Sets the CMS Reply To Address for this message
- * @param Reply To value
- */
- virtual void setCMSReplyTo(const std::string& id) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_REPLYTO ),
- id );
- }
-
- /**
- * Gets the Time Stamp for this Message
- * @return time stamp value
- */
- virtual long getCMSTimeStamp(void) const {
- return util::Long::parseLong( getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_TIMESTAMP ), "0" ) );
- }
-
- /**
- * Sets the Time Stamp for this message
- * @param time stamp value
- */
- virtual void setCMSTimeStamp(long timeStamp) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_TIMESTAMP ),
- util::Long::toString( timeStamp ) );
- }
-
- /**
- * Gets the CMS Message Type for this Message
- * @return type value
- */
- virtual const char* getCMSMessageType(void) const {
- return getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_TYPE ) );
- }
-
- /**
- * Sets the CMS Message Type for this message
- * @param type value
- */
- virtual void setCMSMessageType(const std::string& type) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_TYPE ),
- type );
- }
-
- public: // ActiveMQMessage
-
- /**
- * Sets the Acknowledgement Handler that this Message will use
- * when the Acknowledge method is called.
- * @param ActiveMQAckHandler
- */
- virtual void setAckHandler(core::ActiveMQAckHandler* handler) {
- this->ackHandler = handler;
- }
-
- /**
- * Gets the number of times this message has been redelivered.
- * @return redelivery count
- */
- virtual int getRedeliveryCount(void) const {
- return util::Integer::parseInt( getPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_REDELIVERYCOUNT ),
- "0" ) );
- }
-
- /**
- * Sets the count of the number of times this message has been
- * redelivered
- * @param redelivery count
- */
- virtual void setRedeliveryCount(int count) {
- setPropertyValue(
- CommandConstants::toString(
- CommandConstants::HEADER_REDELIVERYCOUNT ),
- util::Integer::toString( count ) );
- }
-
- 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::SEND ) );
- }
-
- /**
- * 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::SEND ) )
- {
- if(frame.getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION ) ) )
- {
- return true;
- }
- }
- else if( frame.getCommand() ==
- CommandConstants::toString( CommandConstants::MESSAGE ) )
- {
- if(frame.getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_DESTINATION ) ) &&
- frame.getProperties().hasProperty(
- CommandConstants::toString(
- CommandConstants::HEADER_MESSAGEID ) ) )
- {
- return true;
- }
- }
-
- return false;
- }
-
- };
-
-}}}}
-
-#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_STOMPMESSAGE_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_STOMPMESSAGE_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_STOMPMESSAGE_H_
+
+#include <activemq/core/ActiveMQMessage.h>
+#include <activemq/core/ActiveMQAckHandler.h>
+#include <activemq/connector/stomp/commands/AbstractCommand.h>
+#include <activemq/transport/Command.h>
+#include <activemq/connector/stomp/StompTopic.h>
+
+#include <activemq/util/Long.h>
+#include <activemq/util/Integer.h>
+#include <activemq/util/Boolean.h>
+
+#include <string>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+ /**
+ * Base class for Stomp Commands that represent the Active MQ message
+ * types. This class is templated and expects the Template type to be
+ * a cms::Message type, Message, TextMessage etc. This class will
+ * implement all the general cms:Message methods
+ *
+ * This class implement AbsractCommand<StompCommnd> and the
+ * ActiveMQMessage interface.
+ */
+ template<typename T>
+ class StompMessage :
+ public AbstractCommand< transport::Command >,
+ public T,
+ public core::ActiveMQMessage
+ {
+ private:
+
+ // Core API defined Acknowedge Handler.
+ core::ActiveMQAckHandler* ackHandler;
+
+ // Cached Destination
+ cms::Destination* dest;
+
+ public:
+
+ StompMessage(void) :
+ AbstractCommand< transport::Command >(),
+ ackHandler( NULL ) { dest = new StompTopic(); }
+ StompMessage( StompFrame* frame ) :
+ AbstractCommand< transport::Command >( frame ),
+ ackHandler( NULL )
+ {
+ dest = CommandConstants::toDestination(
+ getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION ), "" ) );
+ }
+
+ virtual ~StompMessage(void) { delete dest; }
+
+ /**
+ * Gets the properties map for this command.
+ * @return Reference to a Properties object
+ */
+ virtual util::Properties& getProperties(void){
+ return getFrame().getProperties();
+ }
+ virtual const util::Properties& getProperties(void) const{
+ return getFrame().getProperties();
+ }
+
+ /**
+ * Get the Correlation Id for this message
+ * @return string representation of the correlation Id
+ */
+ virtual const char* getCMSCorrelationId(void) const {
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_CORRELATIONID ) );
+ }
+
+ /**
+ * Sets the Correlation Id used by this message
+ * @param String representing the correlation id.
+ */
+ virtual void setCMSCorrelationId(const std::string& correlationId) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_CORRELATIONID ) ,
+ correlationId );
+ }
+
+ /**
+ * Acknowledges all consumed messages of the session
+ * of this consumed message.
+ */
+ virtual void acknowledge(void) const throw( cms::CMSException ) {
+ if(ackHandler != NULL) ackHandler->acknowledgeMessage(this);
+ }
+
+ /**
+ * Sets the DeliveryMode for this message
+ * @return DeliveryMode enumerated value.
+ */
+ virtual cms::Message::DeliveryMode getCMSDeliveryMode(void) const {
+ if(!getFrame().getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_PERSISTANT ) ) ) {
+ return cms::Message::PERSISTANT;
+ }
+
+ return (cms::Message::DeliveryMode)(
+ util::Integer::parseInt( getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_PERSISTANT ) ) ) );
+ }
+
+ /**
+ * Sets the DeliveryMode for this message
+ * @param DeliveryMode enumerated value.
+ */
+ virtual void setCMSDeliveryMode(cms::Message::DeliveryMode mode) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_PERSISTANT ) ,
+ util::Integer::toString((int)mode) );
+ }
+
+ /**
+ * Gets the Destination for this Message
+ * @return Destination object
+ */
+ virtual const cms::Destination& getCMSDestination(void) const{
+ return *dest;
+ }
+
+ /**
+ * Sets the Destination for this message
+ * @param Destination Object
+ */
+ virtual void setCMSDestination(const cms::Destination& destination) {
+ dest->copy( destination );
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION ),
+ dest->toProviderString() );
+ }
+
+ /**
+ * Gets the Expiration Time for this Message
+ * @return time value
+ */
+ virtual long getCMSExpiration(void) const {
+ return util::Long::parseLong( getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_EXPIRES ), "0" ) );
+ }
+
+ /**
+ * Sets the Expiration Time for this message
+ * @param time value
+ */
+ virtual void setCMSExpiration(long expireTime) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_EXPIRES) ,
+ util::Long::toString( expireTime ) );
+ }
+
+ /**
+ * Gets the CMS Message Id for this Message
+ * @return time value
+ */
+ virtual const char* getCMSMessageId(void) const {
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_MESSAGEID ) );
+ }
+
+ /**
+ * Sets the CMS Message Id for this message
+ * @param time value
+ */
+ virtual void setCMSMessageId(const std::string& id) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_MESSAGEID ),
+ id );
+ }
+
+ /**
+ * Gets the Priority Value for this Message
+ * @return priority value
+ */
+ virtual int getCMSPriority(void) const {
+ return util::Integer::parseInt( getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_PRIORITY ), "0" ) );
+ }
+
+ /**
+ * Sets the Priority Value for this message
+ * @param priority value
+ */
+ virtual void setCMSPriority(int priority) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_PRIORITY),
+ util::Integer::toString( priority ) );
+ }
+
+ /**
+ * Gets the Redelivered Flag for this Message
+ * @return redelivered value
+ */
+ virtual bool getCMSRedelivered(void) const {
+ return util::Boolean::parseBoolean( getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_REDELIVERED ),
+ "false" ) );
+ }
+
+ /**
+ * Sets the Redelivered Flag for this message
+ * @param redelivered value
+ */
+ virtual void setCMSRedelivered(bool redelivered) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_REDELIVERED ),
+ util::Boolean::toString( redelivered ) );
+ }
+
+ /**
+ * Gets the CMS Reply To Address for this Message
+ * @return Reply To Value
+ */
+ virtual const char* getCMSReplyTo(void) const {
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_REPLYTO ) );
+ }
+
+ /**
+ * Sets the CMS Reply To Address for this message
+ * @param Reply To value
+ */
+ virtual void setCMSReplyTo(const std::string& id) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_REPLYTO ),
+ id );
+ }
+
+ /**
+ * Gets the Time Stamp for this Message
+ * @return time stamp value
+ */
+ virtual long getCMSTimeStamp(void) const {
+ return util::Long::parseLong( getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_TIMESTAMP ), "0" ) );
+ }
+
+ /**
+ * Sets the Time Stamp for this message
+ * @param time stamp value
+ */
+ virtual void setCMSTimeStamp(long timeStamp) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_TIMESTAMP ),
+ util::Long::toString( timeStamp ) );
+ }
+
+ /**
+ * Gets the CMS Message Type for this Message
+ * @return type value
+ */
+ virtual const char* getCMSMessageType(void) const {
+ return getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_TYPE ) );
+ }
+
+ /**
+ * Sets the CMS Message Type for this message
+ * @param type value
+ */
+ virtual void setCMSMessageType(const std::string& type) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_TYPE ),
+ type );
+ }
+
+ public: // ActiveMQMessage
+
+ /**
+ * Sets the Acknowledgement Handler that this Message will use
+ * when the Acknowledge method is called.
+ * @param ActiveMQAckHandler
+ */
+ virtual void setAckHandler(core::ActiveMQAckHandler* handler) {
+ this->ackHandler = handler;
+ }
+
+ /**
+ * Gets the number of times this message has been redelivered.
+ * @return redelivery count
+ */
+ virtual int getRedeliveryCount(void) const {
+ return util::Integer::parseInt( getPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_REDELIVERYCOUNT ),
+ "0" ) );
+ }
+
+ /**
+ * Sets the count of the number of times this message has been
+ * redelivered
+ * @param redelivery count
+ */
+ virtual void setRedeliveryCount(int count) {
+ setPropertyValue(
+ CommandConstants::toString(
+ CommandConstants::HEADER_REDELIVERYCOUNT ),
+ util::Integer::toString( count ) );
+ }
+
+ 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::SEND ) );
+ }
+
+ /**
+ * 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::SEND ) )
+ {
+ if(frame.getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION ) ) )
+ {
+ return true;
+ }
+ }
+ else if( frame.getCommand() ==
+ CommandConstants::toString( CommandConstants::MESSAGE ) )
+ {
+ if(frame.getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_DESTINATION ) ) &&
+ frame.getProperties().hasProperty(
+ CommandConstants::toString(
+ CommandConstants::HEADER_MESSAGEID ) ) )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_STOMPMESSAGE_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h
------------------------------------------------------------------------------
svn:eol-style = native