activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r462621 [7/7] - in /incubator/activemq/sandbox/qpid: ./ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/activemq/ src/main/java/org/apache/activemq/qpid/ src/main/java/org/apache/activemq/qpid/command/ s...
Date Tue, 10 Oct 2006 22:43:51 GMT
Modified: incubator/activemq/sandbox/qpid/stylesheets/marshaller-java.xsl
URL: http://svn.apache.org/viewvc/incubator/activemq/sandbox/qpid/stylesheets/marshaller-java.xsl?view=diff&rev=462621&r1=462620&r2=462621
==============================================================================
--- incubator/activemq/sandbox/qpid/stylesheets/marshaller-java.xsl (original)
+++ incubator/activemq/sandbox/qpid/stylesheets/marshaller-java.xsl Tue Oct 10 15:43:45 2006
@@ -32,17 +32,9 @@
     <xsl:apply-templates mode="generate-registry" select="frames"/>
 </xsl:template>
 
-<!-- processes all frames outputting the classes in a single stream -->
-<!-- (useful for debugging etc) -->
-<xsl:template match="frame" mode="generate-single"> 
-    <xsl:call-template name="generate-class">
-        <xsl:with-param name="f" select="."/>
-    </xsl:call-template>
-</xsl:template>
-
 <!-- generates seperate file for each class/frame -->
 <xsl:template match="frame" mode="generate-multi"> 
-    <xsl:variable name="uri" select="concat(@name, '.java')"/> 
+    <xsl:variable name="uri" select="concat(@name, 'Marshaller.java')"/> 
     wrote <xsl:value-of select="$uri"/> 
     <xsl:result-document href="{$uri}" format="textFormat"> 
     <xsl:call-template name="generate-class">
@@ -53,39 +45,39 @@
 
 <!-- main class generation template -->
 <xsl:template name="generate-class"> 
-    <xsl:param name="f"/>
-    <xsl:value-of select="amq:copyright()"/>    
+<xsl:param name="f"/>
+<xsl:value-of select="amq:copyright()"/>    
 package org.apache.activemq.qpid.marshaller.v<xsl:value-of select="$major"/>_<xsl:value-of
select="$minor"/>;
 
-import  org.apache.activemq.qpid.command.*;
-import  org.apache.activemq.qpid.marshaller.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.qpid.*;
+import org.apache.activemq.qpid.command.*;
+import org.apache.activemq.qpid.marshaller.*;
 
 /**
  * This class is autogenerated, do not modify. [From <xsl:value-of select="$f/parent::frames/@protocol"/>]
  */
