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 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}" println "Generating Java marshalling code to directory ${destDir}"
@ -42,7 +42,7 @@ class GenerateCSharpClasses extends OpenWireScript {
for (jclass in messageClasses) { for (jclass in messageClasses) {
if (destinationNames.contains(jclass.simpleName)) continue if (manuallyMaintainedClasses.contains(jclass.simpleName)) continue
println "Processing $jclass.simpleName" println "Processing $jclass.simpleName"
@ -114,10 +114,6 @@ namespace OpenWire.Core.Commands
def type = toCSharpType(property.type) def type = toCSharpType(property.type)
def name = decapitalize(property.simpleName) def name = decapitalize(property.simpleName)
def propertyName = 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 getter = capitalize(property.getter.simpleName)
def setter = capitalize(property.setter.simpleName) def setter = capitalize(property.setter.simpleName)
@ -125,14 +121,8 @@ namespace OpenWire.Core.Commands
out << """ out << """
public $type $propertyName public $type $propertyName
{ {
get get { return $name; }
{ set { this.$name = value; }
return $name;
}
set
{
$name = value;
}
} }
""" """
} }

View File

@ -128,10 +128,6 @@ namespace OpenWire.Core.IO
} }
for (property in propertyList) { for (property in propertyList) {
def propertyName = property.simpleName def propertyName = property.simpleName
if (propertyName == jclass.simpleName) {
// TODO think of a better naming convention :)
propertyName += "Value"
}
out << " info.${propertyName} = " out << " info.${propertyName} = "
type = toCSharpType(property.type) type = toCSharpType(property.type)

View File

@ -27,7 +27,7 @@ public class ProducerId implements DataStructure {
protected String connectionId; protected String connectionId;
protected long sessionId; protected long sessionId;
protected long producerId; protected long value;
protected transient int hashCode; protected transient int hashCode;
protected transient String key; protected transient String key;
@ -39,20 +39,20 @@ public class ProducerId implements DataStructure {
public ProducerId(SessionId sessionId, long producerId) { public ProducerId(SessionId sessionId, long producerId) {
this.connectionId = sessionId.getConnectionId(); this.connectionId = sessionId.getConnectionId();
this.sessionId = sessionId.getValue(); this.sessionId = sessionId.getValue();
this.producerId=producerId; this.value=producerId;
} }
public ProducerId(ProducerId id) { public ProducerId(ProducerId id) {
this.connectionId = id.getConnectionId(); this.connectionId = id.getConnectionId();
this.sessionId = id.getSessionId(); this.sessionId = id.getSessionId();
this.producerId=id.getProducerId(); this.value=id.getValue();
} }
public ProducerId(String producerKey) { public ProducerId(String producerKey) {
// Parse off the producerId // Parse off the producerId
int p = producerKey.lastIndexOf(":"); int p = producerKey.lastIndexOf(":");
if( p >= 0 ) { if( p >= 0 ) {
producerId = Long.parseLong(producerKey.substring(p+1)); value = Long.parseLong(producerKey.substring(p+1));
producerKey = producerKey.substring(0,p); producerKey = producerKey.substring(0,p);
} }
setProducerSessionKey(producerKey); setProducerSessionKey(producerKey);
@ -67,7 +67,7 @@ public class ProducerId implements DataStructure {
public int hashCode() { public int hashCode() {
if( hashCode == 0 ) { if( hashCode == 0 ) {
hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)producerId; hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value;
} }
return hashCode; return hashCode;
} }
@ -79,7 +79,7 @@ public class ProducerId implements DataStructure {
return false; return false;
ProducerId id = (ProducerId) o; ProducerId id = (ProducerId) o;
return sessionId==id.sessionId return sessionId==id.sessionId
&& producerId==id.producerId && value==id.value
&& connectionId.equals(id.connectionId); && connectionId.equals(id.connectionId);
} }
@ -100,7 +100,7 @@ public class ProducerId implements DataStructure {
public String toString() { public String toString() {
if( key == null ) { if( key == null ) {
key=connectionId+":"+sessionId+":"+producerId; key=connectionId+":"+sessionId+":"+value;
} }
return key; return key;
} }
@ -120,11 +120,11 @@ public class ProducerId implements DataStructure {
/** /**
* @openwire:property version=1 * @openwire:property version=1
*/ */
public long getProducerId() { public long getValue() {
return producerId; return value;
} }
public void setProducerId(long producerId) { public void setValue(long producerId) {
this.producerId = producerId; this.value = producerId;
} }
/** /**

View File

@ -65,7 +65,7 @@ public class ProducerIdMarshaller extends org.apache.activemq.openwire.DataStrea
ProducerId info = (ProducerId)o; ProducerId info = (ProducerId)o;
info.setConnectionId(readString(dataIn, bs)); info.setConnectionId(readString(dataIn, bs));
info.setProducerId(unmarshalLong(wireFormat, dataIn, bs)); info.setValue(unmarshalLong(wireFormat, dataIn, bs));
info.setSessionId(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); int rc = super.marshal1(wireFormat, o, bs);
rc += writeString(info.getConnectionId(), bs); rc += writeString(info.getConnectionId(), bs);
rc+=marshal1Long(wireFormat, info.getProducerId(), bs); rc+=marshal1Long(wireFormat, info.getValue(), bs);
rc+=marshal1Long(wireFormat, info.getSessionId(), bs); rc+=marshal1Long(wireFormat, info.getSessionId(), bs);
return rc+0; return rc+0;
@ -98,7 +98,7 @@ public class ProducerIdMarshaller extends org.apache.activemq.openwire.DataStrea
ProducerId info = (ProducerId)o; ProducerId info = (ProducerId)o;
writeString(info.getConnectionId(), dataOut, bs); writeString(info.getConnectionId(), dataOut, bs);
marshal2Long(wireFormat, info.getProducerId(), dataOut, bs); marshal2Long(wireFormat, info.getValue(), dataOut, bs);
marshal2Long(wireFormat, info.getSessionId(), dataOut, bs); marshal2Long(wireFormat, info.getSessionId(), dataOut, bs);
} }