further cleaning up of the OpenWire protocol now that the FooId classes all now have value properties called "value"

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@367565 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-01-10 10:55:01 +00:00
parent 5eff976d28
commit c3a767b21e
4 changed files with 18 additions and 32 deletions

View File

@ -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; }
}
"""
}

View File

@ -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)

View File

@ -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;
}
/**

View File

@ -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);
}