-public class <xsl:value-of select="$f/@name"/> extends AMQMethodBody implements EncodableAMQDataBlock
+public class <xsl:value-of select="$f/@name"/>Marshaller extends AMQMethodBodyMarshaller
 { 
     public static final int CLASS_ID = <xsl:value-of select="$f/@class-id"/>; 	
     public static final int METHOD_ID = <xsl:value-of select="$f/@method-id"/>; 	
 
-    <xsl:for-each select="$f/field"> 
-        <xsl:text>public </xsl:text><xsl:value-of select="@java-type"/>
-        <xsl:text> </xsl:text>
-        <xsl:value-of select="@name"/>;    
-    </xsl:for-each> 
-
     protected int getClazz()
     {
-        return <xsl:value-of select="$f/@class-id"/>;
+        return CLASS_ID;
     }
    
     protected int getMethod()
     {
-        return <xsl:value-of select="$f/@method-id"/>;
+        return METHOD_ID;
     }
 
-    protected int getBodySize()
+    protected int getBodySize(AMQMethodBody o)
     {
+        <xsl:value-of select="$f/@name"/> object = (<xsl:value-of select="$f/@name"/>)o;
         <xsl:choose> 
         <xsl:when test="$f/field">
         return
@@ -100,46 +92,27 @@
         </xsl:choose> 
     }
 
-    protected void writeMethodPayload(ByteBuffer buffer)
+    protected void writeMethodPayload(DataOutput buffer, AMQMethodBody o) throws IOException
     {
+        <xsl:value-of select="$f/@name"/> object = (<xsl:value-of select="$f/@name"/>)o;
         <xsl:for-each select="$f/field">
             <xsl:if test="@type != 'bit'">
                 <xsl:value-of select="amq:encoder(.)"/>;
             </xsl:if>
             <xsl:if test="@type = 'bit' and @boolean-index = 1">
-                <xsl:text>EncodingUtils.writeBooleans(buffer, new boolean[]{</xsl:text>
-                <xsl:value-of select="$f/field[@type='bit']/@name" separator=", "/>});
+                <xsl:text>EncodingUtils.writeBooleans(buffer, new boolean[]{ object.</xsl:text>
+                <xsl:value-of select="$f/field[@type='bit']/@name" separator=", object."/>});
             </xsl:if>
         </xsl:for-each>		 
     }
 
-    public void populateMethodBodyFromBuffer(ByteBuffer buffer) throws AMQFrameDecodingException
+    public void populateMethodBodyFromBuffer(DataInput buffer, AMQMethodBody o) throws IOException
     {
+        <xsl:value-of select="$f/@name"/> object = (<xsl:value-of select="$f/@name"/>)o;
         <xsl:for-each select="$f/field">
             <xsl:value-of select="amq:decoder(.)"/>;
         </xsl:for-each>		 
     }
-
-    public String toString()
-    {
-        StringBuffer buf = new StringBuffer(super.toString());
-        <xsl:for-each select="$f/field">
-            <xsl:text>buf.append(" </xsl:text><xsl:value-of select="@name"/>:
").append(<xsl:value-of select="@name"/>);
-        </xsl:for-each> 
-        return buf.toString();
-    }
-
-    public static AMQFrame createAMQFrame(int channelId<xsl:if test="$f/field">, </xsl:if><xsl:value-of
select="$f/field/concat(@java-type, ' ', @name)" separator=", "/>)
-    {
-        <xsl:value-of select="@name"/> body = new <xsl:value-of select="@name"/>();
-        <xsl:for-each select="$f/field">
-            <xsl:value-of select="concat('body.', @name, ' = ', @name)"/>;
-        </xsl:for-each>		 
-        AMQFrame frame = new AMQFrame();
-        frame.channel = channelId;
-        frame.bodyFrame = body;
-        return frame;
-    }
 } 
 </xsl:template> 
 
@@ -212,7 +185,7 @@
     <xsl:result-document href="{$file}" format="textFormat">
     <xsl:value-of select="amq:copyright()"/>
 <!-- package org.apache.qpid.framing_<xsl:value-of select="$major"/>_<xsl:value-of
select="$minor"/>; -->
-package org.apache.qpid.framing;
+package org.apache.activemq.qpid.marshaller.v<xsl:value-of select="$major"/>_<xsl:value-of
select="$minor"/>;
 
 import java.util.Map;
 
@@ -228,8 +201,8 @@
             <xsl:value-of select="@class-id"/>         
 	    <xsl:text> * 1000 + </xsl:text> 
             <xsl:value-of select="@method-id"/>         
-	    <xsl:text>), </xsl:text> 
-            <xsl:value-of select="concat(@name, '.class')"/>);         
+	    <xsl:text>), new </xsl:text> 
+            <xsl:value-of select="concat(@name, 'Marshaller()')"/>);         
         </xsl:for-each>
     }
 }

Modified: incubator/activemq/sandbox/qpid/stylesheets/utils.xsl
URL: http://svn.apache.org/viewvc/incubator/activemq/sandbox/qpid/stylesheets/utils.xsl?view=diff&rev=462621&r1=462620&r2=462621
==============================================================================
--- incubator/activemq/sandbox/qpid/stylesheets/utils.xsl (original)
+++ incubator/activemq/sandbox/qpid/stylesheets/utils.xsl Tue Oct 10 15:43:45 2006
@@ -83,13 +83,13 @@
             <xsl:value-of select="concat('8 /*', $f/@name, '*/')"/>
         </xsl:when>
 	<xsl:when test="$f/@type='shortstr'">
-            <xsl:value-of select="concat('EncodingUtils.encodedShortStringLength(', $f/@name,
')')"/>
+            <xsl:value-of select="concat('EncodingUtils.encodedShortStringLength(object.',
$f/@name, ')')"/>
         </xsl:when> 		 		 
 	<xsl:when test="$f/@type='longstr'">
-            <xsl:value-of select="concat('4 + (', $f/@name, ' == null ? 0 : ', $f/@name,
'.length)')"/>
+            <xsl:value-of select="concat('4 + (object.', $f/@name, ' == null ? 0 : object.',
$f/@name, '.length)')"/>
         </xsl:when> 		 		 
 	<xsl:when test="$f/@type='table'">
-            <xsl:value-of select="concat('EncodingUtils.encodedFieldTableLength(', $f/@name,
')')"/>
+            <xsl:value-of select="concat('EncodingUtils.encodedFieldTableLength(object.',
$f/@name, ')')"/>
         </xsl:when> 		 		 
         <xsl:otherwise><xsl:text>/* WARNING: COULD NOT DETERMINE FIELD SIZE */</xsl:text></xsl:otherwise>
     </xsl:choose>    
@@ -104,28 +104,28 @@
     <xsl:param name="f"/>
     <xsl:choose>
         <xsl:when test="$f/@type='char'">
-            <xsl:value-of select="concat('EncodingUtils.writeChar(buffer, ', $f/@name,
')')"/>
+            <xsl:value-of select="concat('EncodingUtils.writeChar(buffer, object.', $f/@name,
')')"/>
         </xsl:when>
         <xsl:when test="$f/@type='octet'">
