Latest spike of the refactor of the code generation; almost done refactoing it so I can look at the C++ code shortly...

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@379824 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-02-22 17:40:18 +00:00
parent 9c4223615d
commit 54db62a395
9 changed files with 859 additions and 641 deletions

View File

@ -16,6 +16,8 @@
*/
package org.apache.activemq.openwire.tool;
import org.codehaus.jam.JClass;
import java.io.File;
/**
@ -26,9 +28,12 @@ public abstract class OpenWireCSharpClassesScript extends OpenWireClassesScript
public Object run() {
filePostFix = ".cs";
destDir = new File("../openwire-dotnet/src/OpenWire.Client/Commands");
if (destDir == null) {
destDir = new File("../openwire-dotnet/src/OpenWire.Client/Commands");
}
return super.run();
}
}

View File

@ -0,0 +1,246 @@
/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.openwire.tool;
import org.codehaus.jam.JAnnotation;
import org.codehaus.jam.JAnnotationValue;
import org.codehaus.jam.JClass;
import org.codehaus.jam.JProperty;
import java.io.*;
import java.util.*;
/**
*
* @version $Revision$
*/
public abstract class OpenWireCSharpMarshallingScript extends OpenWireJavaMarshallingScript {
public Object run() {
filePostFix = ".cs";
if (destDir == null) {
destDir = new File("../openwire-dotnet/src/OpenWire.Client/IO");
}
return super.run();
}
protected void generateUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
out.print(" ");
String propertyName = property.getSimpleName();
String type = property.getType().getSimpleName();
if (type.equals("boolean")) {
out.println("info." + propertyName + " = bs.ReadBoolean();");
}
else if (type.equals("byte")) {
out.println("info." + propertyName + " = dataIn.ReadByte();");
}
else if (type.equals("char")) {
out.println("info." + propertyName + " = dataIn.ReadChar();");
}
else if (type.equals("short")) {
out.println("info." + propertyName + " = dataIn.ReadInt16();");
}
else if (type.equals("int")) {
out.println("info." + propertyName + " = dataIn.ReadInt32();");
}
else if (type.equals("long")) {
out.println("info." + propertyName + " = UnmarshalLong(wireFormat, dataIn, bs);");
}
else if (type.equals("String")) {
out.println("info." + propertyName + " = ReadString(dataIn, bs);");
}
else if (type.equals("byte[]") || type.equals("ByteSequence")) {
if (size != null) {
out.println("info." + propertyName + " = ReadBytes(dataIn, " + size.asInt() + ");");
}
else {
out.println("info." + propertyName + " = ReadBytes(dataIn, bs.ReadBoolean());");
}
}
else if (isThrowable(property.getType())) {
out.println("info." + propertyName + " = UnmarshalBrokerError(wireFormat, dataIn, bs);");
}
else if (isCachedProperty(property)) {
out.println("info." + propertyName + " = (" + type + ") UnmarshalCachedObject(wireFormat, dataIn, bs);");
}
else {
out.println("info." + propertyName + " = (" + type + ") UnmarshalNestedObject(wireFormat, dataIn, bs);");
}
}
protected void generateUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
JClass propertyType = property.getType();
String arrayType = propertyType.getArrayComponentType().getSimpleName();
String propertyName = property.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 + ") UnmarshalNestedObject(wireFormat,dataIn, bs);");
out.println(" }");
out.println(" info." + propertyName + " = value;");
out.println(" }");
}
else {
out.println(" if (bs.ReadBoolean()) {");
out.println(" short size = dataIn.ReadInt16();");
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(" }");
out.println(" info." + propertyName + " = value;");
out.println(" }");
out.println(" else {");
out.println(" info." + propertyName + " = null;");
out.println(" }");
}
}
protected int generateMarshal1Body(PrintWriter out) {
List properties = getProperties();
int baseSize = 0;
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.getSimpleName();
out.print(indent);
if (type.equals("boolean")) {
out.println("bs.WriteBoolean(" + getter + ");");
}
else if (type.equals("byte")) {
baseSize += 1;
}
else if (type.equals("char")) {
baseSize += 1;
}
else if (type.equals("short")) {
baseSize += 1;
}
else if (type.equals("int")) {
baseSize += 1;
}
else if (type.equals("long")) {
out.println("rc += Marshal1Long(wireFormat, " + getter + ", bs);");
}
else if (type.equals("String")) {
out.println("rc += WriteString(" + getter + ", bs);");
}
else if (type.equals("byte[]") || type.equals("ByteSequence")) {
if (size == null) {
out.println("bs.WriteBoolean(" + getter + "!=null);");
out.println(" rc += " + getter + "==null ? 0 : " + getter + ".Length+4;");
}
else {
baseSize += size.asInt();
}
}
else if (propertyType.isArrayType()) {
if (size != null) {
out.println("rc += MarshalObjectArrayConstSize(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
}
else {
out.println("rc += MarshalObjectArray(wireFormat, " + getter + ", bs);");
}
}
else if (isThrowable(propertyType)) {
out.println("rc += MarshalBrokerError(wireFormat, " + getter + ", bs);");
}
else {
if (isCachedProperty(property)) {
out.println("rc += Marshal1CachedObject(wireFormat, " + getter + ", bs);");
}
else {
out.println("rc += Marshal1NestedObject(wireFormat, " + getter + ", bs);");
}
}
}
return baseSize;
}
protected void generateMarshal2Body(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.getSimpleName();
out.print(indent);
if (type.equals("boolean")) {
out.println("bs.ReadBoolean();");
}
else if (type.equals("byte")) {
out.println("dataOut.Write((byte) " + getter + ");");
}
else if (type.equals("char")) {
out.println("dataOut.Write((char) " + getter + ");");
}
else if (type.equals("short")) {
out.println("dataOut.Write((short)" + getter + ");");
}
else if (type.equals("int")) {
out.println("dataOut.Write((int) " + getter + ");");
}
else if (type.equals("long")) {
out.println("Marshal2Long(wireFormat, " + getter + ", dataOut, bs);");
}
else if (type.equals("String")) {
out.println("WriteString(" + getter + ", dataOut, bs);");
}
else if (type.equals("byte[]") || type.equals("ByteSequence")) {
if (size != null) {
out.println("dataOut.WriteBytes(" + getter + ", 0, " + size.asInt() + ");");
}
else {
out.println("if(bs.ReadBoolean()) {");
out.println(" dataOut.Write((int)" + getter + ".Length);");
out.println(" dataOut.Write(" + getter + ");");
out.println(" }");
}
}
else if (propertyType.isArrayType()) {
if (size != null) {
out.println("MarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
}
else {
out.println("MarshalObjectArray(wireFormat, " + getter + ", dataOut, bs);");
}
}
else if (isThrowable(propertyType)) {
out.println("MarshalBrokerError(wireFormat, " + getter + ", dataOut, bs);");
}
else {
if (isCachedProperty(property)) {
out.println("Marshal2CachedObject(wireFormat, " + getter + ", dataOut, bs);");
}
else {
out.println("Marshal2NestedObject(wireFormat, " + getter + ", dataOut, bs);");
}
}
}
}
}

