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 [10/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/c...

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp Wed Jul  5 15:27:34 2006
@@ -1,245 +1,245 @@
-/*
-* 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 "ActiveMQConnectionFactory.h"
-
-#include <activemq/util/Guid.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/connector/ConnectorFactoryMap.h>
-#include <activemq/network/SocketFactory.h>
-#include <activemq/transport/TransportFactoryMap.h>
-#include <activemq/network/Socket.h>
-#include <activemq/exceptions/NullPointerException.h>
-#include <activemq/core/ActiveMQConnection.h>
-#include <activemq/util/StringTokenizer.h>
-#include <activemq/support/LibraryInit.h>
-
-using namespace std;
-using namespace activemq;
-using namespace activemq::core;
-using namespace activemq::util;
-using namespace activemq::connector;
-using namespace activemq::exceptions;
-using namespace activemq::network;
-using namespace activemq::transport;
-
-////////////////////////////////////////////////////////////////////////////////
-ActiveMQConnectionFactory::ActiveMQConnectionFactory(void)
-{
-    brokerURL = "tcp://localhost:61616";
-    
-    this->username = "";
-    this->password = "";
-    this->clientId = "";
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ActiveMQConnectionFactory::ActiveMQConnectionFactory(const std::string& url,
-                                                     const std::string& username,
-                                                     const std::string& password,
-                                                     const std::string& clientId)
-{
-    brokerURL = url;
-
-    this->username = username;
-    this->password = password;
-    this->clientId = clientId;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-cms::Connection* ActiveMQConnectionFactory::createConnection(void) 
-throw ( cms::CMSException )
-{
-    return createConnection(username, password);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-cms::Connection* ActiveMQConnectionFactory::createConnection(
-    const std::string& username,
-    const std::string& password,
-    const std::string& clientId ) 
-       throw ( cms::CMSException )
-{
-    // Declared here so that they can be deleted in the catch block
-    SimpleProperties* properties = NULL;
-    Transport* transport = NULL;
-    Connector* connector = NULL;
-    ActiveMQConnectionData* connectionData = NULL;
-    ActiveMQConnection* connection = NULL;
-    
-    this->username = username;
-    this->password = password;
-    this->clientId = clientId;
-
-    try
-    {
-        properties = new SimpleProperties;
-
-        // if no Client Id specified, create one
-        if( this->clientId == "" )
-        {
-            this->clientId = Guid::createGUIDString();
-        }
-
-        // Store login data in the properties
-        properties->setProperty( "username", this->username );
-        properties->setProperty( "password", this->password );
-        properties->setProperty( "clientId", this->clientId );
-
-        // Parse out the properties from the URI
-        parseURL( brokerURL, *properties );
-
-        // Create the Transport that the Connector will use.
-        string factoryName = 
-            properties->getProperty( "transport", "tcp" );
-        TransportFactory* factory = 
-            TransportFactoryMap::getInstance().lookup( factoryName );
-        if( factory == NULL ){
-            throw ActiveMQException( 
-                __FILE__, __LINE__, 
-                "ActiveMQConnectionFactory::createConnection - "
-                "unknown transport factory");
-        }
-        
-        // Create the transport.
-        transport = factory->createTransport( *properties );
-        if( transport == NULL ){
-            throw ActiveMQException( 
-                __FILE__, __LINE__, 
-                "ActiveMQConnectionFactory::createConnection - "
-                "failed creating new Transport");
-        }
-
-        // What wire format are we using, defaults to Stomp
-        std::string wireFormat = 
-            properties->getProperty( "wireFormat", "stomp" );
-
-        // Now try and find a factory to create the Connector
-        ConnectorFactory* connectorfactory = 
-            ConnectorFactoryMap::getInstance()->lookup( wireFormat );
-
-        if( connectorfactory == NULL )
-        {
-            throw NullPointerException(
-                __FILE__, __LINE__,
-                "ActiveMQConnectionFactory::createConnection - "
-                "Connector for Wire Format not registered in Map");
-        }
-
-        // Create the Connector.
-        connector = connectorfactory->createConnector( *properties, transport );
-
-        if(connector == NULL)
-        {
-            throw NullPointerException(
-                __FILE__, __LINE__,
-                "ActiveMQConnectionFactory::createConnection - "
-                "Failed to Create the Connector");
-        }
-        
-        // Start the Connector
-        connector->start();
-
-        // Create Holder and store the data for the Connection
-        connectionData = new ActiveMQConnectionData(
-            connector, transport, properties );
-
-        // Create and Return the new connection object.
-        connection = new ActiveMQConnection( connectionData );
-        
-        return connection;
-    }
-    catch( exceptions::ActiveMQException& ex )
-    {
-        ex.setMark( __FILE__, __LINE__ );
-
-        delete connection;
-        delete connector;
-        delete transport;
-        delete properties;
-        
-        throw ex;
-    }
-    catch( ... )
-    {
-        exceptions::ActiveMQException ex( 
-           __FILE__, __LINE__, 
-           "ActiveMQConnectionFactory::create - "
-           "caught unknown exception" );
-
-        delete connection;
-        delete connector;
-        delete transport;
-        delete properties;
-
-        throw ex;
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnectionFactory::parseURL(const std::string& URI, 
-                                         Properties& properties)
-    throw ( exceptions::IllegalArgumentException )
-{
-    try
-    {
-        StringTokenizer tokenizer(URI, ":/");
-    
-        std::vector<std::string> tokens;
-    
-        // Require that there be three tokens at the least, these are
-        // transport, url, port.
-        if(tokenizer.countTokens() < 3)
-        {
-            throw exceptions::IllegalArgumentException(
-                __FILE__, __LINE__,
-                (string("ActiveMQConnectionFactory::parseURL - "
-                        "Marlformed URI: ") + URI).c_str());
-        }
-    
-        // First element should be the Transport Type, following that is the
-        // URL and any params.  
-        properties.setProperty( "transport", tokenizer.nextToken() );
-
-        // Parse URL and Port as one item, optional params follow the ?
-        // and then each param set is delimited with & we extract first
-        // three chars as they are the left over ://
-        properties.setProperty( "uri", tokenizer.nextToken("&?").substr(3) );
-    
-        // Now get all the optional parameters and store them as properties
-        int count = tokenizer.toArray(tokens);
-        
-        for(int i = 0; i < count; ++i)
-        {
-            tokenizer.reset(tokens[i], "=");
-    
-            if(tokenizer.countTokens() != 2)
-            {
-                throw exceptions::IllegalArgumentException(
-                    __FILE__, __LINE__,
-                    (string("ActiveMQConnectionFactory::parseURL - "
-                           "Marlformed Parameter = ") + tokens[i]).c_str());
-            }
-    
-            // Store this param as a property
-            properties.setProperty(tokenizer.nextToken(), tokenizer.nextToken());
-        }
-    }
-    AMQ_CATCH_RETHROW( IllegalArgumentException )
-    AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IllegalArgumentException )
-    AMQ_CATCHALL_THROW( IllegalArgumentException )
-}
+/*
+* 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 "ActiveMQConnectionFactory.h"
+
+#include <activemq/util/Guid.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/connector/ConnectorFactoryMap.h>
+#include <activemq/network/SocketFactory.h>
+#include <activemq/transport/TransportFactoryMap.h>
+#include <activemq/network/Socket.h>
+#include <activemq/exceptions/NullPointerException.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/support/LibraryInit.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::util;
+using namespace activemq::connector;
+using namespace activemq::exceptions;
+using namespace activemq::network;
+using namespace activemq::transport;
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQConnectionFactory::ActiveMQConnectionFactory(void)
+{
+    brokerURL = "tcp://localhost:61616";
+    
+    this->username = "";
+    this->password = "";
+    this->clientId = "";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQConnectionFactory::ActiveMQConnectionFactory(const std::string& url,
+                                                     const std::string& username,
+                                                     const std::string& password,
+                                                     const std::string& clientId)
+{
+    brokerURL = url;
+
+    this->username = username;
+    this->password = password;
+    this->clientId = clientId;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::Connection* ActiveMQConnectionFactory::createConnection(void) 
+throw ( cms::CMSException )
+{
+    return createConnection(username, password);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms::Connection* ActiveMQConnectionFactory::createConnection(
+    const std::string& username,
+    const std::string& password,
+    const std::string& clientId ) 
+       throw ( cms::CMSException )
+{
+    // Declared here so that they can be deleted in the catch block
+    SimpleProperties* properties = NULL;
+    Transport* transport = NULL;
+    Connector* connector = NULL;
+    ActiveMQConnectionData* connectionData = NULL;
+    ActiveMQConnection* connection = NULL;
+    
+    this->username = username;
+    this->password = password;
+    this->clientId = clientId;
+
+    try
+    {
+        properties = new SimpleProperties;
+
+        // if no Client Id specified, create one
+        if( this->clientId == "" )
+        {
+            this->clientId = Guid::createGUIDString();
+        }
+
+        // Store login data in the properties
+        properties->setProperty( "username", this->username );
+        properties->setProperty( "password", this->password );
+        properties->setProperty( "clientId", this->clientId );
+
+        // Parse out the properties from the URI
+        parseURL( brokerURL, *properties );
+
+        // Create the Transport that the Connector will use.
+        string factoryName = 
+            properties->getProperty( "transport", "tcp" );
+        TransportFactory* factory = 
+            TransportFactoryMap::getInstance().lookup( factoryName );
+        if( factory == NULL ){
+            throw ActiveMQException( 
+                __FILE__, __LINE__, 
+                "ActiveMQConnectionFactory::createConnection - "
+                "unknown transport factory");
+        }
+        
+        // Create the transport.
+        transport = factory->createTransport( *properties );
+        if( transport == NULL ){
+            throw ActiveMQException( 
+                __FILE__, __LINE__, 
+                "ActiveMQConnectionFactory::createConnection - "
+                "failed creating new Transport");
+        }
+
+        // What wire format are we using, defaults to Stomp
+        std::string wireFormat = 
+            properties->getProperty( "wireFormat", "stomp" );
+
+        // Now try and find a factory to create the Connector
+        ConnectorFactory* connectorfactory = 
+            ConnectorFactoryMap::getInstance()->lookup( wireFormat );
+
+        if( connectorfactory == NULL )
+        {
+            throw NullPointerException(
+                __FILE__, __LINE__,
+                "ActiveMQConnectionFactory::createConnection - "
+                "Connector for Wire Format not registered in Map");
+        }
+
+        // Create the Connector.
+        connector = connectorfactory->createConnector( *properties, transport );
+
+        if(connector == NULL)
+        {
+            throw NullPointerException(
+                __FILE__, __LINE__,
+                "ActiveMQConnectionFactory::createConnection - "
+                "Failed to Create the Connector");
+        }
+        
+        // Start the Connector
+        connector->start();
+
+        // Create Holder and store the data for the Connection
+        connectionData = new ActiveMQConnectionData(
+            connector, transport, properties );
+
+        // Create and Return the new connection object.
+        connection = new ActiveMQConnection( connectionData );
+        
+        return connection;
+    }
+    catch( exceptions::ActiveMQException& ex )
+    {
+        ex.setMark( __FILE__, __LINE__ );
+
+        delete connection;
+        delete connector;
+        delete transport;
+        delete properties;
+        
+        throw ex;
+    }
+    catch( ... )
+    {
+        exceptions::ActiveMQException ex( 
+           __FILE__, __LINE__, 
+           "ActiveMQConnectionFactory::create - "
+           "caught unknown exception" );
+
+        delete connection;
+        delete connector;
+        delete transport;
+        delete properties;
+
+        throw ex;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnectionFactory::parseURL(const std::string& URI, 
+                                         Properties& properties)
+    throw ( exceptions::IllegalArgumentException )
+{
+    try
+    {
+        StringTokenizer tokenizer(URI, ":/");
+    
+        std::vector<std::string> tokens;
+    
+        // Require that there be three tokens at the least, these are
+        // transport, url, port.
+        if(tokenizer.countTokens() < 3)
+        {
+            throw exceptions::IllegalArgumentException(
+                __FILE__, __LINE__,
+                (string("ActiveMQConnectionFactory::parseURL - "
+                        "Marlformed URI: ") + URI).c_str());
+        }
+    
+        // First element should be the Transport Type, following that is the
+        // URL and any params.  
+        properties.setProperty( "transport", tokenizer.nextToken() );
+
+        // Parse URL and Port as one item, optional params follow the ?
+        // and then each param set is delimited with & we extract first
+        // three chars as they are the left over ://
+        properties.setProperty( "uri", tokenizer.nextToken("&?").substr(3) );
+    
+        // Now get all the optional parameters and store them as properties
+        int count = tokenizer.toArray(tokens);
+        
+        for(int i = 0; i < count; ++i)
+        {
+            tokenizer.reset(tokens[i], "=");
+    
+            if(tokenizer.countTokens() != 2)
+            {
+                throw exceptions::IllegalArgumentException(
+                    __FILE__, __LINE__,
+                    (string("ActiveMQConnectionFactory::parseURL - "
+                           "Marlformed Parameter = ") + tokens[i]).c_str());
+            }
+    
+            // Store this param as a property
+            properties.setProperty(tokenizer.nextToken(), tokenizer.nextToken());
+        }
+    }
+    AMQ_CATCH_RETHROW( IllegalArgumentException )
+    AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IllegalArgumentException )
+    AMQ_CATCHALL_THROW( IllegalArgumentException )
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h Wed Jul  5 15:27:34 2006
@@ -1,178 +1,178 @@
-/*
- * 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_ACTIVEMQCONNECTIONFACTORY_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORY_H_
-
-#include <cms/ConnectionFactory.h>
-#include <cms/Connection.h>
-
-#include <activemq/exceptions/IllegalArgumentException.h>
-
-namespace activemq{
-namespace core{
-
-   class util::Properties;
-
-   class ActiveMQConnectionFactory : public cms::ConnectionFactory
-   {
-   private:
-   
-      // The user name this factory will use to connect
-      std::string username;
-      
-      // The password this factory will use to connect
-      std::string password;
-      
-      // The client id to assign to the connection created
-      std::string clientId;
-      
-      // The URL of the Broker, the default is:
-      // "tcp://localhost:61616"
-      std::string brokerURL;
-
-   public:
-      
-      /**
-       * Constructor
-       */
-   	  ActiveMQConnectionFactory(void);
-
-      /**
-       * Constructor
-       * @param the URL of the Broker we are connecting to.
-       * @param username to authenticate with, defaults to ""
-       * @param password to authenticate with, defaults to ""
-       * @param client Id to assign to connection, defaults to ""
-       */
-      ActiveMQConnectionFactory(const std::string& url,
-                                const std::string& username = "",
-                                const std::string& password = "",
-                                const std::string& clientId = "");
-
-      /**
-       * Destructor
-       */
-   	  virtual ~ActiveMQConnectionFactory(void) {}
-
-      /**
-       * Creates a connection with the default user identity. The 
-       * connection is created in stopped mode. No messages will be 
-       * delivered until the Connection.start method is explicitly 
-       * called. 
-       * @throws CMSException
-       */
-      virtual cms::Connection* createConnection(void) throw ( cms::CMSException );
-
-      /**
-       * Creates a connection with the specified user identity. The 
-       * connection is created in stopped mode. No messages will be 
-       * delivered until the Connection.start method is explicitly called.
-       * @throw CMSException.
-       */
-      virtual cms::Connection* createConnection(const std::string& username,
-                                                const std::string& password,
-                                                const std::string& clientId = "")
-         throw ( cms::CMSException );
-                                       
-      /**
-       * Sets the username that should be used when creating a new connection
-       * @param username string
-       */
-      virtual void setUsername(const std::string& username){
-         this->username = username;
-      }
-      
-      /**
-       * Gets the username that this factory will use when creating a new
-       * connection instance.
-       * @return username string, "" for default credentials
-       */
-      virtual const std::string& getUsername(void) const {
-         return username;
-      }
-      
-      /**
-       * Sets the password that should be used when creating a new connection
-       * @param password string
-       */
-      virtual void setPassword(const std::string& password){
-         this->password = password;
-      }
-      
-      /**
-       * Gets the password that this factory will use when creating a new
-       * connection instance.
-       * @return password string, "" for default credentials
-       */
-      virtual const std::string& getPassword(void) const {
-         return password;
-      }
-
-      /**
-       * Sets the Broker URL that should be used when creating a new 
-       * connection instance
-       * @param brokerURL string
-       */
-      virtual void setBrokerURL(const std::string& brokerURL){
-         this->brokerURL = brokerURL;
-      }
-      
-      /**
-       * Gets the Broker URL that this factory will use when creating a new
-       * connection instance.
-       * @return brokerURL string
-       */
-      virtual const std::string& getBrokerURL(void) const {
-         return brokerURL;
-      }
-
-      /**
-       * Sets the Client Id that should be used when creating a new 
-       * connection instance
-       * @param clientId string
-       */
-      virtual void setClientId(const std::string& clientId){
-         this->clientId = clientId;
-      }
-      
-      /**
-       * Gets the Client Id that this factory will use when creating a new
-       * connection instance.
-       * @return clientId string
-       */
-      virtual const std::string& getClientId(void) const {
-         return clientId;
-      }
-      
-   protected:
-
-      /**
-       * Parses the properties out of the provided Broker URI and sets
-       * them in the passed Properties Object.
-       * @param a Broker URI to parse
-       * @param a Properties object to set the parsed values in
-       * @throws IllegalArgumentException if the passed URI is invalid
-       */
-      virtual void parseURL(const std::string& URI, 
-                            util::Properties& properties)
-         throw ( exceptions::IllegalArgumentException );
-         
-   };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORY_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_ACTIVEMQCONNECTIONFACTORY_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORY_H_
+
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+
+#include <activemq/exceptions/IllegalArgumentException.h>
+
+namespace activemq{
+namespace core{
+
+   class util::Properties;
+
+   class ActiveMQConnectionFactory : public cms::ConnectionFactory
+   {
+   private:
+   
+      // The user name this factory will use to connect
+      std::string username;
+      
+      // The password this factory will use to connect
+      std::string password;
+      
+      // The client id to assign to the connection created
+      std::string clientId;
+      
+      // The URL of the Broker, the default is:
+      // "tcp://localhost:61616"
+      std::string brokerURL;
+
+   public:
+      
+      /**
+       * Constructor
+       */
+   	  ActiveMQConnectionFactory(void);
+
+      /**
+       * Constructor
+       * @param the URL of the Broker we are connecting to.
+       * @param username to authenticate with, defaults to ""
+       * @param password to authenticate with, defaults to ""
+       * @param client Id to assign to connection, defaults to ""
+       */
+      ActiveMQConnectionFactory(const std::string& url,
+                                const std::string& username = "",
+                                const std::string& password = "",
+                                const std::string& clientId = "");
+
+      /**
+       * Destructor
+       */
+   	  virtual ~ActiveMQConnectionFactory(void) {}
+
+      /**
+       * Creates a connection with the default user identity. The 
+       * connection is created in stopped mode. No messages will be 
+       * delivered until the Connection.start method is explicitly 
+       * called. 
+       * @throws CMSException
+       */
+      virtual cms::Connection* createConnection(void) throw ( cms::CMSException );
+
+      /**
+       * Creates a connection with the specified user identity. The 
+       * connection is created in stopped mode. No messages will be 
+       * delivered until the Connection.start method is explicitly called.
+       * @throw CMSException.
+       */
+      virtual cms::Connection* createConnection(const std::string& username,
+                                                const std::string& password,
+                                                const std::string& clientId = "")
+         throw ( cms::CMSException );
+                                       
+      /**
+       * Sets the username that should be used when creating a new connection
+       * @param username string
+       */
+      virtual void setUsername(const std::string& username){
+         this->username = username;
+      }
+      
+      /**
+       * Gets the username that this factory will use when creating a new
+       * connection instance.
+       * @return username string, "" for default credentials
+       */
+      virtual const std::string& getUsername(void) const {
+         return username;
+      }
+      
+      /**
+       * Sets the password that should be used when creating a new connection
+       * @param password string
+       */
+      virtual void setPassword(const std::string& password){
+         this->password = password;
+      }
+      
+      /**
+       * Gets the password that this factory will use when creating a new
+       * connection instance.
+       * @return password string, "" for default credentials
+       */
+      virtual const std::string& getPassword(void) const {
+         return password;
+      }
+
+      /**
+       * Sets the Broker URL that should be used when creating a new 
+       * connection instance
+       * @param brokerURL string
+       */
+      virtual void setBrokerURL(const std::string& brokerURL){
+         this->brokerURL = brokerURL;
+      }
+      
+      /**
+       * Gets the Broker URL that this factory will use when creating a new
+       * connection instance.
+       * @return brokerURL string
+       */
+      virtual const std::string& getBrokerURL(void) const {
+         return brokerURL;
+      }
+
+      /**
+       * Sets the Client Id that should be used when creating a new 
+       * connection instance
+       * @param clientId string
+       */
+      virtual void setClientId(const std::string& clientId){
+         this->clientId = clientId;
+      }
+      
+      /**
+       * Gets the Client Id that this factory will use when creating a new
+       * connection instance.
+       * @return clientId string
+       */
+      virtual const std::string& getClientId(void) const {
+         return clientId;
+      }
+      
+   protected:
+
+      /**
+       * Parses the properties out of the provided Broker URI and sets
+       * them in the passed Properties Object.
+       * @param a Broker URI to parse
+       * @param a Properties object to set the parsed values in
+       * @throws IllegalArgumentException if the passed URI is invalid
+       */
+      virtual void parseURL(const std::string& URI, 
+                            util::Properties& properties)
+         throw ( exceptions::IllegalArgumentException );
+         
+   };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORY_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h Wed Jul  5 15:27:34 2006
@@ -1,68 +1,68 @@
-/*
- * 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_ACTIVEMQMESSAGE_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQMESSAGE_H_
-
-#include <cms/Message.h>
-
-namespace activemq{
-namespace core{
-
-    class ActiveMQAckHandler;
-
-    /**
-     * Interface for all ActiveMQ Messages that will pass through the core
-     * API layer.  This interface defines a method that the API uses to set
-     * an Acknowledgement handler that will be called by the message when
-     * a user calls the <code>acknowledge</code> method of the Message 
-     * interface.  This is only done when the Session that this message
-     * passes through is in Client Acknowledge mode.
-     */
-    class ActiveMQMessage
-    {
-    public:
-
-        /**
-         * Destructor
-         */
-    	virtual ~ActiveMQMessage(void) {}
-
-        /**
-         * Sets the Acknowledgement Handler that this Message will use
-         * when the Acknowledge method is called.
-         * @param ActiveMQAckHandler
-         */
-        virtual void setAckHandler(ActiveMQAckHandler* handler) = 0;
-        
-        /**
-         * Gets the number of times this message has been redelivered.
-         * @return redelivery count
-         */
-        virtual int getRedeliveryCount(void) const = 0;
-        
-        /**
-         * Sets the count of the number of times this message has been 
-         * redelivered
-         * @param redelivery count
-         */
-        virtual void setRedeliveryCount(int count) = 0;
-
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQMESSAGE_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_ACTIVEMQMESSAGE_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQMESSAGE_H_
+
+#include <cms/Message.h>
+
+namespace activemq{
+namespace core{
+
+    class ActiveMQAckHandler;
+
+    /**
+     * Interface for all ActiveMQ Messages that will pass through the core
+     * API layer.  This interface defines a method that the API uses to set
+     * an Acknowledgement handler that will be called by the message when
+     * a user calls the <code>acknowledge</code> method of the Message 
+     * interface.  This is only done when the Session that this message
+     * passes through is in Client Acknowledge mode.
+     */
+    class ActiveMQMessage
+    {
+    public:
+
+        /**
+         * Destructor
+         */
+    	virtual ~ActiveMQMessage(void) {}
+
+        /**
+         * Sets the Acknowledgement Handler that this Message will use
+         * when the Acknowledge method is called.
+         * @param ActiveMQAckHandler
+         */
+        virtual void setAckHandler(ActiveMQAckHandler* handler) = 0;
+        
+        /**
+         * Gets the number of times this message has been redelivered.
+         * @return redelivery count
+         */
+        virtual int getRedeliveryCount(void) const = 0;
+        
+        /**
+         * Sets the count of the number of times this message has been 
+         * redelivered
+         * @param redelivery count
+         */
+        virtual void setRedeliveryCount(int count) = 0;
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQMESSAGE_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h Wed Jul  5 15:27:34 2006
@@ -1,47 +1,47 @@
-/*
- * 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_ACTIVEMQMESSAGELISTENER_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQMESSAGELISTENER_H_
-
-#include <activemq/exceptions/ActiveMQException.h>
-
-namespace activemq{
-namespace core{
-
-    class ActiveMQMessage;
-
-    class ActiveMQMessageListener
-    {
-    public:
-
-    	virtual ~ActiveMQMessageListener(void) {}
-
-        /**
-         * Called asynchronously when a new message is received, the message
-         * that is passed is now the property of the callee, and the caller
-         * will disavowe all knowledge of the message, i.e Callee must delete.
-         * @param Message object pointer
-         */
-        virtual void onActiveMQMessage( ActiveMQMessage* message ) 
-            throw ( exceptions::ActiveMQException ) = 0;
-
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQMESSAGELISTENER_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_ACTIVEMQMESSAGELISTENER_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQMESSAGELISTENER_H_
+
+#include <activemq/exceptions/ActiveMQException.h>
+
+namespace activemq{
+namespace core{
+
+    class ActiveMQMessage;
+
+    class ActiveMQMessageListener
+    {
+    public:
+
+    	virtual ~ActiveMQMessageListener(void) {}
+
+        /**
+         * Called asynchronously when a new message is received, the message
+         * that is passed is now the property of the callee, and the caller
+         * will disavowe all knowledge of the message, i.e Callee must delete.
+         * @param Message object pointer
+         */
+        virtual void onActiveMQMessage( ActiveMQMessage* message ) 
+            throw ( exceptions::ActiveMQException ) = 0;
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQMESSAGELISTENER_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp Wed Jul  5 15:27:34 2006
@@ -1,91 +1,91 @@
-/*
- * 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 "ActiveMQProducer.h"
-
-#include <activemq/core/ActiveMQSession.h>
-#include <activemq/exceptions/NullPointerException.h>
-
-using namespace std;
-using namespace activemq;
-using namespace activemq::core;
-using namespace activemq::connector;
-using namespace activemq::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-ActiveMQProducer::ActiveMQProducer(connector::ProducerInfo* producerInfo,
-                                   ActiveMQSession* session)
-{
-    if(session == NULL || producerInfo == NULL)
-    {
-        throw NullPointerException(
-            __FILE__, __LINE__,
-            "ActiveMQProducer::ActiveMQProducer - Init with NULL Session");
-    }
-    
-    // Init Producer Data
-    this->session      = session;
-    this->producerInfo = producerInfo;
-
-    // Default the Delivery options
-    deliveryMode      = cms::Message::PERSISTANT;
-    disableMsgId      = false;
-    disableTimestamps = false;
-    priority          = 4;
-    timeToLive        = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ActiveMQProducer::~ActiveMQProducer(void)
-{
-    try
-    {
-        // Dispose of the ProducerInfo
-        session->onDestroySessionResource(this);
-    }
-    AMQ_CATCH_NOTHROW( ActiveMQException )
-    AMQ_CATCHALL_NOTHROW( )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQProducer::send(cms::Message& message) 
-    throw ( cms::CMSException )
-{
-    try
-    {
-        send(producerInfo->getDestination(), message);
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQProducer::send(const cms::Destination& destination,
-                            cms::Message& message) throw ( cms::CMSException )
-{
-    try
-    {
-        // configure the message
-        message.setCMSDestination(destination);
-        message.setCMSDeliveryMode(deliveryMode);
-        message.setCMSPriority(priority);
-        message.setCMSExpiration(timeToLive);
-
-        session->send(&message, this);
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
-}
+/*
+ * 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 "ActiveMQProducer.h"
+
+#include <activemq/core/ActiveMQSession.h>
+#include <activemq/exceptions/NullPointerException.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::connector;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQProducer::ActiveMQProducer(connector::ProducerInfo* producerInfo,
+                                   ActiveMQSession* session)
+{
+    if(session == NULL || producerInfo == NULL)
+    {
+        throw NullPointerException(
+            __FILE__, __LINE__,
+            "ActiveMQProducer::ActiveMQProducer - Init with NULL Session");
+    }
+    
+    // Init Producer Data
+    this->session      = session;
+    this->producerInfo = producerInfo;
+
+    // Default the Delivery options
+    deliveryMode      = cms::Message::PERSISTANT;
+    disableMsgId      = false;
+    disableTimestamps = false;
+    priority          = 4;
+    timeToLive        = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQProducer::~ActiveMQProducer(void)
+{
+    try
+    {
+        // Dispose of the ProducerInfo
+        session->onDestroySessionResource(this);
+    }
+    AMQ_CATCH_NOTHROW( ActiveMQException )
+    AMQ_CATCHALL_NOTHROW( )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducer::send(cms::Message& message) 
+    throw ( cms::CMSException )
+{
+    try
+    {
+        send(producerInfo->getDestination(), message);
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducer::send(const cms::Destination& destination,
+                            cms::Message& message) throw ( cms::CMSException )
+{
+    try
+    {
+        // configure the message
+        message.setCMSDestination(destination);
+        message.setCMSDeliveryMode(deliveryMode);
+        message.setCMSPriority(priority);
+        message.setCMSExpiration(timeToLive);
+
+        session->send(&message, this);
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h Wed Jul  5 15:27:34 2006
@@ -1,191 +1,191 @@
-/*
- * 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_ACTIVEMQPRODUCER_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQPRODUCER_H_
-
-#include <cms/MessageProducer.h>
-#include <cms/Message.h>
-#include <cms/Destination.h>
-
-#include <activemq/core/ActiveMQSessionResource.h>
-#include <activemq/connector/ProducerInfo.h>
-
-namespace activemq{
-namespace core{
-
-    class ActiveMQSession;
-
-    class ActiveMQProducer : public cms::MessageProducer,
-                             public ActiveMQSessionResource
-    {
-    private:
-   
-        // Delivery Mode of this Producer
-        cms::Message::DeliveryMode deliveryMode;
-      
-        // Disable the Message Id
-        bool disableMsgId;
-      
-        // Disable sending timestamps
-        bool disableTimestamps;
-      
-        // Priority Level to send at
-        int priority;
-
-        // Time to live setting for message
-        int timeToLive;
-      
-        // Session that this producer sends to.
-        ActiveMQSession* session;
-      
-        // This Producers protocal specific info object
-        connector::ProducerInfo* producerInfo;
-      
-    public:
-
-        /**
-         * Constructor
-         */
-        ActiveMQProducer( connector::ProducerInfo* producerInfo,
-                          ActiveMQSession* session );
-
-        /**
-         * Destructor
-         */
-        virtual ~ActiveMQProducer(void);
-
-        /**
-         * Sends the message to the default producer destination.
-         * @param a Message Object Pointer
-         * @throws CMSException
-         */
-        virtual void send( cms::Message& message ) throw ( cms::CMSException );
-      
-        /**
-         * Sends the message to the designated destination.
-         * @param a Message Object Pointer
-         * @throws CMSException
-         */
-        virtual void send( const cms::Destination& destination,
-                           cms::Message& message) throw ( cms::CMSException );
-
-        /** 
-         * Sets the delivery mode for this Producer
-         * @param The DeliveryMode
-         */
-        virtual void setDeliveryMode(cms::Message::DeliveryMode mode) {
-            deliveryMode = mode; 
-        }
-      
-        /** 
-         * Gets the delivery mode for this Producer
-         * @return The DeliveryMode
-         */
-        virtual cms::Message::DeliveryMode getDeliveryMode(void) const {
-            return deliveryMode; 
-        }
-      
-        /**
-         * Sets if Message Ids are disbled for this Producer
-         * @param boolean indicating enable / disable (true / false)
-         */
-        virtual void setDisableMessageId( bool value ) {
-            disableMsgId = value; 
-        }
-      
-        /**
-         * Sets if Message Ids are disbled for this Producer
-         * @param boolean indicating enable / disable (true / false)
-         */
-        virtual bool getDisableMessageId(void) const {
-            return disableMsgId;
-        }
-
-        /**
-         * Sets if Message Time Stamps are disbled for this Producer
-         * @param boolean indicating enable / disable (true / false)
-         */
-        virtual void setDisableMessageTimeStamp( bool value ) {
-            disableTimestamps = value;
-        }
-      
-        /**
-         * Sets if Message Time Stamps are disbled for this Producer
-         * @param boolean indicating enable / disable (true / false)
-         */
-        virtual bool getDisableMessageTimeStamp(void) const {
-            return disableTimestamps;
-        }
-      
-        /**
-         * Sets the Priority that this Producers sends messages at
-         * @param int value for Priority level
-         */
-        virtual void setPriority( int priority ) {
-            this->priority = priority; 
-        }
-      
-        /**
-         * Gets the Priority level that this producer sends messages at
-         * @return int based priority level
-         */
-        virtual int getPriority(void) const {
-            return priority;
-        }
-      
-        /**
-         * Sets the Time to Live that this Producers sends messages with
-         * @param int value for time to live
-         */
-        virtual void setTimeToLive( int time ) {
-            timeToLive = time;
-        }
-  
-        /**
-         * Gets the Time to Live that this producer sends messages with
-         * @return int based Time to Live
-         */
-        virtual int getTimeToLive(void) const {
-            return timeToLive;
-        }
-      
-    public:  // ActiveMQSessionResource
-    
-        /**
-         * Retrieve the Connector resource that is associated with
-         * this Session resource.
-         * @return pointer to a Connector Resource, can be NULL
-         */
-        virtual connector::ConnectorResource* getConnectorResource(void) {
-            return producerInfo;
-        }
-
-    public:
-   
-        /**
-         * Retrives this object ProducerInfo pointer
-         * @return ProducerInfo pointer
-         */
-        virtual connector::ProducerInfo* getProducerInfo(void){
-            return producerInfo;
-        }
-
-   };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQPRODUCER_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_ACTIVEMQPRODUCER_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQPRODUCER_H_
+
+#include <cms/MessageProducer.h>
+#include <cms/Message.h>
+#include <cms/Destination.h>
+
+#include <activemq/core/ActiveMQSessionResource.h>
+#include <activemq/connector/ProducerInfo.h>
+
+namespace activemq{
+namespace core{
+
+    class ActiveMQSession;
+
+    class ActiveMQProducer : public cms::MessageProducer,
+                             public ActiveMQSessionResource
+    {
+    private:
+   
+        // Delivery Mode of this Producer
+        cms::Message::DeliveryMode deliveryMode;
+      
+        // Disable the Message Id
+        bool disableMsgId;
+      
+        // Disable sending timestamps
+        bool disableTimestamps;
+      
+        // Priority Level to send at
+        int priority;
+
+        // Time to live setting for message
+        int timeToLive;
+      
+        // Session that this producer sends to.
+        ActiveMQSession* session;
+      
+        // This Producers protocal specific info object
+        connector::ProducerInfo* producerInfo;
+      
+    public:
+
+        /**
+         * Constructor
+         */
+        ActiveMQProducer( connector::ProducerInfo* producerInfo,
+                          ActiveMQSession* session );
+
+        /**
+         * Destructor
+         */
+        virtual ~ActiveMQProducer(void);
+
+        /**
+         * Sends the message to the default producer destination.
+         * @param a Message Object Pointer
+         * @throws CMSException
+         */
+        virtual void send( cms::Message& message ) throw ( cms::CMSException );
+      
+        /**
+         * Sends the message to the designated destination.
+         * @param a Message Object Pointer
+         * @throws CMSException
+         */
+        virtual void send( const cms::Destination& destination,
+                           cms::Message& message) throw ( cms::CMSException );
+
+        /** 
+         * Sets the delivery mode for this Producer
+         * @param The DeliveryMode
+         */
+        virtual void setDeliveryMode(cms::Message::DeliveryMode mode) {
+            deliveryMode = mode; 
+        }
+      
+        /** 
+         * Gets the delivery mode for this Producer
+         * @return The DeliveryMode
+         */
+        virtual cms::Message::DeliveryMode getDeliveryMode(void) const {
+            return deliveryMode; 
+        }
+      
+        /**
+         * Sets if Message Ids are disbled for this Producer
+         * @param boolean indicating enable / disable (true / false)
+         */
+        virtual void setDisableMessageId( bool value ) {
+            disableMsgId = value; 
+        }
+      
+        /**
+         * Sets if Message Ids are disbled for this Producer
+         * @param boolean indicating enable / disable (true / false)
+         */
+        virtual bool getDisableMessageId(void) const {
+            return disableMsgId;
+        }
+
+        /**
+         * Sets if Message Time Stamps are disbled for this Producer
+         * @param boolean indicating enable / disable (true / false)
+         */
+        virtual void setDisableMessageTimeStamp( bool value ) {
+            disableTimestamps = value;
+        }
+      
+        /**
+         * Sets if Message Time Stamps are disbled for this Producer
+         * @param boolean indicating enable / disable (true / false)
+         */
+        virtual bool getDisableMessageTimeStamp(void) const {
+            return disableTimestamps;
+        }
+      
+        /**
+         * Sets the Priority that this Producers sends messages at
+         * @param int value for Priority level
+         */
+        virtual void setPriority( int priority ) {
+            this->priority = priority; 
+        }
+      
+        /**
+         * Gets the Priority level that this producer sends messages at
+         * @return int based priority level
+         */
+        virtual int getPriority(void) const {
+            return priority;
+        }
+      
+        /**
+         * Sets the Time to Live that this Producers sends messages with
+         * @param int value for time to live
+         */
+        virtual void setTimeToLive( int time ) {
+            timeToLive = time;
+        }
+  
+        /**
+         * Gets the Time to Live that this producer sends messages with
+         * @return int based Time to Live
+         */
+        virtual int getTimeToLive(void) const {
+            return timeToLive;
+        }
+      
+    public:  // ActiveMQSessionResource
+    
+        /**
+         * Retrieve the Connector resource that is associated with
+         * this Session resource.
+         * @return pointer to a Connector Resource, can be NULL
+         */
+        virtual connector::ConnectorResource* getConnectorResource(void) {
+            return producerInfo;
+        }
+
+    public:
+   
+        /**
+         * Retrives this object ProducerInfo pointer
+         * @return ProducerInfo pointer
+         */
+        virtual connector::ProducerInfo* getProducerInfo(void){
+            return producerInfo;
+        }
+
+   };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQPRODUCER_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h
------------------------------------------------------------------------------
    svn:eol-style = native