activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r511596 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire: OpenWireFormat.cpp OpenWireFormatFactory.cpp
Date Sun, 25 Feb 2007 20:29:03 GMT
Author: tabish
Date: Sun Feb 25 12:29:02 2007
New Revision: 511596

URL: http://svn.apache.org/viewvc?view=rev&rev=511596
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30

Refactored the Prefered WireFormat info setup code, so that we can
get tight encoding working.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormat.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormat.cpp?view=diff&rev=511596&r1=511595&r2=511596
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormat.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormat.cpp
Sun Feb 25 12:29:02 2007
@@ -61,22 +61,12 @@
     // Generate an ID
     this->id = Guid::createGUIDString();
 
-    // parse params out of the properties
-    stackTraceEnabled = Boolean::parseBoolean(
-        properties.getProperty( "wireFormat.stackTraceEnabled",
-                                "false" ) );
-    cacheEnabled = Boolean::parseBoolean(
-        properties.getProperty( "wireFormat.cacheEnabled",
-                                "false" ) );
-    tcpNoDelayEnabled = Boolean::parseBoolean(
-        properties.getProperty( "wireFormat.tcpNoDelayEnabled",
-                                "false" ) );
-    tightEncodingEnabled = Boolean::parseBoolean(
-        properties.getProperty( "wireFormat.tightEncodingEnabled",
-                                "false" ) );
-    sizePrefixDisabled = Boolean::parseBoolean(
-        properties.getProperty( "wireFormat.sizePrefixDisabled",
-                                "false" ) );
+    // Set defaults for initial WireFormat negotiation
+    this->stackTraceEnabled = false;
+    this->cacheEnabled = false;
+    this->tcpNoDelayEnabled = false;
+    this->tightEncodingEnabled = false;
+    this->sizePrefixDisabled = false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -108,19 +98,6 @@
 
     delete preferedWireFormatInfo;
     this->preferedWireFormatInfo = info;
-
-    try {
-        preferedWireFormatInfo->setStackTraceEnabled( stackTraceEnabled );
-        preferedWireFormatInfo->setCacheEnabled( cacheEnabled );
-        preferedWireFormatInfo->setTcpNoDelayEnabled( tcpNoDelayEnabled );
-        preferedWireFormatInfo->setTightEncodingEnabled( tightEncodingEnabled );
-        preferedWireFormatInfo->setSizePrefixDisabled( sizePrefixDisabled );
-    } catch( ActiveMQException& e ) {
-        throw IllegalStateException(
-            __FILE__, __LINE__,
-            "OpenWireFormat::initialize - "
-            "Could not configure WireFormatInfo" );
-    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp?view=diff&rev=511596&r1=511595&r2=511596
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp
Sun Feb 25 12:29:02 2007
@@ -14,12 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 #include <activemq/connector/openwire/OpenwireFormatFactory.h>
 #include <activemq/connector/openwire/OpenwireFormat.h>
 
+#include <activemq/util/Boolean.h>
+
 using namespace std;
 using namespace activemq;
+using namespace activemq::util;
 using namespace activemq::wireformat;
 using namespace activemq::connector;
 using namespace activemq::transport;
@@ -28,18 +31,35 @@
 using namespace activemq::connector::openwire::commands;
 
 ////////////////////////////////////////////////////////////////////////////////
-WireFormat* OpenWireFormatFactory::createWireFormat( 
+WireFormat* OpenWireFormatFactory::createWireFormat(
     const util::Properties& properties )
         throw ( exceptions::IllegalStateException ) {
 
     WireFormatInfo* info = new WireFormatInfo();
-    
+
     // Configure the version to use
     info->setVersion( 2 );
-    
+
+    // parse params out of the properties
+    info->setStackTraceEnabled( Boolean::parseBoolean(
+        properties.getProperty( "wireFormat.stackTraceEnabled",
+                                "false" ) ) );
+    info->setCacheEnabled( Boolean::parseBoolean(
+        properties.getProperty( "wireFormat.cacheEnabled",
+                                "false" ) ) );
+    info->setTcpNoDelayEnabled( Boolean::parseBoolean(
+        properties.getProperty( "wireFormat.tcpNoDelayEnabled",
+                                "false" ) ) );
+    info->setTightEncodingEnabled( Boolean::parseBoolean(
+        properties.getProperty( "wireFormat.tightEncodingEnabled",
+                                "false" ) ) );
+    info->setSizePrefixDisabled( Boolean::parseBoolean(
+        properties.getProperty( "wireFormat.sizePrefixDisabled",
+                                "false" ) ) );
+
     // Create the Openwire Format Object
     OpenWireFormat* f = new OpenWireFormat( properties );
-    
+
     // give the format object the ownership
     f->setPreferedWireFormatInfo( info );
 



Mime
View raw message