View File

@ -31,9 +31,8 @@ import java.util.*;
*/
public abstract class OpenWireClassesScript extends OpenWireScript {
protected Set manuallyMaintainedClasses = new HashSet();
protected File destDir = new File("target/generated/classes");
protected File destDir;
protected File destFile;
protected String filePostFix = "";
protected JClass jclass;
protected JClass superclass;
@ -43,16 +42,14 @@ public abstract class OpenWireClassesScript extends OpenWireScript {
protected StringBuffer buffer;
public OpenWireClassesScript() {
String[] names = { "ActiveMQDestination", "ActiveMQTempDestination", "ActiveMQQueue", "ActiveMQTopic", "ActiveMQTempQueue", "ActiveMQTempTopic",
"BaseCommand", "ActiveMQMessage", "ActiveMQTextMessage", "ActiveMQMapMessage", "ActiveMQBytesMessage", "ActiveMQStreamMessage",
"ActiveMQStreamMessage", "DataStructureSupport" };
for (int i = 0; i < names.length; i++) {
manuallyMaintainedClasses.add(names[i]);
}
initialiseManuallyMaintainedClasses();
}
public Object run() {
if (destDir == null) {
throw new IllegalArgumentException("No destDir defined!");
}
System.out.println(getClass().getName() + " generating files in: " + destDir);
destDir.mkdirs();
buffer = new StringBuffer();
@ -80,7 +77,7 @@ public abstract class OpenWireClassesScript extends OpenWireScript {
}
return answer;
}
protected boolean isValidClass(JClass jclass) {
if (jclass.getAnnotation("openwire:marshaller") == null) {
return false;
@ -131,5 +128,27 @@ public abstract class OpenWireClassesScript extends OpenWireScript {
protected String getClassName(JClass jclass) {
return jclass.getSimpleName();
}
public boolean isAbstractClass() {
return jclass != null & jclass.isAbstract();
}
public String getAbstractClassText() {
return isAbstractClass() ? "abstract " : "";
}
public boolean isMarshallerAware() {
return isMarshallAware(jclass);
}
protected void initialiseManuallyMaintainedClasses() {
String[] names = { "ActiveMQDestination", "ActiveMQTempDestination", "ActiveMQQueue", "ActiveMQTopic", "ActiveMQTempQueue", "ActiveMQTempTopic",
"BaseCommand", "ActiveMQMessage", "ActiveMQTextMessage", "ActiveMQMapMessage", "ActiveMQBytesMessage", "ActiveMQStreamMessage",
"ActiveMQStreamMessage", "DataStructureSupport" };
for (int i = 0; i < names.length; i++) {
manuallyMaintainedClasses.add(names[i]);
}
}
}

View File

@ -28,7 +28,9 @@ public abstract class OpenWireCppClassesScript extends OpenWireClassesScript {
public Object run() {
filePostFix = getFilePostFix();
destDir = new File("../openwire-cpp/src/command");
if (destDir == null) {
destDir = new File("../openwire-cpp/src/command");
}
return super.run();
}

View File

@ -0,0 +1,347 @@
/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.openwire.tool;
import org.codehaus.jam.*;
import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
*
* @version $Revision$
*/
public abstract class OpenWireJavaMarshallingScript extends OpenWireClassesScript {
protected List concreteClasses = new ArrayList();
protected File factoryFile;
protected String factoryFileName = "MarshallerFactory";
protected String indent = " ";
public Object run() {
if (destDir == null) {
destDir = new File("src/main/java/org/apache/activemq/openwire/v" + getOpenwireVersion());
}
Object answer = super.run();
processFactory();
return answer;
}
protected void processFactory() {
if (factoryFile == null) {
factoryFile = new File(destDir, factoryFileName + filePostFix);
}
PrintWriter out = null;
try {
out = new PrintWriter(new FileWriter(factoryFile));
generateFactory(out);
}
catch (Exception e) {
throw new RuntimeException(e);
}
finally {
if (out != null) {
out.close();
}
}
}
protected abstract void generateFactory(PrintWriter out);
protected void processClass(JClass jclass) {
super.processClass(jclass);
if (!jclass.isAbstract()) {
concreteClasses.add(jclass);
}
}
protected String getClassName(JClass jclass) {
return super.getClassName(jclass) + "Marshaller";
}
protected String getBaseClassName(JClass jclass) {
String answer = "DataStreamMarshaller";
JClass superclass = jclass.getSuperclass();
if (superclass != null) {
String superName = superclass.getSimpleName();
if (!superName.equals("Object") && !superName.equals("JNDIBaseStorable") && !superName.equals("DataStructureSupport")) {
answer = superName + "Marshaller";
}
}
return answer;
}
protected void initialiseManuallyMaintainedClasses() {
}
protected void generateUnmarshalBody(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[]")) {
generateUnmarshalBodyForArrayProperty(out, property, size);
}
else {
generateUnmarshalBodyForProperty(out, property, size);
}
}
}
protected void generateUnmarshalBodyForProperty(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 + "(bs.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 + "(unmarshalLong(wireFormat, dataIn, bs));");
}
else if (type.equals("String")) {
out.println("info." + setter + "(readString(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(" }");
}
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(" }");
}
}
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(" }");
}
else if (isThrowable(property.getType())) {
out.println("info." + setter + "((" + type + ") unmarsalThrowable(wireFormat, dataIn, bs));");
}
else if (isCachedProperty(property)) {
out.println("info." + setter + "((" + type + ") unmarsalCachedObject(wireFormat, dataIn, bs));");
}
else {
out.println("info." + setter + "((" + type + ") unmarsalNestedObject(wireFormat, dataIn, bs));");
}
}
protected void generateUnmarshalBodyForArrayProperty(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 + ") unmarsalNestedObject(wireFormat,dataIn, bs);");
out.println(" }");
out.println(" info." + setter + "(value);");
out.println(" }");
}
else {
out.println(" if (bs.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 + ") unmarsalNestedObject(wireFormat,dataIn, bs);");
out.println(" }");
out.println(" info." + setter + "(value);");
out.println(" }");
out.println(" else {");
out.println(" info." + setter + "(null);");
out.println(" }");
}
}
protected int generateMarshal1Body(PrintWriter out) {
List properties = getProperties();
int baseSize = 0;
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("bs.writeBoolean(" + getter + ");");
}
else if (type.equals("byte")) {
baseSize += 1;
}
else if (type.equals("char")) {
baseSize += 1;
}
else if (type.equals("short")) {
baseSize += 1;
}
else if (type.equals("int")) {
baseSize += 1;
}
else if (type.equals("long")) {
out.println("rc+=marshal1Long(wireFormat, " + getter + ", bs);");
}
else if (type.equals("String")) {
out.println("rc += writeString(" + 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;");
}
else {
baseSize += size.asInt();
}
}
else if (type.equals("ByteSequence")) {
out.println("bs.writeBoolean(" + getter + "!=null);");
out.println(" rc += " + getter + "==null ? 0 : " + getter + ".getLength()+4;");
}
else if (propertyType.isArrayType()) {
if (size != null) {
out.println("rc += marshalObjectArrayConstSize(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
}
else {
out.println("rc += marshalObjectArray(wireFormat, " + getter + ", bs);");
}
}
else if (isThrowable(propertyType)) {
out.println("rc += marshalThrowable(wireFormat, " + getter + ", bs);");
}
else {
if (isCachedProperty(property)) {
out.println("rc += marshal1CachedObject(wireFormat, " + getter + ", bs);");
}
else {
out.println("rc += marshal1NestedObject(wireFormat, " + getter + ", bs);");
}
}
}
return baseSize;
}
protected void generateMarshal2Body(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("bs.readBoolean();");
}
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("marshal2Long(wireFormat, " + getter + ", dataOut, bs);");
}
else if (type.equals("String")) {
out.println("writeString(" + getter + ", dataOut, bs);");
}
else if (type.equals("byte[]")) {
if (size != null) {
out.println("dataOut.write(" + getter + ", 0, " + size.asInt() + ");");
}
else {
out.println("if(bs.readBoolean()) {");
out.println(" dataOut.writeInt(" + getter + ".length);");
out.println(" dataOut.write(" + getter + ");");
out.println(" }");
}
}
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(" }");
}
else if (propertyType.isArrayType()) {
if (size != null) {
out.println("marshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
}
else {
out.println("marshalObjectArray(wireFormat, " + getter + ", dataOut, bs);");
}
}
else if (isThrowable(propertyType)) {
out.println("marshalThrowable(wireFormat, " + getter + ", dataOut, bs);");
}
else {
if (isCachedProperty(property)) {
out.println("marshal2CachedObject(wireFormat, " + getter + ", dataOut, bs);");
}
else {
out.println("marshal2NestedObject(wireFormat, " + getter + ", dataOut, bs);");
}
}
}
}
}

