You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2010/01/31 01:31:57 UTC

svn commit: r904934 [10/11] - in /qpid/trunk/qpid/java: broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/ broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/example/ broker/ broker/src/main/java/org/apache/qpid/qmf/ b...

Added: qpid/trunk/qpid/java/broker/src/xsl/qmf.xsl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/xsl/qmf.xsl?rev=904934&view=auto
==============================================================================
--- qpid/trunk/qpid/java/broker/src/xsl/qmf.xsl (added)
+++ qpid/trunk/qpid/java/broker/src/xsl/qmf.xsl Sun Jan 31 00:31:49 2010
@@ -0,0 +1,842 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output omit-xml-declaration="yes" />
+<xsl:template match="/">
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.qpid.qmf.schema;
+
+import org.apache.qpid.qmf.*;
+import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.message.ServerMessage;
+import org.apache.qpid.transport.codec.BBEncoder;
+import org.apache.qpid.transport.codec.BBDecoder;
+
+import java.util.Arrays;
+import java.util.UUID;
+import java.util.Map;
+
+    <xsl:apply-templates select="descendant-or-self::node()[name()='schema']" mode="schema"/>
+    
+</xsl:template>
+    
+<xsl:template match="node()[name()='schema']" mode="schema">
+    
+<xsl:variable name="schemaName"><xsl:call-template name="substringAfterLast"><xsl:with-param name="input" select="@package"/><xsl:with-param name="arg">.</xsl:with-param></xsl:call-template></xsl:variable>
+<xsl:variable name="ClassName"><xsl:call-template name="initCap"><xsl:with-param name="input" select="$schemaName"></xsl:with-param></xsl:call-template>Schema</xsl:variable>
+<xsl:variable name="classList"><xsl:apply-templates select="node()[name()='class']" mode="classList"/></xsl:variable>
+<xsl:variable name="eventList"><xsl:apply-templates select="node()[name()='event']" mode="eventList"/></xsl:variable>        
+
+public class <xsl:value-of select="$ClassName"/> extends QMFPackage
+{
+    private static final byte QMF_VERSION = (byte) '2';
+    
+    private static final BrokerSchema PACKAGE = new <xsl:value-of select="$ClassName"/>();
+    private static final String SCHEMA_NAME = "<xsl:value-of select="@package"/>";
+    
+<xsl:text disable-output-escaping="yes">
+    
+    protected abstract class QMFInfoCommand&lt;T extends QMFObject&gt; extends QMFCommand
+    {
+        private final T _object;
+        private final long _sampleTime;
+        
+        
+        protected QMFInfoCommand(QMFCommand trigger, QMFOperation op, T object, long sampleTime)
+        {
+            this(trigger.getHeader().getVersion(),
+                 trigger.getHeader().getSeq(),
+                 op,
+                 object,
+                 sampleTime);
+        }
+        
+        protected QMFInfoCommand(QMFOperation op, T object, long sampleTime)
+        {
+            this(QMF_VERSION,0,op,object,sampleTime);
+        }
+        
+        private QMFInfoCommand(final byte qmfVersion,
+                               final int seq,
+                               final QMFOperation op,
+                               final T object,
+                               final long sampleTime)
+        {
+            super(new QMFCommandHeader(qmfVersion, seq,op));
+            _object = object;
+            _sampleTime = sampleTime;
+        }
+          
+        public T getObject()
+        {
+            return _object;
+        }
+        
+        @Override
+        public void encode(final BBEncoder encoder)
+        {
+            super.encode(encoder);
+            encoder.writeStr8(SCHEMA_NAME);
+            encoder.writeStr8(_object.getQMFClass().getName());
+            encoder.writeBin128(new byte[16]);
+            encoder.writeUint64(_sampleTime * 1000000L);
+            encoder.writeUint64(_object.getCreateTime() * 1000000L);
+            encoder.writeUint64(_object.getDeleteTime() * 1000000L);
+            encoder.writeBin128(_object.getId());
+        }
+    }
+    
+    protected abstract class QMFConfigInfoCommand&lt;T extends QMFObject&gt; extends QMFInfoCommand&lt;T&gt;
+    {
+        protected QMFConfigInfoCommand(T object, long sampleTime)
+        {
+            super(QMFOperation.CONFIG_INDICATION, object, sampleTime);
+        }
+    }
+    
+    protected abstract class QMFInstrumentInfoCommand&lt;T extends QMFObject&gt; extends QMFInfoCommand&lt;T&gt;
+    {
+        protected QMFInstrumentInfoCommand(T object, long sampleTime)
+        {
+            super(QMFOperation.INSTRUMENTATION_INDICATION, object, sampleTime);
+        }
+    }
+    
+    protected abstract class QMFGetQueryResponseCommand&lt;T extends QMFObject&gt; extends QMFInfoCommand&lt;T&gt;
+    {
+        protected QMFGetQueryResponseCommand(T object, QMFGetQueryCommand cmd, long sampleTime)
+        {
+            super(cmd, QMFOperation.GET_QUERY_RESPONSE, object, sampleTime);
+        }
+    }
+    
+    
+</xsl:text>
+    
+    <xsl:apply-templates select="node()[name()='class']" mode="class"/>
+    
+    <xsl:apply-templates select="node()[name()='event']" mode="event"/>
+
+    private <xsl:value-of select="$ClassName"/>()
+    {
+        super(SCHEMA_NAME);
+        setClasses( Arrays.asList( new QMFClass[] { <xsl:value-of select="$classList"/>, <xsl:value-of select="$eventList"/> } ) );
+    }
+<xsl:text disable-output-escaping="yes">
+    public &lt;T extends QMFClass&gt; T getQMFClassInstance(Class&lt;T&gt; clazz)
+    {
+        for(QMFClass c : getClasses())
+        {
+            if(clazz.isInstance(c))
+            {
+                return (T) c;
+            }
+        }
+        return null;
+    } 
+</xsl:text>    
+    
+
+    public static BrokerSchema getPackage()
+    {
+        return PACKAGE;
+    }
+    
+}
+</xsl:template>    
+
+
+<xsl:template match="node()[name()='class']" mode="class">
+    <xsl:variable name="ClassName"><xsl:value-of select="@name"/>Class</xsl:variable>
+    <xsl:variable name="name"><xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template></xsl:variable>
+    <xsl:variable name="propertyList"><xsl:apply-templates select="node()[name()='property']" mode="propertyList"/></xsl:variable>
+    <xsl:variable name="statisticList"><xsl:apply-templates select="node()[name()='statistic']" mode="statisticList"/></xsl:variable>
+    <xsl:variable name="methodList"><xsl:apply-templates select="node()[name()='method']" mode="methodList"/></xsl:variable>
+    
+    public class <xsl:value-of select="$ClassName"/> extends QMFObjectClass<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="@name"/>Object, <xsl:value-of select="@name"/>Delegate<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+    {
+        <xsl:apply-templates select="node()[name()='property']" mode="property"/>
+    
+        <xsl:apply-templates select="node()[name()='statistic']" mode="statistic"/>
+    
+        <xsl:apply-templates select="node()[name()='method']" mode="method"><xsl:with-param name="qmfClass" select="@name"/></xsl:apply-templates>
+    
+        private <xsl:value-of select="$ClassName"/>()
+        {
+            super("<xsl:value-of select="$name"/>",
+                 new byte[16]);
+
+            setProperties( Arrays.asList( new QMFProperty[] { <xsl:value-of select="$propertyList"/> } ) );
+            setStatistics( Arrays.asList( new QMFStatistic[] { <xsl:value-of select="$statisticList"/> } ) );
+            setMethods( Arrays.asList( new QMFMethod[] { <xsl:value-of select="$methodList"/> } ) );
+        }
+        
+        public <xsl:value-of select="@name"/>Object newInstance(final <xsl:value-of select="@name"/>Delegate delegate)
+        {
+            return new <xsl:value-of select="@name"/>Object(delegate);
+        }
+        
+    }
+    
+    private final <xsl:value-of select="$ClassName"/> _<xsl:value-of select="$name"/>Class = new <xsl:value-of select="$ClassName"/>();
+    
+    public interface <xsl:value-of select="@name"/>Delegate extends QMFObject.Delegate
+    {<xsl:apply-templates select="node()[name()='property']" mode="propertyGetter"/>
+    <xsl:apply-templates select="node()[name()='statistic']" mode="propertyGetter"/>
+    <xsl:apply-templates select="node()[name()='method']" mode="methodDefinition"><xsl:with-param name="qmfClass" select="@name"/><xsl:with-param name="delegate">Y</xsl:with-param></xsl:apply-templates>
+    }
+    
+    public final class <xsl:value-of select="@name"/>Object extends QMFObject<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="$ClassName"/>, <xsl:value-of select="@name"/>Delegate<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+    {
+        protected <xsl:value-of select="@name"/>Object(<xsl:value-of select="@name"/>Delegate delegate)
+        {
+           super(delegate);
+        }
+        
+        public <xsl:value-of select="@name"/>Class getQMFClass()
+        {
+            return _<xsl:value-of select="$name"/>Class;
+        }
+        
+        public QMFCommand asConfigInfoCmd(long sampleTime) 
+        {
+            return new QMF<xsl:value-of select="@name"/>ConfigInfoCommand(this,sampleTime);
+        }
+        
+        public QMFCommand asInstrumentInfoCmd(long sampleTime) 
+        {
+           return new QMF<xsl:value-of select="@name"/>InstrumentInfoCommand(this,sampleTime);
+        }
+        
+        public QMFCommand asGetQueryResponseCmd(QMFGetQueryCommand queryCommand, long sampleTime) 
+        {
+            return new QMF<xsl:value-of select="@name"/>GetQueryResponseCommand(this,queryCommand,sampleTime);
+        }
+    
+    
+        <xsl:apply-templates select="node()[name()='method']" mode="methodDefinition"><xsl:with-param name="qmfClass" select="@name"/></xsl:apply-templates>
+        
+        <xsl:apply-templates select="node()[name()='property']" mode="propertyDelegation"/>
+        <xsl:apply-templates select="node()[name()='statistic']" mode="propertyDelegation"/>
+    }
+
+    public final class QMF<xsl:value-of select="@name"/>ConfigInfoCommand extends QMFConfigInfoCommand<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="@name"/>Object<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+    {
+        
+        protected QMF<xsl:value-of select="@name"/>ConfigInfoCommand(<xsl:value-of select="@name"/>Object object, long sampleTime)
+        {
+            super(object, sampleTime);
+        }
+        
+        @Override
+        public void encode(final BBEncoder encoder)
+        {
+            super.encode(encoder);
+            <xsl:apply-templates select="node()[name()='property']" mode="optionalPropertyPresence"/>
+            <xsl:apply-templates select="node()[name()='property']" mode="encodeProperty"/>
+        }
+    }
+    
+    public final class QMF<xsl:value-of select="@name"/>InstrumentInfoCommand extends QMFInstrumentInfoCommand<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="@name"/>Object<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+    {
+    
+        protected QMF<xsl:value-of select="@name"/>InstrumentInfoCommand(<xsl:value-of select="@name"/>Object object, long sampleTime)
+        {
+            super(object, sampleTime);
+        }
+    
+        @Override
+        public void encode(final BBEncoder encoder)
+        {
+            super.encode(encoder);
+            <xsl:apply-templates select="node()[name()='statistic']" mode="optionalPropertyPresence"><xsl:with-param name="type">statistic</xsl:with-param></xsl:apply-templates>
+            <xsl:apply-templates select="node()[name()='statistic']" mode="encodeProperty"/>
+        }
+    }
+    
+    public final class QMF<xsl:value-of select="@name"/>GetQueryResponseCommand extends QMFGetQueryResponseCommand<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="@name"/>Object<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+    {
+    
+        protected QMF<xsl:value-of select="@name"/>GetQueryResponseCommand(<xsl:value-of select="@name"/>Object object, QMFGetQueryCommand cmd, long sampleTime)
+        {
+            super(object, cmd, sampleTime);
+        }
+    
+        @Override
+        public void encode(final BBEncoder encoder)
+        {
+            super.encode(encoder);
+            <xsl:apply-templates select="node()[name()='property' or name()='statistic']" mode="optionalPropertyPresence"/>
+            <xsl:apply-templates select="node()[name()='property' or name()='statistic']" mode="encodeProperty"/>
+        }
+    }
+    
+    
+    
+
+</xsl:template>
+
+    <xsl:template match="node()[attribute::optional]" mode="optionalPropertyPresence">
+        <xsl:param name="type">property</xsl:param>
+        <xsl:variable name="var">presence<xsl:value-of select="floor(count(preceding-sibling::node()[name()=$type and attribute::optional]) div 8)"/></xsl:variable>
+        <xsl:if test="count(preceding-sibling::node()[name()=$type and attribute::optional]) mod 8 = 0">
+            byte <xsl:value-of select="$var"/> = (byte) 0;              
+        </xsl:if>
+            if(  getObject().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>() != null )
+            {
+                <xsl:value-of select="$var"/> |= (1 <xsl:text disable-output-escaping="yes">&lt;&lt;</xsl:text> <xsl:value-of select="count(preceding-sibling::node()[name()=$type and attribute::optional])"/>);
+            }
+        <xsl:if test="count(preceding-sibling::node()[name()=$type and attribute::optional]) mod 8 = 7 or count(following-sibling::node()[name()=$type and attribute::optional]) = 0">
+            encoder.writeUint8( <xsl:value-of select="$var"/> );
+        </xsl:if>
+    </xsl:template>
+    
+    <xsl:template match="node()" mode="propertyGetter"><xsl:text>
+        </xsl:text><xsl:choose>
+        
+        <xsl:when test="@type='hilo32'">
+            <xsl:call-template name="javaType"><xsl:with-param name="type">count32</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>();<xsl:text>
+        </xsl:text><xsl:call-template name="javaType"><xsl:with-param name="type">count32</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>High();<xsl:text>
+        </xsl:text><xsl:call-template name="javaType"><xsl:with-param name="type">count32</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Low();</xsl:when>
+
+        <xsl:when test="@type='mmaTime'">
+            <xsl:call-template name="javaType"><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Samples();<xsl:text>
+        </xsl:text><xsl:call-template name="javaType"><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Min();<xsl:text>
+        </xsl:text><xsl:call-template name="javaType"><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Max();<xsl:text>
+        </xsl:text><xsl:call-template name="javaType"><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Average();</xsl:when>
+        
+        <xsl:otherwise><xsl:call-template name="javaType"><xsl:with-param name="type" select="@type"/><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>();</xsl:otherwise>
+    </xsl:choose></xsl:template>
+    
+
+    <xsl:template match="node()" mode="propertyDelegation"><xsl:text>
+        </xsl:text><xsl:choose>
+            <xsl:when test="@type='hilo32'">
+                public <xsl:call-template name="javaType"><xsl:with-param name="type">count32</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>()
+                {
+                    return getDelegate().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>();
+                }
+                
+                public <xsl:call-template name="javaType"><xsl:with-param name="type">count32</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>High</xsl:with-param></xsl:call-template>()
+                {
+                    return getDelegate().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>High</xsl:with-param></xsl:call-template>();
+                }
+                
+                public <xsl:call-template name="javaType"><xsl:with-param name="type">count32</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Low</xsl:with-param></xsl:call-template>()
+                {
+                    return getDelegate().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Low</xsl:with-param></xsl:call-template>();
+                }
+                
+            </xsl:when>
+            <xsl:when test="@type='mmaTime'">
+                public <xsl:call-template name="javaType"><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Samples</xsl:with-param></xsl:call-template>()
+                {
+                    return getDelegate().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Samples</xsl:with-param></xsl:call-template>();
+                }
+                
+                public <xsl:call-template name="javaType"><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Min</xsl:with-param></xsl:call-template>()
+                {
+                    return getDelegate().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Min</xsl:with-param></xsl:call-template>();
+                }
+                
+                public <xsl:call-template name="javaType"><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Max</xsl:with-param></xsl:call-template>()
+                {
+                    return getDelegate().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Max</xsl:with-param></xsl:call-template>();
+                }
+                
+                public <xsl:call-template name="javaType"><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Average</xsl:with-param></xsl:call-template>()
+                {
+                    return getDelegate().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/>Average</xsl:with-param></xsl:call-template>();
+                }
+                
+            </xsl:when>
+            <xsl:otherwise>
+            public <xsl:call-template name="javaType"><xsl:with-param name="type" select="@type"/><xsl:with-param name="referenceType" select="@references"/></xsl:call-template> get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>()
+            {
+                return getDelegate().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>();
+            }
+            
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <xsl:template match="node()" mode="encodeProperty">
+        <xsl:variable name="prop">getObject().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>()</xsl:variable>
+        <xsl:choose>
+            <xsl:when test="@optional">
+            if(<xsl:value-of select="$prop"/> != null)
+            {
+                encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var" select="$prop"/><xsl:with-param name="type" select="@type"/></xsl:call-template>;
+            }
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:choose>
+                    <xsl:when test="@type='hilo32'"><xsl:text>
+            </xsl:text>encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var" select="$prop"/><xsl:with-param name="type">count32</xsl:with-param></xsl:call-template>;<xsl:text>
+            </xsl:text>encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var">getObject().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>High()</xsl:with-param><xsl:with-param name="type">count32</xsl:with-param></xsl:call-template>;<xsl:text>
+            </xsl:text>encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var">getObject().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Low()</xsl:with-param><xsl:with-param name="type">count32</xsl:with-param></xsl:call-template>;
+                    </xsl:when>
+                
+                    <xsl:when test="@type='mmaTime'"><xsl:text>            
+            </xsl:text>encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var">getObject().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Samples()</xsl:with-param><xsl:with-param name="type">deltaTime</xsl:with-param></xsl:call-template>;<xsl:text>
+            </xsl:text>encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var">getObject().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Min()</xsl:with-param><xsl:with-param name="type">deltaTime</xsl:with-param></xsl:call-template>;<xsl:text>
+            </xsl:text>encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var">getObject().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Max()</xsl:with-param><xsl:with-param name="type">deltaTime</xsl:with-param></xsl:call-template>;<xsl:text>
+            </xsl:text>encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var">getObject().get<xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Average()</xsl:with-param><xsl:with-param name="type">deltaTime</xsl:with-param></xsl:call-template>;                        
+                    </xsl:when>
+
+                    <xsl:otherwise><xsl:text>
+            </xsl:text>encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="var" select="$prop"/><xsl:with-param name="type" select="@type"/></xsl:call-template>;
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+
+    </xsl:template>
+
+    <xsl:template match="node()[name()='property']" mode="property">
+        <xsl:variable name="ClassName"><xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Property</xsl:variable>
+        public class <xsl:value-of select="$ClassName"/> extends QMFProperty
+        {
+            
+            private <xsl:value-of select="$ClassName"/>()
+            {
+                super( "<xsl:value-of select="@name"/>",
+                       QMFType.<xsl:call-template name="qmfType"><xsl:with-param name="type" select="@type"></xsl:with-param></xsl:call-template>,
+                       QMFProperty.AccessCode.<xsl:call-template name="toUpper"><xsl:with-param name="input" select="@access"></xsl:with-param></xsl:call-template>,
+                       <xsl:choose><xsl:when test="@index='y'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose>,
+                       <xsl:choose><xsl:when test="@optional='y'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose>);
+<xsl:if test="@desc">
+                setDescription("<xsl:value-of select="@desc"/>");
+</xsl:if>
+<xsl:if test="@min">
+                setMin(<xsl:value-of select="@min"/>);
+</xsl:if>
+<xsl:if test="@max">
+                setMin(<xsl:value-of select="@max"/>);
+</xsl:if>
+<xsl:if test="@references">
+                setReferencedClass("<xsl:call-template name="initLower"><xsl:with-param name="input"><xsl:value-of select="@references"/></xsl:with-param></xsl:call-template>");
+</xsl:if>
+            
+        <xsl:if test="@unit">
+                setUnit("<xsl:value-of select="@unit"/>");
+        </xsl:if>
+            }     
+        }
+    
+        private final <xsl:value-of select="$ClassName"/> _<xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template>Property = new <xsl:value-of select="$ClassName"/>();
+    </xsl:template>
+
+    <xsl:template match="node()[name()='statistic']" mode="statistic">
+        <xsl:choose>
+            <xsl:when test="@type='hilo32'">            
+                <xsl:call-template name="statdef"><xsl:with-param name="name" select="@name"/><xsl:with-param name="type">uint32</xsl:with-param><xsl:with-param name="unit" select="@unit"/><xsl:with-param name="desc" select="@desc"/></xsl:call-template>
+                <xsl:call-template name="statdef"><xsl:with-param name="name"><xsl:value-of select="@name"/>High</xsl:with-param><xsl:with-param name="type">uint32</xsl:with-param><xsl:with-param name="unit" select="@unit"/><xsl:with-param name="desc"><xsl:value-of select="@desc"/> (High)</xsl:with-param></xsl:call-template>
+                <xsl:call-template name="statdef"><xsl:with-param name="name"><xsl:value-of select="@name"/>Low</xsl:with-param><xsl:with-param name="type">uint32</xsl:with-param><xsl:with-param name="unit" select="@unit"/><xsl:with-param name="desc"><xsl:value-of select="@desc"/> (Low)</xsl:with-param></xsl:call-template>
+            </xsl:when>
+            <xsl:when test="@type='mmaTime'">                            
+                <xsl:call-template name="statdef"><xsl:with-param name="name"><xsl:value-of select="@name"/>Samples</xsl:with-param><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="unit" select="@unit"/><xsl:with-param name="desc"><xsl:value-of select="@desc"/> (Samples)</xsl:with-param></xsl:call-template>
+                <xsl:call-template name="statdef"><xsl:with-param name="name"><xsl:value-of select="@name"/>Max</xsl:with-param><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="unit" select="@unit"/><xsl:with-param name="desc"><xsl:value-of select="@desc"/> (Max)</xsl:with-param></xsl:call-template>
+                <xsl:call-template name="statdef"><xsl:with-param name="name"><xsl:value-of select="@name"/>Min</xsl:with-param><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="unit" select="@unit"/><xsl:with-param name="desc"><xsl:value-of select="@desc"/> (Min)</xsl:with-param></xsl:call-template>
+                <xsl:call-template name="statdef"><xsl:with-param name="name"><xsl:value-of select="@name"/>Average</xsl:with-param><xsl:with-param name="type">deltaTime</xsl:with-param><xsl:with-param name="unit" select="@unit"/><xsl:with-param name="desc"><xsl:value-of select="@desc"/> (Average)</xsl:with-param></xsl:call-template>
+            </xsl:when>
+            
+            <xsl:otherwise><xsl:call-template name="statdef"><xsl:with-param name="name" select="@name"/><xsl:with-param name="type" select="@type"/><xsl:with-param name="unit" select="@unit"/><xsl:with-param name="desc" select="@desc"/></xsl:call-template></xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:template>
+
+    <xsl:template name="statdef">
+        <xsl:param name="name"/>
+        <xsl:param name="type"/>
+        <xsl:param name="unit"/>
+        <xsl:param name="desc"/>
+        <xsl:variable name="ClassName"><xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="$name"/></xsl:with-param></xsl:call-template>Statistic</xsl:variable>
+        public class <xsl:value-of select="$ClassName"/> extends QMFStatistic
+        {
+        
+            private <xsl:value-of select="$ClassName"/>()
+            {
+                super( "<xsl:value-of select="$name"/>", QMFType.<xsl:call-template name="qmfType"><xsl:with-param name="type" select="$type"></xsl:with-param></xsl:call-template>, <xsl:choose>
+                    <xsl:when test="$unit">"<xsl:value-of select="$unit"/>"</xsl:when>
+                    <xsl:otherwise>null</xsl:otherwise>
+                </xsl:choose>, <xsl:choose>
+                    <xsl:when test="$desc">"<xsl:value-of select="$desc"/>"</xsl:when>
+                    <xsl:otherwise>null</xsl:otherwise>
+                </xsl:choose>); 
+            }     
+        }
+        
+        private final <xsl:value-of select="$ClassName"/> _<xsl:call-template name="initLower"><xsl:with-param name="input" select="$name"/></xsl:call-template>Statistic = new <xsl:value-of select="$ClassName"/>();
+    </xsl:template>
+    
+
+    <xsl:template match="node()[name()='method']" mode="method">
+        <xsl:param name="qmfClass"/>
+        <xsl:variable name="ClassName"><xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Method</xsl:variable>
+        public class <xsl:value-of select="$ClassName"/> extends QMFMethod<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="$qmfClass"/>Object<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+        {
+            private <xsl:value-of select="$ClassName"/>()
+            {
+                super( "<xsl:value-of select="@name"/>", <xsl:choose>
+                <xsl:when test="@desc">"<xsl:value-of select="@desc"/>"</xsl:when>
+                <xsl:otherwise>null</xsl:otherwise>
+</xsl:choose>);
+        
+                <xsl:apply-templates select="node()[name()='arg']" mode="argument"/>
+        
+            }
+            
+            
+            public <xsl:value-of select="$ClassName"/>Invocation parse(BBDecoder decoder)
+            {
+                <xsl:apply-templates select="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]" mode="decodeArg"/>
+                return new <xsl:value-of select="$ClassName"/>Invocation(<xsl:apply-templates select="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]" mode="methodArgList"/>);
+            }
+        }
+        
+        private final <xsl:value-of select="$ClassName"/> _<xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template>Method = new <xsl:value-of select="$ClassName"/>();
+        
+        private class <xsl:value-of select="$ClassName"/>Invocation implements QMFMethodInvocation<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="$qmfClass"/>Object<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+        {
+            <xsl:apply-templates select="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]" mode="methodInputArgDecl"/>
+        
+            private <xsl:value-of select="$ClassName"/>Invocation(<xsl:apply-templates select="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]" mode="methodArgList"><xsl:with-param name="includeType">yes</xsl:with-param></xsl:apply-templates>)
+            {
+                <xsl:apply-templates select="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]" mode="methodInputArgAssign"/>
+            }
+        
+            public QMFMethodResponseCommand execute(<xsl:value-of select="$qmfClass"/>Object obj, QMFMethodRequestCommand cmd)
+            {
+                return obj.<xsl:value-of select="@name"/>( new <xsl:value-of select="$ClassName"/>ResponseCommandFactory(cmd)<xsl:if test="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]">, </xsl:if><xsl:apply-templates select="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]" mode="methodArgList"><xsl:with-param name="prefix">_</xsl:with-param></xsl:apply-templates> );
+            }
+        }
+        
+        public final class <xsl:value-of select="$ClassName"/>ResponseCommandFactory
+        {
+            private final QMFMethodRequestCommand _requestCmd;
+            private <xsl:value-of select="$ClassName"/>ResponseCommandFactory(QMFMethodRequestCommand cmd)
+            {
+                _requestCmd = cmd;
+            }
+            
+            public <xsl:value-of select="$ClassName"/>ResponseCommand createResponseCommand( <xsl:apply-templates select="node()[name()='arg' and ( @dir='O' or @dir='IO' ) ]" mode="methodArgList"><xsl:with-param name="includeType">yes</xsl:with-param><xsl:with-param name="direction">O</xsl:with-param></xsl:apply-templates> )
+            {
+                return new <xsl:value-of select="$ClassName"/>ResponseCommand(_requestCmd<xsl:if test="node()[name()='arg' and ( @dir='O' or @dir='IO' ) ]">, <xsl:apply-templates select="node()[name()='arg' and ( @dir='O' or @dir='IO' ) ]" mode="methodArgList"><xsl:with-param name="direction">O</xsl:with-param></xsl:apply-templates></xsl:if>);
+            }
+        }
+        
+        public final class <xsl:value-of select="$ClassName"/>ResponseCommand extends QMFMethodResponseCommand
+        {
+            <xsl:apply-templates select="node()[name()='arg' and ( @dir='O' or @dir='IO' ) ]" mode="methodInputArgDecl"/>
+            private <xsl:value-of select="$ClassName"/>ResponseCommand(QMFMethodRequestCommand cmd<xsl:if test="node()[name()='arg' and ( @dir='O' or @dir='IO' ) ]">, <xsl:apply-templates select="node()[name()='arg' and ( @dir='O' or @dir='IO' ) ]" mode="methodArgList"><xsl:with-param name="includeType">yes</xsl:with-param><xsl:with-param name="direction">O</xsl:with-param></xsl:apply-templates></xsl:if>)
+            {
+                super(cmd);
+                
+                <xsl:apply-templates select="node()[name()='arg' and ( @dir='O' or @dir='IO' ) ]" mode="methodInputArgAssign"/>
+            }
+            
+            @Override
+            public void encode(final BBEncoder encoder)
+            {
+                super.encode(encoder);
+                
+                <xsl:apply-templates select="node()[name()='arg' and ( @dir='O' or @dir='IO' ) ]" mode="encodeArg"/>
+            }
+        }
+        
+    </xsl:template>
+    <xsl:template match="node()[name()='method']" mode="methodDefinition"><xsl:param name="qmfClass"/><xsl:param name="delegate">N</xsl:param>
+        <xsl:variable name="ClassName"><xsl:call-template name="initCap"><xsl:with-param name="input"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>Method</xsl:variable><xsl:text>
+        </xsl:text><xsl:if test="$delegate='N'">public </xsl:if><xsl:value-of select="$qmfClass"/>Class.<xsl:value-of select="$ClassName"/>ResponseCommand <xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template>(<xsl:value-of select="$qmfClass"/>Class.<xsl:value-of select="$ClassName"/>ResponseCommandFactory factory<xsl:if test="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]">, <xsl:apply-templates select="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]" mode="methodArgList"><xsl:with-param name="includeType">yes</xsl:with-param></xsl:apply-templates> </xsl:if>)<xsl:if test="$delegate='N'">
+        {
+            return getDelegate().<xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template>(factory<xsl:if test="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]">, <xsl:apply-templates select="node()[name()='arg' and ( @dir='I' or @dir='IO' ) ]" mode="methodArgList"/></xsl:if> );
+        }
+        </xsl:if><xsl:if test="$delegate='Y'">;</xsl:if>
+    </xsl:template>
+    <xsl:template match="node()[name()='arg']" mode="argument">
+                QMFMethod.Argument <xsl:value-of select="@name"/> = new QMFMethod.Argument("<xsl:value-of select="@name"/>", QMFType.<xsl:call-template name="qmfType"><xsl:with-param name="type" select="@type"/></xsl:call-template>);
+<xsl:if test="@desc">
+    <xsl:text>                </xsl:text>    
+    <xsl:value-of select="@name"/>.setDescription("<xsl:value-of select="@desc" disable-output-escaping="yes"/>"); 
+</xsl:if>
+<xsl:if test="@dir">
+    <xsl:text>                </xsl:text>
+    <xsl:value-of select="@name"/>.setDirection(QMFMethod.Direction.<xsl:value-of select="@dir"/>); </xsl:if>                 
+                addArgument( <xsl:value-of select="@name"/> );
+    </xsl:template>
+    <xsl:template match="node()[name()='arg']" mode="decodeArg">
+        <xsl:call-template name="javaType"><xsl:with-param name="type" select="@type"></xsl:with-param></xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="@name"/> = decoder.<xsl:call-template name="decoderRead"><xsl:with-param name="type" select="@type"/></xsl:call-template>;
+    </xsl:template>
+    <xsl:template match="node()[name()='arg']" mode="encodeArg">
+        encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="type" select="@type"/><xsl:with-param name="var">_<xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>;
+    </xsl:template>
+    <xsl:template match="node()[name()='arg']" mode="methodArgList"><xsl:param name="includeType"/><xsl:param name="direction">I</xsl:param><xsl:param name="prefix"></xsl:param>
+        <xsl:if test="$includeType"><xsl:call-template name="javaType"><xsl:with-param name="type" select="@type"/></xsl:call-template></xsl:if><xsl:text> </xsl:text><xsl:value-of select="$prefix"/><xsl:value-of select="@name"/><xsl:if test="following-sibling::node()[name()='arg' and ( @dir=$direction or @dir='IO' ) ]">, </xsl:if>
+    </xsl:template>
+    <xsl:template match="node()[name()='arg']" mode="methodInputArgDecl">
+            private final <xsl:call-template name="javaType"><xsl:with-param name="type" select="@type"/></xsl:call-template> _<xsl:value-of select="@name"/>;
+    </xsl:template>
+    <xsl:template match="node()[name()='arg']" mode="methodInputArgAssign">
+                _<xsl:value-of select="@name"/> = <xsl:value-of select="@name"/>;
+    </xsl:template>
+    
+    <xsl:template match="node()[name()='class']" mode="classList">_<xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template>Class<xsl:if test="following-sibling::node()[name()='class']">, </xsl:if></xsl:template>
+    <xsl:template match="node()[name()='event']" mode="eventList">_<xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template>EventClass<xsl:if test="following-sibling::node()[name()='event']">, </xsl:if></xsl:template>
+    <xsl:template match="node()[name()='property']" mode="propertyList">_<xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template>Property<xsl:if test="following-sibling::node()[name()='property']">, </xsl:if></xsl:template>
+    <xsl:template match="node()[name()='statistic']" mode="statisticList"><xsl:variable name="field">_<xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template></xsl:variable><xsl:choose><xsl:when test="@type!='mmaTime'"><xsl:value-of select="$field"/>Statistic<xsl:if test="@type='hilo32'">, <xsl:value-of select="$field"/>HighStatistic, <xsl:value-of select="$field"/>LowStatistic</xsl:if></xsl:when><xsl:otherwise><xsl:value-of select="$field"/>SamplesStatistic, <xsl:value-of select="$field"/>MaxStatistic, <xsl:value-of select="$field"/>MinStatistic, <xsl:value-of select="$field"/>AverageStatistic</xsl:otherwise></xsl:choose><xsl:if test="following-sibling::node()[name()='statistic']">, </xsl:if></xsl:template>
+    <xsl:template match="node()[name()='method']" mode="methodList">_<xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template>Method<xsl:if test="following-sibling::node()[name()='method']">, </xsl:if></xsl:template>
+    
+
+    <xsl:template match="node()[name()='event']" mode="event">
+        <xsl:variable name="ClassName"><xsl:call-template name="initCap"><xsl:with-param name="input" select="@name"/></xsl:call-template>EventClass</xsl:variable>
+        <xsl:variable name="cmdName"><xsl:call-template name="initCap"><xsl:with-param name="input" select="@name"/></xsl:call-template>Event</xsl:variable>
+        <xsl:variable name="name"><xsl:call-template name="initLower"><xsl:with-param name="input" select="@name"/></xsl:call-template></xsl:variable>
+
+        <xsl:variable name="argsList"><xsl:call-template name="argList"><xsl:with-param name="args" select="@args"></xsl:with-param></xsl:call-template></xsl:variable>
+        
+    public class <xsl:value-of select="$ClassName"/> extends QMFEventClass
+    {
+<!--        <xsl:apply-templates select="node()[name()='property']" mode="property"/> -->
+        
+        <xsl:apply-templates select="preceding-sibling::node()[name()='eventArguments']" mode="eventArg"><xsl:with-param name="args" select="@args"/></xsl:apply-templates>
+        
+        private <xsl:value-of select="$ClassName"/>()
+        {
+            super("<xsl:value-of select="$name"/>",
+            new byte[16]);
+           
+            setProperties( Arrays.asList( new QMFProperty[] { <xsl:value-of select="$argsList"/> } ) );
+        }
+        
+        public QMFEventSeverity getSeverity()
+        {
+            return QMFEventSeverity.<xsl:call-template name="severity"><xsl:with-param name="severity" select="@sev"/></xsl:call-template>;
+        }
+        
+        public QMFEventCommand<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="$ClassName"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text> newEvent(<xsl:apply-templates select="preceding-sibling::node()[name()='eventArguments']" mode="eventArg"><xsl:with-param name="args" select="@args"/><xsl:with-param name="tmpl">argParamList</xsl:with-param><xsl:with-param name="separator">, </xsl:with-param></xsl:apply-templates>)
+        {
+            return new  <xsl:value-of select="$cmdName"/>(<xsl:apply-templates select="preceding-sibling::node()[name()='eventArguments']" mode="eventArg"><xsl:with-param name="args" select="@args"/><xsl:with-param name="tmpl">argList</xsl:with-param><xsl:with-param name="separator">, </xsl:with-param></xsl:apply-templates>);
+        }
+        
+        
+        
+    }
+        
+    private final <xsl:value-of select="$ClassName"/> _<xsl:value-of select="$name"/>EventClass = new <xsl:value-of select="$ClassName"/>();
+        
+    private final class <xsl:value-of select="$cmdName"/> extends QMFEventCommand<xsl:text disable-output-escaping="yes">&lt;</xsl:text><xsl:value-of select="$ClassName"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+    {
+        <xsl:apply-templates select="preceding-sibling::node()[name()='eventArguments']" mode="eventArg"><xsl:with-param name="args" select="@args"/><xsl:with-param name="tmpl">argMemberDef</xsl:with-param></xsl:apply-templates>
+        
+        private <xsl:value-of select="$cmdName"/>(<xsl:apply-templates select="preceding-sibling::node()[name()='eventArguments']" mode="eventArg"><xsl:with-param name="args" select="@args"/><xsl:with-param name="tmpl">argParamList</xsl:with-param><xsl:with-param name="separator">, </xsl:with-param></xsl:apply-templates>)
+        {
+        <xsl:apply-templates select="preceding-sibling::node()[name()='eventArguments']" mode="eventArg"><xsl:with-param name="args" select="@args"/><xsl:with-param name="tmpl">argMemberAssign</xsl:with-param></xsl:apply-templates>        
+        }
+        
+        public <xsl:value-of select="$ClassName"/> getEventClass()
+        {
+            return _<xsl:value-of select="$name"/>EventClass;
+        }
+        
+        public void encode(final BBEncoder encoder)
+        {
+            super.encode(encoder);
+            <xsl:apply-templates select="preceding-sibling::node()[name()='eventArguments']" mode="eventArg"><xsl:with-param name="args" select="@args"/><xsl:with-param name="tmpl">argEncode</xsl:with-param><xsl:with-param name="separator"><xsl:text>
+            </xsl:text></xsl:with-param></xsl:apply-templates>        
+        
+        }
+    }
+    </xsl:template>
+    
+    <xsl:template name="eventArguments" mode="eventArg" match="node()[name()='eventArguments']">        
+        <xsl:param name="args"></xsl:param>
+        <xsl:param name="tmpl">propertyClass</xsl:param>
+        <xsl:param name="separator"></xsl:param>
+        <xsl:variable name="arg"><xsl:choose>
+            <xsl:when test="contains($args,',')"><xsl:value-of select="normalize-space(substring-before($args,','))"/></xsl:when>
+            <xsl:otherwise><xsl:value-of select="$args"/></xsl:otherwise>
+        </xsl:choose></xsl:variable>
+        <xsl:variable name="tail" select="normalize-space(substring-after($args,','))"></xsl:variable>
+        <xsl:if test="string-length($arg)>0">
+            <xsl:apply-templates mode="eventArg" select="node()[name()='arg' and @name=$arg]"><xsl:with-param name="tmpl" select="$tmpl"/></xsl:apply-templates> 
+        </xsl:if>
+        <xsl:if test="string-length($tail)>0"><xsl:value-of select="$separator"/><xsl:apply-templates select="." mode="eventArg"><xsl:with-param name="args" select="$tail"/><xsl:with-param name="tmpl" select="$tmpl"/><xsl:with-param name="separator" select="$separator"/></xsl:apply-templates></xsl:if>        
+    </xsl:template>
+    
+    <xsl:template mode="eventArg" match="node()[name()='arg']">
+        <xsl:param name="tmpl"/>
+        <xsl:choose>
+            <xsl:when test="$tmpl='propertyClass'"><xsl:apply-templates mode="propertyClass" select="."/></xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+            <xsl:when test="$tmpl='argParamList'"><xsl:apply-templates mode="argParamList" select="."/></xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+            <xsl:when test="$tmpl='argList'"><xsl:apply-templates mode="argList" select="."/></xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+            <xsl:when test="$tmpl='argMemberDef'"><xsl:apply-templates mode="argMemberDef" select="."/></xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+            <xsl:when test="$tmpl='argMemberAssign'"><xsl:apply-templates mode="argMemberAssign" select="."/></xsl:when>
+        </xsl:choose>
+        <xsl:choose>
+            <xsl:when test="$tmpl='argEncode'"><xsl:apply-templates mode="argEncode" select="."/></xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="arg" mode="propertyClass" match="node()[name()='arg']">
+<xsl:variable name="propClassName"><xsl:call-template name="initCap"><xsl:with-param name="input" select="@name"/></xsl:call-template>Arg</xsl:variable>        
+        public class <xsl:value-of select="$propClassName"/> extends QMFProperty
+        {
+            private  <xsl:value-of select="$propClassName"/>()
+            {
+                super( "<xsl:value-of select="@name"/>",
+                       QMFType.<xsl:call-template name="qmfType"><xsl:with-param name="type" select="@type"></xsl:with-param></xsl:call-template>,
+                       QMFProperty.AccessCode.RO,false,false);
+                
+                <xsl:if test="@desc">
+                setDescription("<xsl:value-of select="@desc"/>");    
+                </xsl:if>
+            }
+        }
+        
+        private final <xsl:value-of select="$propClassName"/> _<xsl:value-of select="@name"/>Arg = new <xsl:value-of select="$propClassName"/>();
+    </xsl:template>
+    
+    <xsl:template mode="argMemberDef" match="node()[name()='arg']"><xsl:text>
+        private final </xsl:text><xsl:call-template name="javaType"><xsl:with-param name="type" select="@type"></xsl:with-param></xsl:call-template><xsl:text> _</xsl:text><xsl:value-of select="@name"/>;</xsl:template>
+    <xsl:template mode="argParamList" match="node()[name()='arg']"><xsl:call-template name="javaType"><xsl:with-param name="type" select="@type"/></xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="@name"/></xsl:template>
+    <xsl:template mode="argList" match="node()[name()='arg']"><xsl:value-of select="@name"/></xsl:template>
+    <xsl:template mode="argMemberAssign" match="node()[name()='arg']"><xsl:text>
+            _</xsl:text><xsl:value-of select="@name"/> = <xsl:value-of select="@name"/>;</xsl:template>
+    <xsl:template mode="argEncode" match="node()[name()='arg']">encoder.<xsl:call-template name="encoderWrite"><xsl:with-param name="type" select="@type"/><xsl:with-param name="var">_<xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>;</xsl:template>
+    
+    <xsl:template name="argList">
+        <xsl:param name="args"/>
+        <xsl:variable name="arg"><xsl:choose>
+            <xsl:when test="contains($args,',')"><xsl:value-of select="normalize-space(substring-before($args,','))"/></xsl:when>
+            <xsl:otherwise><xsl:value-of select="$args"/></xsl:otherwise>
+        </xsl:choose></xsl:variable>        
+        <xsl:variable name="tail" select="normalize-space(substring-after($args,','))"></xsl:variable>
+        <xsl:if test="string-length($arg)>0">_<xsl:value-of select="$arg"/>Arg</xsl:if>
+        <xsl:if test="string-length($tail)>0">, <xsl:call-template name="argList"><xsl:with-param name="args" select="$tail"/></xsl:call-template></xsl:if>
+    </xsl:template>
+
+
+    <xsl:template name="qmfType"><xsl:param name="type"/>
+<xsl:choose><xsl:when test="$type='absTime'">ABSTIME</xsl:when>
+<xsl:when test="$type='bool'">BOOLEAN</xsl:when>
+<xsl:when test="$type='map'">MAP</xsl:when>
+<xsl:when test="$type='objId'">OBJECTREFERENCE</xsl:when>
+<xsl:when test="$type='sstr'">STR8</xsl:when>
+<xsl:when test="$type='lstr'">STR16</xsl:when>
+<xsl:when test="$type='uint16'">UINT16</xsl:when>
+<xsl:when test="$type='uint32'">UINT32</xsl:when>
+<xsl:when test="$type='uuid'">UUID</xsl:when>
+<xsl:when test="$type='deltaTime'">DELTATIME</xsl:when>    
+<xsl:when test="$type='count32'">UINT32</xsl:when>
+<xsl:when test="$type='count64'">UINT64</xsl:when>    
+    <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+        
+
+    <xsl:template name="javaType"><xsl:param name="type"/><xsl:param name="referenceType">UUID</xsl:param>
+        <xsl:choose><xsl:when test="$type='absTime'">Long</xsl:when>
+            <xsl:when test="$type='bool'">Boolean</xsl:when>
+            <xsl:when test="$type='map'">Map</xsl:when>
+            <xsl:when test="$type='objId'"><xsl:value-of select="$referenceType"/>Object</xsl:when>
+            <xsl:when test="$type='sstr'">String</xsl:when>
+            <xsl:when test="$type='lstr'">String</xsl:when>
+            <xsl:when test="$type='uint16'">Integer</xsl:when>
+            <xsl:when test="$type='uint32'">Long</xsl:when>
+            <xsl:when test="$type='uuid'">UUID</xsl:when>
+            <xsl:when test="$type='deltaTime'">Long</xsl:when>    
+            <xsl:when test="$type='count32'">Long</xsl:when>
+            <xsl:when test="$type='count64'">Long</xsl:when>    
+            <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <xsl:template name="encoderWrite"><xsl:param name="type"/><xsl:param name="var"/>
+        <xsl:choose><xsl:when test="$type='absTime'">writeUint64( <xsl:value-of select="$var"/> )</xsl:when>
+            <xsl:when test="$type='bool'">writeInt8( <xsl:value-of select="$var"/> ? (byte) -1 : (byte) 0)</xsl:when>
+            <xsl:when test="$type='map'">writeMap( <xsl:value-of select="$var"/> )</xsl:when>
+            <xsl:when test="$type='objId'">writeBin128( <xsl:value-of select="$var"/>.getId() )</xsl:when>
+            <xsl:when test="$type='sstr'">writeStr8( <xsl:value-of select="$var"/> )</xsl:when>
+            <xsl:when test="$type='lstr'">writeStr16( <xsl:value-of select="$var"/> )</xsl:when>
+            <xsl:when test="$type='uint16'">writeUint16( <xsl:value-of select="$var"/> )</xsl:when>
+            <xsl:when test="$type='uint32'">writeUint32( <xsl:value-of select="$var"/> )</xsl:when>
+            <xsl:when test="$type='uuid'">writeUuid( <xsl:value-of select="$var"/> )</xsl:when>
+            <xsl:when test="$type='deltaTime'">writeUint64( <xsl:value-of select="$var"/> )</xsl:when>    
+            <xsl:when test="$type='count32'">writeUint32( <xsl:value-of select="$var"/> )</xsl:when>
+            <xsl:when test="$type='count64'">writeUint64( <xsl:value-of select="$var"/> )</xsl:when>    
+            <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <xsl:template name="decoderRead"><xsl:param name="type"/>
+        <xsl:choose><xsl:when test="$type='absTime'">readUint64()</xsl:when>
+            <xsl:when test="$type='bool'">readInt8() != 0</xsl:when>
+            <xsl:when test="$type='map'">readMap()</xsl:when>
+            <xsl:when test="$type='objId'">readBin128()</xsl:when>
+            <xsl:when test="$type='sstr'">readStr8()</xsl:when>
+            <xsl:when test="$type='lstr'">readStr16()</xsl:when>
+            <xsl:when test="$type='uint16'">readUint16()</xsl:when>
+            <xsl:when test="$type='uint32'">readUint32()</xsl:when>
+            <xsl:when test="$type='uuid'">readUuid()</xsl:when>
+            <xsl:when test="$type='deltaTime'">readUint64()</xsl:when>    
+            <xsl:when test="$type='count32'">readUint32()</xsl:when>
+            <xsl:when test="$type='count64'">readUint64()</xsl:when>    
+            <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+
+<xsl:template name="severity">
+    <xsl:param name="severity"/>
+    <xsl:choose>
+        <xsl:when test="$severity='emerg'">EMERGENCY</xsl:when>
+        <xsl:when test="$severity='alert'">ALERT</xsl:when>
+        <xsl:when test="$severity='crit'">CRITICAL</xsl:when>
+        <xsl:when test="$severity='error'">ERROR</xsl:when>
+        <xsl:when test="$severity='warn'">WARN</xsl:when>
+        <xsl:when test="$severity='notice'">NOTICE</xsl:when>
+        <xsl:when test="$severity='inform'">INFORM</xsl:when>
+        <xsl:when test="$severity='debug'">DEBUG</xsl:when>
+    </xsl:choose>
+    
+</xsl:template>    
+
+<xsl:template name="substringAfterLast"><xsl:param name="input"/><xsl:param name="arg"/>
+<xsl:choose>
+    <xsl:when test="contains($input,$arg)"><xsl:call-template name="substringAfterLast"><xsl:with-param name="input"><xsl:value-of select="substring-after($input,$arg)"/></xsl:with-param><xsl:with-param name="arg"><xsl:value-of select="$arg"/></xsl:with-param></xsl:call-template></xsl:when>
+    <xsl:otherwise><xsl:value-of select="$input"/></xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+<xsl:template name="initCap"><xsl:param name="input"/><xsl:value-of select="translate(substring($input,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/><xsl:value-of select="substring($input,2)"/></xsl:template>
+<xsl:template name="initLower"><xsl:param name="input"/><xsl:value-of select="translate(substring($input,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/><xsl:value-of select="substring($input,2)"/></xsl:template>
+<xsl:template name="toUpper"><xsl:param name="input"/><xsl:value-of select="translate($input,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/></xsl:template>
+</xsl:stylesheet>

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java?rev=904934&r1=904933&r2=904934&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java Sun Jan 31 00:31:49 2010
@@ -47,6 +47,8 @@
 
     protected final boolean _isAutoDelete;
 
+    private final boolean _browseOnly;
+
     private AMQShortString _queueName;
 
     private AMQShortString _routingKey;
@@ -82,6 +84,7 @@
         _isExclusive = Boolean.parseBoolean(binding.getOption(BindingURL.OPTION_EXCLUSIVE));
         _isAutoDelete = Boolean.parseBoolean(binding.getOption(BindingURL.OPTION_AUTODELETE));
         _isDurable = Boolean.parseBoolean(binding.getOption(BindingURL.OPTION_DURABLE));
+        _browseOnly = Boolean.parseBoolean(binding.getOption(BindingURL.OPTION_BROWSE));
         _queueName = binding.getQueueName() == null ? null : binding.getQueueName();
         _routingKey = binding.getRoutingKey() == null ? null : binding.getRoutingKey();
         _bindingKeys = binding.getBindingKeys() == null || binding.getBindingKeys().length == 0 ? new AMQShortString[0] : binding.getBindingKeys();
@@ -122,6 +125,12 @@
     protected AMQDestination(AMQShortString exchangeName, AMQShortString exchangeClass, AMQShortString routingKey, boolean isExclusive,
                              boolean isAutoDelete, AMQShortString queueName, boolean isDurable,AMQShortString[] bindingKeys)
     {
+        this (exchangeName, exchangeClass, routingKey, isExclusive,isAutoDelete,queueName,isDurable,bindingKeys, false);
+    }
+
+    protected AMQDestination(AMQShortString exchangeName, AMQShortString exchangeClass, AMQShortString routingKey, boolean isExclusive,
+                             boolean isAutoDelete, AMQShortString queueName, boolean isDurable,AMQShortString[] bindingKeys, boolean browseOnly)
+    {
         if ( (ExchangeDefaults.DIRECT_EXCHANGE_CLASS.equals(exchangeClass) || 
               ExchangeDefaults.TOPIC_EXCHANGE_CLASS.equals(exchangeClass))  
               && routingKey == null)
@@ -144,6 +153,7 @@
         _queueName = queueName;
         _isDurable = isDurable;
         _bindingKeys = bindingKeys == null || bindingKeys.length == 0 ? new AMQShortString[0] : bindingKeys;
+        _browseOnly = browseOnly;
     }
 
     public AMQShortString getEncodedName()
@@ -502,4 +512,9 @@
             return new AMQAnyDestination(binding);
         }
     }