-            <xsl:value-of select="concat('EncodingUtils.writeUnsignedByte(buffer, ', $f/@name,
')')"/>
+            <xsl:value-of select="concat('EncodingUtils.writeUnsignedByte(buffer, object.',
$f/@name, ')')"/>
         </xsl:when>
 	<xsl:when test="$f/@type='short'">
-            <xsl:value-of select="concat('EncodingUtils.writeUnsignedShort(buffer, ',
$f/@name, ')')"/>
+            <xsl:value-of select="concat('EncodingUtils.writeUnsignedShort(buffer, object.',
$f/@name, ')')"/>
         </xsl:when>
         <xsl:when test="$f/@type='long'">
-            <xsl:value-of select="concat('EncodingUtils.writeUnsignedInteger(buffer, ',
$f/@name, ')')"/>
+            <xsl:value-of select="concat('EncodingUtils.writeUnsignedInteger(buffer, object.',
$f/@name, ')')"/>
         </xsl:when>
         <xsl:when test="$f/@type='longlong'">
-            <xsl:value-of select="concat('buffer.putLong(', $f/@name, ')')"/>
+            <xsl:value-of select="concat('buffer.writeLong(object.', $f/@name, ')')"/>
         </xsl:when>
 	<xsl:when test="$f/@type='shortstr'">
-            <xsl:value-of select="concat('EncodingUtils.writeShortStringBytes(buffer,
', $f/@name, ')')"/>
+            <xsl:value-of select="concat('EncodingUtils.writeShortStringBytes(buffer,
object.', $f/@name, ')')"/>
         </xsl:when> 		 		 
 	<xsl:when test="$f/@type='longstr'">
-            <xsl:value-of select="concat('EncodingUtils.writeLongstr(buffer, ', $f/@name,
')')"/>
+            <xsl:value-of select="concat('EncodingUtils.writeLongstr(buffer, object.',
$f/@name, ')')"/>
         </xsl:when> 		 		 
 	<xsl:when test="$f/@type='table'">
-            <xsl:value-of select="concat('EncodingUtils.writeFieldTableBytes(buffer, ',
$f/@name, ')')"/>
+            <xsl:value-of select="concat('EncodingUtils.writeFieldTableBytes(buffer, object.',
$f/@name, ')')"/>
         </xsl:when> 		 		 
         <xsl:otherwise><xsl:text>/* WARNING: COULD NOT DETERMINE ENCODER */</xsl:text></xsl:otherwise>
     </xsl:choose>    
@@ -139,31 +139,31 @@
             <xsl:if test="$f/@boolean-index = 1">
                 <xsl:text>boolean[] bools = EncodingUtils.readBooleans(buffer);</xsl:text>
             </xsl:if>
-            <xsl:value-of select="concat($f/@name, ' = bools[', $f/@boolean-index - 1
, ']')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = bools[', $f/@boolean-index
- 1 , ']')"/>
         </xsl:when>
         <xsl:when test="$f/@type='char'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getChar()')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = buffer.getChar()')"/>
         </xsl:when>
         <xsl:when test="$f/@type='octet'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getUnsigned()')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = EncodingUtils.readUnsignedByte(buffer)')"/>
         </xsl:when>
         <xsl:when test="$f/@type='short'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getUnsignedShort()')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = EncodingUtils.readUnsignedShort(buffer)')"/>
         </xsl:when>
         <xsl:when test="$f/@type='long'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getUnsignedInt()')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = EncodingUtils.readUnsignedInteger(buffer)')"/>
         </xsl:when>
         <xsl:when test="$f/@type='longlong'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getLong()')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = buffer.readLong()')"/>
         </xsl:when>
         <xsl:when test="$f/@type='shortstr'">
-            <xsl:value-of select="concat($f/@name, ' = EncodingUtils.readShortString(buffer)')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = EncodingUtils.readShortString(buffer)')"/>
         </xsl:when>
         <xsl:when test="$f/@type='longstr'">
-            <xsl:value-of select="concat($f/@name, ' = EncodingUtils.readLongstr(buffer)')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = EncodingUtils.readLongstr(buffer)')"/>
         </xsl:when>
         <xsl:when test="$f/@type='table'">
-            <xsl:value-of select="concat($f/@name, ' = EncodingUtils.readFieldTable(buffer)')"/>
+            <xsl:value-of select="concat('object.', $f/@name, ' = EncodingUtils.readFieldTable(buffer)')"/>
         </xsl:when>
         <xsl:otherwise><xsl:text>/* WARNING: COULD NOT DETERMINE DECODER */</xsl:text></xsl:otherwise>
     </xsl:choose>    



Mime
View raw message