View File

@ -30,26 +30,27 @@ import org.codehaus.jam.JamService;
*/
public abstract class OpenWireScript extends GramSupport {
private String openwireVersion;
protected String filePostFix = ".java";
public boolean isValidProperty(JProperty it) {
JMethod getter = it.getGetter();
return getter != null && it.getSetter() != null && getter.isStatic() == false
&& getter.getAnnotation("openwire:property") != null;
return getter != null && it.getSetter() != null && getter.isStatic() == false && getter.getAnnotation("openwire:property") != null;
}
public boolean isCachedProperty(JProperty it) {
JMethod getter = it.getGetter();
if( !isValidProperty(it) )
if (!isValidProperty(it))
return false;
JAnnotationValue value = getter.getAnnotation("openwire:property").getValue("cache");
return value!=null && value.asBoolean();
return value != null && value.asBoolean();
}
public boolean isAbstract(JClass j) {
JField[] fields = j.getFields();
for (int i = 0; i < fields.length; i++) {
JField field = fields[i];
if (field.isStatic() && field.isPublic() && field.isFinal()
&& field.getSimpleName().equals("DATA_STRUCTURE_TYPE")) {
if (field.isStatic() && field.isPublic() && field.isFinal() && field.getSimpleName().equals("DATA_STRUCTURE_TYPE")) {
return false;
}
}
@ -60,19 +61,31 @@ public abstract class OpenWireScript extends GramSupport {
if (j.getQualifiedName().equals(Throwable.class.getName())) {
return true;
}
return j.getSuperclass()!=null && isThrowable(j.getSuperclass());
return j.getSuperclass() != null && isThrowable(j.getSuperclass());
}
public boolean isMarshallAware(JClass j) {
JClass[] interfaces = j.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if( interfaces[i].getQualifiedName().equals("org.apache.activemq.command.MarshallAware") ) {
return true;
if (filePostFix.endsWith("java")) {
JClass[] interfaces = j.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getQualifiedName().equals("org.apache.activemq.command.MarshallAware")) {
return true;
}
}
return false;
}
return false; //j.getSuperclass()!=null && isMarshallAware(j.getSuperclass());
else {
String simpleName = j.getSimpleName();
return simpleName.equals("ActiveMQMessage");
}
/*
* else { // is it a message type String simpleName = j.getSimpleName();
* JClass superclass = j.getSuperclass(); return
* simpleName.equals("ActiveMQMessage") || (superclass != null &&
* superclass.getSimpleName().equals("ActiveMQMessage")); }
*/
}
public JamService getJam() {
return (JamService) getBinding().getVariable("jam");
}
@ -80,7 +93,18 @@ public abstract class OpenWireScript extends GramSupport {
public JamClassIterator getClasses() {
return getJam().getClasses();
}
public String getOpenwireVersion() {
if (openwireVersion == null) {
openwireVersion = System.getProperty("openwire.version");
}
return openwireVersion;
}
public void setOpenwireVersion(String openwireVersion) {
this.openwireVersion = openwireVersion;
}
/**
* Converts the Java type to a C# type name
*/
@ -103,7 +127,6 @@ public abstract class OpenWireScript extends GramSupport {
}
}
public String getOpenWireOpCode(JClass aClass) {
return annotationValue(aClass, "openwire:marshaller", "code", "0");
}

View File

@ -59,7 +59,7 @@ namespace OpenWire.Client.Commands
//
public class ${jclass.simpleName} : $baseClass
{
public const byte ID_${jclass.simpleName} = ${getOpenWireOpCode(jclass)};
public const byte ID_${jclass.simpleName} = ${getOpenWireOpCode(jclass)};
"""
for (property in properties) {
@ -76,7 +76,7 @@ namespace OpenWire.Client.Commands
// TODO generate ToString method
public override byte GetCommandType() {
public override byte GetDataStructureType() {
return ID_${jclass.simpleName};
}

View File

@ -14,87 +14,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.activemq.openwire.tool.OpenWireScript
import org.apache.activemq.openwire.tool.OpenWireCSharpMarshallingScript
/**
* Generates the Java marshalling code for the Open Wire Format
* Generates the C# marshalling code for the Open Wire Format
*
* @version $Revision$
*/
class GenerateCSharpMarshalling extends OpenWireScript {
class GenerateCSharpMarshalling extends OpenWireCSharpMarshallingScript {
Object run() {
def destDir = new File("../openwire-dotnet/src/OpenWire.Client/IO")
destDir.mkdirs()
def messageClasses = classes.findAll {
it.getAnnotation("openwire:marshaller")!=null
}
println "Generating Java marshalling code to directory ${destDir}"
def buffer = new StringBuffer()
def readMethodBuffer = new StringBuffer()
def writeMethodBuffer = new StringBuffer()
int counter = 0
Map map = [:]
def propertyList = null
def type = null
for (jclass in messageClasses) {
println "Processing $jclass.simpleName"
propertyList = jclass.declaredProperties.findAll { isValidProperty(it) }
def file = new File(destDir, jclass.simpleName + "Marshaller.cs")
String baseClass = "AbstractCommandMarshaller"
if (jclass.superclass?.simpleName == "ActiveMQMessage") {
baseClass = "ActiveMQMessageMarshaller"
}
//def notAbstract = jclass.simpleName != "ActiveMQDestination"
def notAbstract = jclass.isAbstract() == false
def abstractText = (notAbstract) ? "" : "abstract "
def marshallerType = jclass.simpleName + "Marshaller"
def marshallerField = decapitalize(marshallerType)
if (notAbstract) {
buffer << """
private static $marshallerType $marshallerField = new $marshallerType();
public static $marshallerType $marshallerType
{
get
{
return $marshallerField;
}
}
"""
readMethodBuffer << """
case ${jclass.simpleName}.ID_${jclass.simpleName}:
return ${marshallerField}.ReadCommand(dataIn);
"""
writeMethodBuffer << """
case ${jclass.simpleName}.ID_${jclass.simpleName}:
${marshallerField}.WriteCommand(command, dataOut);
break;
"""
}
file.withWriter { out |
out << """//
// Marshalling code for Open Wire Format for ${jclass.simpleName}
void generateFile(PrintWriter out) {
out << """//
//
// Copyright 2005-2006 The Apache Software Foundation
//
// 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
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
@ -108,221 +52,124 @@ using OpenWire.Client.IO;
namespace OpenWire.Client.IO
{
public ${abstractText}class $marshallerType : $baseClass
//
// 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-core module
//
public ${abstractClassText}class $className : $baseClass
{
"""
if( !abstractClass ) out << """
public override DataStructure CreateObject()
{
"""
if (notAbstract)
out << """
public override Command CreateCommand() {
return new ${jclass.simpleName}();
}
"""
out << """
public override void BuildCommand(Command command, BinaryReader dataIn) {
base.BuildCommand(command, dataIn);
"""
if (!propertyList.empty) {
out << """
${jclass.simpleName} info = (${jclass.simpleName}) command;
"""
}
for (property in propertyList) {
def propertyName = property.simpleName
out << " info.${propertyName} = "
type = toCSharpType(property.type)
switch (type) {
case "string":
out << "dataIn.ReadString()"
break;
case "bool":
out << "dataIn.ReadBoolean()"
break;
case "byte":
out << "dataIn.ReadByte()"
break;
case "byte[]":
out << "ReadBytes(dataIn)"
break;
case "char":
out << "dataIn.ReadChar()"
break;
case "short":
out << "dataIn.ReadInt16()"
break;
case "int":
out << "dataIn.ReadInt32()"
break;
case "long":
out << "dataIn.ReadInt64()"
break;
case "float":
out << "dataIn.ReadDecimal()"
break;
case "double":
out << "dataIn.ReadDouble()"
break;
case "ActiveMQDestination":
out << "ReadDestination(dataIn)"
break;
case "BrokerError":
out << "ReadBrokerError(dataIn)"
break;
case "BrokerId[]":
out << "ReadBrokerIds(dataIn)"
break;
case "BrokerInfo[]":
out << "ReadBrokerInfos(dataIn)"
break;
case "DataStructure[]":
out << "ReadDataStructures(dataIn)"
break;
case "DataStructure":
out << "CommandMarshallerRegistry.ReadCommand(dataIn)"
break;
case "Throwable":
out << "ReadThrowable(dataIn)"
break;
default:
if (property.type.isAbstract())
out << "(${type}) CommandMarshallerRegistry.ReadCommand(dataIn)"
else
out << "(${type}) CommandMarshallerRegistry.${type}Marshaller.ReadCommand(dataIn)"
}
out << """;
"""
}
out << """
}
public override void WriteCommand(Command command, BinaryWriter dataOut) {
base.WriteCommand(command, dataOut);
"""
if (!propertyList.empty) {
out << """
${jclass.simpleName} info = (${jclass.simpleName}) command;
"""
}
for (property in propertyList) {
def propertyName = property.simpleName
if (propertyName == jclass.simpleName) {
// TODO think of a better naming convention :)
propertyName += "Value"
}
def getter = "info." + propertyName
out << " "
type = toCSharpType(property.type)
switch (type) {
case "string":
out << "dataOut.Write($getter);"
break;
case "bool":
out << "dataOut.Write($getter);"
break;
case "byte":
out << "dataOut.Write($getter);"
break;
case "byte[]":
out << "WriteBytes($getter, dataOut);"
break;
case "char":
out << "dataOut.Write($getter);"
break;
case "short":
out << "dataOut.Write($getter);"
break;
case "int":
out << "dataOut.Write($getter);"
break;
case "long":
out << "dataOut.Write($getter);"
break;
case "float":
out << "dataOut.Write($getter);"
break;
case "double":
out << "dataOut.Write($getter);"
break;
case "ActiveMQDestination":
out << "WriteDestination($getter, dataOut);"
break;
case "BrokerError":
out << "WriteBrokerError($getter, dataOut);"
break;
case "BrokerId[]":
out << "WriteBrokerIds($getter, dataOut);"
break;
case "BrokerInfo[]":
out << "WriteBrokerInfos($getter, dataOut);"
break;
case "DataStructure[]":
out << "WriteDataStructures($getter, dataOut);"
break;
case "DataStructure":
out << "CommandMarshallerRegistry.WriteCommand((Command) $getter, dataOut);"
break;
case "Throwable":
out << "WriteThrowable($getter, dataOut);"
break;
default:
if (property.type.isAbstract())
out << "CommandMarshallerRegistry.WriteCommand($getter, dataOut);"
else
out << "CommandMarshallerRegistry.${type}Marshaller.WriteCommand($getter, dataOut);"
}
out << """
"""
}
out << """
}
return new ${jclass.simpleName}();
}
public override byte GetDataStructureType()
{
return ${jclass.simpleName}.ID_${jclass.simpleName};
}
}
"""
}
}
out << """
//
// Un-marshal an object instance from the data input stream
//
public override void Unmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
{
base.Unmarshal(wireFormat, o, dataIn, bs);
"""
if( !properties.isEmpty() || marshallerAware ) out << """
${jclass.simpleName} info = (${jclass.simpleName})o;
"""
if( marshallerAware ) out << """
info.BeforeUnmarshall(wireFormat);
def file = new File(destDir, "CommandMarshallerRegistry.cs")
file.withWriter { out |
out << """//
"""
generateUnmarshalBody(out)
if( marshallerAware ) out << """
info.AfterUnmarshall(wireFormat);
"""
out << """
}
//
// Write the booleans that this object uses to a BooleanStream
//
public override int Marshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) {
${jclass.simpleName} info = (${jclass.simpleName})o;
"""
if( marshallerAware ) out << """
info.BeforeMarshall(wireFormat);
"""
out << """
int rc = base.Marshal1(wireFormat, info, bs);
"""
def baseSize = generateMarshal1Body(out)
out << """
return rc + ${baseSize};
}
//
// 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);
"""
if( !properties.isEmpty() || marshallerAware ) out << """
${jclass.simpleName} info = (${jclass.simpleName})o;
"""
generateMarshal2Body(out)
if( marshallerAware ) out << """
info.AfterMarshall(wireFormat);
"""
out << """
}
}
}
"""
}
void generateFactory(PrintWriter out) {
out << """//
//
// Copyright 2005-2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Marshalling code for Open Wire Format for ${jclass.simpleName}
//
//
@ -342,40 +189,22 @@ using OpenWire.Client.IO;
namespace OpenWire.Client.IO
{
public class CommandMarshallerRegistry
public class MarshallerFactory
{
public static Command ReadCommand(BinaryReader dataIn)
{
byte commandID = dataIn.ReadByte();
switch (commandID)
{
$readMethodBuffer
default:
throw new Exception("Unknown command type: " + commandID);
}
}
public void configure(OpenWireFormat format)
{
"""
for (jclass in concreteClasses) {
out << """
format.addMarshaller(new ${jclass.simpleName}Marshaller());"""
}
public static void WriteCommand(Command command, BinaryWriter dataOut)
{
byte commandID = command.GetCommandType();
dataOut.Write(commandID);
switch (commandID)
{
$writeMethodBuffer
default:
throw new Exception("Unknown command type: " + commandID);
}
}
// Properties
$buffer
out << """
}
}
}
"""
}
}
}
}

View File

@ -14,50 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.activemq.openwire.tool.OpenWireScript
import org.apache.activemq.openwire.tool.OpenWireJavaMarshallingScript
/**
* Generates the Java marshalling code for the Open Wire Format
*
* @version $Revision$
*/
class GenerateJavaMarshalling extends OpenWireScript {
class GenerateJavaMarshalling extends OpenWireJavaMarshallingScript {
Object run() {
def openwireVersion = System.getProperty("openwire.version");
def destDir = new File("src/main/java/org/apache/activemq/openwire/v${openwireVersion}")
println "Generating Java marshalling code to directory ${destDir}"
def openwireClasses = classes.findAll {
it.getAnnotation("openwire:marshaller")!=null
}
def concreteClasses = new ArrayList()
def buffer = new StringBuffer()
int counter = 0
Map map = [:]
destDir.mkdirs()
for (jclass in openwireClasses) {
println "Processing ${jclass.simpleName}"
def isAbstract = isAbstract(jclass);
if( !isAbstract ) {
concreteClasses.add(jclass)
}
def properties = jclass.declaredProperties.findAll { isValidProperty(it) }
def file = new File(destDir, jclass.simpleName + "Marshaller.java")
buffer << """
${jclass.simpleName}Marshaller.class
"""
file.withWriter { out |
out << """/**
void generateFile(PrintWriter out) {
out << """/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
@ -88,18 +55,10 @@ for (pkg in jclass.importedPackages) {
out << "import "+clazz.qualifiedName+";"
}
}
def baseClass = "DataStreamMarshaller"
if (!jclass.superclass.simpleName.equals("JNDIBaseStorable") && !jclass.superclass.simpleName.equals("DataStructureSupport") && !jclass.superclass.simpleName.equals("Object") ) {
baseClass = jclass.superclass.simpleName + "Marshaller";
}
def marshallerAware = isMarshallAware(jclass);
out << """
/**
* Marshalling code for Open Wire Format for ${jclass.simpleName}
* Marshalling code for Open Wire Format for ${className}
*
*
* NOTE!: This file is auto generated - do not modify!
@ -109,10 +68,10 @@ out << """
*
* @version \$Revision\$
*/
public """+ (isAbstract?"abstract ":"") + """class ${jclass.simpleName}Marshaller extends ${baseClass} {
public ${abstractClassText}class ${className} extends ${baseClass} {
"""
if( !isAbstract ) {
out << """
if( !abstractClass ) out << """
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
@ -128,7 +87,7 @@ out << """
return new ${jclass.simpleName}();
}
"""
}
out << """
/**
* Un-marshal an object instance from the data input stream
@ -140,117 +99,23 @@ out << """
public void unmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, BooleanStream bs) throws IOException {
super.unmarshal(wireFormat, o, dataIn, bs);
"""
if( !properties.isEmpty() ) {
out << """
if( !properties.isEmpty() ) out << """
${jclass.simpleName} info = (${jclass.simpleName})o;
"""
}
if( marshallerAware ) {
out << """
if( marshallerAware ) out << """
info.beforeUnmarshall(wireFormat);
"""
}
for (property in properties) {
def annotation = property.getter.getAnnotation("openwire:property");
def size = annotation.getValue("size");
def type = property.type.qualifiedName
def cached = isCachedProperty(property);
out << " "
switch (type) {
case "boolean":
out << "info.${property.setter.simpleName}(bs.readBoolean());"; break;
case "byte":
out << "info.${property.setter.simpleName}(dataIn.readByte());"; break;
case "char":
out << "info.${property.setter.simpleName}(dataIn.readChar());"; break;
case "short":
out << "info.${property.setter.simpleName}(dataIn.readShort());"; break;
case "int":
out << "info.${property.setter.simpleName}(dataIn.readInt());"; break;
case "long":
out << "info.${property.setter.simpleName}(unmarshalLong(wireFormat, dataIn, bs));"; break;
case "byte[]":
if( size != null ) {
out << """{
byte data[] = new byte[${size.asInt()}];
dataIn.readFully(data);
info.${property.setter.simpleName}(data);
}
""";
} else {
out << """{
if( bs.readBoolean() ) {
int size = dataIn.readInt();
byte data[] = new byte[size];
dataIn.readFully(data);
info.${property.setter.simpleName}(data);
} else {
info.${property.setter.simpleName}(null);
}
}
""";
}
break;
case "org.activeio.ByteSequence":
out << """
if( bs.readBoolean() ) {
int size = dataIn.readInt();
byte data[] = new byte[size];
dataIn.readFully(data);
info.${property.setter.simpleName}(new org.activeio.ByteSequence(data,0,size));
} else {
info.${property.setter.simpleName}(null);
}
""";
break;
case "java.lang.String":
out << "info.${property.setter.simpleName}(readString(dataIn, bs));"; break;
default:
if( property.type.arrayType ) {
def arrayType = property.type.arrayComponentType.qualifiedName;
if( size!=null ) {
out << """
${arrayType} value[] = new ${arrayType}[${size}];
for( int i=0; i < ${size}; i++ ) {
value[i] = (${arrayType})unmarsalNestedObject(wireFormat,dataIn, bs);
}
info.${property.setter.simpleName}(value);
"""
} else {
out << """
if( bs.readBoolean() ) {
short size = dataIn.readShort();
${arrayType} value[] = new ${arrayType}[size];
for( int i=0; i < size; i++ ) {
value[i] = (${arrayType})unmarsalNestedObject(wireFormat,dataIn, bs);
}
info.${property.setter.simpleName}(value);
} else {
info.${property.setter.simpleName}(null);
}
"""
}
} else if( isThrowable(property.type) ) {
out << "info.${property.setter.simpleName}((${type}) unmarsalThrowable(wireFormat, dataIn, bs));"
} else {
if ( cached ) {
out << "info.${property.setter.simpleName}((${type}) unmarsalCachedObject(wireFormat, dataIn, bs));"
} else {
out << "info.${property.setter.simpleName}((${type}) unmarsalNestedObject(wireFormat, dataIn, bs));"
}
}
}
out << """
"""
}
if( marshallerAware ) {
out << """
generateUnmarshalBody(out)
if( marshallerAware ) out << """
info.afterUnmarshall(wireFormat);
"""
}
out << """
out << """
}
@ -259,78 +124,25 @@ out << """
*/
public int marshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
"""
if( !properties.isEmpty() ) {
out << """
if( !properties.isEmpty() ) out << """
${jclass.simpleName} info = (${jclass.simpleName})o;
"""
}
if( marshallerAware ) {
out << """
if( marshallerAware ) out << """
info.beforeMarshall(wireFormat);
"""
}
def baseSize=0;
out << """
int rc = super.marshal1(wireFormat, o, bs);
"""
for (property in properties) {
def annotation = property.getter.getAnnotation("openwire:property");
def size = annotation.getValue("size");
def getter = "info." + property.getter.simpleName + "()"
def cached = isCachedProperty(property);
out << " "
def type = property.type.qualifiedName
switch (type) {
case "boolean":
out << "bs.writeBoolean($getter);"; break;
case "byte": baseSize+=1; break;
case "char": baseSize+=2; break;
case "short": baseSize+=2; break;
case "int": baseSize+=4; break;
case "long":
out << "rc+=marshal1Long(wireFormat, $getter, bs);"; break;
case "byte[]":
if( size ==null ) {
out << """
bs.writeBoolean($getter!=null);
rc += ${getter}==null ? 0 : ${getter}.length+4;
""";
} else {
baseSize += size.asInt();
}
break;
case "org.activeio.ByteSequence":
out << """
bs.writeBoolean($getter!=null);
rc += ${getter}==null ? 0 : ${getter}.getLength()+4;
""";
break;
case "java.lang.String":
out << "rc += writeString($getter, bs);"; break;
default:
if( property.type.arrayType ) {
if( size!=null ) {
out << "rc += marshalObjectArrayConstSize(wireFormat, $getter, bs, $size);"; break;
} else {
out << "rc += marshalObjectArray(wireFormat, $getter, bs);"; break;
}
} else if( isThrowable(property.type) ) {
out << "rc += marshalThrowable(wireFormat, $getter, bs);"; break;
} else {
if( cached ) {
out << "rc += marshal1CachedObject(wireFormat, $getter, bs);"; break;
} else {
out << "rc += marshal1NestedObject(wireFormat, $getter, bs);"; break;
}
}
}
out << """
"""
}
out << """
return rc+${baseSize};
def baseSize = generateMarshal1Body(out)
out << """
return rc + ${baseSize};
}
/**
@ -343,91 +155,26 @@ for (property in properties) {
public void marshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
super.marshal2(wireFormat, o, dataOut, bs);
"""
if( !properties.isEmpty() ) {
out << """
if( !properties.isEmpty() ) out << """
${jclass.simpleName} info = (${jclass.simpleName})o;
"""
}
for (property in properties) {
def annotation = property.getter.getAnnotation("openwire:property");
def size = annotation.getValue("size");
def getter = "info." + property.getter.simpleName + "()"
def cached = isCachedProperty(property);
out << " "
def type = property.type.qualifiedName
switch (type) {
case "boolean":
out << "bs.readBoolean();"; break;
case "byte":
out << "dataOut.writeByte($getter);"; break;
case "char":
out << "dataOut.writeChar($getter);"; break;
case "short":
out << "dataOut.writeShort($getter);"; break;
case "int":
out << "dataOut.writeInt($getter);"; break;
case "long":
out << "marshal2Long(wireFormat, $getter, dataOut, bs);"; break;
case "byte[]":
if( size !=null ) {
out << "dataOut.write($getter, 0, ${size.asInt()});";
} else {
out << """
if(bs.readBoolean()) {
dataOut.writeInt(${getter}.length);
dataOut.write(${getter});
}
""";
}
break;
case "org.activeio.ByteSequence":
out << """
if(bs.readBoolean()) {
org.activeio.ByteSequence data = ${getter};
dataOut.writeInt(data.getLength());
dataOut.write(data.getData(), data.getOffset(), data.getLength());
}
""";
break;
case "java.lang.String":
out << "writeString($getter, dataOut, bs);"; break;
default:
if( property.type.arrayType ) {
if( size!=null ) {
out << "marshalObjectArrayConstSize(wireFormat, $getter, dataOut, bs, $size);"; break;
} else {
out << "marshalObjectArray(wireFormat, $getter, dataOut, bs);"; break;
}
} else if( isThrowable(property.type) ) {
out << "marshalThrowable(wireFormat, $getter, dataOut, bs);"; break;
} else {
if( cached ) {
out << "marshal2CachedObject(wireFormat, $getter, dataOut, bs);"; break;
} else {
out << "marshal2NestedObject(wireFormat, $getter, dataOut, bs);"; break;
}
}
}
out << """
"""
}
if( marshallerAware ) {
out << """
generateMarshal2Body(out)
if( marshallerAware ) out << """
info.afterMarshall(wireFormat);
"""
}
out << """
out << """
}
}
"""
}
}
def file = new File(destDir, "MarshallerFactory.java")
file.withWriter { out |
out << """/**
void generateFactory(PrintWriter out) {
out << """/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
@ -468,10 +215,12 @@ public class MarshallerFactory {
static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
static {
"""
for (jclass in concreteClasses) {
out << """
add(new ${jclass.simpleName}Marshaller());"""
}
out << """
}
@ -485,7 +234,5 @@ out << """
}
}
"""
}
}
}