+
+    public boolean isBrowseOnly()
+    {
+        return _browseOnly;
+    }
 }

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?rev=904934&r1=904933&r2=904934&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Sun Jan 31 00:31:49 2010
@@ -20,52 +20,14 @@
  */
 package org.apache.qpid.client;
 
-import java.io.Serializable;
-import java.net.URISyntaxException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.IllegalStateException;
-import javax.jms.InvalidDestinationException;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.StreamMessage;
-import javax.jms.TemporaryQueue;
-import javax.jms.TemporaryTopic;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.jms.TransactionRolledBackException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import org.apache.qpid.AMQChannelClosedException;
 import org.apache.qpid.AMQDisconnectedException;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.AMQInvalidArgumentException;
 import org.apache.qpid.AMQInvalidRoutingKeyException;
-import org.apache.qpid.AMQChannelClosedException;
 import org.apache.qpid.client.failover.FailoverException;
 import org.apache.qpid.client.failover.FailoverNoopSupport;
 import org.apache.qpid.client.failover.FailoverProtectedOperation;
@@ -92,8 +54,23 @@
 import org.apache.qpid.jms.Session;
 import org.apache.qpid.thread.Threading;
 import org.apache.qpid.url.AMQBindingURL;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import javax.jms.*;
+import javax.jms.IllegalStateException;
+import java.io.Serializable;
+import java.net.URISyntaxException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * <p/><table id="crc"><caption>CRC Card</caption>
@@ -734,7 +711,7 @@
 
        }
 
