activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r381926 [1/8] - in /incubator/activemq/trunk: activemq-core/src/gram/java/org/apache/activemq/openwire/tool/ activemq-core/src/gram/script/ activemq-core/src/main/java/org/apache/activemq/command/ activemq-core/src/main/java/org/apache/acti...
Date Wed, 01 Mar 2006 06:29:57 GMT
Author: chirino
Date: Tue Feb 28 22:29:45 2006
New Revision: 381926

URL: http://svn.apache.org/viewcvs?rev=381926&view=rev
Log:
A few openwire refactors/enhancments
 - The old/default marshaling style is now refered to tight encoding 
 - We now support a loose encoding style which should be less CPU intensive (it's only a 1 pass algorithim)
 - prefixing the packet size is now optional (needs more testing)
 - Updated the c client so that it works once again.


Added:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java   (with props)
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DataStructureSupportMarshaller.java
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Core/BaseDataStreamMarshaller.cs
      - copied, changed from r381665, incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Core/DataStreamMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/DataStructureSupportMarshaller.cs
Removed:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/DataStructureSupport.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/DataStreamMarshaller.java
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Core/DataStreamMarshaller.cs
Modified:
    incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java
    incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireJavaMarshallingScript.java
    incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCMarshalling.groovy
    incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy
    incubator/activemq/trunk/activemq-core/src/gram/script/GenerateJavaMarshalling.groovy
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQMessageMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQQueueMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQTempDestinationMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQTopicMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseCommandMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BrokerIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BrokerInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConnectionErrorMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConnectionIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConnectionInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConsumerIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConsumerInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ControlCommandMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DataArrayResponseMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DataResponseMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DestinationInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DiscoveryEventMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ExceptionResponseMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/FlushCommandMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/IntegerResponseMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalQueueAckMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTopicAckMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTraceMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTransactionMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/LocalTransactionIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageAckMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageDispatchMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/RemoveInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ResponseMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SessionIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SessionInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ShutdownInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SubscriptionInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/TransactionIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/TransactionInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/XATransactionIdMarshaller.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java
    incubator/activemq/trunk/openwire-c/openwire.xcodeproj/project.pbxproj
    incubator/activemq/trunk/openwire-c/src/libactivemq/amqcs.c
    incubator/activemq/trunk/openwire-c/src/libopenwire/ow_command_types_v1.h
    incubator/activemq/trunk/openwire-c/src/libopenwire/ow_commands_v1.c
    incubator/activemq/trunk/openwire-c/src/libopenwire/ow_commands_v1.h
    incubator/activemq/trunk/openwire-cpp/src/command/BrokerId.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/BrokerId.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/BrokerInfo.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/BrokerInfo.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/ConnectionId.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/ConnectionId.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/ConnectionInfo.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/ConnectionInfo.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/ConsumerId.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/ConsumerId.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/ConsumerInfo.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/ConsumerInfo.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/ExceptionResponse.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/ExceptionResponse.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/Message.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/Message.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/MessageAck.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/MessageAck.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/ProducerId.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/ProducerId.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/ProducerInfo.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/ProducerInfo.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/RemoveInfo.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/RemoveInfo.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/Response.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/Response.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/SessionId.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/SessionId.hpp
    incubator/activemq/trunk/openwire-cpp/src/command/SessionInfo.cpp
    incubator/activemq/trunk/openwire-cpp/src/command/SessionInfo.hpp
    incubator/activemq/trunk/openwire-dotnet/activemq.sln
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Commands/ActiveMQMessage.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Commands/JournalQueueAck.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Commands/JournalTopicAck.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Commands/JournalTrace.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Commands/JournalTransaction.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Commands/KeepAliveInfo.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Commands/WireFormatInfo.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Core/BooleanStream.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Core/OpenWireFormat.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/Core/PrimitiveMap.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQBytesMessageMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQDestinationMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQMapMessageMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQMessageMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQObjectMessageMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQQueueMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQStreamMessageMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQTempDestinationMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQTempQueueMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQTempTopicMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQTextMessageMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ActiveMQTopicMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/BaseCommandMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/BrokerIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/BrokerInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ConnectionErrorMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ConnectionIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ConnectionInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ConsumerIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ConsumerInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ControlCommandMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/DataArrayResponseMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/DataResponseMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/DestinationInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/DiscoveryEventMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ExceptionResponseMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/FlushCommandMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/IntegerResponseMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/JournalQueueAckMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/JournalTopicAckMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/JournalTraceMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/JournalTransactionMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/KeepAliveInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/LocalTransactionIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/MessageAckMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/MessageDispatchMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/MessageDispatchNotificationMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/MessageIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/MessageMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ProducerIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ProducerInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/RemoveInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/RemoveSubscriptionInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ResponseMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/SessionIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/SessionInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/ShutdownInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/SubscriptionInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/TransactionIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/TransactionInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/WireFormatInfoMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/src/OpenWire.Client/IO/XATransactionIdMarshaller.cs
    incubator/activemq/trunk/openwire-dotnet/tests/OpenWire.Client/EndianTest.cs

Modified: incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java Tue Feb 28 22:29:45 2006
@@ -40,7 +40,7 @@
     }
     
 
-    protected void generateUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+    protected void generateTightUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
         out.print("        ");
         String propertyName = property.getSimpleName();
         String type = property.getType().getSimpleName();
@@ -49,22 +49,22 @@
             out.println("info." + propertyName + " = bs.ReadBoolean();");
         }
         else if (type.equals("byte")) {
-            out.println("info." + propertyName + " = DataStreamMarshaller.ReadByte(dataIn);");
+            out.println("info." + propertyName + " = BaseDataStreamMarshaller.ReadByte(dataIn);");
         }
         else if (type.equals("char")) {
-            out.println("info." + propertyName + " = DataStreamMarshaller.ReadChar(dataIn);");
+            out.println("info." + propertyName + " = BaseDataStreamMarshaller.ReadChar(dataIn);");
         }
         else if (type.equals("short")) {
-            out.println("info." + propertyName + " = DataStreamMarshaller.ReadShort(dataIn);");
+            out.println("info." + propertyName + " = BaseDataStreamMarshaller.ReadShort(dataIn);");
         }
         else if (type.equals("int")) {
-            out.println("info." + propertyName + " = DataStreamMarshaller.ReadInt(dataIn);");
+            out.println("info." + propertyName + " = BaseDataStreamMarshaller.ReadInt(dataIn);");
         }
         else if (type.equals("long")) {
-            out.println("info." + propertyName + " = UnmarshalLong(wireFormat, dataIn, bs);");
+            out.println("info." + propertyName + " = TightUnmarshalLong(wireFormat, dataIn, bs);");
         }
         else if (type.equals("String")) {
-            out.println("info." + propertyName + " = ReadString(dataIn, bs);");
+            out.println("info." + propertyName + " = TightUnmarshalString(dataIn, bs);");
         }
         else if (type.equals("byte[]") || type.equals("ByteSequence")) {
             if (size != null) {
@@ -75,17 +75,17 @@
             }
         }
         else if (isThrowable(property.getType())) {
-            out.println("info." + propertyName + " = UnmarshalBrokerError(wireFormat, dataIn, bs);");
+            out.println("info." + propertyName + " = TightUnmarshalBrokerError(wireFormat, dataIn, bs);");
         }
         else if (isCachedProperty(property)) {
-            out.println("info." + propertyName + " = (" + type + ") UnmarshalCachedObject(wireFormat, dataIn, bs);");
+            out.println("info." + propertyName + " = (" + type + ") TightUnmarshalCachedObject(wireFormat, dataIn, bs);");
         }
         else {
-            out.println("info." + propertyName + " = (" + type + ") UnmarshalNestedObject(wireFormat, dataIn, bs);");
+            out.println("info." + propertyName + " = (" + type + ") TightUnmarshalNestedObject(wireFormat, dataIn, bs);");
         }
     }
 
