diff --git a/activemq-core/src/gram/script/GenerateCSharpClasses.groovy b/activemq-core/src/gram/script/GenerateCSharpClasses.groovy index 8cd4d8e742..02ecec6b3b 100755 --- a/activemq-core/src/gram/script/GenerateCSharpClasses.groovy +++ b/activemq-core/src/gram/script/GenerateCSharpClasses.groovy @@ -31,7 +31,7 @@ class GenerateCSharpClasses extends OpenWireScript { it.getAnnotation("openwire:marshaller")!=null } - def destinationNames = ['ActiveMQDestination', 'ActiveMQTempDestination', 'ActiveMQQueue', 'ActiveMQTopic', 'ActiveMQTempQueue', 'ActiveMQTempTopic'] + def manuallyMaintainedClasses = ['ActiveMQDestination', 'ActiveMQTempDestination', 'ActiveMQQueue', 'ActiveMQTopic', 'ActiveMQTempQueue', 'ActiveMQTempTopic', 'BaseCommand'] println "Generating Java marshalling code to directory ${destDir}" @@ -42,7 +42,7 @@ class GenerateCSharpClasses extends OpenWireScript { for (jclass in messageClasses) { - if (destinationNames.contains(jclass.simpleName)) continue + if (manuallyMaintainedClasses.contains(jclass.simpleName)) continue println "Processing $jclass.simpleName" @@ -114,10 +114,6 @@ namespace OpenWire.Core.Commands def type = toCSharpType(property.type) def name = decapitalize(property.simpleName) def propertyName = property.simpleName - if (propertyName == jclass.simpleName) { - // TODO think of a better naming convention :) - propertyName += "Value" - } def getter = capitalize(property.getter.simpleName) def setter = capitalize(property.setter.simpleName) @@ -125,14 +121,8 @@ namespace OpenWire.Core.Commands out << """ public $type $propertyName { - get - { - return $name; - } - set - { - $name = value; - } + get { return $name; } + set { this.$name = value; } } """ } diff --git a/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy b/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy index 1d410a93c6..a484245b6a 100755 --- a/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy +++ b/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy @@ -128,10 +128,6 @@ namespace OpenWire.Core.IO } for (property in propertyList) { def propertyName = property.simpleName - if (propertyName == jclass.simpleName) { - // TODO think of a better naming convention :) - propertyName += "Value" - } out << " info.${propertyName} = " type = toCSharpType(property.type) diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ProducerId.java b/activemq-core/src/main/java/org/apache/activemq/command/ProducerId.java index d8eb71e0ef..70fc86a186 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ProducerId.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ProducerId.java @@ -27,7 +27,7 @@ public class ProducerId implements DataStructure { protected String connectionId; protected long sessionId; - protected long producerId; + protected long value; protected transient int hashCode; protected transient String key; @@ -39,20 +39,20 @@ public class ProducerId implements DataStructure { public ProducerId(SessionId sessionId, long producerId) { this.connectionId = sessionId.getConnectionId(); this.sessionId = sessionId.getValue(); - this.producerId=producerId; + this.value=producerId; } public ProducerId(ProducerId id) { this.connectionId = id.getConnectionId(); this.sessionId = id.getSessionId(); - this.producerId=id.getProducerId(); + this.value=id.getValue(); } public ProducerId(String producerKey) { // Parse off the producerId int p = producerKey.lastIndexOf(":"); if( p >= 0 ) { - producerId = Long.parseLong(producerKey.substring(p+1)); + value = Long.parseLong(producerKey.substring(p+1)); producerKey = producerKey.substring(0,p); } setProducerSessionKey(producerKey); @@ -67,7 +67,7 @@ public class ProducerId implements DataStructure { public int hashCode() { if( hashCode == 0 ) { - hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)producerId; + hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value; } return hashCode; } @@ -79,7 +79,7 @@ public class ProducerId implements DataStructure { return false; ProducerId id = (ProducerId) o; return sessionId==id.sessionId - && producerId==id.producerId + && value==id.value && connectionId.equals(id.connectionId); } @@ -100,7 +100,7 @@ public class ProducerId implements DataStructure { public String toString() { if( key == null ) { - key=connectionId+":"+sessionId+":"+producerId; + key=connectionId+":"+sessionId+":"+value; } return key; } @@ -120,11 +120,11 @@ public class ProducerId implements DataStructure { /** * @openwire:property version=1 */ - public long getProducerId() { - return producerId; + public long getValue() { + return value; } - public void setProducerId(long producerId) { - this.producerId = producerId; + public void setValue(long producerId) { + this.value = producerId; } /** diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java index 1f2ce3c4c2..ece3a31d35 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java @@ -65,7 +65,7 @@ public class ProducerIdMarshaller extends org.apache.activemq.openwire.DataStrea ProducerId info = (ProducerId)o; info.setConnectionId(readString(dataIn, bs)); - info.setProducerId(unmarshalLong(wireFormat, dataIn, bs)); + info.setValue(unmarshalLong(wireFormat, dataIn, bs)); info.setSessionId(unmarshalLong(wireFormat, dataIn, bs)); } @@ -80,7 +80,7 @@ public class ProducerIdMarshaller extends org.apache.activemq.openwire.DataStrea int rc = super.marshal1(wireFormat, o, bs); rc += writeString(info.getConnectionId(), bs); - rc+=marshal1Long(wireFormat, info.getProducerId(), bs); + rc+=marshal1Long(wireFormat, info.getValue(), bs); rc+=marshal1Long(wireFormat, info.getSessionId(), bs); return rc+0; @@ -98,7 +98,7 @@ public class ProducerIdMarshaller extends org.apache.activemq.openwire.DataStrea ProducerId info = (ProducerId)o; writeString(info.getConnectionId(), dataOut, bs); - marshal2Long(wireFormat, info.getProducerId(), dataOut, bs); + marshal2Long(wireFormat, info.getValue(), dataOut, bs); marshal2Long(wireFormat, info.getSessionId(), dataOut, bs); }