-        //if we don't have an exception then we can perform closing operations  
+        //if we don't have an exception then we can perform closing operations
         _closing.set(e == null);
 
         if (!_closed.getAndSet(true))
@@ -905,7 +882,7 @@
         checkValidDestination(destination);
 
         return createConsumerImpl(destination, _prefetchHighMark, _prefetchLowMark, false, (destination instanceof Topic), null, null,
-                                  false, false);
+                                  ((destination instanceof AMQDestination)  && ((AMQDestination)destination).isBrowseOnly()), false);
     }
 
     public C createExclusiveConsumer(Destination destination) throws JMSException
@@ -913,7 +890,7 @@
         checkValidDestination(destination);
 
         return createConsumerImpl(destination, _prefetchHighMark, _prefetchLowMark, false, true, null, null,
-                                  false, false);
+                                  ((destination instanceof AMQDestination)  && ((AMQDestination)destination).isBrowseOnly()), false);
     }
 
     public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException
@@ -921,7 +898,7 @@
         checkValidDestination(destination);
 
         return createConsumerImpl(destination, _prefetchHighMark, _prefetchLowMark, false, (destination instanceof Topic),
-                                  messageSelector, null, false, false);
+                                  messageSelector, null, ((destination instanceof AMQDestination)  && ((AMQDestination)destination).isBrowseOnly()), false);
     }
 
     public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal)