-    protected void generateUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+    protected void generateTightUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
         JClass propertyType = property.getType();
         String arrayType = propertyType.getArrayComponentType().getSimpleName();
         String propertyName = property.getSimpleName();
@@ -94,17 +94,17 @@
             out.println("        {");
             out.println("            " + arrayType + "[] value = new " + arrayType + "[" + size.asInt() + "];");
             out.println("            " + "for( int i=0; i < " + size.asInt() + "; i++ ) {");
-            out.println("                value[i] = (" + arrayType + ") UnmarshalNestedObject(wireFormat,dataIn, bs);");
+            out.println("                value[i] = (" + arrayType + ") TightUnmarshalNestedObject(wireFormat,dataIn, bs);");
             out.println("            }");
             out.println("            info." + propertyName + " = value;");
             out.println("        }");
         }
         else {
             out.println("        if (bs.ReadBoolean()) {");
-            out.println("            short size = DataStreamMarshaller.ReadShort(dataIn);");
+            out.println("            short size = BaseDataStreamMarshaller.ReadShort(dataIn);");
             out.println("            " + arrayType + "[] value = new " + arrayType + "[size];");
             out.println("            for( int i=0; i < size; i++ ) {");
-            out.println("                value[i] = (" + arrayType + ") UnmarshalNestedObject(wireFormat,dataIn, bs);");
+            out.println("                value[i] = (" + arrayType + ") TightUnmarshalNestedObject(wireFormat,dataIn, bs);");
             out.println("            }");
             out.println("            info." + propertyName + " = value;");
             out.println("        }");
@@ -114,7 +114,7 @@
         }
     }
 
