diff --git a/activemq-core/maven.xml b/activemq-core/maven.xml
index 57568b27ad..fb2153800b 100755
--- a/activemq-core/maven.xml
+++ b/activemq-core/maven.xml
@@ -109,12 +109,10 @@
+
+
-
diff --git a/activemq-core/project.xml b/activemq-core/project.xml
index 47be40b301..a803a0afaa 100755
--- a/activemq-core/project.xml
+++ b/activemq-core/project.xml
@@ -259,7 +259,7 @@
groovy
groovy-all
- 1.0-jsr-01
+ 1.0-jsr-04
jar
diff --git a/activemq-core/src/gram/script/GenerateCMarshalling.groovy b/activemq-core/src/gram/script/GenerateCMarshalling.groovy
index 4ac410c728..985d593ea9 100755
--- a/activemq-core/src/gram/script/GenerateCMarshalling.groovy
+++ b/activemq-core/src/gram/script/GenerateCMarshalling.groovy
@@ -285,7 +285,7 @@ out << """/**
"""
for (jclass in openwireClasses) {
- def properties = jclass.declaredProperties.findAll { isValidProperty(it) }
+ properties = jclass.declaredProperties.findAll { isValidProperty(it) }
def name = jclass.simpleName;
def type = ("ow_"+name).toUpperCase()+"_TYPE"
@@ -337,7 +337,7 @@ apr_status_t ow_marshal1_${name}(ow_bit_buffer *buffer, ow_${name} *object)
ow_marshal1_${baseName}(buffer, (ow_${baseName}*)object);
"""
- def properties = jclass.declaredProperties.findAll { isValidProperty(it) }
+ properties = jclass.declaredProperties.findAll { isValidProperty(it) }
for (property in properties) {
def propname = toPropertyCase(property.simpleName);
def cached = isCachedProperty(property);
@@ -345,7 +345,7 @@ apr_status_t ow_marshal1_${name}(ow_bit_buffer *buffer, ow_${name} *object)
def size = annotation.getValue("size");
out << " ";
- def type = property.type.qualifiedName
+ type = property.type.qualifiedName
switch (type) {
case "boolean":
@@ -404,7 +404,7 @@ apr_status_t ow_marshal2_${name}(ow_byte_buffer *buffer, ow_bit_buffer *bitbuffe
ow_marshal2_${baseName}(buffer, bitbuffer, (ow_${baseName}*)object);
"""
- def properties = jclass.declaredProperties.findAll { isValidProperty(it) }
+ properties = jclass.declaredProperties.findAll { isValidProperty(it) }
for (property in properties) {
def annotation = property.getter.getAnnotation("openwire:property");
def size = annotation.getValue("size");
@@ -412,7 +412,7 @@ apr_status_t ow_marshal2_${name}(ow_byte_buffer *buffer, ow_bit_buffer *bitbuffe
def cached = isCachedProperty(property);
out << " "
- def type = property.type.qualifiedName
+ type = property.type.qualifiedName
switch (type) {
case "boolean":
out << "ow_bit_buffer_read(bitbuffer);"; break;
@@ -478,7 +478,7 @@ apr_status_t ow_unmarshal_${name}(ow_byte_array *buffer, ow_bit_buffer *bitbuffe
ow_unmarshal_${baseName}(buffer, bitbuffer, (ow_${baseName}*)object, pool);
"""
- def properties = jclass.declaredProperties.findAll { isValidProperty(it) }
+ properties = jclass.declaredProperties.findAll { isValidProperty(it) }
for (property in properties) {
def annotation = property.getter.getAnnotation("openwire:property");
def size = annotation.getValue("size");
@@ -486,7 +486,7 @@ apr_status_t ow_unmarshal_${name}(ow_byte_array *buffer, ow_bit_buffer *bitbuffe
def cached = isCachedProperty(property);
out << " "
- def type = property.type.qualifiedName
+ type = property.type.qualifiedName
switch (type) {
case "boolean":
out << "object->$propname = ow_bit_buffer_read(bitbuffer);"; break;
diff --git a/activemq-core/src/gram/script/GenerateCSharpClasses.groovy b/activemq-core/src/gram/script/GenerateCSharpClasses.groovy
index 6246eba4bc..0d03fc16a7 100755
--- a/activemq-core/src/gram/script/GenerateCSharpClasses.groovy
+++ b/activemq-core/src/gram/script/GenerateCSharpClasses.groovy
@@ -24,10 +24,12 @@ import org.apache.activemq.openwire.tool.OpenWireScript
class GenerateCSharpClasses extends OpenWireScript {
Object run() {
- def destDir = new File("target/generated/dotnet/cs/org/apache/activemq/openwire")
+ def destDir = new File("../openwire-dotnet/src/OpenWire.Core/Commands")
destDir.mkdirs()
- def messageClasses = classes.findAll { isMessageType(it) }
+ def messageClasses = classes.findAll {
+ it.getAnnotation("openwire:marshaller")!=null
+ }
println "Generating Java marshalling code to directory ${destDir}"
@@ -43,7 +45,7 @@ class GenerateCSharpClasses extends OpenWireScript {
def properties = jclass.declaredProperties.findAll { isValidProperty(it) }
def file = new File(destDir, jclass.simpleName + ".cs")
- String baseClass = "AbstractPacket"
+ String baseClass = "AbstractCommand"
if (jclass.superclass?.simpleName == "ActiveMQMessage") {
baseClass = "ActiveMQMessage"
}
@@ -53,19 +55,21 @@ ${jclass.simpleName}.class
"""
file.withWriter { out |
- out << """/**
- * Marshalling code for Open Wire Format for ${jclass.simpleName}
- *
- *
- * NOTE!: This file is autogenerated - do not modify!
- * if you need to make a change, please see the Groovy scripts in the
- * activemq-openwire module
- */
+ out << """//
+// Marshalling code for Open Wire Format for ${jclass.simpleName}
+//
+//
+// NOTE!: This file is autogenerated - do not modify!
+// if you need to make a change, please see the Groovy scripts in the
+// activemq-openwire module
+//
using System;
using System.Collections;
-namespace ActiveMQ
+using OpenWire.Core;
+
+namespace OpenWire.Core.Commands
{
public class ${jclass.simpleName} : $baseClass
{
@@ -86,7 +90,7 @@ namespace ActiveMQ
// TODO generate ToString method
- public overide int getPacketType() {
+ public override int GetCommandType() {
return ${getEnum(jclass)};
}
@@ -97,21 +101,27 @@ namespace ActiveMQ
for (property in properties) {
def type = toCSharpType(property.type)
def name = decapitalize(property.simpleName)
- def getter = property.getter.simpleName
- def setter = property.setter.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)
out << """
- public $type $getter()
+ public $type $propertyName
{
- return this.$name;
+ get
+ {
+ return $name;
+ }
+ set
+ {
+ $name = value;
+ }
}
-
- public void $setter($type $name)
- {
- this.$name = $name;
- }
-
"""
}
@@ -123,17 +133,25 @@ namespace ActiveMQ
}
}
+ def getEnum(type) {
+ return 1
+ }
+
def toCSharpType(type) {
def name = type.qualifiedName
switch (type) {
case "java.lang.String":
return "string"
+ case "boolean":
+ return "bool"
+ case "org.apache.activemq.command.DataStructure":
+ return "Command"
case "org.apache.activemq.message.ActiveMQDestination":
return "ActiveMQDestination"
case "org.apache.activemq.message.ActiveMQXid":
return "ActiveMQXid"
default:
- return name
+ return type.simpleName
}
}
}
\ No newline at end of file
diff --git a/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy b/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy
index abb931ba36..3444447d61 100755
--- a/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy
+++ b/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy
@@ -24,10 +24,12 @@ import org.apache.activemq.openwire.tool.OpenWireScript
class GenerateCSharpMarshalling extends OpenWireScript {
Object run() {
- def destDir = new File("target/generated/dotnet/cs/org/apache/activemq/openwire/io")
+ def destDir = new File("../openwire-dotnet/src/OpenWire.Core/IO")
destDir.mkdirs()
- def messageClasses = classes.findAll { isMessageType(it) }
+ def messageClasses = classes.findAll {
+ it.getAnnotation("openwire:marshaller")!=null
+ }
println "Generating Java marshalling code to directory ${destDir}"
@@ -35,15 +37,17 @@ class GenerateCSharpMarshalling extends OpenWireScript {
int counter = 0
Map map = [:]
+ def propertyList = null
+ def type = null
for (jclass in messageClasses) {
println "Processing $jclass.simpleName"
- def properties = jclass.declaredProperties.findAll { isValidProperty(it) }
+ propertyList = jclass.declaredProperties.findAll { isValidProperty(it) }
def file = new File(destDir, jclass.simpleName + "Marshaller.cs")
- String baseClass = "AbstractPacketMarshaller"
+ String baseClass = "AbstractCommandMarshaller"
if (jclass.superclass?.simpleName == "ActiveMQMessage") {
baseClass = "ActiveMQMessageMarshaller"
}
@@ -53,39 +57,40 @@ ${jclass.simpleName}Marshaller.class
"""
file.withWriter { out |
- out << """/**
- * Marshalling code for Open Wire Format for ${jclass.simpleName}
- *
- *
- * NOTE!: This file is autogenerated - do not modify!
- * if you need to make a change, please see the Groovy scripts in the
- * activemq-openwire module
- */
+ out << """//
+// Marshalling code for Open Wire Format for ${jclass.simpleName}
+//
+//
+// NOTE!: This file is autogenerated - do not modify!
+// if you need to make a change, please see the Groovy scripts in the
+// activemq-openwire module
+//
using System;
using System.Collections;
+using System.IO;
-namespace ActiveMQ
+using OpenWire.Core;
+using OpenWire.Core.Commands;
+using OpenWire.Core.IO;
+
+namespace OpenWire.Core.IO
{
- public class ${jclass.simpleName} : $baseClass
+ public class ${jclass.simpleName}Marshaller : $baseClass
{
- public override int GetPacketType() {
- return ${getEnum(jclass)};
- }
-
- public override Packet CreatePacket() {
+ public override Command CreateCommand() {
return new ${jclass.simpleName}();
}
- public override void BuildPacket(Packet packet, DataInput dataIn) throws IOException {
- super.buildPacket(packet, dataIn);
- ${jclass.simpleName} info = (${jclass.simpleName}) packet;
+ public override void BuildCommand(Command command, BinaryReader dataIn) {
+ super.buildCommand(command, dataIn);
+ ${jclass.simpleName} info = (${jclass.simpleName}) command;
"""
- for (property in properties) {
+ for (property in propertyList) {
out << " info.${property.setter.simpleName}("
- def type = property.type.qualifiedName
+ type = property.type.qualifiedName
switch (type) {
case "java.lang.String":
out << "dataIn.readUTF()"
@@ -137,15 +142,15 @@ namespace ActiveMQ
out << """
}
- public override void WritePacket(Packet packet, DataOutput dataOut) throws IOException {
- super.writePacket(packet, dataOut);
- ${jclass.simpleName} info = (${jclass.simpleName}) packet;
+ public override void WriteCommand(Command command, BinaryWriter dataOut) {
+ super.writeCommand(command, dataOut);
+ ${jclass.simpleName} info = (${jclass.simpleName}) command;
"""
- for (property in properties) {
+ for (property in propertyList) {
def getter = "info." + property.getter.simpleName + "()"
out << " "
- def type = property.type.qualifiedName
+ type = property.type.qualifiedName
switch (type) {
case "java.lang.String":
out << "writeUTF($getter, dataOut);"