@@ -930,7 +907,7 @@
         checkValidDestination(destination);
 
         return createConsumerImpl(destination, _prefetchHighMark, _prefetchLowMark, noLocal, (destination instanceof Topic),
-                                  messageSelector, null, false, false);
+                                  messageSelector, null, ((destination instanceof AMQDestination)  && ((AMQDestination)destination).isBrowseOnly()), false);
     }
 
     public MessageConsumer createExclusiveConsumer(Destination destination, String messageSelector, boolean noLocal)
@@ -947,7 +924,7 @@
     {
         checkValidDestination(destination);
 
-        return createConsumerImpl(destination, prefetch, prefetch / 2, noLocal, exclusive, selector, null, false, false);
+        return createConsumerImpl(destination, prefetch, prefetch / 2, noLocal, exclusive, selector, null, ((destination instanceof AMQDestination)  && ((AMQDestination)destination).isBrowseOnly()), false);
     }
 
     public MessageConsumer createConsumer(Destination destination, int prefetchHigh, int prefetchLow, boolean noLocal,
@@ -955,7 +932,7 @@
     {
         checkValidDestination(destination);
 
-        return createConsumerImpl(destination, prefetchHigh, prefetchLow, noLocal, exclusive, selector, null, false, false);
+        return createConsumerImpl(destination, prefetchHigh, prefetchLow, noLocal, exclusive, selector, null, ((destination instanceof AMQDestination)  && ((AMQDestination)destination).isBrowseOnly()), false);
     }
 
     public MessageConsumer createConsumer(Destination destination, int prefetch, boolean noLocal, boolean exclusive,
@@ -963,7 +940,7 @@
     {
         checkValidDestination(destination);
 
-        return createConsumerImpl(destination, prefetch, prefetch / 2, noLocal, exclusive, selector, rawSelector, false, false);
+        return createConsumerImpl(destination, prefetch, prefetch / 2, noLocal, exclusive, selector, rawSelector, ((destination instanceof AMQDestination)  && ((AMQDestination)destination).isBrowseOnly()), false);
     }
 
     public MessageConsumer createConsumer(Destination destination, int prefetchHigh, int prefetchLow, boolean noLocal,
@@ -971,7 +948,7 @@
     {
         checkValidDestination(destination);
 
-        return createConsumerImpl(destination, prefetchHigh, prefetchLow, noLocal, exclusive, selector, rawSelector, false,
+        return createConsumerImpl(destination, prefetchHigh, prefetchLow, noLocal, exclusive, selector, rawSelector, ((destination instanceof AMQDestination)  && ((AMQDestination)destination).isBrowseOnly()),
                                   false);
     }
 
@@ -1526,7 +1503,7 @@
             sendRecover();
 
             markClean();
-            
+
             if (!isSuspended)
             {
                 suspendChannel(false);
@@ -1599,7 +1576,7 @@
                 // should be rolled back(reject/release)
                 _rollbackMark.set(_highestDeliveryTag.get());
 
-                syncDispatchQueue();      
+                syncDispatchQueue();
 
                 _dispatcher.rollback();
 

Modified: qpid/trunk/qpid/java/common/build.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/build.xml?rev=904934&r1=904933&r2=904934&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/build.xml (original)
+++ qpid/trunk/qpid/java/common/build.xml Sun Jan 31 00:31:49 2010
@@ -27,6 +27,7 @@
   <property name="gentools.home" location="${project.root}/../gentools" />
   <property name="generated.package" value="org/apache/qpid/framing" />
   <property name="generated.dir" location="${module.precompiled}/${generated.package}" />
+  <property name="qpidbuildversion.java" location="${module.precompiled}/org/apache/qpid/QpidBuildVersion.java" />
   <property name="xml.spec.dir" location="${project.root}/../specs" />
   <property name="xml.spec.deps" value="amqp.0-8.xml amqp.0-9.xml amqp0-9-1.stripped.xml" />
   <property name="xml.spec.list" value="${xml.spec.dir}/amqp.0-8.xml ${xml.spec.dir}/amqp.0-9.xml ${xml.spec.dir}/amqp0-9-1.stripped.xml" />
@@ -77,7 +78,26 @@
     <touch file="${gentools.timestamp}" />
   </target>
 
-  <target name="precompile" depends="gentools,jython,create-version"/>
+  <target name="build-version" depends="create-version" if="version-stale">
+  <tstamp>
+    <format property="build.time" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC"/>
+  </tstamp>
+
+    <echo file="${qpidbuildversion.java}" append="false">package org.apache.qpid;
+
+public class QpidBuildVersion
+{
+    public static final String VERSION = "${project.version}";
+    public static final String SVN_VERSION = "${svnversion.output}";
+    public static final String BUILD_PROJECT = "${project.name}";
+    public static final String BUILD_TIME = "${build.time}";
+
+}
+</echo>
+
+  </target>
+
+  <target name="precompile" depends="gentools,jython,create-version,build-version"/>
 
   <target name="bundle" depends="bundle-tasks"/>
 </project>

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java?rev=904934&r1=904933&r2=904934&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java (original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java Sun Jan 31 00:31:49 2010
@@ -40,8 +40,6 @@
     private static final byte MINUS = (byte)'-';
     private static final byte ZERO = (byte) '0';
 
-
-
     private final class TokenizerImpl implements AMQShortStringTokenizer
     {
         private final byte _delim;
@@ -115,7 +113,7 @@
 
     private final int _length;
     private static final char[] EMPTY_CHAR_ARRAY = new char[0];
-    
+
     public static final AMQShortString EMPTY_STRING = new AMQShortString((String)null);
 
     public AMQShortString(byte[] data)
@@ -760,6 +758,11 @@
         return false;  //To change body of created methods use File | Settings | File Templates.
     }
 
+    public static AMQShortString valueOf(Object obj)
+    {
+        return obj == null ? null : new AMQShortString(String.valueOf(obj));
+    }
+
 
     public static void main(String args[])
     {

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java?rev=904934&r1=904933&r2=904934&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java (original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java Sun Jan 31 00:31:49 2010
@@ -21,15 +21,15 @@
 package org.apache.qpid.framing;
 
 import org.apache.mina.common.ByteBuffer;
-
-import org.apache.qpid.AMQPInvalidClassException;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.qpid.AMQPInvalidClassException;
+
 import java.math.BigDecimal;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
@@ -68,8 +68,11 @@
     public FieldTable(ByteBuffer buffer, long length) throws AMQFrameDecodingException
     {
         this();
-        _encodedForm = buffer.slice();
-        _encodedForm.limit((int) length);
+        ByteBuffer encodedForm = buffer.slice();
+        encodedForm.limit((int) length);
+        _encodedForm = ByteBuffer.allocate((int)length);
+        _encodedForm.put(encodedForm);
+        _encodedForm.flip();
         _encodedSize = length;
         buffer.skip((int) length);
     }
@@ -829,6 +832,36 @@
         recalculateEncodedSize();
     }
 
+    public static Map<String, Object> convertToMap(final FieldTable fieldTable)
+    {
+        final Map<String, Object> map = new HashMap<String, Object>();
+
+        if(fieldTable != null)
+        {
+            fieldTable.processOverElements(
+                        new FieldTableElementProcessor()
+                    {
+
+                        public boolean processElement(String propertyName, AMQTypedValue value)
+                        {
+                            Object val = value.getValue();
+                            if(val instanceof AMQShortString)
+                            {
+                                val = val.toString();
+                            }
+                            map.put(propertyName, val);
+                            return true;
+                        }
+
+                        public Object getResult()
+                        {
+                            return map;
+                        }
+                    });
+        }
+        return map;
+    }
+
 
     public static interface FieldTableElementProcessor
     {
@@ -1046,6 +1079,9 @@
             {
 
                 final AMQShortString key = EncodingUtils.readAMQShortString(buffer);
+
+                _logger.debug("FieldTable::PropFieldTable(buffer," + length + "): Read key '" + key);
+
                 AMQTypedValue value = AMQTypedValue.readFromBuffer(buffer);
 
                 if (trace)

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/thread/DefaultThreadFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/thread/DefaultThreadFactory.java?rev=904934&r1=904933&r2=904934&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/thread/DefaultThreadFactory.java (original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/thread/DefaultThreadFactory.java Sun Jan 31 00:31:49 2010
@@ -3,6 +3,17 @@
 public class DefaultThreadFactory implements ThreadFactory
 {
 
+    private static class QpidThread extends Thread
+    {
+        private QpidThread(final Runnable target)
+        {
+            super(target);
+        }
+
+    }
+
+
+
     public Thread createThread(Runnable r)
     {
         return new Thread(r);

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java?rev=904934&r1=904933&r2=904934&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java (original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java Sun Jan 31 00:31:49 2010
@@ -20,8 +20,19 @@
  */
 package org.apache.qpid.transport;
 
+import org.ietf.jgss.GSSContext;
+import org.ietf.jgss.GSSException;
+import org.ietf.jgss.GSSManager;
+import org.ietf.jgss.GSSName;
+import org.ietf.jgss.Oid;
+
+import org.apache.qpid.security.UsernamePasswordCallbackHandler;
 import static org.apache.qpid.transport.Connection.State.OPEN;
+import org.apache.qpid.transport.util.Logger;
 
+import javax.security.sasl.Sasl;
+import javax.security.sasl.SaslClient;
+import javax.security.sasl.SaslException;
 import java.lang.management.ManagementFactory;
 import java.lang.management.RuntimeMXBean;
 import java.util.ArrayList;
@@ -30,18 +41,6 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.security.sasl.Sasl;
-import javax.security.sasl.SaslClient;
-import javax.security.sasl.SaslException;
-
-import org.apache.qpid.security.UsernamePasswordCallbackHandler;
-import org.apache.qpid.transport.util.Logger;
-import org.ietf.jgss.GSSContext;
-import org.ietf.jgss.GSSException;
-import org.ietf.jgss.GSSManager;
-import org.ietf.jgss.GSSName;
-import org.ietf.jgss.Oid;
-
 
 /**
  * ClientDelegate
@@ -54,20 +53,22 @@
 
     private static final String KRB5_OID_STR = "1.2.840.113554.1.2.2";
     protected static Oid KRB5_OID;
-    
-    static {
-        try {
+
+    static
+    {
+        try
+        {
             KRB5_OID = new Oid(KRB5_OID_STR);
         } catch (GSSException ignore) {}
     }
-    
+
     private List<String> clientMechs;
     private ConnectionSettings conSettings;
-    
+
     public ClientDelegate(ConnectionSettings settings)
     {
         this.conSettings = settings;
-        this.clientMechs = Arrays.asList(settings.getSaslMechs().split(" "));       
+        this.clientMechs = Arrays.asList(settings.getSaslMechs().split(" "));
     }
 
     public void init(Connection conn, ProtocolHeader hdr)
@@ -81,12 +82,17 @@
     @Override public void connectionStart(Connection conn, ConnectionStart start)
     {
         Map<String,Object> clientProperties = new HashMap<String,Object>();
+
+        if(this.conSettings.getClientProperties() != null)
+        {
+            clientProperties.putAll(this.conSettings.getClientProperties());
+        }
+
         clientProperties.put("qpid.session_flow", 1);
         clientProperties.put("qpid.client_pid",getPID());
-        clientProperties.put("qpid.client_pid",clientProperties.get("qpid.client_pid"));
         clientProperties.put("qpid.client_process",
                 System.getProperty("qpid.client_process","Qpid Java Client"));
-        
+
         List<Object> brokerMechs = start.getMechanisms();
         if (brokerMechs == null || brokerMechs.isEmpty())
         {
@@ -94,27 +100,29 @@
                 (clientProperties, null, null, conn.getLocale());
             return;
         }
-        
+
         List<String> choosenMechs = new ArrayList<String>();
         for (String mech:clientMechs)
         {
-            if (brokerMechs.contains(mech)) 
+            if (brokerMechs.contains(mech))
             {
                 choosenMechs.add(mech);
             }
         }
-        
+
         if (choosenMechs.size() == 0)
         {
             conn.exception(new ConnectionException("The following SASL mechanisms " +
-                    clientMechs.toString()  + 
+                    clientMechs.toString()  +
                     " specified by the client are not supported by the broker"));
             return;
         }
-        
+
         String[] mechs = new String[choosenMechs.size()];
-        choosenMechs.toArray(mechs); 
-        
+        choosenMechs.toArray(mechs);
+
+        conn.setServerProperties(start.getServerProperties());
+
         try
         {
             Map<String,Object> saslProps = new HashMap<String,Object>();
@@ -162,8 +170,8 @@
                                                      tune.getHeartbeatMin(),
                                                      tune.getHeartbeatMax()
                                                      );
-        conn.connectionTuneOk(tune.getChannelMax(), 
-                              tune.getMaxFrameSize(), 
+        conn.connectionTuneOk(tune.getChannelMax(),
+                              tune.getMaxFrameSize(),
                               hb_interval);
         // The idle timeout is twice the heartbeat amount (in milisecs)
         conn.setIdleTimeout(hb_interval*1000*2);
@@ -212,11 +220,11 @@
             return max;
         }
     }
-    
+
     private int getPID()
     {
         RuntimeMXBean rtb = ManagementFactory.getRuntimeMXBean();
-        String processName = rtb.getName();       
+        String processName = rtb.getName();
         if (processName != null && processName.indexOf('@')>0)
         {
             try
@@ -236,36 +244,36 @@
         }
 
     }
-    
+
     private String getUserID()
     {
         log.debug("Obtaining userID from kerberos");
         String service = conSettings.getSaslProtocol() + "@" + conSettings.getSaslServerName();
         GSSManager manager = GSSManager.getInstance();
-        
-        try 
+
+        try
         {
             GSSName acceptorName = manager.createName(service,
                 GSSName.NT_HOSTBASED_SERVICE, KRB5_OID);
-        
+
             GSSContext secCtx = manager.createContext(acceptorName,
                                                       KRB5_OID,
                                                       null,
                                                       GSSContext.INDEFINITE_LIFETIME);
-            
-            secCtx.initSecContext(new byte[0], 0, 1);            
-            
+
+            secCtx.initSecContext(new byte[0], 0, 1);
+
             if (secCtx.getSrcName() != null)
             {
                 return secCtx.getSrcName().toString();
-            }            
-            
-        } 
-        catch (GSSException e) 
+            }
+
+        }
+        catch (GSSException e)
         {
             log.warn("Unable to retrieve userID from Kerberos due to error",e);
         }
-        
+
         return null;
     }
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org