-    protected int generateMarshal1Body(PrintWriter out) {
+    protected int generateTightMarshal1Body(PrintWriter out) {
         List properties = getProperties();
         int baseSize = 0;
         for (Iterator iter = properties.iterator(); iter.hasNext();) {
@@ -133,19 +133,19 @@
                 baseSize += 1;
             }
             else if (type.equals("char")) {
-                baseSize += 1;
+                baseSize += 2;
             }
             else if (type.equals("short")) {
-                baseSize += 1;
+                baseSize += 2;
             }
             else if (type.equals("int")) {
-                baseSize += 1;
+                baseSize += 4;
             }
             else if (type.equals("long")) {
-                out.println("rc += Marshal1Long(wireFormat, " + getter + ", bs);");
+                out.println("rc += TightMarshalLong1(wireFormat, " + getter + ", bs);");
             }
             else if (type.equals("String")) {
-                out.println("rc += WriteString(" + getter + ", bs);");
+                out.println("rc += TightMarshalString1(" + getter + ", bs);");
             }
             else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                 if (size == null) {
@@ -158,28 +158,28 @@
             }
             else if (propertyType.isArrayType()) {
                 if (size != null) {
-                    out.println("rc += MarshalObjectArrayConstSize(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
+                    out.println("rc += TightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
                 }
                 else {
-                    out.println("rc += MarshalObjectArray(wireFormat, " + getter + ", bs);");
+                    out.println("rc += TightMarshalObjectArray1(wireFormat, " + getter + ", bs);");
                 }
             }
             else if (isThrowable(propertyType)) {
-                out.println("rc += MarshalBrokerError(wireFormat, " + getter + ", bs);");
+                out.println("rc += TightMarshalBrokerError1(wireFormat, " + getter + ", bs);");
             }
             else {
                 if (isCachedProperty(property)) {
-                    out.println("rc += Marshal1CachedObject(wireFormat, " + getter + ", bs);");
+                    out.println("rc += TightMarshalCachedObject1(wireFormat, " + getter + ", bs);");
                 }
                 else {
-                    out.println("rc += Marshal1NestedObject(wireFormat, " + getter + ", bs);");
+                    out.println("rc += TightMarshalNestedObject1(wireFormat, " + getter + ", bs);");
                 }
             }
         }
         return baseSize;
     }
 
-    protected void generateMarshal2Body(PrintWriter out) {
+    protected void generateTightMarshal2Body(PrintWriter out) {
         List properties = getProperties();
         for (Iterator iter = properties.iterator(); iter.hasNext();) {
             JProperty property = (JProperty) iter.next();
@@ -194,22 +194,22 @@
                 out.println("bs.ReadBoolean();");
             }
             else if (type.equals("byte")) {
-                out.println("DataStreamMarshaller.WriteByte(" + getter + ", dataOut);");
+                out.println("BaseDataStreamMarshaller.WriteByte(" + getter + ", dataOut);");
             }
             else if (type.equals("char")) {
-                out.println("DataStreamMarshaller.WriteChar(" + getter + ", dataOut);");
+                out.println("BaseDataStreamMarshaller.WriteChar(" + getter + ", dataOut);");
             }
             else if (type.equals("short")) {
-                out.println("DataStreamMarshaller.WriteShort(" + getter + ", dataOut);");
+                out.println("BaseDataStreamMarshaller.WriteShort(" + getter + ", dataOut);");
             }
             else if (type.equals("int")) {
-                out.println("DataStreamMarshaller.WriteInt(" + getter + ", dataOut);");
+                out.println("BaseDataStreamMarshaller.WriteInt(" + getter + ", dataOut);");
             }
             else if (type.equals("long")) {
-                out.println("Marshal2Long(wireFormat, " + getter + ", dataOut, bs);");
+                out.println("TightMarshalLong2(wireFormat, " + getter + ", dataOut, bs);");
             }
             else if (type.equals("String")) {
-                out.println("WriteString(" + getter + ", dataOut, bs);");
+                out.println("TightMarshalString2(" + getter + ", dataOut, bs);");
             }
             else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                 if (size != null) {
@@ -217,28 +217,28 @@
                 }
                 else {
                     out.println("if(bs.ReadBoolean()) {");
-                    out.println("           DataStreamMarshaller.WriteInt(" + getter + ".Length, dataOut);");
+                    out.println("           BaseDataStreamMarshaller.WriteInt(" + getter + ".Length, dataOut);");
                     out.println("           dataOut.Write(" + getter + ");");
                     out.println("        }");
                 }
             }
             else if (propertyType.isArrayType()) {
                 if (size != null) {
-                    out.println("MarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
+                    out.println("TightMarshalObjectArrayConstSize2(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
                 }
                 else {
-                    out.println("MarshalObjectArray(wireFormat, " + getter + ", dataOut, bs);");
+                    out.println("TightMarshalObjectArray2(wireFormat, " + getter + ", dataOut, bs);");
                 }
             }
             else if (isThrowable(propertyType)) {
-                out.println("MarshalBrokerError(wireFormat, " + getter + ", dataOut, bs);");
+                out.println("TightMarshalBrokerError2(wireFormat, " + getter + ", dataOut, bs);");
             }
             else {
                 if (isCachedProperty(property)) {
-                    out.println("Marshal2CachedObject(wireFormat, " + getter + ", dataOut, bs);");
+                    out.println("TightMarshalCachedObject2(wireFormat, " + getter + ", dataOut, bs);");
                 }
                 else {
-                    out.println("Marshal2NestedObject(wireFormat, " + getter + ", dataOut, bs);");
+                    out.println("TightMarshalNestedObject2(wireFormat, " + getter + ", dataOut, bs);");
                 }
             }
         }

Modified: incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireJavaMarshallingScript.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireJavaMarshallingScript.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireJavaMarshallingScript.java (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireJavaMarshallingScript.java Tue Feb 28 22:29:45 2006
@@ -16,13 +16,18 @@
  */
 package org.apache.activemq.openwire.tool;
 
-import org.codehaus.jam.*;
-
-import java.io.*;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import org.codehaus.jam.JAnnotation;
+import org.codehaus.jam.JAnnotationValue;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JProperty;
+
 /**
  * 
  * @version $Revision$
@@ -77,7 +82,7 @@
     }
 
     protected String getBaseClassName(JClass jclass) {
-        String answer = "DataStreamMarshaller";
+        String answer = "BaseDataStreamMarshaller";
         JClass superclass = jclass.getSuperclass();
         if (superclass != null) {
             String superName = superclass.getSimpleName();
@@ -91,7 +96,7 @@
     protected void initialiseManuallyMaintainedClasses() {
     }
 
-    protected void generateUnmarshalBody(PrintWriter out) {
+    protected void generateTightUnmarshalBody(PrintWriter out) {
         List properties = getProperties();
         for (Iterator iter = properties.iterator(); iter.hasNext();) {
             JProperty property = (JProperty) iter.next();
@@ -101,15 +106,15 @@
             String propertyTypeName = propertyType.getSimpleName();
 
             if (propertyType.isArrayType() && !propertyTypeName.equals("byte[]")) {
-                generateUnmarshalBodyForArrayProperty(out, property, size);
+                generateTightUnmarshalBodyForArrayProperty(out, property, size);
             }
             else {
-                generateUnmarshalBodyForProperty(out, property, size);
+                generateTightUnmarshalBodyForProperty(out, property, size);
             }
         }
     }
 
-    protected void generateUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+    protected void generateTightUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
         out.print("        ");
         String setter = property.getSetter().getSimpleName();
         String type = property.getType().getSimpleName();
@@ -130,52 +135,34 @@
             out.println("info." + setter + "(dataIn.readInt());");
         }
         else if (type.equals("long")) {
-            out.println("info." + setter + "(unmarshalLong(wireFormat, dataIn, bs));");
+            out.println("info." + setter + "(tightUnmarshalLong(wireFormat, dataIn, bs));");
         }
         else if (type.equals("String")) {
-            out.println("info." + setter + "(readString(dataIn, bs));");
+            out.println("info." + setter + "(tightUnmarshalString(dataIn, bs));");
         }
         else if (type.equals("byte[]")) {
             if (size != null) {
-                out.println("{");
-                out.println("            byte data[] = new byte[" + size.asInt() + "];");
-                out.println("            dataIn.readFully(data);");
-                out.println("            info." + setter + "(data);");
-                out.println("        }");
+                out.println("info." + setter + "(tightUnmarshalConstByteArray(dataIn, bs, "+ size.asInt() +"));");
             }
             else {
-                out.println("if( bs.readBoolean() ) {");
-                out.println("            int size = dataIn.readInt();");
-                out.println("            byte data[] = new byte[size];");
-                out.println("            dataIn.readFully(data);");
-                out.println("            info." + setter + "(data);");
-                out.println("            } else {");
-                out.println("            info." + setter + "(null);");
-                out.println("        }");
+                out.println("info." + setter + "(tightUnmarshalByteArray(dataIn, bs));");
             }
         }
         else if (type.equals("ByteSequence")) {
-            out.println("if( bs.readBoolean() ) {");
-            out.println("            int size = dataIn.readInt();");
-            out.println("            byte data[] = new byte[size];");
-            out.println("            dataIn.readFully(data);");
-            out.println("            info." + setter + "(new org.activeio.ByteSequence(data,0,size));");
-            out.println("            } else {");
-            out.println("            info." + setter + "(null);");
-            out.println("        }");
+            out.println("info." + setter + "(tightUnmarshalByteSequence(dataIn, bs));");
         }
         else if (isThrowable(property.getType())) {
-            out.println("info." + setter + "((" + type + ") unmarsalThrowable(wireFormat, dataIn, bs));");
+            out.println("info." + setter + "((" + type + ") tightUnmarsalThrowable(wireFormat, dataIn, bs));");
         }
         else if (isCachedProperty(property)) {
-            out.println("info." + setter + "((" + type + ") unmarsalCachedObject(wireFormat, dataIn, bs));");
+            out.println("info." + setter + "((" + type + ") tightUnmarsalCachedObject(wireFormat, dataIn, bs));");
         }
         else {
-            out.println("info." + setter + "((" + type + ") unmarsalNestedObject(wireFormat, dataIn, bs));");
+            out.println("info." + setter + "((" + type + ") tightUnmarsalNestedObject(wireFormat, dataIn, bs));");
         }
     }
 
-    protected void generateUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+    protected void generateTightUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
         JClass propertyType = property.getType();
         String arrayType = propertyType.getArrayComponentType().getSimpleName();
         String setter = property.getSetter().getSimpleName();
@@ -184,7 +171,7 @@
             out.println("        {");
             out.println("            " + arrayType + " value[] = new " + arrayType + "[" + size.asInt() + "];");
             out.println("            " + "for( int i=0; i < " + size.asInt() + "; i++ ) {");
-            out.println("                value[i] = (" + arrayType + ") unmarsalNestedObject(wireFormat,dataIn, bs);");
+            out.println("                value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);");
             out.println("            }");
             out.println("            info." + setter + "(value);");
             out.println("        }");
@@ -194,7 +181,7 @@
             out.println("            short size = dataIn.readShort();");
             out.println("            " + arrayType + " value[] = new " + arrayType + "[size];");
             out.println("            for( int i=0; i < size; i++ ) {");
-            out.println("                value[i] = (" + arrayType + ") unmarsalNestedObject(wireFormat,dataIn, bs);");
+            out.println("                value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);");
             out.println("            }");
             out.println("            info." + setter + "(value);");
             out.println("        }");
@@ -204,7 +191,7 @@
         }
     }
 
-    protected int generateMarshal1Body(PrintWriter out) {
+    protected int generateTightMarshal1Body(PrintWriter out) {
         List properties = getProperties();
         int baseSize = 0;
         for (Iterator iter = properties.iterator(); iter.hasNext();) {
@@ -223,57 +210,55 @@
                 baseSize += 1;
             }
             else if (type.equals("char")) {
-                baseSize += 1;
+                baseSize += 2;
             }
             else if (type.equals("short")) {
-                baseSize += 1;
+                baseSize += 2;
             }
             else if (type.equals("int")) {
-                baseSize += 1;
+                baseSize += 4;
             }
             else if (type.equals("long")) {
-                out.println("rc+=marshal1Long(wireFormat, " + getter + ", bs);");
+                out.println("rc+=tightMarshalLong1(wireFormat, " + getter + ", bs);");
             }
             else if (type.equals("String")) {
-                out.println("rc += writeString(" + getter + ", bs);");
+                out.println("rc += tightMarshalString1(" + getter + ", bs);");
             }
             else if (type.equals("byte[]")) {
                 if (size == null) {
-                    out.println("bs.writeBoolean(" + getter + "!=null);");
-                    out.println("        rc += " + getter + "==null ? 0 : " + getter + ".length+4;");
+                    out.println("rc += tightMarshalByteArray1(" + getter + ", bs);");
                 }
                 else {
-                    baseSize += size.asInt();
+                    out.println("rc += tightMarshalConstByteArray1(" + getter + ", bs, "+size.asInt()+");");
                 }
             }
             else if (type.equals("ByteSequence")) {
-                out.println("bs.writeBoolean(" + getter + "!=null);");
-                out.println("        rc += " + getter + "==null ? 0 : " + getter + ".getLength()+4;");
+                out.println("rc += tightMarshalByteSequence1(" + getter + ", bs);");
             }
             else if (propertyType.isArrayType()) {
                 if (size != null) {
-                    out.println("rc += marshalObjectArrayConstSize(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
+                    out.println("rc += tightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
                 }
                 else {
-                    out.println("rc += marshalObjectArray(wireFormat, " + getter + ", bs);");
+                    out.println("rc += tightMarshalObjectArray1(wireFormat, " + getter + ", bs);");
                 }
             }
             else if (isThrowable(propertyType)) {
-                out.println("rc += marshalThrowable(wireFormat, " + getter + ", bs);");
+                out.println("rc += tightMarshalThrowable1(wireFormat, " + getter + ", bs);");
             }
             else {
                 if (isCachedProperty(property)) {
-                    out.println("rc += marshal1CachedObject(wireFormat, " + getter + ", bs);");
+                    out.println("rc += tightMarshalCachedObject1(wireFormat, " + getter + ", bs);");
                 }
                 else {
-                    out.println("rc += marshal1NestedObject(wireFormat, " + getter + ", bs);");
+                    out.println("rc += tightMarshalNestedObject1(wireFormat, " + getter + ", bs);");
                 }
             }
         }
         return baseSize;
     }
 
-    protected void generateMarshal2Body(PrintWriter out) {
+    protected void generateTightMarshal2Body(PrintWriter out) {
         List properties = getProperties();
         for (Iterator iter = properties.iterator(); iter.hasNext();) {
             JProperty property = (JProperty) iter.next();
@@ -300,48 +285,204 @@
                 out.println("dataOut.writeInt(" + getter + ");");
             }
             else if (type.equals("long")) {
-                out.println("marshal2Long(wireFormat, " + getter + ", dataOut, bs);");
+                out.println("tightMarshalLong2(wireFormat, " + getter + ", dataOut, bs);");
             }
             else if (type.equals("String")) {
-                out.println("writeString(" + getter + ", dataOut, bs);");
+                out.println("tightMarshalString2(" + getter + ", dataOut, bs);");
             }
             else if (type.equals("byte[]")) {
                 if (size != null) {
-                    out.println("dataOut.write(" + getter + ", 0, " + size.asInt() + ");");
+                    out.println("tightMarshalConstByteArray2(" + getter + ", dataOut, bs, " + size.asInt() + ");");
                 }
                 else {
-                    out.println("if(bs.readBoolean()) {");
-                    out.println("           dataOut.writeInt(" + getter + ".length);");
-                    out.println("           dataOut.write(" + getter + ");");
-                    out.println("        }");
+                    out.println("tightMarshalByteArray2(" + getter + ", dataOut, bs);");
                 }
             }
             else if (type.equals("ByteSequence")) {
-                out.println("if(bs.readBoolean()) {");
-                out.println("           org.activeio.ByteSequence data = " + getter + ";");
-                out.println("           dataOut.writeInt(data.getLength());");
-                out.println("           dataOut.write(data.getData(), data.getOffset(), data.getLength());");
-                out.println("        }");
+                out.println("tightMarshalByteSequence2(" + getter + ", dataOut, bs);");
             }
             else if (propertyType.isArrayType()) {
                 if (size != null) {
-                    out.println("marshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
+                    out.println("tightMarshalObjectArrayConstSize2(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
                 }
                 else {
-                    out.println("marshalObjectArray(wireFormat, " + getter + ", dataOut, bs);");
+                    out.println("tightMarshalObjectArray2(wireFormat, " + getter + ", dataOut, bs);");
                 }
             }
             else if (isThrowable(propertyType)) {
-                out.println("marshalThrowable(wireFormat, " + getter + ", dataOut, bs);");
+                out.println("tightMarshalThrowable2(wireFormat, " + getter + ", dataOut, bs);");
             }
             else {
                 if (isCachedProperty(property)) {
-                    out.println("marshal2CachedObject(wireFormat, " + getter + ", dataOut, bs);");
+                    out.println("tightMarshalCachedObject2(wireFormat, " + getter + ", dataOut, bs);");
                 }
                 else {
-                    out.println("marshal2NestedObject(wireFormat, " + getter + ", dataOut, bs);");
+                    out.println("tightMarshalNestedObject2(wireFormat, " + getter + ", dataOut, bs);");
                 }
             }
+        }
+    }
+
+
+
+    protected void generateLooseMarshalBody(PrintWriter out) {
+        List properties = getProperties();
+        for (Iterator iter = properties.iterator(); iter.hasNext();) {
+            JProperty property = (JProperty) iter.next();
+            JAnnotation annotation = property.getAnnotation("openwire:property");
+            JAnnotationValue size = annotation.getValue("size");
+            JClass propertyType = property.getType();
+            String type = propertyType.getSimpleName();
+            String getter = "info." + property.getGetter().getSimpleName() + "()";
+
+            out.print(indent);
+            if (type.equals("boolean")) {
+                out.println("dataOut.writeBoolean("+ getter + ");");
+            }
+            else if (type.equals("byte")) {
+                out.println("dataOut.writeByte(" + getter + ");");
+            }
+            else if (type.equals("char")) {
+                out.println("dataOut.writeChar(" + getter + ");");
+            }
+            else if (type.equals("short")) {
+                out.println("dataOut.writeShort(" + getter + ");");
+            }
+            else if (type.equals("int")) {
+                out.println("dataOut.writeInt(" + getter + ");");
+            }
+            else if (type.equals("long")) {
+                out.println("looseMarshalLong(wireFormat, " + getter + ", dataOut);");
+            }
+            else if (type.equals("String")) {
+                out.println("looseMarshalString(" + getter + ", dataOut);");
+            }
+            else if (type.equals("byte[]")) {
+                if (size != null) {
+                    out.println("looseMarshalConstByteArray(wireFormat, " + getter + ", dataOut, " + size.asInt() + ");");
+                }
+                else {
+                    out.println("looseMarshalByteArray(wireFormat, " + getter + ", dataOut);");
+                }
+            }
+            else if (type.equals("ByteSequence")) {
+                out.println("looseMarshalByteSequence(wireFormat, " + getter + ", dataOut);");
+            }
+            else if (propertyType.isArrayType()) {
+                if (size != null) {
+                    out.println("looseMarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, " + size.asInt() + ");");
+                }
+                else {
+                    out.println("looseMarshalObjectArray(wireFormat, " + getter + ", dataOut);");
+                }
+            }
+            else if (isThrowable(propertyType)) {
+                out.println("looseMarshalThrowable(wireFormat, " + getter + ", dataOut);");
+            }
+            else {
+                if (isCachedProperty(property)) {
+                    out.println("looseMarshalCachedObject(wireFormat, " + getter + ", dataOut);");
+                }
+                else {
+                    out.println("looseMarshalNestedObject(wireFormat, " + getter + ", dataOut);");
+                }
+            }
+        }
+    }
+
+
+    protected void generateLooseUnmarshalBody(PrintWriter out) {
+        List properties = getProperties();
+        for (Iterator iter = properties.iterator(); iter.hasNext();) {
+            JProperty property = (JProperty) iter.next();
+            JAnnotation annotation = property.getAnnotation("openwire:property");
+            JAnnotationValue size = annotation.getValue("size");
+            JClass propertyType = property.getType();
+            String propertyTypeName = propertyType.getSimpleName();
+
+            if (propertyType.isArrayType() && !propertyTypeName.equals("byte[]")) {
+                generateLooseUnmarshalBodyForArrayProperty(out, property, size);
+            }
+            else {
+                generateLooseUnmarshalBodyForProperty(out, property, size);
+            }
+        }
+    }
+
+    protected void generateLooseUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+        out.print("        ");
+        String setter = property.getSetter().getSimpleName();
+        String type = property.getType().getSimpleName();
+
+        if (type.equals("boolean")) {
+            out.println("info." + setter + "(dataIn.readBoolean());");
+        }
+        else if (type.equals("byte")) {
+            out.println("info." + setter + "(dataIn.readByte());");
+        }
+        else if (type.equals("char")) {
+            out.println("info." + setter + "(dataIn.readChar());");
+        }
+        else if (type.equals("short")) {
+            out.println("info." + setter + "(dataIn.readShort());");
+        }
+        else if (type.equals("int")) {
+            out.println("info." + setter + "(dataIn.readInt());");
+        }
+        else if (type.equals("long")) {
+            out.println("info." + setter + "(looseUnmarshalLong(wireFormat, dataIn));");
+        }
+        else if (type.equals("String")) {
+            out.println("info." + setter + "(looseUnmarshalString(dataIn));");
+        }
+        else if (type.equals("byte[]")) {
+            if (size != null) {
+                out.println("info." + setter + "(looseUnmarshalConstByteArray(dataIn, " + size.asInt() + "));");
+            }
+            else {
+                out.println("info." + setter + "(looseUnmarshalByteArray(dataIn));");
+            }
+        }
+        else if (type.equals("ByteSequence")) {
+            out.println("info." + setter + "(looseUnmarshalByteSequence(dataIn));");
+        }
+        else if (isThrowable(property.getType())) {
+            out.println("info." + setter + "((" + type + ") looseUnmarsalThrowable(wireFormat, dataIn));");
+        }
+        else if (isCachedProperty(property)) {
+            out.println("info." + setter + "((" + type + ") looseUnmarsalCachedObject(wireFormat, dataIn));");
+        }
+        else {
+            out.println("info." + setter + "((" + type + ") looseUnmarsalNestedObject(wireFormat, dataIn));");
+        }
+    }
+
+    protected void generateLooseUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+        JClass propertyType = property.getType();
+        String arrayType = propertyType.getArrayComponentType().getSimpleName();
+        String setter = property.getSetter().getSimpleName();
+        out.println();
+        if (size != null) {
+            out.println("        {");
+            out.println("            " + arrayType + " value[] = new " + arrayType + "[" + size.asInt() + "];");
+            out.println("            " + "for( int i=0; i < " + size.asInt() + "; i++ ) {");
+            out.println("                value[i] = (" + arrayType + ") looseUnmarsalNestedObject(wireFormat,dataIn);");
+            out.println("            }");
+            out.println("            info." + setter + "(value);");
+            out.println("        }");
+        }
+        else {
+            out.println("        if (dataIn.readBoolean()) {");
+            out.println("            short size = dataIn.readShort();");
+            out.println("            " + arrayType + " value[] = new " + arrayType + "[size];");
+            out.println("            for( int i=0; i < size; i++ ) {");
+            out.println("                value[i] = (" + arrayType + ") looseUnmarsalNestedObject(wireFormat,dataIn);");
+            out.println("            }");
+            out.println("            info." + setter + "(value);");
+            out.println("        }");
+            out.println("        else {");
+            out.println("            info." + setter + "(null);");
+            out.println("        }");
         }
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCMarshalling.groovy
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCMarshalling.groovy?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCMarshalling.groovy (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCMarshalling.groovy Tue Feb 28 22:29:45 2006
@@ -287,9 +287,16 @@
 	            def type = ("ow_"+name).toUpperCase()+"_TYPE"
 	            
 	            def baseName="DataStructure";
-	            if( !jclass.superclass.simpleName.equals("Object") ) {
-                  baseName = jclass.superclass.simpleName;
-               }
+	            
+	            def superclass = jclass.superclass;	            
+	            while( superclass.superclass != null ) {
+  	              if( openwireClasses.contains(superclass) ) {
+                      baseName = superclass.simpleName;
+                      break;
+                   } else {
+                      superclass = superclass.superclass;
+                   }
+	            }
                
 out << """
 ow_boolean ow_is_a_${name}(ow_DataStructure *object) {

Modified: incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy Tue Feb 28 22:29:45 2006
@@ -81,9 +81,9 @@
     // 
     // Un-marshal an object instance from the data input stream
     // 
-    public override void Unmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) 
+    public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) 
     {
-        base.Unmarshal(wireFormat, o, dataIn, bs);
+        base.TightUnmarshal(wireFormat, o, dataIn, bs);
 """
  
 if( !properties.isEmpty() || marshallerAware )  out << """
@@ -95,7 +95,7 @@
         
 """
 
-generateUnmarshalBody(out)
+generateTightUnmarshalBody(out)
 
 if( marshallerAware ) out << """
         info.AfterUnmarshall(wireFormat);
@@ -108,7 +108,7 @@
     //
     // Write the booleans that this object uses to a BooleanStream
     //
-    public override int Marshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) {
+    public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) {
         ${jclass.simpleName} info = (${jclass.simpleName})o;
 """
 
@@ -118,10 +118,10 @@
 """
 
 out << """
-        int rc = base.Marshal1(wireFormat, info, bs);
+        int rc = base.TightMarshal1(wireFormat, info, bs);
 """
 
-def baseSize = generateMarshal1Body(out)
+def baseSize = generateTightMarshal1Body(out)
     
 out << """
         return rc + ${baseSize};
@@ -130,15 +130,15 @@
     // 
     // Write a object instance to data output stream
     //
-    public override void Marshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) {
-        base.Marshal2(wireFormat, o, dataOut, bs);
+    public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) {
+        base.TightMarshal2(wireFormat, o, dataOut, bs);
 """
 
 if( !properties.isEmpty() || marshallerAware ) out << """
         ${jclass.simpleName} info = (${jclass.simpleName})o;
 """
 
-generateMarshal2Body(out)
+generateTightMarshal2Body(out)
 
 if( marshallerAware ) out << """
         info.AfterMarshall(wireFormat);

Modified: incubator/activemq/trunk/activemq-core/src/gram/script/GenerateJavaMarshalling.groovy
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/gram/script/GenerateJavaMarshalling.groovy?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/script/GenerateJavaMarshalling.groovy (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/script/GenerateJavaMarshalling.groovy Tue Feb 28 22:29:45 2006
@@ -96,8 +96,8 @@
      * @param dataIn the data input stream to build the object from
      * @throws IOException
      */
-    public void unmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, BooleanStream bs) throws IOException {
-        super.unmarshal(wireFormat, o, dataIn, bs);
+    public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, BooleanStream bs) throws IOException {
+        super.tightUnmarshal(wireFormat, o, dataIn, bs);
 """
 
 if( !properties.isEmpty() )  out << """
@@ -109,7 +109,7 @@
         
 """
 
-generateUnmarshalBody(out)
+generateTightUnmarshalBody(out)
 
 if( marshallerAware ) out << """
         info.afterUnmarshall(wireFormat);
@@ -122,7 +122,7 @@
     /**
      * Write the booleans that this object uses to a BooleanStream
      */
-    public int marshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+    public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
 """
 
 
@@ -136,10 +136,10 @@
 """
 
 out << """
-        int rc = super.marshal1(wireFormat, o, bs);
+        int rc = super.tightMarshal1(wireFormat, o, bs);
 """
 
-def baseSize = generateMarshal1Body(out)
+def baseSize = generateTightMarshal1Body(out)
     
 out << """
         return rc + ${baseSize};
@@ -152,20 +152,76 @@
      * @param dataOut the output stream
      * @throws IOException thrown if an error occurs
      */
-    public void marshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
-        super.marshal2(wireFormat, o, dataOut, bs);
+    public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
+        super.tightMarshal2(wireFormat, o, dataOut, bs);
 """
 
 if( !properties.isEmpty() ) out << """
         ${jclass.simpleName} info = (${jclass.simpleName})o;
 """
 
-generateMarshal2Body(out)
+generateTightMarshal2Body(out)
 
 if( marshallerAware ) out << """
         info.afterMarshall(wireFormat);
 """
 
+out << """
+    }
+"""
+
+out << """
+    /**
+     * Un-marshal an object instance from the data input stream
+     *
+     * @param o the object to un-marshal
+     * @param dataIn the data input stream to build the object from
+     * @throws IOException
+     */
+    public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn) throws IOException {
+        super.looseUnmarshal(wireFormat, o, dataIn);
+"""
+
+if( !properties.isEmpty() )  out << """
+        ${jclass.simpleName} info = (${jclass.simpleName})o;
+"""
+
+if( marshallerAware ) out << """
+        info.beforeUnmarshall(wireFormat);
+        
+"""
+
+generateLooseUnmarshalBody(out)
+
+if( marshallerAware ) out << """
+        info.afterUnmarshall(wireFormat);
+"""
+
+out << """
+    }
+
+
+    /**
+     * Write the booleans that this object uses to a BooleanStream
+     */
+    public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut) throws IOException {
+"""
+
+if( !properties.isEmpty() ) out << """
+        ${jclass.simpleName} info = (${jclass.simpleName})o;
+"""
+
+
+if( marshallerAware ) out << """
+        info.beforeMarshall(wireFormat);
+"""
+
+out << """
+        super.looseMarshal(wireFormat, o, dataOut);
+"""
+
+generateLooseMarshalBody(out)
+    
 out << """
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java Tue Feb 28 22:29:45 2006
@@ -24,7 +24,7 @@
  * @openwire:marshaller
  * @version $Revision: 1.11 $
  */
-abstract public class BaseCommand extends DataStructureSupport implements Command {
+abstract public class BaseCommand implements Command {
 
     protected short commandId;
     protected boolean responseRequired;

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java Tue Feb 28 22:29:45 2006
@@ -16,12 +16,14 @@
  */
 package org.apache.activemq.command;
 
+import org.apache.activemq.util.IntrospectionSupport;
+
 /**
  * 
  * @openwire:marshaller code="52"
  * @version $Revision$
  */
-public class JournalQueueAck extends DataStructureSupport implements DataStructure {
+public class JournalQueueAck implements DataStructure {
 
     public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_REMOVE;
 
@@ -60,4 +62,9 @@
     public boolean isMarshallAware() {
         return false;
     }
+    
+    public String toString() {
+        return IntrospectionSupport.toString(this, JournalQueueAck.class);
+    }
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java Tue Feb 28 22:29:45 2006
@@ -16,12 +16,14 @@
  */
 package org.apache.activemq.command;
 
+import org.apache.activemq.util.IntrospectionSupport;
+
 /**
  * 
  * @openwire:marshaller code="50"
  * @version $Revision$
  */
-public class JournalTopicAck extends DataStructureSupport implements DataStructure {
+public class JournalTopicAck implements DataStructure {
     
     public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_ACK;
     
@@ -105,5 +107,9 @@
     
     public boolean isMarshallAware() {
         return false;
+    }
+
+    public String toString() {
+        return IntrospectionSupport.toString(this, JournalTopicAck.class);
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java Tue Feb 28 22:29:45 2006
@@ -16,12 +16,14 @@
  */
 package org.apache.activemq.command;
 
+import org.apache.activemq.util.IntrospectionSupport;
+
 /**
  * 
  * @openwire:marshaller code="53"
  * @version $Revision: 1.6 $
  */
-public class JournalTrace extends DataStructureSupport implements DataStructure {
+public class JournalTrace implements DataStructure {
 
     public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_TRACE;
 
@@ -47,5 +49,9 @@
 
     public boolean isMarshallAware() {
         return false;
+    }
+
+    public String toString() {
+        return IntrospectionSupport.toString(this, JournalTrace.class);
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java Tue Feb 28 22:29:45 2006
@@ -16,11 +16,13 @@
  */
 package org.apache.activemq.command;
 
+import org.apache.activemq.util.IntrospectionSupport;
+
 
 /**
  * @openwire:marshaller code="54"
  */
-public class JournalTransaction extends DataStructureSupport implements DataStructure {
+public class JournalTransaction implements DataStructure {
     
     public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_TRANSACTION;
 
@@ -81,5 +83,9 @@
 
     public boolean isMarshallAware() {
         return false;
+    }
+    
+    public String toString() {
+        return IntrospectionSupport.toString(this, JournalTransaction.class);
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java Tue Feb 28 22:29:45 2006
@@ -17,12 +17,13 @@
 package org.apache.activemq.command;
 
 import org.apache.activemq.state.CommandVisitor;
+import org.apache.activemq.util.IntrospectionSupport;
 
 /**
  * @openwire:marshaller code="10"
  * @version $Revision$
  */
-public class KeepAliveInfo extends DataStructureSupport implements Command {
+public class KeepAliveInfo implements Command {
 
     public static final byte DATA_STRUCTURE_TYPE=CommandTypes.KEEP_ALIVE_INFO;
     
@@ -84,4 +85,7 @@
         return false;
     }
 
+    public String toString() {
+        return IntrospectionSupport.toString(this, KeepAliveInfo.class);
+    }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java Tue Feb 28 22:29:45 2006
@@ -17,6 +17,7 @@
 package org.apache.activemq.command;
 
 import org.apache.activemq.state.CommandVisitor;
+import org.apache.activemq.util.IntrospectionSupport;
 
 import java.util.Arrays;
 
@@ -33,10 +34,11 @@
     protected int version;
     protected byte magic[] = MAGIC;
 
-    private boolean stackTraceEnabled;
-    private boolean tcpNoDelayEnabled;
-    private boolean cacheEnabled;
-    private boolean compressionEnabled;
+    protected boolean stackTraceEnabled;
+    protected boolean tcpNoDelayEnabled;
+    protected boolean cacheEnabled;
+    protected boolean tightEncodingEnabled;
+    protected boolean prefixPacketSize;
 
     public byte getDataStructureType() {
         return DATA_STRUCTURE_TYPE;
@@ -106,10 +108,6 @@
     public void setResponseRequired(boolean responseRequired) {
     }
 
-    public String toString() {
-        return "WireFormatInfo {version=" + version + "}";
-    }
-
     /**
      * @openwire:property version=1
      */
@@ -124,17 +122,6 @@
     /**
      * @openwire:property version=1
      */
-    public boolean isCompressionEnabled() {
-        return compressionEnabled;
-    }
-
-    public void setCompressionEnabled(boolean compressionEnabled) {
-        this.compressionEnabled = compressionEnabled;
-    }
-
-    /**
-     * @openwire:property version=1
-     */
     public boolean isStackTraceEnabled() {
         return stackTraceEnabled;
     }
@@ -154,6 +141,26 @@
         this.tcpNoDelayEnabled = tcpNoDelayEnabled;
     }
 
+    /**
+     * @openwire:property version=1
+     */
+    public boolean isPrefixPacketSize() {
+        return prefixPacketSize;
+    }
+    public void setPrefixPacketSize(boolean prefixPacketSize) {
+        this.prefixPacketSize = prefixPacketSize;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public boolean isTightEncodingEnabled() {
+        return tightEncodingEnabled;
+    }
+    public void setTightEncodingEnabled(boolean tightEncodingEnabled) {
+        this.tightEncodingEnabled = tightEncodingEnabled;
+    }
+
     public Response visit(CommandVisitor visitor) throws Throwable {
         return visitor.processWireFormat(this);
     }
@@ -170,4 +177,7 @@
         return false;
     }
 
+    public String toString() {
+        return IntrospectionSupport.toString(this, WireFormatInfo.class);
+    }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java Tue Feb 28 22:29:45 2006
@@ -25,6 +25,7 @@
 import org.activeio.ByteArrayOutputStream;
 import org.activeio.ByteSequence;
 import org.activeio.Packet;
+import org.activeio.PacketData;
 import org.activeio.adapter.PacketToInputStream;
 import org.activeio.command.ClassLoading;
 import org.activeio.command.WireFormat;
@@ -46,6 +47,8 @@
     private boolean stackTraceEnabled=true;
     private boolean tcpNoDelayEnabled=false;
     private boolean cacheEnabled=true;
+    private boolean tightEncodingEnabled=true;
+    private boolean prefixPacketSize=true;
 
     private HashMap marshallCacheMap = new HashMap();
     private short nextMarshallCacheIndex=0;    
@@ -64,8 +67,9 @@
     
     public int hashCode() {
         return  version 
-            ^ (cacheEnabled?0x10000000:0x20000000)
-            ^ (stackTraceEnabled?0x30000000:0x40000000);
+            ^ (cacheEnabled         ? 0x10000000:0x20000000)
+            ^ (stackTraceEnabled    ? 0x01000000:0x02000000)
+            ^ (tightEncodingEnabled ? 0x00100000:0x00200000);
     }
     
     public boolean equals(Object object) {
@@ -74,7 +78,8 @@
         OpenWireFormat o = (OpenWireFormat) object;
         return o.stackTraceEnabled == stackTraceEnabled &&
             o.cacheEnabled == cacheEnabled &&
-            o.version == version;
+            o.version == version && 
+            o.tightEncodingEnabled == tightEncodingEnabled;
     }
     
     public String toString() {
@@ -108,19 +113,43 @@
                 DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
                 if( dsm == null )
                     throw new IOException("Unknown data type: "+type);
-                BooleanStream bs = new BooleanStream();
-                size += dsm.marshal1(this, c, bs);
-                size += bs.marshalledSize();
-
-                ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
-                DataOutputStream ds = new DataOutputStream(baos);
-                ds.writeInt(size);
-                ds.writeByte(type);
-                bs.marshal(ds);
-                dsm.marshal2(this, c, ds, bs);                
-                ds.close();
                 
-                sequence = baos.toByteSequence();
+                if( tightEncodingEnabled ) {
+                    
+                    BooleanStream bs = new BooleanStream();
+                    size += dsm.tightMarshal1(this, c, bs);
+                    size += bs.marshalledSize();
+    
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
+                    DataOutputStream ds = new DataOutputStream(baos);
+                    if( prefixPacketSize ) {
+                        ds.writeInt(size);
+                    }
+                    ds.writeByte(type);
+                    bs.marshal(ds);
+                    dsm.tightMarshal2(this, c, ds, bs);                
+                    ds.close();
+                    sequence = baos.toByteSequence();
+                    
+                } else {
+                    
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
+                    DataOutputStream ds = new DataOutputStream(baos);
+                    if( prefixPacketSize ) {
+                        ds.writeInt(0); // we don't know the final size yet but write this here for now.
+                    }
+                    ds.writeByte(type);
+                    dsm.looseMarshal(this, c, ds);                
+                    ds.close();
+                    sequence = baos.toByteSequence();
+                    
+                    if( prefixPacketSize ) {
+                        size = sequence.getLength()-4;
+                        ByteArrayPacket packet = new ByteArrayPacket(sequence);
+                        PacketData.writeIntBig(packet, size);
+                    }
+                }
+                
                 
             } else {
                 
@@ -142,10 +171,14 @@
     public Object unmarshal(Packet packet) throws IOException {
         ByteSequence sequence = packet.asByteSequence();
         DataInputStream dis = new DataInputStream(new PacketToInputStream(packet));
-        int size = dis.readInt();
-        if( sequence.getLength() != size+4 )
-            System.out.println("Packet size does not match marshaled size: "+size+", "+(sequence.getLength()-4));
-//            throw new IOException("Packet size does not match marshaled size");        
+        
+        if( prefixPacketSize ) {
+            int size = dis.readInt();
+            if( sequence.getLength()-4 != size )
+                System.out.println("Packet size does not match marshaled size: "+size+", "+(sequence.getLength()-4));
+    //            throw new IOException("Packet size does not match marshaled size");
+        }
+        
         Object command = doUnmarshal(dis);
         if( !cacheEnabled && ((DataStructure)command).isMarshallAware() ) {
             ((MarshallAware) command).setCachedMarshalledForm(this, sequence);
@@ -163,13 +196,13 @@
                 throw new IOException("Unknown data type: "+type);
 
             BooleanStream bs = new BooleanStream();
-            size += dsm.marshal1(this, c, bs);
+            size += dsm.tightMarshal1(this, c, bs);
             size += bs.marshalledSize(); 
 
             ds.writeInt(size);
             ds.writeByte(type);            
             bs.marshal(ds);
-            dsm.marshal2(this, c, ds, bs);
+            dsm.tightMarshal2(this, c, ds, bs);
         } else {
             ds.writeInt(size);
             ds.writeByte(NULL_TYPE);
@@ -209,16 +242,20 @@
             if( dsm == null )
                 throw new IOException("Unknown data type: "+dataType);
             Object data = dsm.createObject();
-            BooleanStream bs = new BooleanStream();
-            bs.unmarshal(dis);
-            dsm.unmarshal(this, data, dis, bs);
+            if( this.tightEncodingEnabled ) {
+                BooleanStream bs = new BooleanStream();
+                bs.unmarshal(dis);
+                dsm.tightUnmarshal(this, data, dis, bs);
+            } else {
+                dsm.looseUnmarshal(this, data, dis);
+            }
             return data;
         } else {
             return null;
         }
     }
     
-    public int marshal1NestedObject(DataStructure o, BooleanStream bs) throws IOException {
+    public int tightMarshalNestedObject1(DataStructure o, BooleanStream bs) throws IOException {
         bs.writeBoolean(o != null);
         if( o == null ) 
             return 0;
@@ -236,10 +273,10 @@
         DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
         if( dsm == null )
             throw new IOException("Unknown data type: "+type);
-        return 1 + dsm.marshal1(this, o, bs);
+        return 1 + dsm.tightMarshal1(this, o, bs);
     }
     
-    public void marshal2NestedObject(DataStructure o, DataOutputStream ds, BooleanStream bs) throws IOException {
+    public void tightMarshalNestedObject2(DataStructure o, DataOutputStream ds, BooleanStream bs) throws IOException {
         if( !bs.readBoolean() ) 
             return;
             
@@ -257,12 +294,12 @@
             DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
             if( dsm == null )
                 throw new IOException("Unknown data type: "+type);
-            dsm.marshal2(this, o, ds, bs);
+            dsm.tightMarshal2(this, o, ds, bs);
             
         }
     }
     
-    public DataStructure unmarshalNestedObject(DataInputStream dis, BooleanStream bs) throws IOException {
+    public DataStructure tightUnmarshalNestedObject(DataInputStream dis, BooleanStream bs) throws IOException {
         if( bs.readBoolean() ) {
             
             byte dataType = dis.readByte();
@@ -278,14 +315,14 @@
                 
                 BooleanStream bs2 = new BooleanStream();
                 bs2.unmarshal(dis);
-                dsm.unmarshal(this, data, dis, bs2);
+                dsm.tightUnmarshal(this, data, dis, bs2);
 
                 // TODO: extract the sequence from the dis and associate it.
 //                MarshallAware ma = (MarshallAware)data
 //                ma.setCachedMarshalledForm(this, sequence);
                 
             } else {
-                dsm.unmarshal(this, data, dis, bs);
+                dsm.tightUnmarshal(this, data, dis, bs);
             }
             
             return data;
@@ -294,6 +331,35 @@
         }
     }
     
+    public DataStructure looseUnmarshalNestedObject(DataInputStream dis) throws IOException {
+        if( dis.readBoolean() ) {
+            
+            byte dataType = dis.readByte();
+            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[dataType & 0xFF];
+            if( dsm == null )
+                throw new IOException("Unknown data type: "+dataType);
+            DataStructure data = dsm.createObject();
+            dsm.looseUnmarshal(this, data, dis);
+            return data;
+            
+        } else {
+            return null;
+        }
+    }
+
+    public void looseMarshalNestedObject(DataStructure o, DataOutputStream dataOut) throws IOException {
+        dataOut.writeBoolean(o!=null);
+        if( o!=null ) {
+            byte type = o.getDataStructureType();
+            dataOut.writeByte(type);
+            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
+            if( dsm == null )
+                throw new IOException("Unknown data type: "+type);
+            dsm.looseMarshal(this, o, dataOut);
+        }
+    }
+
+    
     public Short getMarshallCacheIndex(Object o) {
         return (Short) marshallCacheMap.get(o);
     }
@@ -345,4 +411,20 @@
         this.cacheEnabled = cacheEnabled;
     }
 
+    public boolean isTightEncodingEnabled() {
+        return tightEncodingEnabled;
+    }
+
+    public void setTightEncodingEnabled(boolean tightEncodingEnabled) {
+        this.tightEncodingEnabled = tightEncodingEnabled;
+    }
+
+    public boolean isPrefixPacketSize() {
+        return prefixPacketSize;
+    }
+
+    public void setPrefixPacketSize(boolean prefixPacketSize) {
+        this.prefixPacketSize = prefixPacketSize;
+    }
+    
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageMarshaller.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageMarshaller.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageMarshaller.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageMarshaller.java Tue Feb 28 22:29:45 2006
@@ -60,8 +60,8 @@
      * @param dataIn the data input stream to build the object from
      * @throws IOException
      */
-    public void unmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, BooleanStream bs) throws IOException {
-        super.unmarshal(wireFormat, o, dataIn, bs);
+    public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, BooleanStream bs) throws IOException {
+        super.tightUnmarshal(wireFormat, o, dataIn, bs);
 
     }
 
@@ -69,9 +69,9 @@
     /**
      * Write the booleans that this object uses to a BooleanStream
      */
-    public int marshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+    public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
 
-        int rc = super.marshal1(wireFormat, o, bs);
+        int rc = super.tightMarshal1(wireFormat, o, bs);
 
         return rc + 0;
     }
@@ -83,8 +83,30 @@
      * @param dataOut the output stream
      * @throws IOException thrown if an error occurs
      */
-    public void marshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
-        super.marshal2(wireFormat, o, dataOut, bs);
+    public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
+        super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+    }
+
+    /**
+     * Un-marshal an object instance from the data input stream
+     *
+     * @param o the object to un-marshal
+     * @param dataIn the data input stream to build the object from
+     * @throws IOException
+     */
+    public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn) throws IOException {
+        super.looseUnmarshal(wireFormat, o, dataIn);
+
+    }
+
+
+    /**
+     * Write the booleans that this object uses to a BooleanStream
+     */
+    public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut) throws IOException {
+
+        super.looseMarshal(wireFormat, o, dataOut);
 
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java?rev=381926&r1=381925&r2=381926&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java Tue Feb 28 22:29:45 2006
@@ -36,7 +36,7 @@
  *
  * @version $Revision$
  */
-public abstract class ActiveMQDestinationMarshaller extends DataStreamMarshaller {
+public abstract class ActiveMQDestinationMarshaller extends BaseDataStreamMarshaller {
 
     /**
      * Un-marshal an object instance from the data input stream
@@ -45,11 +45,11 @@
      * @param dataIn the data input stream to build the object from
      * @throws IOException
      */
-    public void unmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, BooleanStream bs) throws IOException {
-        super.unmarshal(wireFormat, o, dataIn, bs);
+    public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, BooleanStream bs) throws IOException {
+        super.tightUnmarshal(wireFormat, o, dataIn, bs);
 
         ActiveMQDestination info = (ActiveMQDestination)o;
-        info.setPhysicalName(readString(dataIn, bs));
+        info.setPhysicalName(tightUnmarshalString(dataIn, bs));
 
     }
 
@@ -57,12 +57,12 @@
     /**
      * Write the booleans that this object uses to a BooleanStream
      */
-    public int marshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+    public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
 
         ActiveMQDestination info = (ActiveMQDestination)o;
 
-        int rc = super.marshal1(wireFormat, o, bs);
-        rc += writeString(info.getPhysicalName(), bs);
+        int rc = super.tightMarshal1(wireFormat, o, bs);
+    rc += tightMarshalString1(info.getPhysicalName(), bs);
 
         return rc + 0;
     }
@@ -74,11 +74,39 @@
      * @param dataOut the output stream
      * @throws IOException thrown if an error occurs
      */
-    public void marshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
-        super.marshal2(wireFormat, o, dataOut, bs);
+    public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
+        super.tightMarshal2(wireFormat, o, dataOut, bs);
 
         ActiveMQDestination info = (ActiveMQDestination)o;
-        writeString(info.getPhysicalName(), dataOut, bs);
+    tightMarshalString2(info.getPhysicalName(), dataOut, bs);
+
+    }
+
+    /**
+     * Un-marshal an object instance from the data input stream
+     *
+     * @param o the object to un-marshal
+     * @param dataIn the data input stream to build the object from
+     * @throws IOException
+     */
+    public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn) throws IOException {
+        super.looseUnmarshal(wireFormat, o, dataIn);
+
+        ActiveMQDestination info = (ActiveMQDestination)o;
+        info.setPhysicalName(looseUnmarshalString(dataIn));
+
+    }
+
+
+    /**
+     * Write the booleans that this object uses to a BooleanStream
+     */
+    public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut) throws IOException {
+
+        ActiveMQDestination info = (ActiveMQDestination)o;
+
+        super.looseMarshal(wireFormat, o, dataOut);
+    looseMarshalString(info.getPhysicalName(), dataOut);
 
     }
 }



Mime
View raw message